Java Code Examples for org.apache.nifi.groups.ProcessGroup#addProcessGroup()
The following examples show how to use
org.apache.nifi.groups.ProcessGroup#addProcessGroup() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StandardProcessGroupDAO.java From localization_nifi with Apache License 2.0 | 6 votes |
@Override public ProcessGroup createProcessGroup(String parentGroupId, ProcessGroupDTO processGroup) { if (processGroup.getParentGroupId() != null && !flowController.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 = flowController.createProcessGroup(processGroup.getId()); 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; }
Example 2
Source File: StandardProcessGroupDAO.java From nifi with Apache License 2.0 | 5 votes |
@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())); } final ParameterContextReferenceEntity parameterContextReference = processGroup.getParameterContext(); if (parameterContextReference != null && parameterContextReference.getId() != null) { final ParameterContext parameterContext = flowController.getFlowManager().getParameterContextManager().getParameterContext(parameterContextReference.getId()); group.setParameterContext(parameterContext); } // add the process group group.setParent(parentGroup); parentGroup.addProcessGroup(group); return group; }
Example 3
Source File: StandardFlowSynchronizer.java From nifi with Apache License 2.0 | 4 votes |
private ProcessGroup addProcessGroup(final FlowController controller, final ProcessGroup parentGroup, final Element processGroupElement, final StringEncryptor encryptor, final FlowEncodingVersion encodingVersion) { // get the parent group ID final String parentId = (parentGroup == null) ? null : parentGroup.getIdentifier(); final FlowManager flowManager = controller.getFlowManager(); // add the process group final ProcessGroupDTO processGroupDTO = FlowFromDOMFactory.getProcessGroup(parentId, processGroupElement, encryptor, encodingVersion); final ProcessGroup processGroup = flowManager.createProcessGroup(processGroupDTO.getId()); processGroup.setComments(processGroupDTO.getComments()); processGroup.setVersionedComponentId(processGroupDTO.getVersionedComponentId()); processGroup.setPosition(toPosition(processGroupDTO.getPosition())); processGroup.setName(processGroupDTO.getName()); processGroup.setParent(parentGroup); if (parentGroup == null) { controller.setRootGroup(processGroup); } else { parentGroup.addProcessGroup(processGroup); } final String flowfileConcurrencyName = processGroupDTO.getFlowfileConcurrency(); final String flowfileOutboundPolicyName = processGroupDTO.getFlowfileOutboundPolicy(); if (flowfileConcurrencyName == null) { processGroup.setFlowFileConcurrency(FlowFileConcurrency.UNBOUNDED); } else { processGroup.setFlowFileConcurrency(FlowFileConcurrency.valueOf(flowfileConcurrencyName)); } if (flowfileOutboundPolicyName == null) { processGroup.setFlowFileOutboundPolicy(FlowFileOutboundPolicy.STREAM_WHEN_AVAILABLE); } else { processGroup.setFlowFileOutboundPolicy(FlowFileOutboundPolicy.valueOf(flowfileOutboundPolicyName)); } final String parameterContextId = getString(processGroupElement, "parameterContextId"); if (parameterContextId != null) { final ParameterContext parameterContext = controller.getFlowManager().getParameterContextManager().getParameterContext(parameterContextId); processGroup.setParameterContext(parameterContext); } addVariables(processGroupElement, processGroup); addVersionControlInfo(processGroup, processGroupDTO, controller); addControllerServices(processGroupElement, processGroup, controller, encodingVersion); addProcessors(processGroupElement, processGroup, controller, encodingVersion); addInputPorts(processGroupElement, processGroup, controller); addOutputPorts(processGroupElement, processGroup, controller); addFunnels(processGroupElement, processGroup, controller); addLabels(processGroupElement, processGroup, controller); addNestedProcessGroups(processGroupElement, processGroup, controller, encodingVersion); addRemoteProcessGroups(processGroupElement, processGroup, controller); addConnections(processGroupElement, processGroup, controller); addTemplates(processGroupElement, processGroup); return processGroup; }