Skip to content

Instantly share code, notes, and snippets.

@jfrazee
Created March 7, 2017 14:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jfrazee/efcc64e3dd149716ef3bb711177f1f3a to your computer and use it in GitHub Desktop.
Save jfrazee/efcc64e3dd149716ef3bb711177f1f3a to your computer and use it in GitHub Desktop.
NIFI-3147-suggestions.diff
diff --git a/nifi-nar-bundles/nifi-ccda-bundle/nifi-ccda-nar/pom.xml b/nifi-nar-bundles/nifi-ccda-bundle/nifi-ccda-nar/pom.xml
index 7bb3112b9..41ddb5c05 100644
--- a/nifi-nar-bundles/nifi-ccda-bundle/nifi-ccda-nar/pom.xml
+++ b/nifi-nar-bundles/nifi-ccda-bundle/nifi-ccda-nar/pom.xml
@@ -33,7 +33,6 @@
<dependency>
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-ccda-processors</artifactId>
- <version>1.2.0-SNAPSHOT</version>
</dependency>
</dependencies>
diff --git a/nifi-nar-bundles/nifi-ccda-bundle/nifi-ccda-nar/src/main/resources/META-INF/LICENSE b/nifi-nar-bundles/nifi-ccda-bundle/nifi-ccda-nar/src/main/resources/META-INF/LICENSE
index b344c7e32..f3c8ecef2 100644
--- a/nifi-nar-bundles/nifi-ccda-bundle/nifi-ccda-nar/src/main/resources/META-INF/LICENSE
+++ b/nifi-nar-bundles/nifi-ccda-bundle/nifi-ccda-nar/src/main/resources/META-INF/LICENSE
@@ -207,32 +207,3 @@ The Apache NiFi project contains subcomponents with separate copyright
notices and license terms. Your use of the source code for the these
subcomponents is subject to the terms and conditions of the following
licenses.
-
- The binary distribution of this product bundles 'Antlr 3' which is available
- under a "3-clause BSD" license. For details see http://www.antlr3.org/license.html
-
- Copyright (c) 2010 Terence Parr
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
- Neither the name of the author nor the names of its contributors may be used
- to endorse or promote products derived from this software without specific
- prior written permission.
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/nifi-nar-bundles/nifi-ccda-bundle/nifi-ccda-processors/src/main/java/org/apache/nifi/processors/ccda/ExtractCCDAAttributes.java b/nifi-nar-bundles/nifi-ccda-bundle/nifi-ccda-processors/src/main/java/org/apache/nifi/processors/ccda/ExtractCCDAAttributes.java
index 63a312be6..686d64e22 100644
--- a/nifi-nar-bundles/nifi-ccda-bundle/nifi-ccda-processors/src/main/java/org/apache/nifi/processors/ccda/ExtractCCDAAttributes.java
+++ b/nifi-nar-bundles/nifi-ccda-bundle/nifi-ccda-processors/src/main/java/org/apache/nifi/processors/ccda/ExtractCCDAAttributes.java
@@ -19,6 +19,7 @@ package org.apache.nifi.processors.ccda;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
@@ -96,7 +97,7 @@ public class ExtractCCDAAttributes extends AbstractProcessor {
*/
public static final Relationship REL_SUCCESS = new Relationship.Builder()
.name("success")
- .description("A FlowFile is routed to this relationship if it is properly parsed as CDA and its content stored in FlowFile")
+ .description("A FlowFile is routed to this relationship if it is properly parsed as CDA and its contents extracted as attributes.")
.build();
/**
@@ -104,7 +105,7 @@ public class ExtractCCDAAttributes extends AbstractProcessor {
*/
public static final Relationship REL_FAILURE = new Relationship.Builder()
.name("failure")
- .description("A FlowFile is routed to this relationship if it cannot be parse CDA and store content to FlowFile.")
+ .description("A FlowFile is routed to this relationship if it cannot be parsed as CDA or its contents extracted as attributes.")
.build();
@Override
@@ -119,13 +120,14 @@ public class ExtractCCDAAttributes extends AbstractProcessor {
@Override
protected void init(final ProcessorInitializationContext context) {
-
- relationships = new HashSet<>();
- relationships.add(REL_SUCCESS);
- relationships.add(REL_FAILURE);
-
- properties = new ArrayList<>();
- properties.add(SKIP_VALIDATION);
+ final Set<Relationship> _relationships = new HashSet<>();
+ _relationships.add(REL_SUCCESS);
+ _relationships.add(REL_FAILURE);
+ this.relationships = Collections.unmodifiableSet(_relationships);
+
+ final List<PropertyDescriptor> _properties = new ArrayList<>();
+ _properties.add(SKIP_VALIDATION);
+ this.properties = Collections.unmodifiableList(_properties);
}
@OnScheduled
@@ -183,7 +185,7 @@ public class ExtractCCDAAttributes extends AbstractProcessor {
flowFile = session.putAllAttributes(flowFile, attributes);
stopWatch.stop();
- getLogger().info("Successfully processed {} in {}", new Object[] {flowFile, stopWatch.getDuration(TimeUnit.MILLISECONDS)});
+ getLogger().debug("Successfully processed {} in {}", new Object[] {flowFile, stopWatch.getDuration(TimeUnit.MILLISECONDS)});
if(getLogger().isDebugEnabled()){
for (Entry<String, String> entry : attributes.entrySet()) {
getLogger().debug("Attribute: {}={}", new Object[] {entry.getKey(), entry.getValue()});
@@ -200,9 +202,10 @@ public class ExtractCCDAAttributes extends AbstractProcessor {
* For List, the processList method is called to iterate and process
* For an Object this method is called recursively
* While adding to the attributes the key is prefixed by parent
- * @param parent Parent key for this element, used as a prefix for attribute key
- * @param element Element to be processed
- * @return Map of processed data, value can contain String or Map of Strings
+ * @param parent parent key for this element, used as a prefix for attribute key
+ * @param element element to be processed
+ * @param attributes map of attributes to populate
+ * @return map of processed data, value can contain String or Map of Strings
*/
protected Map<String, Object> processElement(String parent, Object element, Map<String, String> attributes) {
final StopWatch stopWatch = new StopWatch(true);
@@ -236,6 +239,7 @@ public class ExtractCCDAAttributes extends AbstractProcessor {
* @param prefix parent key as prefix
* @param key element key
* @param value element value
+ * @param attributes map of attributes to populate
*/
protected Map<String, String> addElement(Map<String, Object> map, String prefix, String key, Object value, Map<String, String> attributes) {
// if the value is a String, add it to final attribute list
@@ -259,6 +263,7 @@ public class ExtractCCDAAttributes extends AbstractProcessor {
* Iterate through the list and calls processElement to process each element
* @param key key used while calling processElement
* @param value value is the individual Object being processed
+ * @param attributes map of attributes to populate
* @return list of elements
*/
protected List<Object> processList(String key, List value, Map<String, String> attributes) {
diff --git a/nifi-nar-bundles/nifi-ccda-bundle/nifi-ccda-processors/src/main/resources/docs/org.apache.nifi.processors.ccda.ExtractCCDAAttributes/additionalDetails.html b/nifi-nar-bundles/nifi-ccda-bundle/nifi-ccda-processors/src/main/resources/docs/org.apache.nifi.processors.ccda.ExtractCCDAAttributes/additionalDetails.html
index 830c09d3b..999078ab8 100644
--- a/nifi-nar-bundles/nifi-ccda-bundle/nifi-ccda-processors/src/main/resources/docs/org.apache.nifi.processors.ccda.ExtractCCDAAttributes/additionalDetails.html
+++ b/nifi-nar-bundles/nifi-ccda-bundle/nifi-ccda-processors/src/main/resources/docs/org.apache.nifi.processors.ccda.ExtractCCDAAttributes/additionalDetails.html
@@ -57,7 +57,7 @@
</p>
<h3>References</h3>
<p>
- These mappings are defined as per the implementation guide -<a href="http://www.hl7.org/documentcenter/public/standards/dstu/CDAR2_IG_IHE_CONSOL_DSTU_R1dot1_2012JUL.zip">HL7 Implementation Guide for CDA® Release 2</a></br>
+ These mappings are defined as per the implementation guide&mdash;<a href="http://www.hl7.org/documentcenter/public/standards/dstu/CDAR2_IG_IHE_CONSOL_DSTU_R1dot1_2012JUL.zip">HL7 Implementation Guide for CDA&reg; Release 2</a></br>
</p>
</body>
</html>
diff --git a/nifi-nar-bundles/nifi-ccda-bundle/pom.xml b/nifi-nar-bundles/nifi-ccda-bundle/pom.xml
index ecd1e8ca9..d5dc2ca31 100644
--- a/nifi-nar-bundles/nifi-ccda-bundle/pom.xml
+++ b/nifi-nar-bundles/nifi-ccda-bundle/pom.xml
@@ -30,4 +30,14 @@
<module>nifi-ccda-nar</module>
</modules>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.nifi</groupId>
+ <artifactId>nifi-ccda-processors</artifactId>
+ <version>1.2.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
</project>
@jfrazee
Copy link
Author

jfrazee commented Mar 7, 2017

Apply with git apply -3 --ignore-whitespace NIFI-3147-suggestions.diff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment