if (componentTypeName.equals(org.apache.nifi.registry.flow.ComponentType.CONTROLLER_SERVICE.name())) { return authorizableLookup.getControllerService(componentId).getAuthorizable(); if (componentTypeName.equals(org.apache.nifi.registry.flow.ComponentType.CONNECTION.name())) { return authorizableLookup.getConnection(componentId).getAuthorizable(); if (componentTypeName.equals(org.apache.nifi.registry.flow.ComponentType.FUNNEL.name())) { return authorizableLookup.getFunnel(componentId); if (componentTypeName.equals(org.apache.nifi.registry.flow.ComponentType.INPUT_PORT.name())) { return authorizableLookup.getInputPort(componentId); if (componentTypeName.equals(org.apache.nifi.registry.flow.ComponentType.OUTPUT_PORT.name())) { return authorizableLookup.getOutputPort(componentId); if (componentTypeName.equals(org.apache.nifi.registry.flow.ComponentType.LABEL.name())) { return authorizableLookup.getLabel(componentId); if (componentTypeName.equals(org.apache.nifi.registry.flow.ComponentType.PROCESS_GROUP.name())) { return authorizableLookup.getProcessGroup(componentId).getAuthorizable(); if (componentTypeName.equals(org.apache.nifi.registry.flow.ComponentType.PROCESSOR.name())) { return authorizableLookup.getProcessor(componentId).getAuthorizable(); if (componentTypeName.equals(org.apache.nifi.registry.flow.ComponentType.REMOTE_INPUT_PORT.name())) { return authorizableLookup.getRemoteProcessGroup(versionedComponent.getInstanceGroupId()); if (componentTypeName.equals(org.apache.nifi.registry.flow.ComponentType.REMOTE_OUTPUT_PORT.name())) { return authorizableLookup.getRemoteProcessGroup(versionedComponent.getInstanceGroupId());
@Override public String describeDifference(final DifferenceType type, final String flowAName, final String flowBName, final VersionedComponent componentA, final VersionedComponent componentB, final String fieldName, final Object valueA, final Object valueB) { final String description; switch (type) { case COMPONENT_ADDED: description = String.format("%s with ID %s was added to flow", componentB.getComponentType().getTypeName(), componentB.getIdentifier()); break; case COMPONENT_REMOVED: description = String.format("%s with ID %s was removed from flow", componentA.getComponentType().getTypeName(), componentA.getIdentifier()); break; case PROPERTY_ADDED: description = String.format("Property '%s' was added to %s with ID %s", fieldName, componentB.getComponentType().getTypeName(), componentB.getIdentifier()); break; case PROPERTY_REMOVED: description = String.format("Property '%s' was removed from %s with ID %s", fieldName, componentA.getComponentType().getTypeName(), componentA.getIdentifier()); break; case VARIABLE_ADDED: description = String.format("Variable '%s' was added to Process Group with ID %s", fieldName, componentB.getIdentifier()); break; case VARIABLE_REMOVED: description = String.format("Variable '%s' was removed from Process Group with ID %s", fieldName, componentA.getIdentifier()); break; default: description = String.format("%s for %s with ID %s from '%s' to '%s'", type.getDescription(), componentA.getComponentType().getTypeName(), componentA.getIdentifier(), valueA, valueB); break; } return description; }
private ComponentDifferenceDTO createComponentDifference(final FlowDifference difference) { VersionedComponent component = difference.getComponentA(); if (component == null || difference.getComponentB() instanceof InstantiatedVersionedComponent) { component = difference.getComponentB(); } final ComponentDifferenceDTO dto = new ComponentDifferenceDTO(); dto.setComponentName(component.getName()); dto.setComponentType(component.getComponentType().toString()); if (component instanceof InstantiatedVersionedComponent) { final InstantiatedVersionedComponent instantiatedComponent = (InstantiatedVersionedComponent) component; dto.setComponentId(instantiatedComponent.getInstanceId()); dto.setProcessGroupId(instantiatedComponent.getInstanceGroupId()); } else { dto.setComponentId(component.getIdentifier()); dto.setProcessGroupId(dto.getProcessGroupId()); } return dto; }
switch (type) { case COMPONENT_ADDED: description = String.format("%s was added", componentB.getComponentType().getTypeName()); break; case COMPONENT_REMOVED: description = String.format("%s was removed", componentA.getComponentType().getTypeName()); break; case PROPERTY_ADDED:
case COMPONENT_ADDED: description = String.format("%s with ID %s exists in %s but not in %s", componentB.getComponentType().getTypeName(), componentB.getIdentifier(), flowBName, flowAName); break; case COMPONENT_REMOVED: description = String.format("%s with ID %s exists in %s but not in %s", componentA.getComponentType().getTypeName(), componentA.getIdentifier(), flowAName, flowBName); break; case PROPERTY_ADDED: description = String.format("Property '%s' exists for %s with ID %s in %s but not in %s", fieldName, componentB.getComponentType().getTypeName(), componentB.getIdentifier(), flowBName, flowAName); break; case PROPERTY_REMOVED: description = String.format("Property '%s' exists for %s with ID %s in %s but not in %s", fieldName, componentA.getComponentType().getTypeName(), componentA.getIdentifier(), flowAName, flowBName); break; case VARIABLE_ADDED: type.getDescription(), componentA.getComponentType().getTypeName(), componentA.getIdentifier(), flowAName, valueA, flowBName, valueB); break; default: description = String.format("%s for %s with ID %s; flow '%s' has value %s; flow '%s' has value %s", type.getDescription(), componentA.getComponentType().getTypeName(), componentA.getIdentifier(), flowAName, valueA, flowBName, valueB); break;
return createAffectedComponentEntity((InstantiatedVersionedComponent) localComponent, localComponent.getComponentType().name(), state); }) .collect(Collectors.toCollection(HashSet::new));
public static ComponentDifferenceGroup map(VersionedComponent versionedComponent){ ComponentDifferenceGroup grouping = new ComponentDifferenceGroup(); grouping.setComponentId(versionedComponent.getIdentifier()); grouping.setComponentName(versionedComponent.getName()); grouping.setProcessGroupId(versionedComponent.getGroupIdentifier()); grouping.setComponentType(versionedComponent.getComponentType().getTypeName()); return grouping; }