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

The following examples show how to use org.apache.nifi.groups.ProcessGroup#getIdentifier() . 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: BulletinFactory.java    From localization_nifi with Apache License 2.0 6 votes vote down vote up
public static Bulletin createBulletin(final Connectable connectable, final String category, final String severity, final String message) {
    final ComponentType type;
    switch (connectable.getConnectableType()) {
        case REMOTE_INPUT_PORT:
        case REMOTE_OUTPUT_PORT:
            type = ComponentType.REMOTE_PROCESS_GROUP;
            break;
        case INPUT_PORT:
            type = ComponentType.INPUT_PORT;
            break;
        case OUTPUT_PORT:
            type = ComponentType.OUTPUT_PORT;
            break;
        case PROCESSOR:
        default:
            type = ComponentType.PROCESSOR;
            break;
    }

    final ProcessGroup group = connectable.getProcessGroup();
    final String groupId = group == null ? null : group.getIdentifier();
    return BulletinFactory.createBulletin(groupId, connectable.getIdentifier(), type, connectable.getName(), category, severity, message);
}
 
Example 2
Source File: StandardValidationContext.java    From nifi with Apache License 2.0 5 votes vote down vote up
@Override
public ValidationContext getControllerServiceValidationContext(final ControllerService controllerService) {
    final ControllerServiceNode serviceNode = controllerServiceProvider.getControllerServiceNode(controllerService.getIdentifier());
    final ProcessGroup serviceGroup = serviceNode.getProcessGroup();
    final String serviceGroupId = serviceGroup == null ? null : serviceGroup.getIdentifier();
    return new StandardValidationContext(controllerServiceProvider, serviceNode.getProperties(), serviceNode.getAnnotationData(), serviceGroupId,
        serviceNode.getIdentifier(), variableRegistry, serviceNode.getProcessGroup().getParameterContext());
}
 
Example 3
Source File: StandardValidationContext.java    From localization_nifi with Apache License 2.0 5 votes vote down vote up
@Override
public ValidationContext getControllerServiceValidationContext(final ControllerService controllerService) {
    final ControllerServiceNode serviceNode = controllerServiceProvider.getControllerServiceNode(controllerService.getIdentifier());
    final ProcessGroup serviceGroup = serviceNode.getProcessGroup();
    final String serviceGroupId = serviceGroup == null ? null : serviceGroup.getIdentifier();
    return new StandardValidationContext(controllerServiceProvider, serviceNode.getProperties(), serviceNode.getAnnotationData(), serviceGroupId, serviceNode.getIdentifier(),variableRegistry);
}
 
Example 4
Source File: ControllerServiceLogObserver.java    From nifi with Apache License 2.0 5 votes vote down vote up
@Override
public void onLogMessage(final LogMessage message) {
    // Map LogLevel.WARN to Severity.WARNING so that we are consistent with the Severity enumeration. Else, just use whatever
    // the LogLevel is (INFO and ERROR map directly and all others we will just accept as they are).
    final String bulletinLevel = message.getLevel() == LogLevel.WARN ? Severity.WARNING.name() : message.getLevel().toString();

    final ProcessGroup pg = serviceNode.getProcessGroup();
    final String groupId = pg == null ? null : pg.getIdentifier();
    final String groupName = pg == null ? null : pg.getName();

    final Bulletin bulletin = BulletinFactory.createBulletin(groupId, groupName, serviceNode.getIdentifier(), ComponentType.CONTROLLER_SERVICE,
            serviceNode.getName(), "Log Message", bulletinLevel, message.getMessage());
    bulletinRepository.addBulletin(bulletin);
}
 
Example 5
Source File: StandardFunnel.java    From nifi with Apache License 2.0 4 votes vote down vote up
@Override
public String getProcessGroupIdentifier() {
    final ProcessGroup procGroup = getProcessGroup();
    return procGroup == null ? null : procGroup.getIdentifier();
}
 
