summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerhii Siabruk <Serhii_Siabruk@jabil.com>2018-09-06 19:07:00 +0300
committerSerhii Siabruk <Serhii_Siabruk@jabil.com>2018-09-10 13:38:13 +0300
commitaed7a3708a987dc7132229ecac1ee7f42b49ee16 (patch)
treecf4224e840870bad7f4e72a85dc3762b62e6450d
parent7cdaaadc8bd2cb6a5b59e55984f5049290151a5b (diff)
Move this method into "ResourceTask".
Issue-ID: SDNC-1 Change-Id: Ia9b6c49a5c2e9790445b6fa07643f32a4661b5dd Signed-off-by: Serhii Siabruk <serhii_siabruk@jabil.com>
-rw-r--r--pomba/network-discovery/src/main/java/org/onap/sdnc/apps/pomba/networkdiscovery/service/SpringServiceImpl.java61
1 files changed, 31 insertions, 30 deletions
diff --git a/pomba/network-discovery/src/main/java/org/onap/sdnc/apps/pomba/networkdiscovery/service/SpringServiceImpl.java b/pomba/network-discovery/src/main/java/org/onap/sdnc/apps/pomba/networkdiscovery/service/SpringServiceImpl.java
index b8468da..8d0de03 100644
--- a/pomba/network-discovery/src/main/java/org/onap/sdnc/apps/pomba/networkdiscovery/service/SpringServiceImpl.java
+++ b/pomba/network-discovery/src/main/java/org/onap/sdnc/apps/pomba/networkdiscovery/service/SpringServiceImpl.java
@@ -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> {