io.smilego.tenant.configuration.ParamConfiguration Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of multi-tenant-spring-boot-starter Show documentation
Show all versions of multi-tenant-spring-boot-starter Show documentation
A application used as an example on how to set up pushing
its components to the Central Repository.
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