Example 6
Source File: NiFiRegistryFlowMapper.java    From nifi with Apache License 2.0 4 votes vote down vote up
private InstantiatedVersionedProcessGroup mapGroup(final ProcessGroup group, final ControllerServiceProvider serviceProvider,
                                                   final BiFunction<ProcessGroup, VersionedProcessGroup, Boolean> applyVersionControlInfo,
                                                   final boolean topLevel, final Set<String> includedGroupIds,
                                                   final Map<String, ExternalControllerServiceReference> externalControllerServiceReferences) {

    final InstantiatedVersionedProcessGroup versionedGroup = new InstantiatedVersionedProcessGroup(group.getIdentifier(), group.getProcessGroupIdentifier());
    versionedGroup.setIdentifier(getId(group.getVersionedComponentId(), group.getIdentifier()));
    versionedGroup.setGroupIdentifier(getGroupId(group.getProcessGroupIdentifier()));
    versionedGroup.setName(group.getName());
    versionedGroup.setComments(group.getComments());
    versionedGroup.setPosition(mapPosition(group.getPosition()));

    final ParameterContext parameterContext = group.getParameterContext();
    versionedGroup.setParameterContextName(parameterContext == null ? null : parameterContext.getName());

    // If we are at the 'top level', meaning that the given Process Group is the group that we are creating a VersionedProcessGroup for,
    // then we don't want to include the RemoteFlowCoordinates; we want to include the group contents. The RemoteFlowCoordinates will be used
    // only for a child group that is itself version controlled.
    if (!topLevel) {
        final boolean mapDescendantVersionedFlows = applyVersionControlInfo.apply(group, versionedGroup);

        // return here if we do not want to include remotely managed descendant flows
        if (!mapDescendantVersionedFlows) {
            return versionedGroup;
        }
    }

    versionedGroup.setControllerServices(group.getControllerServices(false).stream()
            .map(service -> mapControllerService(service, serviceProvider, includedGroupIds, externalControllerServiceReferences))
            .collect(Collectors.toCollection(LinkedHashSet::new)));

    versionedGroup.setFunnels(group.getFunnels().stream()
            .map(this::mapFunnel)
            .collect(Collectors.toCollection(LinkedHashSet::new)));

    versionedGroup.setInputPorts(group.getInputPorts().stream()
            .map(this::mapPort)
            .collect(Collectors.toCollection(LinkedHashSet::new)));

    versionedGroup.setOutputPorts(group.getOutputPorts().stream()
            .map(this::mapPort)
            .collect(Collectors.toCollection(LinkedHashSet::new)));

    versionedGroup.setLabels(group.getLabels().stream()
            .map(this::mapLabel)
            .collect(Collectors.toCollection(LinkedHashSet::new)));

    versionedGroup.setProcessors(group.getProcessors().stream()
            .map(processor -> mapProcessor(processor, serviceProvider, includedGroupIds, externalControllerServiceReferences))
            .collect(Collectors.toCollection(LinkedHashSet::new)));

    versionedGroup.setRemoteProcessGroups(group.getRemoteProcessGroups().stream()
            .map(this::mapRemoteProcessGroup)
            .collect(Collectors.toCollection(LinkedHashSet::new)));

    versionedGroup.setProcessGroups(group.getProcessGroups().stream()
            .map(grp -> mapGroup(grp, serviceProvider, applyVersionControlInfo, false, includedGroupIds, externalControllerServiceReferences))
            .collect(Collectors.toCollection(LinkedHashSet::new)));

    versionedGroup.setConnections(group.getConnections().stream()
            .map(this::mapConnection)
            .collect(Collectors.toCollection(LinkedHashSet::new)));

    versionedGroup.setVariables(group.getVariableRegistry().getVariableMap().entrySet().stream()
            .collect(Collectors.toMap(entry -> entry.getKey().getName(), Map.Entry::getValue)));

    if (topLevel) {
        versionedGroup.setExternalControllerServiceReferences(externalControllerServiceReferences);
    }

    return versionedGroup;
}
 
