Repository: incubator-nifi Updated Branches: refs/heads/NIFI-250 de21b6090 -> ec2149362
NIFI-250: Restore Comments and AnnotationData for Reporting Tasks on NCM; these were inadvertently skipped Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/ec214936 Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/ec214936 Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/ec214936 Branch: refs/heads/NIFI-250 Commit: ec21493622a9cc9ce0857c0b37d48a08f120a770 Parents: de21b60 Author: Mark Payne <[email protected]> Authored: Tue Mar 24 13:07:05 2015 -0400 Committer: Mark Payne <[email protected]> Committed: Tue Mar 24 13:07:05 2015 -0400 ---------------------------------------------------------------------- .../nifi/cluster/manager/impl/WebClusterManager.java | 10 ++++++++++ .../src/main/java/org/apache/nifi/util/DomUtils.java | 10 ++++++++++ 2 files changed, 20 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/ec214936/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/manager/impl/WebClusterManager.java ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/manager/impl/WebClusterManager.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/manager/impl/WebClusterManager.java index 4046995..0b7afda 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/manager/impl/WebClusterManager.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/manager/impl/WebClusterManager.java @@ -973,6 +973,11 @@ public class WebClusterManager implements HttpClusterManager, ProtocolHandler, C schedulingStrategy, taskSchedulingPeriod, componentLog, this); reportingTask.initialize(config); + final String annotationData = DomUtils.getChildText(taskElement, "annotationData"); + if ( annotationData != null ) { + reportingTaskNode.setAnnotationData(annotationData.trim()); + } + final Map<PropertyDescriptor, String> resolvedProps; try (final NarCloseable narCloseable = NarCloseable.withNarLoader()) { resolvedProps = new HashMap<>(); @@ -985,6 +990,11 @@ public class WebClusterManager implements HttpClusterManager, ProtocolHandler, C for (final Map.Entry<PropertyDescriptor, String> entry : resolvedProps.entrySet()) { reportingTaskNode.setProperty(entry.getKey().getName(), entry.getValue()); } + + final String comments = DomUtils.getChildText(taskElement, "comment"); + if ( comments != null ) { + reportingTaskNode.setComments(comments); + } reportingTaskNode.setScheduledState(scheduledState); if ( ScheduledState.RUNNING.equals(scheduledState) ) { http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/ec214936/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/util/DomUtils.java ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/util/DomUtils.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/util/DomUtils.java index c8b6573..da4f04d 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/util/DomUtils.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/util/DomUtils.java @@ -25,6 +25,16 @@ import org.w3c.dom.NodeList; public class DomUtils { + public static String getChildText(final Element element, final String tagName) { + final Element childElement = getChild(element, tagName); + if ( childElement == null ) { + return null; + } + + final String text = childElement.getTextContent(); + return (text == null) ? null : text.trim(); + } + public static Element getChild(final Element element, final String tagName) { final List<Element> children = getChildElementsByTagName(element, tagName); if (children.isEmpty()) {
