protected Entity addCluster(Location location) { String locationName = elvis(location.getLocationProperty("displayName"), location.getDisplayName(), null); Map creation = Maps.newLinkedHashMap(); creation.putAll(getCustomChildFlags()); if (truth(getDisplayNamePrefix()) || truth(getDisplayNameSuffix())) { String displayName = "" + elvis(getDisplayNamePrefix(), "") + elvis(locationName, "unnamed") + elvis(getDisplayNameSuffix(),""); creation.put("displayName", displayName); } logger.info("Creating entity in fabric {} at {}{}", new Object[] {this, location, (creation!=null && !creation.isEmpty() ? ", properties "+creation : "") }); Entity entity = createCluster(location, creation); if (locationName != null) { if (entity.getDisplayName()==null) ((EntityLocal)entity).setDisplayName(entity.getEntityType().getSimpleName() +" ("+locationName+")"); else if (!entity.getDisplayName().contains(locationName)) ((EntityLocal)entity).setDisplayName(entity.getDisplayName() +" ("+locationName+")"); } if (entity.getParent()==null) entity.setParent(this); Entities.manage(entity); addMember(entity); fabricSizeEnricher.addProducer(entity); return entity; }
entity.setDisplayName(memento.getDisplayName());