protected String generateFrameId(final String label, final PlacementConfig placementConfig) throws CouldNotPerformException { try { String frameId = StringProcessor.transformToIdString(label); if (labelCollisionList.contains(frameId.toLowerCase())) { return locationRegistry.get(placementConfig.getLocationId()).getMessage().getPlacementConfig().getTransformationFrameId() + "_" + frameId; } labelCollisionList.add(frameId.toLowerCase()); return frameId; } catch (final CouldNotPerformException ex) { throw new CouldNotPerformException("Could not generate frame id!", ex); } }
final UnitConfig rootUnitConfig = registry.get(rootLocationId).getMessage(); if (!rootUnitConfig.getPlacementConfig().hasTransformationFrameId() || rootUnitConfig.getPlacementConfig().getTransformationFrameId().isEmpty()) {
final String parentLocationTransformationFrameId = getRegistry().get(locationConfig.getPlacementConfig().getLocationId()).getMessage().getPlacementConfig().getTransformationFrameId();
private void loopTestTopDown(final UnitConfig locationConfig, ProtoBufRegistry<String, UnitConfig, UnitConfig.Builder> registry, List<String> processedLocations) throws InvalidStateException, CouldNotPerformException { markAsProcessed(locationConfig, processedLocations); for (String locationId : locationConfig.getLocationConfig().getChildIdList()) { loopTestTopDown(registry.get(locationId).getMessage(), registry, processedLocations); } }
unitIdList.addAll(locationRegistry.get(childId).getMessage().getLocationConfig().getUnitIdList());
private void loopTestBottomUp(final UnitConfig locationConfig, ProtoBufRegistry<String, UnitConfig, UnitConfig.Builder> registry, List<String> processedLocations) throws InvalidStateException, CouldNotPerformException { if (!locationConfig.hasPlacementConfig()) { return; } if (!locationConfig.getPlacementConfig().hasLocationId() && locationConfig.getPlacementConfig().getLocationId().isEmpty()) { return; } markAsProcessed(locationConfig, processedLocations); // ignore root notes if (locationConfig.getLocationConfig().getRoot()) { return; } loopTestBottomUp(registry.get(locationConfig.getPlacementConfig().getLocationId()).getMessage(), registry, processedLocations); }
LocationType parentLocationType = locationRegistry.get(locationUnit.getPlacementConfig().getLocationId()).getMessage().getLocationConfig().getType(); Set<LocationType> childLocationTypes = new HashSet<>(); for (String childId : locationUnit.getLocationConfig().getChildIdList()) { childLocationTypes.add(locationRegistry.get(childId).getMessage().getLocationConfig().getType());
@Override public void processData(String id, IdentifiableMessage<String, UnitConfig, UnitConfig.Builder> entry, ProtoBufMessageMap<String, UnitConfig, UnitConfig.Builder> entryMap, ProtoBufRegistry<String, UnitConfig, UnitConfig.Builder> registry) throws CouldNotPerformException, EntryModification { UnitConfig.Builder unitLocationConfig = entry.getMessage().toBuilder(); // check if placement exists. if (!unitLocationConfig.hasPlacementConfig()) { throw new NotAvailableException("locationconfig.placementconfig"); } // check children consistency if (!unitLocationConfig.getPlacementConfig().hasLocationId()) { throw new NotAvailableException("locationconfig.placementconfig.locationid"); } // skip root locations if (unitLocationConfig.getLocationConfig().getRoot()) { return; } // check if parent is registered. if (!entryMap.containsKey(unitLocationConfig.getPlacementConfig().getLocationId())) { entry.setMessage(unitLocationConfig.setPlacementConfig(unitLocationConfig.getPlacementConfig().toBuilder().clearLocationId())); throw new EntryModification("Parent[" + unitLocationConfig.getPlacementConfig().getLocationId() + "] of child[" + unitLocationConfig.getId() + "] is unknown! Entry will moved to root location!", entry, this); } // check if parents knows given child. IdentifiableMessage<String, UnitConfig, UnitConfig.Builder> parent = registry.get(unitLocationConfig.getPlacementConfig().getLocationId()); if (parent != null && !parentHasChild(parent.getMessage(), unitLocationConfig.build()) && !parent.getMessage().getPlacementConfig().getLocationId().equals(unitLocationConfig.getId())) { LocationConfig.Builder parentLocationConfig = parent.getMessage().getLocationConfig().toBuilder().addChildId(unitLocationConfig.getId()); parent.setMessage(parent.getMessage().toBuilder().setLocationConfig(parentLocationConfig)); throw new EntryModification("Parent[" + parent.getId() + "] does not know Child[" + unitLocationConfig.getId() + "]", parent, this); } }