Add create tenant

Signed-off-by: SirWayne <dennis.melzer@bosch-si.com>
This commit is contained in:
SirWayne
2016-02-15 16:20:45 +01:00
parent c737614e9b
commit 5d7ade1cf2
4 changed files with 17 additions and 5 deletions

View File

@@ -51,7 +51,12 @@ public class TenantAwareCacheManager implements TenancyCacheManager {
@Override
public Cache getCache(final String name) {
final String currentTenant = tenantAware.getCurrentTenant().toUpperCase();
String currentTenant = tenantAware.getCurrentTenant();
if (currentTenant == null) {
return null;
}
currentTenant = currentTenant.toUpperCase();
if (currentTenant.contains(TENANT_CACHE_DELIMITER)) {
return null;
}
@@ -60,7 +65,12 @@ public class TenantAwareCacheManager implements TenancyCacheManager {
@Override
public Collection<String> getCacheNames() {
final String currentTenant = tenantAware.getCurrentTenant().toUpperCase();
String currentTenant = tenantAware.getCurrentTenant();
if (currentTenant == null) {
return null;
}
currentTenant = currentTenant.toUpperCase();
if (currentTenant.contains(TENANT_CACHE_DELIMITER)) {
return Collections.emptyList();
}

View File

@@ -23,6 +23,7 @@ import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.amqp.support.converter.MessageConverter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
@@ -134,6 +135,7 @@ public class AmqpConfiguration {
* @return
*/
@Bean
@ConditionalOnMissingBean
public AmqpSenderService amqpSenderServiceBean() {
return new DefaultAmqpSenderService(rabbitTemplate);
}

View File

@@ -7,7 +7,6 @@ import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.support.converter.AbstractJavaTypeMapper;
import org.springframework.amqp.support.converter.MessageConverter;
import org.springframework.beans.factory.annotation.Autowired;
/**
* @author Dennis Melzer
@@ -21,7 +20,6 @@ public class BaseAmqpService {
protected RabbitTemplate spInternalConnectorTemplate;
@Autowired
public BaseAmqpService(final MessageConverter messageConverter, final RabbitTemplate defaultTemplate) {
this.messageConverter = messageConverter;
spInternalConnectorTemplate = defaultTemplate;

View File

@@ -48,7 +48,9 @@ public class MultiTenantJpaTransactionManager extends JpaTransactionManager {
&& !definition.getName().startsWith(SystemManagement.class.getCanonicalName() + ".deleteTenant")
&& !definition.getName()
.startsWith(SystemManagement.class.getCanonicalName() + ".currentTenantKeyGenerator")
&& !definition.getName().startsWith(RolloutManagement.class.getCanonicalName() + ".rolloutScheduler")) {
&& !definition.getName().startsWith(RolloutManagement.class.getCanonicalName() + ".rolloutScheduler")
&& !definition.getName()
.startsWith(SystemManagement.class.getCanonicalName() + ".getOrCreateTenantMetadata")) {
final String currentTenant = tenantAware.getCurrentTenant();
if (currentTenant == null) {