nifi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcgil...@apache.org
Subject nifi git commit: NIFI-2150: Cleanse more values from templates that are not necessary. Additionally, updated javadocs in ProcessorConfigDTO to provide further explanation of the getAutoTerminatedRelationships() method, since this was confusing Removed ad
Date Fri, 01 Jul 2016 18:22:54 GMT
Repository: nifi
Updated Branches:
  refs/heads/master ae9e2fdf0 -> 8eb0a3882


NIFI-2150:
Cleanse more values from templates that are not necessary. Additionally, updated javadocs
in ProcessorConfigDTO to provide further explanation of the getAutoTerminatedRelationships()
method, since this was confusing
Removed additional unused fields from templates
Populating snippet response using actual components rather than the snippet contents.
This closes #593


Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/8eb0a388
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/8eb0a388
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/8eb0a388

Branch: refs/heads/master
Commit: 8eb0a3882c4e7ff5b2b7f9ab527277fc432c6b3c
Parents: ae9e2fd
Author: Mark Payne <markap14@hotmail.com>
Authored: Wed Jun 29 15:12:50 2016 -0400
Committer: Matt Gilman <matt.c.gilman@gmail.com>
Committed: Fri Jul 1 14:21:02 2016 -0400

----------------------------------------------------------------------
 .../nifi/web/api/dto/ProcessorConfigDTO.java    |   4 +-
 .../org/apache/nifi/controller/Template.java    |   2 +-
 .../apache/nifi/controller/TemplateUtils.java   |  40 ++++++-
 .../org/apache/nifi/web/api/dto/DtoFactory.java | 118 ++++++++++++-------
 4 files changed, 118 insertions(+), 46 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/8eb0a388/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessorConfigDTO.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessorConfigDTO.java
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessorConfigDTO.java
index ec5df96..a9006c9 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessorConfigDTO.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessorConfigDTO.java
@@ -237,7 +237,9 @@ public class ProcessorConfigDTO {
      * @return the names of all processor relationships that cause a flow file to be terminated
if the relationship is not connected to anything
      */
     @ApiModelProperty(
-            value = "The names of all relationships that cause a flow file to be terminated
if the relationship is not connected elsewhere."
+        value = "The names of all relationships that cause a flow file to be terminated if
the relationship is not connected elsewhere. This property differs "
+            + "from the 'isAutoTerminate' property of the RelationshipDTO in that the RelationshipDTO
is meant to depict the current configuration, whereas this "
+            + "property can be set in a DTO when updating a Processor in order to change
which Relationships should be auto-terminated."
     )
     public Set<String> getAutoTerminatedRelationships() {
         return autoTerminatedRelationships;

http://git-wip-us.apache.org/repos/asf/nifi/blob/8eb0a388/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/controller/Template.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/controller/Template.java
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/controller/Template.java
index e50fe39..b330581 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/controller/Template.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/controller/Template.java
@@ -130,7 +130,7 @@ public class Template implements Authorizable {
         for (final ProcessGroupDTO groupDto : snippet.getProcessGroups()) {
             final ProcessGroup group = processGroup.getProcessGroup(groupDto.getId());
             if (group != null) {
-                authComponents.addAll(getAuthorizableComponents(processGroup));
+                authComponents.addAll(getAuthorizableComponents(group));
             }
         }
 

http://git-wip-us.apache.org/repos/asf/nifi/blob/8eb0a388/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/TemplateUtils.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/TemplateUtils.java
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/TemplateUtils.java
index b7a55ad..a5c4679 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/TemplateUtils.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/TemplateUtils.java
@@ -42,6 +42,7 @@ import org.apache.nifi.web.api.dto.ProcessGroupDTO;
 import org.apache.nifi.web.api.dto.ProcessorConfigDTO;
 import org.apache.nifi.web.api.dto.ProcessorDTO;
 import org.apache.nifi.web.api.dto.PropertyDescriptorDTO;
+import org.apache.nifi.web.api.dto.RelationshipDTO;
 import org.apache.nifi.web.api.dto.RemoteProcessGroupContentsDTO;
 import org.apache.nifi.web.api.dto.RemoteProcessGroupDTO;
 import org.apache.nifi.web.api.dto.RemoteProcessGroupPortDTO;
@@ -147,6 +148,15 @@ public class TemplateUtils {
     private static void scrubProcessGroups(final Set<ProcessGroupDTO> processGroups)
{
         // go through each process group
         for (final ProcessGroupDTO processGroupDTO : processGroups) {
+            processGroupDTO.setActiveRemotePortCount(null);
+            processGroupDTO.setDisabledCount(null);
+            processGroupDTO.setInactiveRemotePortCount(null);
+            processGroupDTO.setInputPortCount(null);
+            processGroupDTO.setInvalidCount(null);
+            processGroupDTO.setOutputPortCount(null);
+            processGroupDTO.setRunningCount(null);
+            processGroupDTO.setStoppedCount(null);
+
             scrubSnippet(processGroupDTO.getContents());
         }
     }
@@ -179,11 +189,25 @@ public class TemplateUtils {
                 }
 
                 processorConfig.setCustomUiUrl(null);
+                processorConfig.setDefaultConcurrentTasks(null);
+                processorConfig.setDefaultSchedulingPeriod(null);
+                processorConfig.setDescriptors(null);
+                processorConfig.setAutoTerminatedRelationships(null);
+            }
+
+            for (final RelationshipDTO relationship : processorDTO.getRelationships()) {
+                relationship.setDescription(null);
             }
 
-            // remove validation errors
             processorDTO.setValidationErrors(null);
             processorDTO.setInputRequirement(null);
+            processorDTO.setDescription(null);
+            processorDTO.setInputRequirement(null);
+            processorDTO.setPersistsState(null);
+            processorDTO.setState(null);
+            processorDTO.setSupportsBatching(null);
+            processorDTO.setSupportsEventDriven(null);
+            processorDTO.setSupportsParallelProcessing(null);
         }
     }
 
@@ -200,6 +224,7 @@ public class TemplateUtils {
                 }
             }
 
