From 2835ba09fb4d6c14979b5ed76aaa4711c7d79a2f Mon Sep 17 00:00:00 2001 From: Mark Payne Date: Wed, 29 Jun 2016 15:12:50 -0400 Subject: [PATCH 1/2] 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 --- .../nifi/web/api/dto/ProcessorConfigDTO.java | 4 +++- .../apache/nifi/controller/TemplateUtils.java | 18 +++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) 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 ec5df96d3613..a9006c9bf68c 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 void setCustomUiUrl(String customUiUrl) { * @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 getAutoTerminatedRelationships() { return autoTerminatedRelationships; 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 b7a55ad44b32..58c701b447f4 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.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; @@ -179,11 +180,25 @@ private static void scrubProcessors(final Set processors) { } 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 +215,7 @@ private static void scrubControllerServices(final Set cont } } + serviceDTO.setDescriptors(null); serviceDTO.setCustomUiUrl(null); serviceDTO.setValidationErrors(null); } From 232abdd9f30baf1068a137aa4ea4f5ff321b1ea0 Mon Sep 17 00:00:00 2001 From: Mark Payne Date: Thu, 30 Jun 2016 11:02:31 -0400 Subject: [PATCH 2/2] NIFI-2150: Removed additional unused fields from templates --- .../org/apache/nifi/controller/Template.java | 2 +- .../apache/nifi/controller/TemplateUtils.java | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) 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 b9fd0cbf195f..a3a2cf5a1f75 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 @@ -131,7 +131,7 @@ private Set getAuthorizableComponents(final ProcessGroup processGr for (final ProcessGroupDTO groupDto : snippet.getProcessGroups()) { final ProcessGroup group = processGroup.getProcessGroup(groupDto.getId()); if (group != null) { - authComponents.addAll(getAuthorizableComponents(processGroup)); + authComponents.addAll(getAuthorizableComponents(group)); } } 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 58c701b447f4..a5c467963782 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 @@ -148,6 +148,15 @@ private static void scrubSnippet(final FlowSnippetDTO snippet) { private static void scrubProcessGroups(final Set 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()); } } @@ -264,6 +273,15 @@ private static void scrubRemoteProcessGroups(final Set re 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) { @@ -299,6 +317,10 @@ private static void scrubRemotePorts(final Set remote remotePortDTO.setExists(null); remotePortDTO.setTargetRunning(null); + remotePortDTO.setConnected(null); + remotePortDTO.setExists(null); + remotePortDTO.setTargetRunning(null); + remotePortDTO.setTransmitting(null); } } }