public MapRouteComponentDTO(final Component component, final String icon) { super(component, icon); if (component.isMobileComponent() && component.getRoutePointList() != null) { route = component.getRoutePointList().getInternalList(); } }
private void addTenantFields(final TenantResource tenantResource, final String currentTenant) { // set the current tenant as tenantId owner if it is not null if (StringUtils.hasText(currentTenant)) { tenantResource.setTenantId(currentTenant); } // Add tenantId owner as authorized tenantResource.getTenantsAuth().add(tenantResource.getTenantId()); // And finally, if tenantResource is Component, add currentTenant to tenantsMapVisible map if (tenantResource instanceof Component) { ((Component) tenantResource).getTenantsMapVisible().add(currentTenant); } }
private void keepTenantFields(final TenantResource entityResource) { final Criteria criteria = Criteria.where("_id").is(entityResource.getId()); final TenantResource resource = mongoOps.findOne(new Query(criteria), entityResource.getClass()); if (resource != null) { entityResource.setTenantsAuth(resource.getTenantsAuth()); entityResource.setTenantId(resource.getTenantId()); // And finally, if tenantResource is Component, keep its tenantsMapVisible members if (entityResource instanceof Component) { ((Component) entityResource) .getTenantsMapVisible() .addAll(((Component) resource).getTenantsMapVisible()); } } }