use of org.apache.nifi.web.revision.RevisionManager in project nifi by apache.
the class StandardFlowServiceFactoryBean method getObject.
@Override
public Object getObject() throws Exception {
if (flowService == null) {
final FlowController flowController = applicationContext.getBean("flowController", FlowController.class);
final RevisionManager revisionManager = applicationContext.getBean("revisionManager", RevisionManager.class);
if (properties.isNode()) {
final NodeProtocolSenderListener nodeProtocolSenderListener = applicationContext.getBean("nodeProtocolSenderListener", NodeProtocolSenderListener.class);
final ClusterCoordinator clusterCoordinator = applicationContext.getBean("clusterCoordinator", ClusterCoordinator.class);
flowService = StandardFlowService.createClusteredInstance(flowController, properties, nodeProtocolSenderListener, clusterCoordinator, encryptor, revisionManager, authorizer);
} else {
flowService = StandardFlowService.createStandaloneInstance(flowController, properties, encryptor, revisionManager, authorizer);
}
}
return flowService;
}
use of org.apache.nifi.web.revision.RevisionManager in project nifi by apache.
the class StandardNiFiServiceFacade method postProcessNewFlowSnippet.
/**
* Post processes a new flow snippet including validation, removing the snippet, and DTO conversion.
*
* @param groupId group id
* @param snippet snippet
* @return flow dto
*/
private FlowDTO postProcessNewFlowSnippet(final String groupId, final FlowSnippetDTO snippet) {
// validate the new snippet
validateSnippetContents(snippet);
// identify all components added
final Set<String> identifiers = new HashSet<>();
snippet.getProcessors().stream().map(proc -> proc.getId()).forEach(id -> identifiers.add(id));
snippet.getConnections().stream().map(conn -> conn.getId()).forEach(id -> identifiers.add(id));
snippet.getInputPorts().stream().map(port -> port.getId()).forEach(id -> identifiers.add(id));
snippet.getOutputPorts().stream().map(port -> port.getId()).forEach(id -> identifiers.add(id));
snippet.getProcessGroups().stream().map(group -> group.getId()).forEach(id -> identifiers.add(id));
snippet.getRemoteProcessGroups().stream().map(remoteGroup -> remoteGroup.getId()).forEach(id -> identifiers.add(id));
snippet.getRemoteProcessGroups().stream().filter(remoteGroup -> remoteGroup.getContents() != null && remoteGroup.getContents().getInputPorts() != null).flatMap(remoteGroup -> remoteGroup.getContents().getInputPorts().stream()).map(remoteInputPort -> remoteInputPort.getId()).forEach(id -> identifiers.add(id));
snippet.getRemoteProcessGroups().stream().filter(remoteGroup -> remoteGroup.getContents() != null && remoteGroup.getContents().getOutputPorts() != null).flatMap(remoteGroup -> remoteGroup.getContents().getOutputPorts().stream()).map(remoteOutputPort -> remoteOutputPort.getId()).forEach(id -> identifiers.add(id));
snippet.getLabels().stream().map(label -> label.getId()).forEach(id -> identifiers.add(id));
final ProcessGroup group = processGroupDAO.getProcessGroup(groupId);
final ProcessGroupStatus groupStatus = controllerFacade.getProcessGroupStatus(groupId);
return dtoFactory.createFlowDto(group, groupStatus, snippet, revisionManager, this::getProcessGroupBulletins);
}
Aggregations