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

io.smilego.tenant.configuration.ParamConfiguration Maven / Gradle / Ivy

Go to download

A application used as an example on how to set up pushing its components to the Central Repository.

There is a newer version: 1.2.5
Show newest version
package io.smilego.tenant.configuration;

import io.smilego.tenant.TenantContext;
import io.smilego.tenant.enumeration.PropertyCode;
import io.smilego.tenant.model.Param;
import io.smilego.tenant.persistence.hibernate.DynamicDataSourceBasedMultiTenantConnectionProvider;
import org.springframework.beans.factory.annotation.Value;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;

public class ParamConfiguration {

    public static Map> mapParams = new HashMap<>();

    public static String applicationName = new String();

    public static Param getParam(PropertyCode propertyCode){
        String tenantId = TenantContext.getTenantId();
        List params = mapParams.get(applicationName);
        if(Objects.nonNull(params) && params.size()>0){
            return params.stream().filter(f->
                    f.getTenant().getTenantId().equals(tenantId) &&
                    f.getProperty().getCode().equals(propertyCode.name())).findFirst().get();
        }

        return new Param();
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy