aboutsummaryrefslogtreecommitdiffstats
path: root/aai-service
diff options
context:
space:
mode:
authorRich Tabedzki <richard.tabedzki@att.com>2018-04-18 09:47:29 -0400
committerRich Tabedzki <richard.tabedzki@att.com>2018-04-18 09:55:00 -0400
commitef14b9caf7a0b04a017c41b79616f2cf1a15355c (patch)
treecfa43735030c74eba5b0c341a6eb03a55d992127 /aai-service
parentcca8e17ff1487366072aac8720058fe1465d0ea3 (diff)
Resolved issues associated with AAI Model
Changes made: * Add support for primary identifier of type int in XSD generated model Change-Id: I9c7afe869d91b4149f5dd238ca86f32b2efb52c3 Issue-ID: CCSDK-246 Signed-off-by: Rich Tabedzki <richard.tabedzki@att.com>
Diffstat (limited to 'aai-service')
-rwxr-xr-xaai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarations.java175
-rwxr-xr-xaai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/query/Result.java75
2 files changed, 145 insertions, 105 deletions
diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarations.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarations.java
index 1df3cce4..7f40c149 100755
--- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarations.java
+++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarations.java
@@ -1080,7 +1080,7 @@ public abstract class AAIDeclarations implements AAIClient {
Method setter = null;
try {
setter = resourceClass.getMethod("set"+StringUtils.capitalize(value), type);
- if(type.getName().startsWith("java.lang") || "boolean".equals(type.getName()) || "long".equals(type.getName())) {
+ if(type.getName().startsWith("java.lang") || "boolean".equals(type.getName()) || "long".equals(type.getName()) || "int".equals(type.getName())) {
try {
setter.setAccessible(true);
Object arglist[] = new Object[1];
@@ -1091,6 +1091,8 @@ public abstract class AAIDeclarations implements AAIClient {
// getLogger().debug(String.format("Processing %s with parameter %s", types[0].getName(), value));
if("boolean".equals(type.getName())) {
arglist[0] = valueOf(Boolean.class, params.get(id));
+ } else if("int".equals(type.getName())) {
+ arglist[0] = valueOf(Integer.class, params.get(id));
} else if("long".equals(type.getName())) {
arglist[0] = valueOf(Long.class, params.get(id));
} else {
@@ -1247,20 +1249,23 @@ public abstract class AAIDeclarations implements AAIClient {
Relationship relationship = new Relationship();
relationships.add(relationship);
relationship.setRelatedTo(relatedTo);
+ getLogger().debug("About to process related link of {}", relatedLink);
if(relatedLink != null) {
+ if(relatedLink.contains("v$"))
+ relatedLink = relatedLink.replace("v$", "v13");
relationship.setRelatedLink(relatedLink);
} else {
Map<String, String> relParams = new HashMap<>();
- while(true) {
- String searchRelationshipKey = "relationship-list.relationship[" + i + "].relationship-data[" + j + "].relationship-key";
- String searchRelationshipValue = "relationship-list.relationship[" + i + "].relationship-data[" + j + "].relationship-value";
- if(!params.containsKey(searchRelationshipKey))
- break;
+ while(true) {
+ String searchRelationshipKey = "relationship-list.relationship[" + i + "].relationship-data[" + j + "].relationship-key";
+ String searchRelationshipValue = "relationship-list.relationship[" + i + "].relationship-data[" + j + "].relationship-value";
+ if(!params.containsKey(searchRelationshipKey))
+ break;
- relParams.put(params.get(searchRelationshipKey), params.get(searchRelationshipValue));
- j++;
- }
+ relParams.put(params.get(searchRelationshipKey), params.get(searchRelationshipValue));
+ j++;
+ }
AAIRequest rlRequest = AAIRequest.createRequest(relatedTo, relParams);
for(Map.Entry<String,String> entry : relParams.entrySet()) {
rlRequest.addRequestProperty(entry.getKey(), entry.getValue());
@@ -1268,26 +1273,26 @@ public abstract class AAIDeclarations implements AAIClient {
String path = rlRequest.updatePathDataValues(null);
relationship.setRelatedLink(path);
}
- {
- int k = 0;
- // process related to properties
- Map<String, String> relParams = new HashMap<String, String>();
-
- while(true) {
- String searchRelatedToKey = "relationship-list.relationship[" + i + "].related-to-property[" + k + "].property-key";
- String searchRelatedToValue = "relationship-list.relationship[" + i + "].related-to-property[" + k + "].property-value";
- if(!params.containsKey(searchRelatedToKey))
- break;
-
- RelatedToProperty relDatum = new RelatedToProperty();
- relDatum.setPropertyKey(params.get(searchRelatedToKey));
- relDatum.setPropertyValue(params.get(searchRelatedToValue));
- relationship.getRelatedToProperty().add(relDatum);
-
- relParams.put(params.get(searchRelatedToKey), params.get(searchRelatedToValue));
- k++;
- }
- }
+ {
+ int k = 0;
+ // process related to properties
+ Map<String, String> relParams = new HashMap<String, String>();
+
+ while(true) {
+ String searchRelatedToKey = "relationship-list.relationship[" + i + "].related-to-property[" + k + "].property-key";
+ String searchRelatedToValue = "relationship-list.relationship[" + i + "].related-to-property[" + k + "].property-value";
+ if(!params.containsKey(searchRelatedToKey))
+ break;
+
+ RelatedToProperty relDatum = new RelatedToProperty();
+ relDatum.setPropertyKey(params.get(searchRelatedToKey));
+ relDatum.setPropertyValue(params.get(searchRelatedToValue));
+ relationship.getRelatedToProperty().add(relDatum);
+
+ relParams.put(params.get(searchRelatedToKey), params.get(searchRelatedToValue));
+ k++;
+ }
+ }
i++;
}
}
@@ -1531,61 +1536,63 @@ public abstract class AAIDeclarations implements AAIClient {
relatedLink = params.get(relatedLinkKey);
}
- Relationship relationship = new Relationship();
- relationships.add(relationship);
- relationship.setRelatedTo(relatedTo);
- if (relatedLink != null) {
- relationship.setRelatedLink(relatedLink);
- } else {
- Map<String, String> relParams = new HashMap<>();
- int j = 0;
-
- while (true) {
- String searchRelationshipKey = "relationship-list.relationship[" + i + "].relationship-data["
- + j + "].relationship-key";
- String searchRelationshipValue = "relationship-list.relationship[" + i + "].relationship-data["
- + j + "].relationship-value";
- if (!params.containsKey(searchRelationshipKey))
- break;
-
- RelationshipData relDatum = new RelationshipData();
- relDatum.setRelationshipKey(params.get(searchRelationshipKey));
- relDatum.setRelationshipValue(params.get(searchRelationshipValue));
- relationship.getRelationshipData().add(relDatum);
-
- relParams.put(params.get(searchRelationshipKey), params.get(searchRelationshipValue));
- j++;
- }
- AAIRequest rlRequest = AAIRequest.createRequest(relatedTo, relParams);
- for (Map.Entry<String, String> entry : relParams.entrySet()) {
- rlRequest.addRequestProperty(entry.getKey(), entry.getValue());
- }
- String path = rlRequest.updatePathDataValues(null);
- relationship.setRelatedLink(path);
- }
- {
- int k = 0;
- // process related to properties
- Map<String, String> relParams = new HashMap<String, String>();
-
- while(true) {
- String searchRelatedToKey = "relationship-list.relationship[" + i + "].related-to-property[" + k + "].property-key";
- String searchRelatedToValue = "relationship-list.relationship[" + i + "].related-to-property[" + k + "].property-value";
- if(!params.containsKey(searchRelatedToKey))
- break;
-
- RelatedToProperty relDatum = new RelatedToProperty();
- relDatum.setPropertyKey(params.get(searchRelatedToKey));
- relDatum.setPropertyValue(params.get(searchRelatedToValue));
- relationship.getRelatedToProperty().add(relDatum);
-
- relParams.put(params.get(searchRelatedToKey), params.get(searchRelatedToValue));
- k++;
- }
- }
-
- i++;
- }
+ Relationship relationship = new Relationship();
+ relationships.add(relationship);
+ relationship.setRelatedTo(relatedTo);
+ if (relatedLink != null) {
+ if(relatedLink.contains("v$"))
+ relatedLink = relatedLink.replace("v$", "v13");
+ relationship.setRelatedLink(relatedLink);
+ } else {
+ Map<String, String> relParams = new HashMap<>();
+ int j = 0;
+
+ while (true) {
+ String searchRelationshipKey = "relationship-list.relationship[" + i + "].relationship-data["
+ + j + "].relationship-key";
+ String searchRelationshipValue = "relationship-list.relationship[" + i + "].relationship-data["
+ + j + "].relationship-value";
+ if (!params.containsKey(searchRelationshipKey))
+ break;
+
+ RelationshipData relDatum = new RelationshipData();
+ relDatum.setRelationshipKey(params.get(searchRelationshipKey));
+ relDatum.setRelationshipValue(params.get(searchRelationshipValue));
+ relationship.getRelationshipData().add(relDatum);
+
+ relParams.put(params.get(searchRelationshipKey), params.get(searchRelationshipValue));
+ j++;
+ }
+ AAIRequest rlRequest = AAIRequest.createRequest(relatedTo, relParams);
+ for (Map.Entry<String, String> entry : relParams.entrySet()) {
+ rlRequest.addRequestProperty(entry.getKey(), entry.getValue());
+ }
+ String path = rlRequest.updatePathDataValues(null);
+ relationship.setRelatedLink(path);
+ }
+ {
+ int k = 0;
+ // process related to properties
+ Map<String, String> relParams = new HashMap<String, String>();
+
+ while(true) {
+ String searchRelatedToKey = "relationship-list.relationship[" + i + "].related-to-property[" + k + "].property-key";
+ String searchRelatedToValue = "relationship-list.relationship[" + i + "].related-to-property[" + k + "].property-value";
+ if(!params.containsKey(searchRelatedToKey))
+ break;
+
+ RelatedToProperty relDatum = new RelatedToProperty();
+ relDatum.setPropertyKey(params.get(searchRelatedToKey));
+ relDatum.setPropertyValue(params.get(searchRelatedToValue));
+ relationship.getRelatedToProperty().add(relDatum);
+
+ relParams.put(params.get(searchRelatedToKey), params.get(searchRelatedToValue));
+ k++;
+ }
+ }
+
+ i++;
+ }
}
return QueryStatus.SUCCESS;
diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/query/Result.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/query/Result.java
index 302e0313..37d4b79b 100755
--- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/query/Result.java
+++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/query/Result.java
@@ -51,9 +51,12 @@ import com.fasterxml.jackson.annotation.JsonProperty;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
+ "resource-type",
+ "resource-link",
+ "url",
"cloud-region",
"complex",
- "configuration",
+ "configuration",
"generic-vnf",
"l3-interface-ipv4-address-list",
"l3-interface-ipv6-address-list",
@@ -68,12 +71,18 @@ import com.fasterxml.jackson.annotation.JsonProperty;
@XmlRootElement(name = "result")
public class Result {
+ @XmlElement(name = "resource-type")
+ private String resourceType;
+ @XmlElement(name = "resource-link")
+ private String resourceLink;
+ @XmlElement(name = "url")
+ private String url;
@XmlElement(name = "cloud-region")
private CloudRegion cloudRegion;
@XmlElement(name = "complex")
private Complex complex;
- @XmlElement(name = "configuration")
- private Configuration configuration;
+ @XmlElement(name = "configuration")
+ private Configuration configuration;
@XmlElement(name = "generic-vnf")
private GenericVnf genericVnf;
@XmlElement(name = "l3-interface-ipv4-address-list")
@@ -84,8 +93,8 @@ public class Result {
private L3Network l3Network;
@XmlElement(name = "l-interface")
private LInterface lInterface;
-// @XmlElement(name = "owning-entity")
-// private OwningEntity owningEntity;
+// @XmlElement(name = "owning-entity")
+// private OwningEntity owningEntity;
@XmlElement(name = "pserver")
private Pserver pserver;
@XmlElement(name = "service-instance")
@@ -117,15 +126,15 @@ public class Result {
this.complex = complex;
}
- @XmlElement(name = "configuration")
- public Configuration getConfiguration() {
- return configuration;
- }
+ @XmlElement(name = "configuration")
+ public Configuration getConfiguration() {
+ return configuration;
+ }
- @XmlElement(name = "configuration")
- public void setConfiguration(Configuration configuration) {
- this.configuration = configuration;
- }
+ @XmlElement(name = "configuration")
+ public void setConfiguration(Configuration configuration) {
+ this.configuration = configuration;
+ }
@XmlElement(name = "generic-vnf")
public GenericVnf getGenericVnf ()
@@ -178,15 +187,15 @@ public class Result {
this.lInterface = linterface;
}
-// @XmlElement(name = "owning-entity")
-// public OwningEntity getOwningEntity() {
-// return owningEntity;
-// }
+// @XmlElement(name = "owning-entity")
+// public OwningEntity getOwningEntity() {
+// return owningEntity;
+// }
-// @XmlElement(name = "owning-entity")
-// public void setOwningEntity(OwningEntity owningEntity) {
-// this.owningEntity = owningEntity;
-// }
+// @XmlElement(name = "owning-entity")
+// public void setOwningEntity(OwningEntity owningEntity) {
+// this.owningEntity = owningEntity;
+// }
@XmlElement(name = "pserver")
public Pserver getPserver() {
@@ -242,4 +251,28 @@ public class Result {
public void setAdditionalProperty(String name, Object value) {
this.additionalProperties.put(name, value);
}
+ @XmlElement(name = "resource-type")
+ public String getResourceType() {
+ return resourceType;
+ }
+ @XmlElement(name = "resource-type")
+ public void setResourceType(String resourceType) {
+ this.resourceType = resourceType;
+ }
+ @XmlElement(name = "resource-link")
+ public String getResourceLink() {
+ return resourceLink;
+ }
+ @XmlElement(name = "resource-link")
+ public void setResourceLink(String resourceLink) {
+ this.resourceLink = resourceLink;
+ }
+ @XmlElement(name = "url")
+ public String getUrl() {
+ return url;
+ }
+ @XmlElement(name = "url")
+ public void setUrl(String url) {
+ this.url = url;
+ }
}