Move this method into "ResourceTask". 07/65207/5
authorSerhii Siabruk <Serhii_Siabruk@jabil.com>
Thu, 6 Sep 2018 16:07:00 +0000 (19:07 +0300)
committerSerhii Siabruk <Serhii_Siabruk@jabil.com>
Mon, 10 Sep 2018 10:38:13 +0000 (13:38 +0300)
Issue-ID: SDNC-1
Change-Id: Ia9b6c49a5c2e9790445b6fa07643f32a4661b5dd
Signed-off-by: Serhii Siabruk <serhii_siabruk@jabil.com>
pomba/network-discovery/src/main/java/org/onap/sdnc/apps/pomba/networkdiscovery/service/SpringServiceImpl.java

index b8468da..8d0de03 100644 (file)
@@ -132,36 +132,6 @@ public class SpringServiceImpl implements SpringService {
         this.executor.shutdown();
     }
 
-    private List<Attribute> toAttributeList(String xml, ONAPLogAdapter adapter) throws SAXException, IOException {
-        Logger log = adapter.unwrap();
-        Document doc = this.parser.parse(new InputSource(new StringReader(xml)));
-        NodeList children = doc.getDocumentElement().getChildNodes();
-        List<Attribute> result = new ArrayList<>();
-        for (int i = 0; i < children.getLength(); i++) {
-            Node child = children.item(i);
-            if (child.getNodeType() == Node.ELEMENT_NODE) {
-
-                // remove white space before conversion
-                String attributeName = ((Element) child).getTagName().replaceAll("\\s", "");
-
-                // If the incoming attribute name is not listed in the
-                // attributeNameMapping, then this attribute will be removed.
-                String newName = enricherAttributeNameMapping.get(attributeName);
-                if (newName != null) {
-                    Attribute attr = new Attribute();
-                    attr.setName(newName);
-                    attr.setValue(((Element) child).getTextContent());
-                    attr.setDataQuality(DataQuality.ok());
-                    result.add(attr);
-                } else {
-                    log.debug("[" + ((Element) child).getTagName()
-                                    + "] was removed due to not listed in enricherAttributeNameMapping.");
-                }
-            }
-        }
-        return result;
-    }
-
     private void sendNotification(String url, String authorization, Object notification, ONAPLogAdapter adapter) {
 
         Invocation.Builder request = this.callbackClient.target(url).request().accept(MediaType.TEXT_PLAIN_TYPE);
@@ -296,6 +266,37 @@ public class SpringServiceImpl implements SpringService {
             // call client back with resource details
             sendNotification(this.notificationURL, this.notificationAuthorization, notification, adapter);
         }
+
+        private List<Attribute> toAttributeList(String xml, ONAPLogAdapter adapter) throws SAXException, IOException {
+            Logger log = adapter.unwrap();
+            Document doc = parser.parse(new InputSource(new StringReader(xml)));
+            NodeList children = doc.getDocumentElement().getChildNodes();
+            List<Attribute> result = new ArrayList<>();
+            for (int i = 0; i < children.getLength(); i++) {
+                Node child = children.item(i);
+                if (child.getNodeType() == Node.ELEMENT_NODE) {
+
+                    // remove white space before conversion
+                    String attributeName = ((Element) child).getTagName().replaceAll("\\s", "");
+
+                    // If the incoming attribute name is not listed in the
+                    // attributeNameMapping, then this attribute will be removed.
+                    String newName = enricherAttributeNameMapping.get(attributeName);
+                    if (newName != null) {
+                        Attribute attr = new Attribute();
+                        attr.setName(newName);
+                        attr.setValue(((Element) child).getTextContent());
+                        attr.setDataQuality(DataQuality.ok());
+                        result.add(attr);
+                    } else {
+                        log.debug("[" + ((Element) child).getTagName()
+                                + "] was removed due to not listed in enricherAttributeNameMapping.");
+                    }
+                }
+            }
+            return result;
+        }
+
     }
 
     private static class RequestBuilderWrapper implements RequestBuilder<RequestBuilderWrapper> {