[
https://issues.apache.org/jira/browse/NIFI-1908?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15306848#comment-15306848
]
ASF GitHub Bot commented on NIFI-1908:
--------------------------------------
Github user jtstorck commented on a diff in the pull request:
https://github.com/apache/nifi/pull/471#discussion_r65096222
--- Diff:
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiServiceFacade.java
---
@@ -1354,55 +1349,55 @@ private void validateSnippetContents(final
FlowSnippetDTO flow) {
@Override
public FlowEntity copySnippet(final String groupId, final String
snippetId, final Double originX, final Double originY, final String
idGenerationSeed) {
final FlowDTO flowDto = revisionManager.get(groupId,
- rev -> {
- // create the new snippet
- final FlowSnippetDTO snippet =
snippetDAO.copySnippet(groupId, snippetId, originX, originY, idGenerationSeed);
-
- // validate the new snippet
- validateSnippetContents(snippet);
+ rev -> {
+ // create the new snippet
+ final FlowSnippetDTO snippet =
snippetDAO.copySnippet(groupId, snippetId, originX, originY, idGenerationSeed);
- // save the flow
- controllerFacade.save();
-
- // drop the snippet
- snippetDAO.dropSnippet(snippetId);
+ // 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()
- .flatMap(remoteGroup ->
remoteGroup.getContents().getInputPorts().stream())
- .map(remoteInputPort -> remoteInputPort.getId())
- .forEach(id -> identifiers.add(id));
- snippet.getRemoteProcessGroups().stream()
- .flatMap(remoteGroup ->
remoteGroup.getContents().getOutputPorts().stream())
- .map(remoteOutputPort -> remoteOutputPort.getId())
- .forEach(id -> identifiers.add(id));
+ // save the flow
+ controllerFacade.save();
- final ProcessGroup processGroup =
processGroupDAO.getProcessGroup(groupId);
- return revisionManager.get(identifiers,
- () -> {
- final ProcessGroupStatus groupStatus =
controllerFacade.getProcessGroupStatus(groupId);
- return dtoFactory.createFlowDto(processGroup,
groupStatus, snippet, revisionManager);
- });
- });
+ // drop the snippet
+ snippetDAO.dropSnippet(snippetId);
+
+ // 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()
+ .flatMap(remoteGroup ->
remoteGroup.getContents().getInputPorts().stream())
--- End diff --
I did fix that bug, in the createTemplateInstance method. Looks like
copySnippet might have the same issue.
> Auto-adjust template layouts upon placement on the canvas
> ---------------------------------------------------------
>
> Key: NIFI-1908
> URL: https://issues.apache.org/jira/browse/NIFI-1908
> Project: Apache NiFi
> Issue Type: Improvement
> Components: Core Framework
> Affects Versions: 1.0.0
> Reporter: Jeff Storck
> Assignee: Jeff Storck
> Fix For: 1.0.0
>
>
> Positions of components in templates created by pre-1.0.0 versions of NiFi
> need to be positionally rescaled due to the UI changes described in
> NIFI-1799.
> New templates created by NiFi as of version 1.0.0 will need to include a
> template encoding version that gets updated as the template DTO changes.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)