summaryrefslogtreecommitdiffstats
path: root/sparkybe-onap-service/src/main/java/org
diff options
context:
space:
mode:
authorPawel <pawel.kasperkiewicz@nokia.com>2018-04-20 03:06:44 -0400
committerJames Forsyth <jf2512@att.com>2018-05-23 20:24:34 +0000
commit182ca15203751a5a72a5470859ef87586fbab768 (patch)
treefa51f2bba7e83cb7683367ec5ec4154e6414958c /sparkybe-onap-service/src/main/java/org
parent6bbcdab2b14a179524db0efb34fb2f90d88b266e (diff)
fixes in CrossEntityReferenceLookup.java
Change-Id: I1ae303cb3baeed4a2fadf41d70a6cdc402df298f Issue-ID: AAI-1081 Signed-off-by: Pawel <pawel.kasperkiewicz@nokia.com>
Diffstat (limited to 'sparkybe-onap-service/src/main/java/org')
-rw-r--r--sparkybe-onap-service/src/main/java/org/onap/aai/sparky/config/oxm/CrossEntityReferenceLookup.java23
1 files changed, 13 insertions, 10 deletions
diff --git a/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/config/oxm/CrossEntityReferenceLookup.java b/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/config/oxm/CrossEntityReferenceLookup.java
index 837503a..7553bde 100644
--- a/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/config/oxm/CrossEntityReferenceLookup.java
+++ b/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/config/oxm/CrossEntityReferenceLookup.java
@@ -33,13 +33,16 @@ import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext;
public class CrossEntityReferenceLookup implements OxmModelProcessor {
+ private static final String ENTITY_NAME = "entityName";
+ private static final String CROSS_ENTITY_REFERENCE = "crossEntityReference";
private Map<String, HashMap<String, String>> crossReferenceEntityOxmModel;
private Map<String, CrossEntityReferenceDescriptor> crossReferenceEntityDescriptors;
+
public CrossEntityReferenceLookup() {
- crossReferenceEntityOxmModel = new LinkedHashMap<String, HashMap<String, String>>();
- crossReferenceEntityDescriptors = new HashMap<String, CrossEntityReferenceDescriptor>();
+ crossReferenceEntityOxmModel = new LinkedHashMap<>();
+ crossReferenceEntityDescriptors = new HashMap<>();
}
@Override
@@ -53,7 +56,7 @@ public class CrossEntityReferenceLookup implements OxmModelProcessor {
DynamicType entity = jaxbContext.getDynamicType(desc.getAlias());
- LinkedHashMap<String, String> oxmProperties = new LinkedHashMap<String, String>();
+ LinkedHashMap<String, String> oxmProperties = new LinkedHashMap<>();
// Not all fields have key attributes
if (desc.getPrimaryKeyFields() != null) {
@@ -64,19 +67,19 @@ public class CrossEntityReferenceLookup implements OxmModelProcessor {
String entityName = desc.getDefaultRootElement();
// add entityName
- oxmProperties.put("entityName", entityName);
+ oxmProperties.put(ENTITY_NAME, entityName);
Map<String, String> properties = entity.getDescriptor().getProperties();
if (properties != null) {
for (Map.Entry<String, String> entry : properties.entrySet()) {
- if (entry.getKey().equalsIgnoreCase("crossEntityReference")) {
- oxmProperties.put("crossEntityReference", entry.getValue());
+ if (CROSS_ENTITY_REFERENCE.equalsIgnoreCase(entry.getKey())) {
+ oxmProperties.put(CROSS_ENTITY_REFERENCE, entry.getValue());
}
}
}
- if (oxmProperties.containsKey("crossEntityReference")) {
+ if (oxmProperties.containsKey(CROSS_ENTITY_REFERENCE)) {
crossReferenceEntityOxmModel.put(entityName, oxmProperties);
}
@@ -86,12 +89,12 @@ public class CrossEntityReferenceLookup implements OxmModelProcessor {
.entrySet()) {
HashMap<String, String> attribute = crossRefModel.getValue();
CrossEntityReferenceDescriptor entity = new CrossEntityReferenceDescriptor();
- entity.setEntityName(attribute.get("entityName"));
+ entity.setEntityName(attribute.get(ENTITY_NAME));
entity.setPrimaryKeyAttributeNames(
Arrays.asList(attribute.get("primaryKeyAttributeNames").replace(" ", "").split(",")));
List<String> crossEntityRefTokens =
- Arrays.asList(attribute.get("crossEntityReference").split(","));
+ Arrays.asList(attribute.get(CROSS_ENTITY_REFERENCE).split(","));
if (crossEntityRefTokens.size() >= 2) {
CrossEntityReference entityRef = new CrossEntityReference();
@@ -103,7 +106,7 @@ public class CrossEntityReferenceLookup implements OxmModelProcessor {
entity.setCrossEntityReference(entityRef);
}
- crossReferenceEntityDescriptors.put(attribute.get("entityName"), entity);
+ crossReferenceEntityDescriptors.put(attribute.get(ENTITY_NAME), entity);
}
}