Browse Source
Merge pull request #10714 from YevhenBondarenko/fix/tenant-creation-order
fixed events ordering during tenant creation
pull/10729/head
Viacheslav Klimov
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
7 additions and
5 deletions
-
dao/src/main/java/org/thingsboard/server/dao/tenant/TenantServiceImpl.java
|
|
|
@ -136,18 +136,20 @@ public class TenantServiceImpl extends AbstractCachedEntityService<TenantId, Ten |
|
|
|
TenantId tenantId = savedTenant.getId(); |
|
|
|
publishEvictEvent(new TenantEvictEvent(tenantId, create)); |
|
|
|
|
|
|
|
if (create && defaultEntitiesCreator != null) { |
|
|
|
defaultEntitiesCreator.accept(tenantId); |
|
|
|
} |
|
|
|
|
|
|
|
eventPublisher.publishEvent(SaveEntityEvent.builder().tenantId(tenantId) |
|
|
|
.entityId(tenantId).entity(savedTenant).created(create).build()); |
|
|
|
|
|
|
|
if (create) { |
|
|
|
deviceProfileService.createDefaultDeviceProfile(tenantId); |
|
|
|
assetProfileService.createDefaultAssetProfile(tenantId); |
|
|
|
apiUsageStateService.createDefaultApiUsageState(tenantId, null); |
|
|
|
notificationSettingsService.createDefaultNotificationConfigs(tenantId); |
|
|
|
if (defaultEntitiesCreator != null) { |
|
|
|
defaultEntitiesCreator.accept(tenantId); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
eventPublisher.publishEvent(SaveEntityEvent.builder().tenantId(tenantId) |
|
|
|
.entityId(tenantId).entity(savedTenant).created(create).build()); |
|
|
|
return savedTenant; |
|
|
|
} |
|
|
|
|
|
|
|
|