All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.nuiton.topia.persistence.TopiaPersistenceContextConstructorParameterSupport Maven / Gradle / Ivy

There is a newer version: 2.0.7
Show newest version
package org.nuiton.topia.persistence;

/*-
 * #%L
 * ToPIA Extension :: Persistence
 * %%
 * Copyright (C) 2018 - 2022 Ultreia.io
 * %%
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with this program.  If not, see
 * .
 * #L%
 */

import org.nuiton.topia.persistence.internal.AbstractTopiaPersistenceContextConstructorParameter;
import org.nuiton.topia.persistence.internal.HibernateProvider;
import org.nuiton.topia.persistence.internal.TopiaHibernateSessionRegistry;
import org.nuiton.topia.persistence.internal.support.TopiaFiresSupport;

import java.time.Duration;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Supplier;

public class TopiaPersistenceContextConstructorParameterSupport extends AbstractTopiaPersistenceContextConstructorParameter {

    private final TopiaConfigurationExtension configuration;

    private final Map>> daoMapping;

    /**
     * @param hibernateProvider       holds the Hibernate configuration and session factory
     * @param applicationFiresSupport the TopiaFiresSupport from the application context
     * @param topiaIdFactory          the TopiaIdFactory instance created according to the application's configuration
     * @param sessionRegistry         hibernate session registry
     * @param slowQueriesThreshold    slowQueriesThreshold
     * @param configuration           application configuration
     * @param daoMapping              daoMapping
     */
    public TopiaPersistenceContextConstructorParameterSupport(HibernateProvider hibernateProvider,
                                                              TopiaFiresSupport applicationFiresSupport,
                                                              TopiaIdFactory topiaIdFactory,
                                                              TopiaHibernateSessionRegistry sessionRegistry,
                                                              Duration slowQueriesThreshold,
                                                              TopiaConfigurationExtension configuration, Map>> daoMapping) {
        super(hibernateProvider, applicationFiresSupport, topiaIdFactory, sessionRegistry, Optional.ofNullable(slowQueriesThreshold));
        this.configuration = Objects.requireNonNull(configuration);
        this.daoMapping = Objects.requireNonNull(daoMapping);
    }

    public Map>> getDaoMapping() {
        return daoMapping;
    }

    public TopiaConfigurationExtension getConfiguration() {
        return configuration;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy