if (requestLabelEntity.getComponent().getParentGroupId() != null && !groupId.equals(requestLabelEntity.getComponent().getParentGroupId())) { throw new IllegalArgumentException(String.format("If specified, the parent process group id %s must be the same as specified in the URI %s", requestLabelEntity.getComponent().getParentGroupId(), groupId));
@Override public Label createLabel(String groupId, LabelDTO labelDTO) { if (labelDTO.getParentGroupId() != null && !flowController.getFlowManager().areGroupsSame(groupId, labelDTO.getParentGroupId())) { throw new IllegalArgumentException("Cannot specify a different Parent Group ID than the Group to which the Label is being added."); } // get the desired group ProcessGroup group = locateProcessGroup(flowController, groupId); // create the label Label label = flowController.getFlowManager().createLabel(labelDTO.getId(), labelDTO.getLabel()); if (labelDTO.getPosition() != null) { label.setPosition(new Position(labelDTO.getPosition().getX(), labelDTO.getPosition().getY())); } if (labelDTO.getWidth() != null && labelDTO.getHeight() != null) { label.setSize(new Size(labelDTO.getWidth(), labelDTO.getHeight())); } label.setStyle(labelDTO.getStyle()); // add the label group.addLabel(label); return label; }
public LabelDTO copy(final LabelDTO original) { final LabelDTO copy = new LabelDTO(); copy.setId(original.getId()); copy.setParentGroupId(original.getParentGroupId()); copy.setLabel(original.getLabel()); copy.setStyle(copy(original.getStyle())); copy.setPosition(original.getPosition()); copy.setWidth(original.getWidth()); copy.setHeight(original.getHeight()); copy.setVersionedComponentId(original.getVersionedComponentId()); return copy; }