Update the aai-common with the latest code
[aai/aai-common.git] / aai-core / src / main / java / org / openecomp / aai / parsers / uri / URIToObject.java
index 3242adb..cf011bf 100644 (file)
@@ -5,16 +5,16 @@
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-     http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
*      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  * ============LICENSE_END=========================================================
  */
 
@@ -32,6 +32,7 @@ import org.openecomp.aai.introspection.Introspector;
 import org.openecomp.aai.introspection.Loader;
 import org.openecomp.aai.introspection.Version;
 import org.openecomp.aai.schema.enums.ObjectMetadata;
+import org.openecomp.aai.serialization.db.EdgeType;
 
 /**
  * Given a URI this class returns an object, or series of nested objects
@@ -90,61 +91,6 @@ public class URIToObject implements Parsable {
 
        }
        
-       /**
-        * @{inheritDoc}
-        */
-       @Override
-       public void processObject(Introspector obj, MultivaluedMap<String, String> uriKeys) {
-               
-               if (this.entityName == null) {
-                       this.topEntityName = obj.getDbName();
-                       this.topEntity = obj;
-               }
-               this.entityName = obj.getDbName();
-               this.entity = obj;
-               this.parentList = (List<Object>)this.previous.getValue(obj.getName());
-               this.parentList.add(entity.getUnderlyingObject());
-               
-               for (String key : uriKeys.keySet()) {
-                       entity.setValue(key, uriKeys.getFirst(key));
-               }
-               try {
-                       if (relatedObjects.containsKey(entity.getObjectId())) {
-                               Introspector relatedObject = relatedObjects.get(entity.getObjectId());
-                               String nameProp = relatedObject.getMetadata(ObjectMetadata.NAME_PROPS);
-                               if (nameProp == null) {
-                                       nameProp = "";
-                               }
-                               if (nameProp != null && !nameProp.equals("")) {
-                                       String[] nameProps = nameProp.split(",");
-                                       for (String prop : nameProps) {
-                                               entity.setValue(prop, relatedObject.getValue(prop));
-                                       }
-                               }
-                       }
-               } catch (UnsupportedEncodingException e) {
-               }
-               this.previous = entity;
-               
-       }
-       
-       /**
-        * @{inheritDoc}
-        */
-       @Override
-       public void processContainer(Introspector  obj, MultivaluedMap<String, String> uriKeys, boolean isFinalContainer) {
-               
-               this.previous = obj;
-
-               if (this.entity != null) {
-                       this.entity.setValue(obj.getName(), obj.getUnderlyingObject());
-               } else {
-                       this.entity = obj;
-                       this.topEntity = obj;
-               }
-               
-       }
-       
        /**
         * @{inheritDoc}
         */
@@ -226,4 +172,50 @@ public class URIToObject implements Parsable {
        public Loader getLoader() {
                return this.loader;
        }
+       @Override
+       public void processObject(Introspector obj, EdgeType type, MultivaluedMap<String, String> uriKeys)
+                       throws AAIException {
+
+               if (this.entityName == null) {
+                       this.topEntityName = obj.getDbName();
+                       this.topEntity = obj;
+               }
+               this.entityName = obj.getDbName();
+               this.entity = obj;
+               this.parentList = (List<Object>)this.previous.getValue(obj.getName());
+               this.parentList.add(entity.getUnderlyingObject());
+               
+               for (String key : uriKeys.keySet()) {
+                       entity.setValue(key, uriKeys.getFirst(key));
+               }
+               try {
+                       if (relatedObjects.containsKey(entity.getObjectId())) {
+                               Introspector relatedObject = relatedObjects.get(entity.getObjectId());
+                               String nameProp = relatedObject.getMetadata(ObjectMetadata.NAME_PROPS);
+                               if (nameProp == null) {
+                                       nameProp = "";
+                               }
+                               if (nameProp != null && !nameProp.equals("")) {
+                                       String[] nameProps = nameProp.split(",");
+                                       for (String prop : nameProps) {
+                                               entity.setValue(prop, relatedObject.getValue(prop));
+                                       }
+                               }
+                       }
+               } catch (UnsupportedEncodingException e) {
+               }
+               this.previous = entity;
+       }
+       @Override
+       public void processContainer(Introspector obj, EdgeType type, MultivaluedMap<String, String> uriKeys,
+                       boolean isFinalContainer) throws AAIException {
+               this.previous = obj;
+
+               if (this.entity != null) {
+                       this.entity.setValue(obj.getName(), obj.getUnderlyingObject());
+               } else {
+                       this.entity = obj;
+                       this.topEntity = obj;
+               }
+       }
 }