+            serviceDTO.setDescriptors(null);
             serviceDTO.setCustomUiUrl(null);
             serviceDTO.setValidationErrors(null);
         }
@@ -248,6 +273,15 @@ public class TemplateUtils {
             remoteProcessGroupDTO.setOutputPortCount(null);
             remoteProcessGroupDTO.setTransmitting(null);
             remoteProcessGroupDTO.setProxyPassword(null);
+            remoteProcessGroupDTO.setActiveRemoteInputPortCount(null);
+            remoteProcessGroupDTO.setInactiveRemoteInputPortCount(null);
+            remoteProcessGroupDTO.setActiveRemoteOutputPortCount(null);
+            remoteProcessGroupDTO.setInactiveRemoteOutputPortCount(null);
+            remoteProcessGroupDTO.setAuthorizationIssues(null);
+            remoteProcessGroupDTO.setFlowRefreshed(null);
+            remoteProcessGroupDTO.setName(null);
+            remoteProcessGroupDTO.setTargetSecure(null);
+            remoteProcessGroupDTO.setTransmitting(null);
 
             // if this remote process group has contents
             if (remoteProcessGroupDTO.getContents() != null) {
@@ -283,6 +317,10 @@ public class TemplateUtils {
 
             remotePortDTO.setExists(null);
             remotePortDTO.setTargetRunning(null);
+            remotePortDTO.setConnected(null);
+            remotePortDTO.setExists(null);
+            remotePortDTO.setTargetRunning(null);
+            remotePortDTO.setTransmitting(null);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/nifi/blob/8eb0a388/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java
index 3689680..10a28c7 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java
@@ -1617,81 +1617,113 @@ public final class DtoFactory {
 
         final FlowDTO flow = new FlowDTO();
 
-        for (final ConnectionDTO connection : snippet.getConnections()) {
-            final RevisionDTO revision = createRevisionDTO(revisionManager.getRevision(connection.getId()));
-            final AccessPolicyDTO accessPolicy = createAccessPolicyDto(group.getConnection(connection.getId()));
+        for (final ConnectionDTO snippetConnection : snippet.getConnections()) {
+            final Connection connection = group.getConnection(snippetConnection.getId());
+
+            // marshal the actual connection as the snippet is pruned
+            final ConnectionDTO dto = createConnectionDto(connection);
+            final RevisionDTO revision = createRevisionDTO(revisionManager.getRevision(connection.getIdentifier()));
+            final AccessPolicyDTO accessPolicy = createAccessPolicyDto(connection);
             final ConnectionStatusDTO status = getComponentStatus(
-                () -> groupStatus.getConnectionStatus().stream().filter(connectionStatus
-> connection.getId().equals(connectionStatus.getId())).findFirst().orElse(null),
+                () -> groupStatus.getConnectionStatus().stream().filter(connectionStatus
-> connection.getIdentifier().equals(connectionStatus.getId())).findFirst().orElse(null),
                 connectionStatus -> createConnectionStatusDto(connectionStatus)
             );
-            flow.getConnections().add(entityFactory.createConnectionEntity(connection, revision,
accessPolicy, status));
+            flow.getConnections().add(entityFactory.createConnectionEntity(dto, revision,
accessPolicy, status));
         }
 
-        for (final FunnelDTO funnel : snippet.getFunnels()) {
-            final RevisionDTO revision = createRevisionDTO(revisionManager.getRevision(funnel.getId()));
-            final AccessPolicyDTO accessPolicy = createAccessPolicyDto(group.getFunnel(funnel.getId()));
-            flow.getFunnels().add(entityFactory.createFunnelEntity(funnel, revision, accessPolicy));
+        for (final FunnelDTO snippetFunnel : snippet.getFunnels()) {
+            final Funnel funnel = group.getFunnel(snippetFunnel.getId());
+
+            // marshal the actual funnel as the snippet is pruned
+            final FunnelDTO dto = createFunnelDto(funnel);
+            final RevisionDTO revision = createRevisionDTO(revisionManager.getRevision(funnel.getIdentifier()));
+            final AccessPolicyDTO accessPolicy = createAccessPolicyDto(funnel);
+            flow.getFunnels().add(entityFactory.createFunnelEntity(dto, revision, accessPolicy));
         }
 
-        for (final PortDTO inputPort : snippet.getInputPorts()) {
-            final RevisionDTO revision = createRevisionDTO(revisionManager.getRevision(inputPort.getId()));
-            final AccessPolicyDTO accessPolicy = createAccessPolicyDto(group.getInputPort(inputPort.getId()));
+        for (final PortDTO snippetInputPort : snippet.getInputPorts()) {
+            final Port inputPort = group.getInputPort(snippetInputPort.getId());
+
+            // marshal the actual port as the snippet is pruned
+            final PortDTO dto = createPortDto(inputPort);
+            final RevisionDTO revision = createRevisionDTO(revisionManager.getRevision(inputPort.getIdentifier()));
+            final AccessPolicyDTO accessPolicy = createAccessPolicyDto(inputPort);
             final PortStatusDTO status = getComponentStatus(
-                () -> groupStatus.getInputPortStatus().stream().filter(inputPortStatus
-> inputPort.getId().equals(inputPortStatus.getId())).findFirst().orElse(null),
+                () -> groupStatus.getInputPortStatus().stream().filter(inputPortStatus
-> inputPort.getIdentifier().equals(inputPortStatus.getId())).findFirst().orElse(null),
                 inputPortStatus -> createPortStatusDto(inputPortStatus)
             );
-            final List<BulletinDTO> bulletins = createBulletinDtos(bulletinRepository.findBulletinsForSource(inputPort.getId()));
-            flow.getInputPorts().add(entityFactory.createPortEntity(inputPort, revision,
accessPolicy, status, bulletins));
+            final List<BulletinDTO> bulletins = createBulletinDtos(bulletinRepository.findBulletinsForSource(inputPort.getIdentifier()));
+            flow.getInputPorts().add(entityFactory.createPortEntity(dto, revision, accessPolicy,
status, bulletins));
         }
 
-        for (final PortDTO outputPort : snippet.getOutputPorts()) {
-            final RevisionDTO revision = createRevisionDTO(revisionManager.getRevision(outputPort.getId()));
-            final AccessPolicyDTO accessPolicy = createAccessPolicyDto(group.getOutputPort(outputPort.getId()));
+        for (final PortDTO snippetOutputPort : snippet.getOutputPorts()) {
+            final Port outputPort = group.getOutputPort(snippetOutputPort.getId());
+
+            // marshal the actual port as the snippet is pruned
+            final PortDTO dto = createPortDto(outputPort);
+            final RevisionDTO revision = createRevisionDTO(revisionManager.getRevision(outputPort.getIdentifier()));
+            final AccessPolicyDTO accessPolicy = createAccessPolicyDto(outputPort);
             final PortStatusDTO status = getComponentStatus(
-                () -> groupStatus.getOutputPortStatus().stream().filter(outputPortStatus
-> outputPort.getId().equals(outputPortStatus.getId())).findFirst().orElse(null),
+                () -> groupStatus.getOutputPortStatus().stream().filter(outputPortStatus
-> outputPort.getIdentifier().equals(outputPortStatus.getId())).findFirst().orElse(null),
                 outputPortStatus -> createPortStatusDto(outputPortStatus)
             );
-            final List<BulletinDTO> bulletins = createBulletinDtos(bulletinRepository.findBulletinsForSource(outputPort.getId()));
-            flow.getOutputPorts().add(entityFactory.createPortEntity(outputPort, revision,
accessPolicy, status, bulletins));
+            final List<BulletinDTO> bulletins = createBulletinDtos(bulletinRepository.findBulletinsForSource(outputPort.getIdentifier()));
+            flow.getOutputPorts().add(entityFactory.createPortEntity(dto, revision, accessPolicy,
status, bulletins));
         }
 
-        for (final LabelDTO label : snippet.getLabels()) {
-            final RevisionDTO revision = createRevisionDTO(revisionManager.getRevision(label.getId()));
-            final AccessPolicyDTO accessPolicy = createAccessPolicyDto(group.getLabel(label.getId()));
-            flow.getLabels().add(entityFactory.createLabelEntity(label, revision, accessPolicy));
+        for (final LabelDTO snippetLabel : snippet.getLabels()) {
+            final Label label = group.getLabel(snippetLabel.getId());
+
+            // marshal the actual label as the snippet is pruned
+            final LabelDTO dto = createLabelDto(label);
+            final RevisionDTO revision = createRevisionDTO(revisionManager.getRevision(label.getIdentifier()));
+            final AccessPolicyDTO accessPolicy = createAccessPolicyDto(label);
+            flow.getLabels().add(entityFactory.createLabelEntity(dto, revision, accessPolicy));
         }
 
-        for (final ProcessGroupDTO processGroup : snippet.getProcessGroups()) {
-            final RevisionDTO revision = createRevisionDTO(revisionManager.getRevision(processGroup.getId()));
-            final AccessPolicyDTO accessPolicy = createAccessPolicyDto(group.getProcessGroup(processGroup.getId()));
+        for (final ProcessGroupDTO snippetProcessGroup : snippet.getProcessGroups()) {
+            final ProcessGroup processGroup = group.getProcessGroup(snippetProcessGroup.getId());
+
+            // marshal the actual group as the snippet is pruned
+            final ProcessGroupDTO dto = createProcessGroupDto(processGroup);
+            final RevisionDTO revision = createRevisionDTO(revisionManager.getRevision(processGroup.getIdentifier()));
+            final AccessPolicyDTO accessPolicy = createAccessPolicyDto(processGroup);
             final ProcessGroupStatusDTO status = getComponentStatus(
-                () -> groupStatus.getProcessGroupStatus().stream().filter(processGroupStatus
-> processGroup.getId().equals(processGroupStatus.getId())).findFirst().orElse(null),
+                () -> groupStatus.getProcessGroupStatus().stream().filter(processGroupStatus
-> processGroup.getIdentifier().equals(processGroupStatus.getId())).findFirst().orElse(null),
                 processGroupStatus -> createConciseProcessGroupStatusDto(processGroupStatus)
             );
-            final List<BulletinDTO> bulletins = createBulletinDtos(bulletinRepository.findBulletinsForSource(processGroup.getId()));
-            flow.getProcessGroups().add(entityFactory.createProcessGroupEntity(processGroup,
revision, accessPolicy, status, bulletins));
+            final List<BulletinDTO> bulletins = createBulletinDtos(bulletinRepository.findBulletinsForSource(processGroup.getIdentifier()));
+            flow.getProcessGroups().add(entityFactory.createProcessGroupEntity(dto, revision,
accessPolicy, status, bulletins));
         }
 
-        for (final ProcessorDTO processor : snippet.getProcessors()) {
-            final RevisionDTO revision = createRevisionDTO(revisionManager.getRevision(processor.getId()));
-            final AccessPolicyDTO accessPolicy = createAccessPolicyDto(group.getProcessor(processor.getId()));
+        for (final ProcessorDTO snippetProcessor : snippet.getProcessors()) {
+            final ProcessorNode processor = group.getProcessor(snippetProcessor.getId());
+
+            // marshal the actual processor as the snippet is pruned
+            final ProcessorDTO dto = createProcessorDto(processor);
+            final RevisionDTO revision = createRevisionDTO(revisionManager.getRevision(processor.getIdentifier()));
+            final AccessPolicyDTO accessPolicy = createAccessPolicyDto(processor);
             final ProcessorStatusDTO status = getComponentStatus(
-                () -> groupStatus.getProcessorStatus().stream().filter(processorStatus
-> processor.getId().equals(processorStatus.getId())).findFirst().orElse(null),
+                () -> groupStatus.getProcessorStatus().stream().filter(processorStatus
-> processor.getIdentifier().equals(processorStatus.getId())).findFirst().orElse(null),
                 processorStatus -> createProcessorStatusDto(processorStatus)
             );
-            final List<BulletinDTO> bulletins = createBulletinDtos(bulletinRepository.findBulletinsForSource(processor.getId()));
-            flow.getProcessors().add(entityFactory.createProcessorEntity(processor, revision,
accessPolicy, status, bulletins));
+            final List<BulletinDTO> bulletins = createBulletinDtos(bulletinRepository.findBulletinsForSource(processor.getIdentifier()));
+            flow.getProcessors().add(entityFactory.createProcessorEntity(dto, revision, accessPolicy,
status, bulletins));
         }
 
-        for (final RemoteProcessGroupDTO remoteProcessGroup : snippet.getRemoteProcessGroups())
{
-            final RevisionDTO revision = createRevisionDTO(revisionManager.getRevision(remoteProcessGroup.getId()));
-            final AccessPolicyDTO accessPolicy = createAccessPolicyDto(group.getRemoteProcessGroup(remoteProcessGroup.getId()));
+        for (final RemoteProcessGroupDTO snippetRemoteProcessGroup : snippet.getRemoteProcessGroups())
{
+            final RemoteProcessGroup remoteProcessGroup = group.getRemoteProcessGroup(snippetRemoteProcessGroup.getId());
+
+            // marshal the actual rpm as the snippet is pruned
+            final RemoteProcessGroupDTO dto = createRemoteProcessGroupDto(remoteProcessGroup);
+            final RevisionDTO revision = createRevisionDTO(revisionManager.getRevision(remoteProcessGroup.getIdentifier()));
+            final AccessPolicyDTO accessPolicy = createAccessPolicyDto(remoteProcessGroup);
             final RemoteProcessGroupStatusDTO status = getComponentStatus(
-                () -> groupStatus.getRemoteProcessGroupStatus().stream().filter(rpgStatus
-> remoteProcessGroup.getId().equals(rpgStatus.getId())).findFirst().orElse(null),
+                () -> groupStatus.getRemoteProcessGroupStatus().stream().filter(rpgStatus
-> remoteProcessGroup.getIdentifier().equals(rpgStatus.getId())).findFirst().orElse(null),
                 remoteProcessGroupStatus -> createRemoteProcessGroupStatusDto(remoteProcessGroupStatus)
             );
-            final List<BulletinDTO> bulletins = createBulletinDtos(bulletinRepository.findBulletinsForSource(remoteProcessGroup.getId()));
-            flow.getRemoteProcessGroups().add(entityFactory.createRemoteProcessGroupEntity(remoteProcessGroup,
revision, accessPolicy, status, bulletins));
+            final List<BulletinDTO> bulletins = createBulletinDtos(bulletinRepository.findBulletinsForSource(remoteProcessGroup.getIdentifier()));
+            flow.getRemoteProcessGroups().add(entityFactory.createRemoteProcessGroupEntity(dto,
revision, accessPolicy, status, bulletins));
         }
 
         return flow;


Mime
View raw message