@Override public ProcessGroup updateProcessGroupFlow(final String groupId, final VersionedFlowSnapshot proposedSnapshot, final VersionControlInformationDTO versionControlInformation, final String componentIdSeed, final boolean verifyNotModified, final boolean updateSettings, final boolean updateDescendantVersionedFlows) { final ProcessGroup group = locateProcessGroup(flowController, groupId); group.updateFlow(proposedSnapshot, componentIdSeed, verifyNotModified, updateSettings, updateDescendantVersionedFlows); group.findAllRemoteProcessGroups().stream().forEach(RemoteProcessGroup::initialize); final StandardVersionControlInformation svci = StandardVersionControlInformation.Builder.fromDto(versionControlInformation) .flowSnapshot(proposedSnapshot.getFlowContents()) .build(); group.setVersionControlInformation(svci, Collections.emptyMap()); group.onComponentModified(); return group; }
@Override public VersionedFlowSnapshot getFlowContents(final String bucketId, final String flowId, final int version, final boolean fetchRemoteFlows, final NiFiUser user) throws IOException, NiFiRegistryException { final FlowSnapshotClient snapshotClient = getFlowSnapshotClient(user); final VersionedFlowSnapshot flowSnapshot = snapshotClient.get(bucketId, flowId, version); if (fetchRemoteFlows) { final VersionedProcessGroup contents = flowSnapshot.getFlowContents(); for (final VersionedProcessGroup child : contents.getProcessGroups()) { populateVersionedContentsRecursively(child, user); } } return flowSnapshot; }
final VersionedProcessGroup flowContents = updatedFlow.getFlowContents(); if (verifyConnectionRemoval) { findAllProcessGroups(updatedFlow.getFlowContents(), proposedProcessGroups); findAllProcessors(updatedFlow.getFlowContents(), proposedProcessors); findAllControllerServices(updatedFlow.getFlowContents(), proposedServices); findAllConnections(updatedFlow.getFlowContents(), proposedConnections);
final ComparableDataFlow remoteFlow = new StandardComparableDataFlow("Remote Flow", proposedSnapshot.getFlowContents()); updateProcessGroup(this, proposedSnapshot.getFlowContents(), componentIdSeed, updatedVersionedComponentIds, false, updateSettings, updateDescendantVersionedFlows, knownVariables); } catch (final Throwable t) {
snapshot.setFlowContents(deserializedSnapshot.getFlowContents());
serviceFacade.discoverCompatibleBundles(flowSnapshot.getFlowContents()); serviceFacade.verifyImportProcessGroup(versionControlInfo, flowSnapshot.getFlowContents(), groupId); if (versionedFlowSnapshot != null) { final Set<ConfigurableComponent> restrictedComponents = FlowRegistryUtils.getRestrictedComponents( versionedFlowSnapshot.getFlowContents(), serviceFacade); restrictedComponents.forEach(restrictedComponent -> { final ComponentAuthorizable restrictedComponentAuthorizable = lookup.getConfigurableComponent(restrictedComponent); final VersionedFlowSnapshot versionedFlowSnapshot = requestProcessGroupEntity.getVersionedFlowSnapshot(); if (versionedFlowSnapshot != null) { serviceFacade.verifyComponentTypes(versionedFlowSnapshot.getFlowContents()); if (flowSnapshot != null && StringUtils.isNotBlank(flowSnapshot.getFlowContents().getName()) && StringUtils.isBlank(processGroup.getName())) { processGroup.setName(flowSnapshot.getFlowContents().getName()); flowSnapshot.getFlowContents().setPosition(null); entity = serviceFacade.updateProcessGroupContents(newGroupRevision, newGroupId, versionControlInfo, flowSnapshot, getIdGenerationSeed().orElse(null), false, true, true);
serviceFacade.discoverCompatibleBundles(flowSnapshot.getFlowContents()); authorizeProcessGroup(groupAuthorizable, authorizer, lookup, RequestAction.WRITE, true, false, true, true); final VersionedProcessGroup groupContents = flowSnapshot.getFlowContents(); final Set<ConfigurableComponent> restrictedComponents = FlowRegistryUtils.getRestrictedComponents(groupContents, serviceFacade); restrictedComponents.forEach(restrictedComponent -> {
final VersionedProcessGroup registryFlow = registrySnapshot.getFlowContents(); vci.setFlowSnapshot(registryFlow); } catch (final IOException | NiFiRegistryException e) {
serviceFacade.discoverCompatibleBundles(flowSnapshot.getFlowContents()); authorizeProcessGroup(groupAuthorizable, authorizer, lookup, RequestAction.WRITE, true, false, true, true); final VersionedProcessGroup groupContents = flowSnapshot.getFlowContents(); final Set<ConfigurableComponent> restrictedComponents = FlowRegistryUtils.getRestrictedComponents(groupContents, serviceFacade); restrictedComponents.forEach(restrictedComponent -> {
final ComparableDataFlow proposedFlow = new StandardComparableDataFlow("Versioned Flow", updatedSnapshot.getFlowContents());
final VersionedProcessGroup registryGroup = versionedFlowSnapshot.getFlowContents();
final VersionedProcessGroup contents = snapshot.getFlowContents();
@Override public ConfigSchema apply(final VersionedFlowSnapshot versionedFlowSnapshot) { Map<String, Object> map = new HashMap<>(); map.put(CommonPropertyKeys.FLOW_CONTROLLER_PROPS_KEY, flowControllerSchemaFunction.apply(versionedFlowSnapshot).toMap()); VersionedProcessGroup versionedProcessGroup = versionedFlowSnapshot.getFlowContents(); addVersionedProcessGroup(map, versionedProcessGroup); return new ConfigSchema(map); }
@Override public ConfigSchema apply(final VersionedFlowSnapshot versionedFlowSnapshot) { Map<String, Object> map = new HashMap<>(); map.put(CommonPropertyKeys.FLOW_CONTROLLER_PROPS_KEY, flowControllerSchemaFunction.apply(versionedFlowSnapshot).toMap()); VersionedProcessGroup versionedProcessGroup = versionedFlowSnapshot.getFlowContents(); addVersionedProcessGroup(map, versionedProcessGroup); return new ConfigSchema(map); }
@Override public FlowControllerSchema apply(final VersionedFlowSnapshot versionedFlowSnapshot) { // If the VersionedFlowSnapshot came directly from NiFi Registry without modification, as would be the // case with C2 server, then we should have a non-null VersionedFlow, but if we're using a snapshot that // was export from another tool like the CLI, the flow may be null'd out, so fall back to root group. String name; String description; if (versionedFlowSnapshot.getFlow() == null) { name = versionedFlowSnapshot.getFlowContents().getName(); description = versionedFlowSnapshot.getFlowContents().getComments(); } else { name = versionedFlowSnapshot.getFlow().getName(); description = versionedFlowSnapshot.getFlow().getDescription(); } Map<String, Object> map = new HashMap<>(); map.put(CommonPropertyKeys.NAME_KEY, name); map.put(CommonPropertyKeys.COMMENT_KEY, description); return new FlowControllerSchema(map); } }
@Override public FlowControllerSchema apply(final VersionedFlowSnapshot versionedFlowSnapshot) { // If the VersionedFlowSnapshot came directly from NiFi Registry without modification, as would be the // case with C2 server, then we should have a non-null VersionedFlow, but if we're using a snapshot that // was export from another tool like the CLI, the flow may be null'd out, so fall back to root group. String name; String description; if (versionedFlowSnapshot.getFlow() == null) { name = versionedFlowSnapshot.getFlowContents().getName(); description = versionedFlowSnapshot.getFlowContents().getComments(); } else { name = versionedFlowSnapshot.getFlow().getName(); description = versionedFlowSnapshot.getFlow().getDescription(); } Map<String, Object> map = new HashMap<>(); map.put(CommonPropertyKeys.NAME_KEY, name); map.put(CommonPropertyKeys.COMMENT_KEY, description); return new FlowControllerSchema(map); } }
public static ConfigSchema transformVersionedFlowSnapshotToSchema(VersionedFlowSnapshot versionedFlowSnapshot) { VersionedProcessGroupEnricher enricher = new VersionedProcessGroupEnricher(); enricher.enrich(versionedFlowSnapshot.getFlowContents()); ConfigSchema configSchema = new NiFiRegConfigSchemaFunction().apply(versionedFlowSnapshot); return configSchema; }
public static ConfigSchema transformVersionedFlowSnapshotToSchema(VersionedFlowSnapshot versionedFlowSnapshot) { VersionedProcessGroupEnricher enricher = new VersionedProcessGroupEnricher(); enricher.enrich(versionedFlowSnapshot.getFlowContents()); ConfigSchema configSchema = new NiFiRegConfigSchemaFunction().apply(versionedFlowSnapshot); return configSchema; }
processGroupSerializer.serialize(flowSnapshot.getFlowContents(), out);