Commit d749e98de2bf3c2104dbac8265b49b114693323c
1 parent
2ec11b2a
Fixed order of widget bundle and types updload
Showing
1 changed file
with
22 additions
and
8 deletions
@@ -148,7 +148,7 @@ public class DefaultSyncEdgeService implements SyncEdgeService { | @@ -148,7 +148,7 @@ public class DefaultSyncEdgeService implements SyncEdgeService { | ||
148 | public void sync(TenantId tenantId, Edge edge) { | 148 | public void sync(TenantId tenantId, Edge edge) { |
149 | log.trace("[{}][{}] Staring edge sync process", tenantId, edge.getId()); | 149 | log.trace("[{}][{}] Staring edge sync process", tenantId, edge.getId()); |
150 | try { | 150 | try { |
151 | - syncWidgetsBundleAndWidgetTypes(tenantId, edge); | 151 | + syncWidgetsBundles(tenantId, edge); |
152 | syncAdminSettings(tenantId, edge); | 152 | syncAdminSettings(tenantId, edge); |
153 | syncRuleChains(tenantId, edge, new TimePageLink(DEFAULT_LIMIT)); | 153 | syncRuleChains(tenantId, edge, new TimePageLink(DEFAULT_LIMIT)); |
154 | syncUsers(tenantId, edge, new TextPageLink(DEFAULT_LIMIT)); | 154 | syncUsers(tenantId, edge, new TextPageLink(DEFAULT_LIMIT)); |
@@ -156,6 +156,7 @@ public class DefaultSyncEdgeService implements SyncEdgeService { | @@ -156,6 +156,7 @@ public class DefaultSyncEdgeService implements SyncEdgeService { | ||
156 | syncAssets(tenantId, edge, new TimePageLink(DEFAULT_LIMIT)); | 156 | syncAssets(tenantId, edge, new TimePageLink(DEFAULT_LIMIT)); |
157 | syncEntityViews(tenantId, edge, new TimePageLink(DEFAULT_LIMIT)); | 157 | syncEntityViews(tenantId, edge, new TimePageLink(DEFAULT_LIMIT)); |
158 | syncDashboards(tenantId, edge, new TimePageLink(DEFAULT_LIMIT)); | 158 | syncDashboards(tenantId, edge, new TimePageLink(DEFAULT_LIMIT)); |
159 | + syncWidgetsTypes(tenantId, edge); | ||
159 | } catch (Exception e) { | 160 | } catch (Exception e) { |
160 | log.error("[{}][{}] Exception during sync process", tenantId, edge.getId(), e); | 161 | log.error("[{}][{}] Exception during sync process", tenantId, edge.getId(), e); |
161 | } | 162 | } |
@@ -344,22 +345,35 @@ public class DefaultSyncEdgeService implements SyncEdgeService { | @@ -344,22 +345,35 @@ public class DefaultSyncEdgeService implements SyncEdgeService { | ||
344 | } | 345 | } |
345 | } | 346 | } |
346 | 347 | ||
347 | - private void syncWidgetsBundleAndWidgetTypes(TenantId tenantId, Edge edge) { | ||
348 | - log.trace("[{}] syncWidgetsBundleAndWidgetTypes [{}]", tenantId, edge.getName()); | 348 | + private void syncWidgetsBundles(TenantId tenantId, Edge edge) { |
349 | + log.trace("[{}] syncWidgetsBundles [{}]", tenantId, edge.getName()); | ||
349 | List<WidgetsBundle> widgetsBundlesToPush = new ArrayList<>(); | 350 | List<WidgetsBundle> widgetsBundlesToPush = new ArrayList<>(); |
350 | - List<WidgetType> widgetTypesToPush = new ArrayList<>(); | ||
351 | widgetsBundlesToPush.addAll(widgetsBundleService.findAllTenantWidgetsBundlesByTenantId(tenantId)); | 351 | widgetsBundlesToPush.addAll(widgetsBundleService.findAllTenantWidgetsBundlesByTenantId(tenantId)); |
352 | widgetsBundlesToPush.addAll(widgetsBundleService.findSystemWidgetsBundles(tenantId)); | 352 | widgetsBundlesToPush.addAll(widgetsBundleService.findSystemWidgetsBundles(tenantId)); |
353 | try { | 353 | try { |
354 | for (WidgetsBundle widgetsBundle: widgetsBundlesToPush) { | 354 | for (WidgetsBundle widgetsBundle: widgetsBundlesToPush) { |
355 | saveEdgeEvent(tenantId, edge.getId(), EdgeEventType.WIDGETS_BUNDLE, EdgeEventActionType.ADDED, widgetsBundle.getId(), null); | 355 | saveEdgeEvent(tenantId, edge.getId(), EdgeEventType.WIDGETS_BUNDLE, EdgeEventActionType.ADDED, widgetsBundle.getId(), null); |
356 | - widgetTypesToPush.addAll(widgetTypeService.findWidgetTypesByTenantIdAndBundleAlias(widgetsBundle.getTenantId(), widgetsBundle.getAlias())); | ||
357 | } | 356 | } |
358 | - for (WidgetType widgetType: widgetTypesToPush) { | ||
359 | - saveEdgeEvent(tenantId, edge.getId(), EdgeEventType.WIDGET_TYPE, EdgeEventActionType.ADDED, widgetType.getId(), null); | 357 | + } catch (Exception e) { |
358 | + log.error("Exception during loading widgets bundle(s) on sync!", e); | ||
359 | + } | ||
360 | + } | ||
361 | + | ||
362 | + private void syncWidgetsTypes(TenantId tenantId, Edge edge) { | ||
363 | + log.trace("[{}] syncWidgetsTypes [{}]", tenantId, edge.getName()); | ||
364 | + List<WidgetsBundle> widgetsBundlesToPush = new ArrayList<>(); | ||
365 | + widgetsBundlesToPush.addAll(widgetsBundleService.findAllTenantWidgetsBundlesByTenantId(tenantId)); | ||
366 | + widgetsBundlesToPush.addAll(widgetsBundleService.findSystemWidgetsBundles(tenantId)); | ||
367 | + try { | ||
368 | + for (WidgetsBundle widgetsBundle: widgetsBundlesToPush) { | ||
369 | + List<WidgetType> widgetTypesToPush = | ||
370 | + widgetTypeService.findWidgetTypesByTenantIdAndBundleAlias(widgetsBundle.getTenantId(), widgetsBundle.getAlias()); | ||
371 | + for (WidgetType widgetType: widgetTypesToPush) { | ||
372 | + saveEdgeEvent(tenantId, edge.getId(), EdgeEventType.WIDGET_TYPE, EdgeEventActionType.ADDED, widgetType.getId(), null); | ||
373 | + } | ||
360 | } | 374 | } |
361 | } catch (Exception e) { | 375 | } catch (Exception e) { |
362 | - log.error("Exception during loading widgets bundle(s) and widget type(s) on sync!", e); | 376 | + log.error("Exception during loading widgets type(s) on sync!", e); |
363 | } | 377 | } |
364 | } | 378 | } |
365 | 379 |