Example 7
Source File: StandardRemoteProcessGroup.java    From nifi with Apache License 2.0 4 votes vote down vote up
@Override
public String getProcessGroupIdentifier() {
    final ProcessGroup procGroup = getProcessGroup();
    return procGroup == null ? null : procGroup.getIdentifier();
}
 
Example 8
Source File: StandardLabel.java    From nifi with Apache License 2.0 4 votes vote down vote up
@Override
public String getProcessGroupIdentifier() {
    final ProcessGroup procGroup = getProcessGroup();
    return procGroup == null ? null : procGroup.getIdentifier();
}
 
Example 9
Source File: StandardControllerServiceNode.java    From nifi with Apache License 2.0 4 votes vote down vote up
@Override
public String getProcessGroupIdentifier() {
    final ProcessGroup procGroup = getProcessGroup();
    return procGroup == null ? null : procGroup.getIdentifier();
}
 
Example 10
Source File: StandardProcessorNode.java    From nifi with Apache License 2.0 4 votes vote down vote up
@Override
public String getProcessGroupIdentifier() {
    final ProcessGroup group = getProcessGroup();
    return group == null ? null : group.getIdentifier();
}
 
Example 11
Source File: StandardFlowSynchronizer.java    From nifi with Apache License 2.0 4 votes vote down vote up
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;
}
 
Example 12
Source File: Template.java    From nifi with Apache License 2.0 4 votes vote down vote up
@Override
public String getProcessGroupIdentifier() {
    final ProcessGroup procGroup = getProcessGroup();
    return procGroup == null ? null : procGroup.getIdentifier();
}
 
Example 13
Source File: AbstractPort.java    From localization_nifi with Apache License 2.0 4 votes vote down vote up
@Override
public String getProcessGroupIdentifier() {
    final ProcessGroup procGroup = getProcessGroup();
    return procGroup == null ? null : procGroup.getIdentifier();
}
 
Example 14
Source File: AbstractPort.java    From nifi with Apache License 2.0 4 votes vote down vote up
@Override
public String getProcessGroupIdentifier() {
    final ProcessGroup procGroup = getProcessGroup();
    return procGroup == null ? null : procGroup.getIdentifier();
}
 
Example 15
Source File: StandardRemoteProcessGroup.java    From localization_nifi with Apache License 2.0 4 votes vote down vote up
@Override
public String getProcessGroupIdentifier() {
    final ProcessGroup procGroup = getProcessGroup();
    return procGroup == null ? null : procGroup.getIdentifier();
}
 
Example 16
Source File: StandardLabel.java    From localization_nifi with Apache License 2.0 4 votes vote down vote up
@Override
public String getProcessGroupIdentifier() {
    final ProcessGroup procGroup = getProcessGroup();
    return procGroup == null ? null : procGroup.getIdentifier();
}
 
Example 17
Source File: StandardControllerServiceNode.java    From localization_nifi with Apache License 2.0 4 votes vote down vote up
@Override
public String getProcessGroupIdentifier() {
    final ProcessGroup procGroup = getProcessGroup();
    return procGroup == null ? null : procGroup.getIdentifier();
}
 
Example 18
Source File: StandardProcessorNode.java    From localization_nifi with Apache License 2.0 4 votes vote down vote up
@Override
public String getProcessGroupIdentifier() {
    final ProcessGroup group = getProcessGroup();
    return group == null ? null : group.getIdentifier();
}
 
Example 19
Source File: Template.java    From localization_nifi with Apache License 2.0 4 votes vote down vote up
@Override
public String getProcessGroupIdentifier() {
    final ProcessGroup procGroup = getProcessGroup();
    return procGroup == null ? null : procGroup.getIdentifier();
}
 
Example 20
Source File: StandardFunnel.java    From localization_nifi with Apache License 2.0 4 votes vote down vote up
@Override
public String getProcessGroupIdentifier() {
    final ProcessGroup procGroup = getProcessGroup();
    return procGroup == null ? null : procGroup.getIdentifier();
}