@Override public ResolvedReference resolve(final CommandOption option, final Integer position) { final ProcessGroupDTO pg = backRefs.get(position); if (pg != null) { return new ResolvedReference(option, position, pg.getName(), pg.getId()); } else { return null; } }
@Override protected void writeSimpleResult(final PrintStream output) { final Table table = new Table.Builder() .column("#", 3, 3, false) .column("Name", 20, 36, true) .column("Id", 36, 36, false) .column("Running", 7, 7, false) .column("Stopped", 7, 7, false) .column("Disabled", 8, 8, false) .column("Invalid", 7, 7, false) .build(); for (int i=0; i < processGroups.size(); i++) { final ProcessGroupDTO dto = processGroups.get(i); table.addRow( String.valueOf(i+1), dto.getName(), dto.getId(), String.valueOf(dto.getRunningCount()), String.valueOf(dto.getStoppedCount()), String.valueOf(dto.getDisabledCount()), String.valueOf(dto.getInvalidCount()) ); } final TableWriter tableWriter = new DynamicTableWriter(); tableWriter.write(table, output); }
/** * Updates the process group corresponding to the specified DTO. Any field * in DTO that is <code>null</code> (with the exception of the required ID) * will be ignored. * * @throws IllegalStateException if no process group can be found with the * ID of DTO or with the ID of the DTO's parentGroupId, if the template ID * specified is invalid, or if the DTO's Parent Group ID changes but the * parent group has incoming or outgoing connections * * @throws NullPointerException if the DTO or its ID is null */ private void updateProcessGroup(final ProcessGroup group, final ProcessGroupDTO dto) { final String name = dto.getName(); final PositionDTO position = dto.getPosition(); final String comments = dto.getComments(); if (name != null) { group.setName(name); } if (position != null) { group.setPosition(toPosition(position)); } if (comments != null) { group.setComments(comments); } }
@Override public ProcessGroup createProcessGroup(String parentGroupId, ProcessGroupDTO processGroup) { final FlowManager flowManager = flowController.getFlowManager(); if (processGroup.getParentGroupId() != null && !flowManager.areGroupsSame(processGroup.getParentGroupId(), parentGroupId)) { throw new IllegalArgumentException("Cannot specify a different Parent Group ID than the Group to which the Process Group is being added."); } // get the parent group ProcessGroup parentGroup = locateProcessGroup(flowController, parentGroupId); // create the process group ProcessGroup group = flowManager.createProcessGroup(processGroup.getId()); if (processGroup.getName() != null) { group.setName(processGroup.getName()); } if (processGroup.getPosition() != null) { group.setPosition(new Position(processGroup.getPosition().getX(), processGroup.getPosition().getY())); } // add the process group group.setParent(parentGroup); parentGroup.addProcessGroup(group); return group; }
}); snippet.getProcessGroups().forEach(processGroupDTO -> { rollbackClonedPolicy(ResourceFactory.getComponentResource(ResourceType.ProcessGroup, processGroupDTO.getId(), processGroupDTO.getName()));
actions.add(generateAuditRecord(processGroup.getId(), processGroup.getName(), Component.ProcessGroup, Operation.Add, timestamp));
if (StringUtils.isBlank(requestProcessGroupEntity.getComponent().getName()) && requestProcessGroupEntity.getComponent().getVersionControlInformation() == null) { throw new IllegalArgumentException("The group name is required when the group is not imported from version control."); if (flowSnapshot != null && StringUtils.isNotBlank(flowSnapshot.getFlowContents().getName()) && StringUtils.isBlank(processGroup.getName())) { processGroup.setName(flowSnapshot.getFlowContents().getName());
@Override public ProcessGroup updateProcessGroup(ProcessGroupDTO processGroupDTO) { final ProcessGroup group = locateProcessGroup(flowController, processGroupDTO.getId()); final String name = processGroupDTO.getName(); final String comments = processGroupDTO.getComments(); if (isNotNull(name)) { group.setName(name); } if (isNotNull(processGroupDTO.getPosition())) { group.setPosition(new Position(processGroupDTO.getPosition().getX(), processGroupDTO.getPosition().getY())); final ProcessGroup parent = group.getParent(); if (parent != null) { parent.onComponentModified(); } } if (isNotNull(comments)) { group.setComments(comments); } group.onComponentModified(); return group; }
processGroup.setVersionedComponentId(processGroupDTO.getVersionedComponentId()); processGroup.setPosition(toPosition(processGroupDTO.getPosition())); processGroup.setName(processGroupDTO.getName()); processGroup.setParent(parentGroup); if (parentGroup == null) {
public ProcessGroupDTO copy(final ProcessGroupDTO original, final boolean deep) { final ProcessGroupDTO copy = new ProcessGroupDTO(); copy.setComments(original.getComments()); copy.setContents(copy(original.getContents(), deep)); copy.setPosition(original.getPosition()); copy.setId(original.getId()); copy.setInputPortCount(original.getInputPortCount()); copy.setInvalidCount(original.getInvalidCount()); copy.setName(original.getName()); copy.setVersionControlInformation(copy(original.getVersionControlInformation())); copy.setOutputPortCount(original.getOutputPortCount()); copy.setParentGroupId(original.getParentGroupId()); copy.setVersionedComponentId(original.getVersionedComponentId()); copy.setRunningCount(original.getRunningCount()); copy.setStoppedCount(original.getStoppedCount()); copy.setDisabledCount(original.getDisabledCount()); copy.setActiveRemotePortCount(original.getActiveRemotePortCount()); copy.setInactiveRemotePortCount(original.getInactiveRemotePortCount()); copy.setUpToDateCount(original.getUpToDateCount()); copy.setLocallyModifiedCount(original.getLocallyModifiedCount()); copy.setStaleCount(original.getStaleCount()); copy.setLocallyModifiedAndStaleCount(original.getLocallyModifiedAndStaleCount()); copy.setSyncFailureCount(original.getSyncFailureCount()); if (original.getVariables() != null) { copy.setVariables(new HashMap<>(original.getVariables())); } return copy; }
childGroup.setPosition(toPosition(groupDTO.getPosition())); childGroup.setComments(groupDTO.getComments()); childGroup.setName(groupDTO.getName()); if (groupDTO.getVariables() != null) { childGroup.setVariables(groupDTO.getVariables());
.map(p -> addSnippet(new HashMap<>(), p.getId(), p.getName(), p.getContents())).collect(Collectors.toList()));
.map(p -> addSnippet(new HashMap<>(), p.getId(), p.getName(), p.getContents())).collect(Collectors.toList()));