Java Code Examples for org.apache.nifi.groups.ProcessGroup#getProcessGroup()

The following examples show how to use org.apache.nifi.groups.ProcessGroup#getProcessGroup() . 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: StandardFlowSynchronizer.java    From localization_nifi with Apache License 2.0 6 votes vote down vote up
private void addLocalTemplates(final Element processGroupElement, final ProcessGroup processGroup, final FlowEncodingVersion encodingVersion) {
    // Replace the templates with those from the proposed flow
    final List<Element> templateNodeList = getChildrenByTagName(processGroupElement, "template");
    if (templateNodeList != null) {
        for (final Element templateElement : templateNodeList) {
            final TemplateDTO templateDto = TemplateUtils.parseDto(templateElement);
            final Template template = new Template(templateDto);

            // If the Process Group does not have the template, add it.
            if (processGroup.getTemplate(template.getIdentifier()) == null) {
                processGroup.addTemplate(template);
            }
        }
    }

    final List<Element> childGroupElements = getChildrenByTagName(processGroupElement, "processGroup");
    for (final Element childGroupElement : childGroupElements) {
        final String childGroupId = getString(childGroupElement, "id");
        final ProcessGroup childGroup = processGroup.getProcessGroup(childGroupId);
        addLocalTemplates(childGroupElement, childGroup, encodingVersion);
    }
}
 
Example 2
Source File: StandardFlowSynchronizer.java    From nifi with Apache License 2.0 6 votes vote down vote up
private void addLocalTemplates(final Element processGroupElement, final ProcessGroup processGroup) {
    // Replace the templates with those from the proposed flow
    final List<Element> templateNodeList = getChildrenByTagName(processGroupElement, "template");
    if (templateNodeList != null) {
        for (final Element templateElement : templateNodeList) {
            final TemplateDTO templateDto = TemplateUtils.parseDto(templateElement);
            final Template template = new Template(templateDto);

            // If the Process Group does not have the template, add it.
            if (processGroup.getTemplate(template.getIdentifier()) == null) {
                processGroup.addTemplate(template);
            }
        }
    }

    final List<Element> childGroupElements = getChildrenByTagName(processGroupElement, "processGroup");
    for (final Element childGroupElement : childGroupElements) {
        final String childGroupId = getString(childGroupElement, "id");
        final ProcessGroup childGroup = processGroup.getProcessGroup(childGroupId);
        addLocalTemplates(childGroupElement, childGroup);
    }
}
 
Example 3
Source File: SnippetUtils.java    From nifi with Apache License 2.0 6 votes vote down vote up
public static void verifyNoVersionControlConflicts(final Snippet snippet, final ProcessGroup parentGroup, final ProcessGroup destination) {
    if (snippet == null) {
        return;
    }
    if (snippet.getProcessGroups() == null) {
        return;
    }

    final List<VersionControlInformation> vcis = new ArrayList<>();
    for (final String groupId : snippet.getProcessGroups().keySet()) {
        final ProcessGroup group = parentGroup.getProcessGroup(groupId);
        if (group != null) {
            findAllVersionControlInfo(group, vcis);
        }
    }

    verifyNoDuplicateVersionControlInfo(destination, vcis);
}
 
Example 4
Source File: FlowController.java    From localization_nifi with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the parent of the specified Connectable. This only considers this
 * group and any direct child sub groups.
 *
 * @param parentGroupId group id
 * @return parent group
 */
private ProcessGroup getConnectableParent(final ProcessGroup group, final String parentGroupId) {
    if (areGroupsSame(group.getIdentifier(), parentGroupId)) {
        return group;
    } else {
        return group.getProcessGroup(parentGroupId);
    }
}
 
Example 5
Source File: StandardFlowSnippet.java    From nifi with Apache License 2.0 5 votes vote down vote up
private ProcessGroup getConnectableParent(final ProcessGroup group, final String parentGroupId, final FlowManager flowManager) {
    if (flowManager.areGroupsSame(group.getIdentifier(), parentGroupId)) {
        return group;
    } else {
        return group.getProcessGroup(parentGroupId);
    }
}