Updating AAI service adaptor to use version 21 (v21) of the schema model.
[ccsdk/sli/adaptors.git] / aai-service / provider / src / main / java / org / onap / ccsdk / sli / adaptors / aai / GenericRequest.java
index 4582484..604dd0e 100755 (executable)
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+ /**
+ * @author Rich Tabedzki
+ *
+ */
 package org.onap.ccsdk.sli.adaptors.aai;
 
 import java.io.UnsupportedEncodingException;
@@ -37,8 +40,8 @@ import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
 
 import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum;
-import org.onap.aai.inventory.v14.L3Network;
-import org.onap.aai.inventory.v14.L3Networks;
+import org.onap.aai.inventory.v21.L3Network;
+import org.onap.aai.inventory.v21.L3Networks;
 
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -186,9 +189,13 @@ public class GenericRequest extends AAIRequest {
 
                             queryParams.put(splitKey[1], encodeQuery(value));
                         } else {
-                            String token = String.format("%s/{%s}", splitKey[0], splitKey[1]);
-                            String encoded_vnf = encodeQuery(value);
-                            request_url = request_url.replace(token, String.format("%s/%s", splitKey[0], encoded_vnf));
+                               String encoded_vnf = encodeQuery(value);
+                               if(!resourceName.equals(splitKey[0]) && resourceName.contains(splitKey[0])) {
+                                       queryParams.put(splitKey[1], encoded_vnf);
+                               } else {
+                                       String token = String.format("%s/{%s}", splitKey[0], splitKey[1]);
+                                       request_url = request_url.replace(token, String.format("%s/%s", splitKey[0], encoded_vnf));
+                               }
                         }
                     }