[AAI-178 Amsterdam] Make Edge Properties to be 43/7743/2
authorMaharajh, Robby (rx2202) <rx2202@att.com>
Wed, 16 Aug 2017 14:43:43 +0000 (10:43 -0400)
committerMaharajh, Robby (rx2202) <rx2202@att.com>
Wed, 16 Aug 2017 14:58:58 +0000 (10:58 -0400)
declared by direction

Change-Id: I8eacd870980c558e8c1f92b72f73c6f86aabc890
Signed-off-by: Maharajh, Robby (rx2202) <rx2202@att.com>
80 files changed:
aai-core/src/main/java/org/openecomp/aai/dbgen/DataGrooming.java
aai-core/src/main/java/org/openecomp/aai/dbgen/GenTester.java
aai-core/src/main/java/org/openecomp/aai/dbgen/SchemaGenerator.java
aai-core/src/main/java/org/openecomp/aai/dbmodel/ConvertDeleteScope.java
aai-core/src/main/java/org/openecomp/aai/introspection/Introspector.java
aai-core/src/main/java/org/openecomp/aai/introspection/IntrospectorWalker.java
aai-core/src/main/java/org/openecomp/aai/introspection/JSONStrategy.java
aai-core/src/main/java/org/openecomp/aai/introspection/Loader.java
aai-core/src/main/java/org/openecomp/aai/introspection/ModelInjestor.java
aai-core/src/main/java/org/openecomp/aai/introspection/MoxyLoader.java
aai-core/src/main/java/org/openecomp/aai/introspection/MoxyStrategy.java
aai-core/src/main/java/org/openecomp/aai/introspection/PojoInjestor.java
aai-core/src/main/java/org/openecomp/aai/introspection/PojoLoader.java
aai-core/src/main/java/org/openecomp/aai/introspection/PojoStrategy.java
aai-core/src/main/java/org/openecomp/aai/introspection/PropertyPredicate.java
aai-core/src/main/java/org/openecomp/aai/introspection/PropertyPredicates.java
aai-core/src/main/java/org/openecomp/aai/introspection/Version.java
aai-core/src/main/java/org/openecomp/aai/introspection/Wanderer.java
aai-core/src/main/java/org/openecomp/aai/introspection/generator/CreateExample.java
aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/DataCopy.java
aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/DataLinkReader.java
aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/DataLinkWriter.java
aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/SideEffect.java
aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/SideEffectRunner.java
aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/SideEffectRunnerHelper.java
aai-core/src/main/java/org/openecomp/aai/introspection/tools/CreateUUID.java
aai-core/src/main/java/org/openecomp/aai/introspection/tools/DefaultFields.java
aai-core/src/main/java/org/openecomp/aai/introspection/tools/InjectKeysFromURI.java
aai-core/src/main/java/org/openecomp/aai/introspection/tools/IntrospectorValidator.java
aai-core/src/main/java/org/openecomp/aai/parsers/query/LegacyQueryParser.java
aai-core/src/main/java/org/openecomp/aai/parsers/query/QueryParser.java
aai-core/src/main/java/org/openecomp/aai/parsers/query/QueryParserStrategy.java
aai-core/src/main/java/org/openecomp/aai/parsers/query/RelationshipQueryParser.java
aai-core/src/main/java/org/openecomp/aai/parsers/query/TraversalStrategy.java
aai-core/src/main/java/org/openecomp/aai/parsers/query/UniqueRelationshipQueryParser.java
aai-core/src/main/java/org/openecomp/aai/parsers/query/UniqueStrategy.java
aai-core/src/main/java/org/openecomp/aai/parsers/query/UniqueURIQueryParser.java
aai-core/src/main/java/org/openecomp/aai/parsers/relationship/RelationshipToURI.java
aai-core/src/main/java/org/openecomp/aai/parsers/uri/Parsable.java
aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIParser.java
aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIToDBKey.java
aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIToExtensionInformation.java
aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIToObject.java
aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIToRelationshipObject.java
aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIValidate.java
aai-core/src/main/java/org/openecomp/aai/rest/db/DBRequest.java
aai-core/src/main/java/org/openecomp/aai/serialization/db/AAIDirection.java [new file with mode: 0644]
aai-core/src/main/java/org/openecomp/aai/serialization/db/DBSerializer.java
aai-core/src/main/java/org/openecomp/aai/serialization/db/EdgeProperty.java
aai-core/src/main/java/org/openecomp/aai/serialization/db/EdgePropertyMap.java [new file with mode: 0644]
aai-core/src/main/java/org/openecomp/aai/serialization/db/EdgeRule.java
aai-core/src/main/java/org/openecomp/aai/serialization/db/EdgeRules.java
aai-core/src/main/java/org/openecomp/aai/serialization/db/GraphSingleton.java
aai-core/src/main/java/org/openecomp/aai/serialization/db/LegacyDBSerializer.java
aai-core/src/main/java/org/openecomp/aai/serialization/engines/TitanDBEngine.java
aai-core/src/main/java/org/openecomp/aai/serialization/engines/TransactionalGraphEngine.java
aai-core/src/main/java/org/openecomp/aai/serialization/engines/query/GraphTraversalQueryEngine.java
aai-core/src/main/java/org/openecomp/aai/serialization/engines/query/GremlinPipelineQueryEngine.java
aai-core/src/main/java/org/openecomp/aai/serialization/engines/query/GremlinQueryEngine.java
aai-core/src/main/java/org/openecomp/aai/serialization/engines/query/QueryEngine.java
aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/Console.java
aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/FormatFactory.java
aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/FormatMapper.java
aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/Formatter.java
aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/GraphSON.java
aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/IdURL.java
aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/PathedURL.java
aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/RawFormat.java
aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/Resource.java
aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/SimpleFormat.java
aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/utils/QueryParamInjector.java
aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/utils/UrlBuilder.java
aai-core/src/main/java/org/openecomp/aai/serialization/tinkerpop/TreeBackedEdge.java
aai-core/src/main/java/org/openecomp/aai/serialization/tinkerpop/TreeBackedVertex.java
aai-core/src/main/resources/dbedgerules/conversion/ruleTemplate.ftlh
aai-core/src/test/java/org/openecomp/aai/serialization/db/EdgeRulesTest.java
aai-core/src/test/java/org/openecomp/aai/serialization/queryformats/utils/UrlBuilderTest.java
aai-core/src/test/java/org/openecomp/aai/serialization/tinkerpop/TreeBackedVertexTest.java
aai-core/src/test/resources/dbEdgeRulesConversion/conversionTestCompare.json
aai-schema/src/main/resources/oxm/aai_oxm_v11.xml

index 88af871..fb70f30 100644 (file)
 
 package org.openecomp.aai.dbgen;
 
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Properties;
-import java.util.Set;
-import java.util.UUID;
-
+import com.att.eelf.configuration.Configuration;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import com.thinkaurelius.titan.core.TitanFactory;
+import com.thinkaurelius.titan.core.TitanGraph;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
-import org.apache.tinkerpop.gremlin.structure.Direction;
-import org.apache.tinkerpop.gremlin.structure.Edge;
-import org.apache.tinkerpop.gremlin.structure.Graph;
-import org.apache.tinkerpop.gremlin.structure.Property;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.apache.tinkerpop.gremlin.structure.VertexProperty;
+import org.apache.tinkerpop.gremlin.structure.*;
 import org.openecomp.aai.db.props.AAIProperties;
 import org.openecomp.aai.dbmap.AAIGraph;
 import org.openecomp.aai.exceptions.AAIException;
@@ -56,17 +38,15 @@ import org.openecomp.aai.introspection.LoaderFactory;
 import org.openecomp.aai.introspection.ModelType;
 import org.openecomp.aai.introspection.exceptions.AAIUnknownObjectException;
 import org.openecomp.aai.logging.ErrorLogHelper;
-import org.openecomp.aai.serialization.db.EdgeProperties;
+import org.openecomp.aai.serialization.db.AAIDirection;
 import org.openecomp.aai.serialization.db.EdgeProperty;
 import org.openecomp.aai.util.AAIConfig;
 import org.openecomp.aai.util.AAIConstants;
 import org.openecomp.aai.util.FormatDate;
 
-import com.att.eelf.configuration.Configuration;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import com.thinkaurelius.titan.core.TitanFactory;
-import com.thinkaurelius.titan.core.TitanGraph;
+import java.io.*;
+import java.util.*;
+import java.util.Map.Entry;
 
 
 public class DataGrooming {
@@ -99,6 +79,11 @@ public class DataGrooming {
                Boolean ghost2CheckOff = false;
                Boolean ghost2FixOn = false;
                Boolean neverUseCache = false;
+               Boolean skipEdgeCheckFlag = false;
+               
+               int timeWindowMinutes = 0; // A value of 0 means that we will not have a time-window -- we will look
+                                   // at all nodes of the passed-in nodeType. 
+               long windowStartTime = 0; // Translation of the window into a starting timestamp 
                
                int maxRecordsToFix = AAIConstants.AAI_GROOMING_DEFAULT_MAX_FIX;
                int sleepMinutes = AAIConstants.AAI_GROOMING_DEFAULT_SLEEP_MINUTES;
@@ -123,8 +108,15 @@ public class DataGrooming {
                String dteStr = fd.getDateTime();
                String groomOutFileName = "dataGrooming." + dteStr + ".out";
 
+               String argString = "";
+               for( int x = 0; x < args.length; x++ ) {
+                       argString = argString + " " + args[x];
+               }
+               LOGGER.info(" DataGrooming called with these options: [" + argString + "]");
+               
                if (args.length > 0) {
                        // They passed some arguments in that will affect processing
+                       
                        for (int i = 0; i < args.length; i++) {
                                String thisArg = args[i];
                                if (thisArg.equals("-edgesOnly")) {
@@ -147,6 +139,8 @@ public class DataGrooming {
                                        neverUseCache = true;
                                } else if (thisArg.equals("-ghost2FixOn")) {
                                        ghost2FixOn = true;
+                               } else if (thisArg.equals("-skipEdgeChecks")) {
+                                       skipEdgeCheckFlag = true;
                                } else if (thisArg.equals("-maxFix")) {
                                        i++;
                                        if (i >= args.length) {
@@ -175,6 +169,25 @@ public class DataGrooming {
                                                                                + nextArg + "]");
                                                System.exit(0);
                                        }
+                               } else if (thisArg.equals("-timeWindowMinutes")) {
+                                       i++;
+                                       if (i >= args.length) {
+                                               LOGGER.error("No value passed with -timeWindowMinutes option.");
+                                               System.exit(0);
+                                       }
+                                       String nextArg = args[i];
+                                       try {
+                                               timeWindowMinutes = Integer.parseInt(nextArg);
+                                       } catch (Exception e) {
+                                               LOGGER.error("Bad value passed with -timeWindowMinutes option: ["
+                                                                               + nextArg + "]");
+                                               System.exit(0);
+                                       }
+                                       if( timeWindowMinutes > 0 ){
+                                               // Translate the window value (ie. 30 minutes) into a unix timestamp like
+                                               //    we use in the db - so we can select data created after that time.
+                                               windowStartTime = figureWindowStartTime( timeWindowMinutes );
+                                       }
                                } else if (thisArg.equals("-f")) {
                                        i++;
                                        if (i >= args.length) {
@@ -213,7 +226,8 @@ public class DataGrooming {
                                doTheGrooming(prevFileName, edgesOnlyFlag, dontFixOrphansFlag,
                                                maxRecordsToFix, groomOutFileName, ver, singleCommits,
                                                dupeCheckOff, dupeFixOn, ghost2CheckOff, ghost2FixOn, 
-                                               finalShutdownFlag, cacheDbOkFlag);
+                                               finalShutdownFlag, cacheDbOkFlag, 
+                                               skipEdgeCheckFlag, windowStartTime);
                        } else if (doAutoFix) {
                                // They want us to run the processing twice -- first to look for
                                // delete candidates, then after
@@ -228,7 +242,8 @@ public class DataGrooming {
                                int fixCandCount = doTheGrooming("", edgesOnlyFlag,
                                                dontFixOrphansFlag, maxRecordsToFix, groomOutFileName,
                                                ver, singleCommits, dupeCheckOff, dupeFixOn, ghost2CheckOff, ghost2FixOn, 
-                                               finalShutdownFlag, cacheDbOkFlag);
+                                               finalShutdownFlag, cacheDbOkFlag, 
+                                               skipEdgeCheckFlag, windowStartTime);
                                if (fixCandCount == 0) {
                                        LOGGER.info(" No fix-Candidates were found by the first pass, so no second/fix-pass is needed. ");
                                } else {
@@ -256,7 +271,8 @@ public class DataGrooming {
                                                        dontFixOrphansFlag, maxRecordsToFix,
                                                        secondGroomOutFileName, ver, singleCommits,
                                                        dupeCheckOff, dupeFixOn, ghost2CheckOff, ghost2FixOn, 
-                                                       finalShutdownFlag, cacheDbOkFlag);
+                                                       finalShutdownFlag, cacheDbOkFlag, 
+                                                       skipEdgeCheckFlag, windowStartTime);
                                }
                        } else {
                                // Do the grooming - plain vanilla (no fix-it-file, no
@@ -271,7 +287,8 @@ public class DataGrooming {
                                doTheGrooming("", edgesOnlyFlag, dontFixOrphansFlag,
                                                maxRecordsToFix, groomOutFileName, ver, singleCommits,
                                                dupeCheckOff, dupeFixOn, ghost2CheckOff, ghost2FixOn, 
-                                               finalShutdownFlag, cacheDbOkFlag);
+                                               finalShutdownFlag, cacheDbOkFlag, 
+                                               skipEdgeCheckFlag, windowStartTime);
                        }
                } catch (Exception ex) {
                        LOGGER.error("Exception while grooming data", ex);
@@ -306,7 +323,8 @@ public class DataGrooming {
                        Boolean singleCommits, 
                        Boolean dupeCheckOff, Boolean dupeFixOn,
                        Boolean ghost2CheckOff, Boolean ghost2FixOn, 
-                       Boolean finalShutdownFlag, Boolean cacheDbOkFlag) {
+                       Boolean finalShutdownFlag, Boolean cacheDbOkFlag,
+                       Boolean skipEdgeCheckFlag, long windowStartTime) {
 
                LOGGER.debug(" Entering doTheGrooming \n");
 
@@ -438,6 +456,18 @@ public class DataGrooming {
                                                                LOGGER.debug("count for " + nType + " so far = " + thisNtCount );
                                                        }
                                                        Vertex thisVtx = iter.next();
+                                                       if( windowStartTime > 0 ){
+                                                               // We only want nodes that are created after a passed-in timestamp
+                                                               Object objTimeStamp = thisVtx.property("aai-created-ts").orElse(null);
+                                                               if( objTimeStamp != null ){
+                                                                       long thisNodeCreateTime = (long)objTimeStamp;
+                                                                       if( thisNodeCreateTime < windowStartTime ){
+                                                                               // It is NOT in our window, so we can pass over it
+                                                                               continue;
+                                                                       }
+                                                               }
+                                                       }
+                                                       
                                                        String thisVid = thisVtx.id().toString();
                                                        if (processedVertices.contains(thisVid)) {
                                                                LOGGER.debug("skipping already processed vertex: " + thisVid);
@@ -479,7 +509,7 @@ public class DataGrooming {
                                                                        // This kind of node is dependent on another for uniqueness.  
                                                                        // Start at it's parent (the dependent vertex) and make sure we can get it
                                                                        // back using it's key properties and that we only get one.
-                                                                       Iterator <Vertex> vertI2 = source1.V(thisVtx).union(__.inE().has(EdgeProperties.out(EdgeProperty.IS_PARENT), true).outV(), __.outE().has(EdgeProperties.in(EdgeProperty.IS_PARENT)).inV());
+                                                                       Iterator <Vertex> vertI2 = source1.V(thisVtx).union(__.inE().has(EdgeProperty.CONTAINS.toString(), AAIDirection.OUT.toString()).outV(), __.outE().has(EdgeProperty.CONTAINS.toString(), AAIDirection.IN.toString()).inV());
                                                                        Vertex parentVtx = null;
                                                                        int pCount = 0;
                                                                        while( vertI2 != null && vertI2.hasNext() ){
@@ -622,6 +652,7 @@ public class DataGrooming {
                        }// end of check to make sure we weren't only supposed to do edges
 
                
+                 if( !skipEdgeCheckFlag ){
                        // --------------------------------------------------------------------------------------
                        // Now, we're going to look for one-armed-edges. Ie. an edge that
                        // should have
@@ -686,6 +717,19 @@ public class DataGrooming {
                                                                                + ", since that guy is a Phantom Node");
                                                continue;
                                        }
+                                       
+                                       if( windowStartTime > 0 ){
+                                               // We only want to look at nodes that are created after a passed-in timestamp
+                                               Object objTimeStamp = v.property("aai-created-ts").orElse(null);
+                                               if( objTimeStamp != null ){
+                                                       long thisNodeCreateTime = (long)objTimeStamp;
+                                                       if( thisNodeCreateTime < windowStartTime ){
+                                                               // It is NOT in our window, so we can pass over it
+                                                               continue;
+                                                       }
+                                               }
+                                       }
+                                       
                                        if (counter == lastShown + 250) {
                                                lastShown = counter;
                                                LOGGER.info("... Checking edges for vertex # "
@@ -928,7 +972,9 @@ public class DataGrooming {
                                } catch (Exception exx) {
                                        LOGGER.warn("WARNING from in the while-verts-loop ", exx);
                                }
-                       }// End of while-vertices-loop
+                       }// End of while-vertices-loop (the edge-checking)
+                 }     // end of -- if we're not skipping the edge-checking 
+                       
 
                        deleteCount = deleteCount + dupeGrpsDeleted;
                        if (!singleCommits && deleteCount > 0) {
@@ -972,13 +1018,13 @@ public class DataGrooming {
                                        + misMatchedHash.size() + "\n");
 
                        bw.write("\n ------------- Delete Candidates ---------\n");
-                       for (Map.Entry<String, Vertex> entry : ghostNodeHash
+                       for (Entry<String, Vertex> entry : ghostNodeHash
                                        .entrySet()) {
                                String vid = entry.getKey();
                                bw.write("DeleteCandidate: Phantom Vid = [" + vid + "]\n");
                                cleanupCandidateCount++;
                        }
-                       for (Map.Entry<String, Vertex> entry : orphanNodeHash
+                       for (Entry<String, Vertex> entry : orphanNodeHash
                                        .entrySet()) {
                                String vid = entry.getKey();
                                bw.write("DeleteCandidate: OrphanDepNode Vid = [" + vid + "]\n");
@@ -986,12 +1032,12 @@ public class DataGrooming {
                                        cleanupCandidateCount++;
                                }
                        }
-                       for (Map.Entry<String, Edge> entry : oneArmedEdgeHash.entrySet()) {
+                       for (Entry<String, Edge> entry : oneArmedEdgeHash.entrySet()) {
                                String eid = entry.getKey();
                                bw.write("DeleteCandidate: Bad EDGE Edge-id = [" + eid + "]\n");
                                cleanupCandidateCount++;
                        }
-                       for (Map.Entry<String, Vertex> entry : missingDepNodeHash
+                       for (Entry<String, Vertex> entry : missingDepNodeHash
                                        .entrySet()) {
                                String vid = entry.getKey();
                                bw.write("DeleteCandidate: (maybe) missingDepNode Vid = ["
@@ -1001,7 +1047,7 @@ public class DataGrooming {
                        bw.write("\n-- NOTE - To see DeleteCandidates for Duplicates, you need to look in the Duplicates Detail section below.\n");
 
                        bw.write("\n ------------- GHOST NODES - detail ");
-                       for (Map.Entry<String, Vertex> entry : ghostNodeHash
+                       for (Entry<String, Vertex> entry : ghostNodeHash
                                        .entrySet()) {
                                try {
                                        String vid = entry.getKey();
@@ -1023,7 +1069,7 @@ public class DataGrooming {
                        }
 
                        bw.write("\n ------------- Missing Dependent Edge ORPHAN NODES - detail: ");
-                       for (Map.Entry<String, Vertex> entry : orphanNodeHash
+                       for (Entry<String, Vertex> entry : orphanNodeHash
                                        .entrySet()) {
                                try {
                                        String vid = entry.getKey();
@@ -1045,7 +1091,7 @@ public class DataGrooming {
                        }
 
                        bw.write("\n ------------- Missing Dependent Edge (but not orphan) NODES: ");
-                       for (Map.Entry<String, Vertex> entry : missingDepNodeHash
+                       for (Entry<String, Vertex> entry : missingDepNodeHash
                                        .entrySet()) {
                                try {
                                        String vid = entry.getKey();
@@ -1068,7 +1114,7 @@ public class DataGrooming {
                        }
 
                        bw.write("\n ------------- EDGES pointing to empty/bad vertices: ");
-                       for (Map.Entry<String, Edge> entry : oneArmedEdgeHash.entrySet()) {
+                       for (Entry<String, Edge> entry : oneArmedEdgeHash.entrySet()) {
                                try {
                                        String eid = entry.getKey();
                                        Edge thisE = entry.getValue();
@@ -1168,7 +1214,7 @@ public class DataGrooming {
                        }// while - work on each group of dupes
 
                        bw.write("\n ------------- Mis-matched Label/aai-node-type Nodes: \n ");
-                       for (Map.Entry<String, String> entry : misMatchedHash.entrySet()) {
+                       for (Entry<String, String> entry : misMatchedHash.entrySet()) {
                                String msg = entry.getValue();
                                bw.write("MixedMsg = " + msg + "\n");
                        }
@@ -1274,7 +1320,7 @@ public class DataGrooming {
                while( it.hasNext() ){
                        String propName = "";
                        String propVal = "";
-                       Map.Entry <?,?>propEntry = (Map.Entry<?,?>)it.next();
+                       Entry <?,?>propEntry = (Entry<?,?>)it.next();
                        Object propNameObj = propEntry.getKey();
                        if( propNameObj != null ){
                                propName = propNameObj.toString();
@@ -1770,7 +1816,7 @@ public class DataGrooming {
                                HashMap<String, ArrayList<Vertex>> vertsGroupedByParentHash = groupVertsByDepNodes(
                                                transId, fromAppId, source, version, nType,
                                                checkVertList, loader);
-                               for (Map.Entry<String, ArrayList<Vertex>> entry : vertsGroupedByParentHash
+                               for (Entry<String, ArrayList<Vertex>> entry : vertsGroupedByParentHash
                                                .entrySet()) {
                                        ArrayList<Vertex> thisParentsVertList = entry
                                                        .getValue();
@@ -2020,7 +2066,7 @@ public class DataGrooming {
                }
                
                int i = -1;
-               for( Map.Entry<String, Object> entry : keyPropsHash.entrySet() ){
+               for( Entry<String, Object> entry : keyPropsHash.entrySet() ){
                        i++;
                        kName.add(i, entry.getKey());
                        kVal.add(i, entry.getValue());
@@ -2201,7 +2247,8 @@ public class DataGrooming {
                        Vertex startVtx, String childNType ) throws AAIException{
                
                ArrayList <Vertex> childList = new ArrayList <> ();
-               Iterator <Vertex> vertI = g.V(startVtx).union(__.outE().has(EdgeProperties.out(EdgeProperty.IS_PARENT), true), __.inE().has(EdgeProperties.in(EdgeProperty.IS_PARENT), true)).bothV();
+               Iterator <Vertex> vertI =  g.V(startVtx).union(__.outE().has(EdgeProperty.CONTAINS.toString(), AAIDirection.OUT.toString()).inV(), __.inE().has(EdgeProperty.CONTAINS.toString(), AAIDirection.IN.toString()).outV());
+               
                Vertex tmpVtx = null;
                while( vertI != null && vertI.hasNext() ){
                        tmpVtx = vertI.next();
@@ -2223,7 +2270,8 @@ public class DataGrooming {
                        Vertex startVtx ) throws AAIException{
                
                Vertex parentVtx = null;
-               Iterator <Vertex> vertI = g.V(startVtx).union(__.inE().has(EdgeProperties.out(EdgeProperty.IS_PARENT), true), __.outE().has(EdgeProperties.in(EdgeProperty.IS_PARENT), true)).bothV();
+               Iterator <Vertex> vertI = g.V(startVtx).union(__.inE().has(EdgeProperty.CONTAINS.toString(), AAIDirection.OUT.toString()).outV(), __.outE().has(EdgeProperty.CONTAINS.toString(), AAIDirection.IN.toString()).inV());
+                               
                while( vertI != null && vertI.hasNext() ){
                        // Note - there better only be one!
                        parentVtx = vertI.next();
@@ -2234,4 +2282,20 @@ public class DataGrooming {
        }// End of getConnectedParent()
        
        
+       private static long figureWindowStartTime( int timeWindowMinutes ){
+               // Given a window size, calculate what the start-timestamp would be.
+               
+               if( timeWindowMinutes <= 0 ){
+                       // This just means that there is no window...
+                       return 0;
+               }
+               long unixTimeNow = System.currentTimeMillis();
+               long windowInMillis = timeWindowMinutes * 60 * 1000;
+               
+               long startTimeStamp = unixTimeNow - windowInMillis;
+               
+               return startTimeStamp;
+       } // End of figureWindowStartTime()
+       
+       
 }
index 14c58cb..7847d3d 100644 (file)
 
 package org.openecomp.aai.dbgen;
 
-import java.util.Properties;
-
-import org.openecomp.aai.dbmap.AAIGraph;
-import org.openecomp.aai.logging.ErrorLogHelper;
-import org.openecomp.aai.util.AAIConfig;
-import org.openecomp.aai.util.AAIConstants;
 import com.att.eelf.configuration.Configuration;
 import com.att.eelf.configuration.EELFLogger;
 import com.att.eelf.configuration.EELFManager;
 import com.thinkaurelius.titan.core.TitanGraph;
 import com.thinkaurelius.titan.core.schema.TitanManagement;
+import org.openecomp.aai.dbmap.AAIGraph;
+import org.openecomp.aai.logging.ErrorLogHelper;
+import org.openecomp.aai.util.AAIConfig;
+import org.openecomp.aai.util.AAIConstants;
 
-
+import java.util.Properties;
 
 
 public class GenTester {
index 9f85d02..165c702 100644 (file)
 package org.openecomp.aai.dbgen;
 
 
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Optional;
-import java.util.Set;
-
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import com.google.common.collect.Multimap;
+import com.thinkaurelius.titan.core.Cardinality;
+import com.thinkaurelius.titan.core.Multiplicity;
+import com.thinkaurelius.titan.core.PropertyKey;
+import com.thinkaurelius.titan.core.TitanGraph;
+import com.thinkaurelius.titan.core.schema.TitanManagement;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.openecomp.aai.db.props.AAIProperties;
 import org.openecomp.aai.introspection.Introspector;
@@ -38,15 +40,7 @@ import org.openecomp.aai.serialization.db.EdgeRule;
 import org.openecomp.aai.serialization.db.EdgeRules;
 import org.openecomp.aai.util.AAIConfig;
 
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import com.google.common.collect.Multimap;
-import com.thinkaurelius.titan.core.Cardinality;
-import com.thinkaurelius.titan.core.Multiplicity;
-import com.thinkaurelius.titan.core.PropertyKey;
-import com.thinkaurelius.titan.core.TitanGraph;
-import com.thinkaurelius.titan.core.schema.TitanManagement;
-
+import java.util.*;
 
 
 public class SchemaGenerator{
@@ -186,6 +180,28 @@ public class SchemaGenerator{
        LOGGER.info(imsg);
        
         graphMgmt.commit();
+        if (addDefaultCR) {
+               if (!graph.traversal().V().has("cloud-owner", "att-aic").has("cloud-region-id", "AAIAIC25").hasNext()) {
+               imsg = "Adding default cloud region to graph...";
+               System.out.println(imsg);
+               LOGGER.info(imsg);
+                       final Vertex cloudRegion = graph.addVertex();
+       
+                       final String ts = String.valueOf(System.currentTimeMillis() / 1000L);
+       
+                       cloudRegion.property("aai-node-type", "cloud-region");
+                       cloudRegion.property("cloud-owner", "att-aic");
+                       cloudRegion.property("cloud-region-id", "AAIAIC25");
+                       cloudRegion.property("cloud-region-version", "2.5");
+                       cloudRegion.property("complex-name", "AAIAIC25");
+                       cloudRegion.property("aai-created-ts", ts);
+                       cloudRegion.property("resource-version", ts);
+                       cloudRegion.property("source-of-truth", "aai-schema-loader");
+                       cloudRegion.property("last-mod-source-of-truth", "aai-schema-loader");
+                       cloudRegion.property(AAIProperties.AAI_URI, "/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25");
+                       graph.tx().commit();
+               }
+               }
     }// End of loadSchemaIntoTitan()
 
 }
index c8eeedf..7fbf395 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=========================================================
  */
 
index 78f5984..1c8baa1 100644 (file)
 
 package org.openecomp.aai.introspection;
 
-import java.io.UnsupportedEncodingException;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.Set;
-
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import com.google.common.base.CaseFormat;
 import org.apache.commons.lang.ClassUtils;
 import org.eclipse.persistence.exceptions.DynamicException;
 import org.openecomp.aai.introspection.exceptions.AAIUnknownObjectException;
@@ -40,9 +32,9 @@ import org.openecomp.aai.schema.enums.ObjectMetadata;
 import org.openecomp.aai.schema.enums.PropertyMetadata;
 import org.openecomp.aai.workarounds.NamingExceptions;
 
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import com.google.common.base.CaseFormat;
+import java.io.UnsupportedEncodingException;
+import java.lang.reflect.InvocationTargetException;
+import java.util.*;
 
 public abstract class Introspector implements Cloneable {
 
index 8bea4dc..8eddac3 100644 (file)
 
 package org.openecomp.aai.introspection;
 
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import org.openecomp.aai.exceptions.AAIException;
+import org.openecomp.aai.introspection.exceptions.AAIUnknownObjectException;
+
 import java.util.HashSet;
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Set;
 
-import org.openecomp.aai.exceptions.AAIException;
-import org.openecomp.aai.introspection.exceptions.AAIUnknownObjectException;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
 public class IntrospectorWalker {
 
        private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(IntrospectorWalker.class);
index bec1af6..7dae20e 100644 (file)
 
 package org.openecomp.aai.introspection;
 
+import org.json.simple.JSONObject;
+import org.openecomp.aai.schema.enums.ObjectMetadata;
+import org.openecomp.aai.schema.enums.PropertyMetadata;
+
 import java.io.UnsupportedEncodingException;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.UUID;
 
-import org.json.simple.JSONObject;
-
-import org.openecomp.aai.schema.enums.ObjectMetadata;
-import org.openecomp.aai.schema.enums.PropertyMetadata;
-
 public class JSONStrategy extends Introspector {
 
        private JSONObject json = null;
index 13b0cca..b5a029e 100644 (file)
 
 package org.openecomp.aai.introspection;
 
-import java.util.Map;
-
 import org.openecomp.aai.introspection.exceptions.AAIUnknownObjectException;
 import org.openecomp.aai.introspection.exceptions.AAIUnmarshallingException;
 import org.openecomp.aai.restcore.MediaType;
 
+import java.util.Map;
+
 public abstract class Loader {
 
        private final Version version;
index a8574d8..c6503a6 100644 (file)
 
 package org.openecomp.aai.introspection;
 
+import org.eclipse.persistence.dynamic.DynamicType;
+import org.eclipse.persistence.jaxb.JAXBContextProperties;
+import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext;
+import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContextFactory;
+import org.openecomp.aai.util.AAIConstants;
+
+import javax.xml.bind.JAXBException;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
@@ -29,15 +36,6 @@ import java.util.Map;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
-import javax.xml.bind.JAXBException;
-
-import org.eclipse.persistence.dynamic.DynamicType;
-import org.eclipse.persistence.jaxb.JAXBContextProperties;
-import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext;
-import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContextFactory;
-
-import org.openecomp.aai.util.AAIConstants;
-
 public class ModelInjestor {
        
        private Map<Version, DynamicJAXBContext> versionContextMap = new HashMap<>();
index 9163f29..80b05ae 100644 (file)
 
 package org.openecomp.aai.introspection;
 
-import java.io.IOException;
-import java.io.StringReader;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.XMLConstants;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Unmarshaller;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.stream.StreamSource;
-
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import com.google.common.base.CaseFormat;
+import com.google.common.collect.ImmutableMap;
 import org.eclipse.persistence.dynamic.DynamicEntity;
 import org.eclipse.persistence.jaxb.UnmarshallerProperties;
 import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext;
@@ -47,10 +37,18 @@ import org.w3c.dom.Document;
 import org.w3c.dom.NodeList;
 import org.xml.sax.SAXException;
 
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import com.google.common.base.CaseFormat;
-import com.google.common.collect.ImmutableMap;
+import javax.xml.XMLConstants;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.stream.StreamSource;
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
 
 public class MoxyLoader extends Loader {
 
@@ -186,7 +184,7 @@ public class MoxyLoader extends Loader {
                        LOGGER.warn("Exception while enumerating objects for API version " + getVersion() + " (returning partial results)", e);
                }
 
-               result.remove("EdgePropNames");
+               //result.remove("EdgePropNames");
                return result;
        }
        
index 5b9e105..b3cda8d 100644 (file)
 
 package org.openecomp.aai.introspection;
 
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.io.UnsupportedEncodingException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Marshaller;
-import javax.xml.bind.Unmarshaller;
-import javax.xml.transform.stream.StreamSource;
-
+import com.google.common.base.CaseFormat;
+import com.google.common.base.Joiner;
 import org.eclipse.persistence.descriptors.ClassDescriptor;
 import org.eclipse.persistence.dynamic.DynamicEntity;
 import org.eclipse.persistence.dynamic.DynamicType;
@@ -48,13 +32,20 @@ import org.eclipse.persistence.mappings.DatabaseMapping;
 import org.eclipse.persistence.oxm.XMLField;
 import org.eclipse.persistence.oxm.mappings.XMLCompositeCollectionMapping;
 import org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping;
-import org.springframework.web.util.UriUtils;
-
 import org.openecomp.aai.restcore.MediaType;
 import org.openecomp.aai.schema.enums.ObjectMetadata;
 import org.openecomp.aai.schema.enums.PropertyMetadata;
-import com.google.common.base.CaseFormat;
-import com.google.common.base.Joiner;
+import org.springframework.web.util.UriUtils;
+
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.transform.stream.StreamSource;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.io.UnsupportedEncodingException;
+import java.util.*;
+import java.util.Map.Entry;
 
 public class MoxyStrategy extends Introspector {
        
index 56d4368..3eea242 100644 (file)
 
 package org.openecomp.aai.introspection;
 
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
+import org.eclipse.persistence.jaxb.JAXBContextFactory;
+import org.openecomp.aai.db.props.AAIProperties;
 
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBException;
-
-import org.eclipse.persistence.jaxb.JAXBContextFactory;
-
-import org.openecomp.aai.db.props.AAIProperties;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 public class PojoInjestor {
        
index dec830a..927ac4b 100644 (file)
 
 package org.openecomp.aai.introspection;
 
-import java.io.StringReader;
-import java.util.Map;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Unmarshaller;
-import javax.xml.transform.stream.StreamSource;
-
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import com.google.common.base.CaseFormat;
 import org.eclipse.persistence.jaxb.JAXBContextFactory;
 import org.eclipse.persistence.jaxb.UnmarshallerProperties;
 import org.openecomp.aai.db.props.AAIProperties;
@@ -37,9 +32,12 @@ import org.openecomp.aai.logging.ErrorLogHelper;
 import org.openecomp.aai.restcore.MediaType;
 import org.openecomp.aai.workarounds.NamingExceptions;
 
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import com.google.common.base.CaseFormat;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.transform.stream.StreamSource;
+import java.io.StringReader;
+import java.util.Map;
 
 public class PojoLoader extends Loader {
 
index 4b8266b..7f114bd 100644 (file)
 
 package org.openecomp.aai.introspection;
 
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import com.google.common.base.CaseFormat;
+import com.google.common.base.Joiner;
+import com.google.common.collect.Multimap;
+import org.eclipse.persistence.jaxb.UnmarshallerProperties;
+import org.openecomp.aai.annotations.Metadata;
+import org.openecomp.aai.logging.ErrorLogHelper;
+import org.openecomp.aai.restcore.MediaType;
+import org.openecomp.aai.schema.enums.ObjectMetadata;
+import org.openecomp.aai.schema.enums.PropertyMetadata;
 
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBException;
@@ -42,17 +36,10 @@ import javax.xml.bind.Marshaller;
 import javax.xml.bind.Unmarshaller;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.transform.stream.StreamSource;
-
-import org.eclipse.persistence.jaxb.UnmarshallerProperties;
-
-import org.openecomp.aai.annotations.Metadata;
-import org.openecomp.aai.logging.ErrorLogHelper;
-import org.openecomp.aai.restcore.MediaType;
-import org.openecomp.aai.schema.enums.ObjectMetadata;
-import org.openecomp.aai.schema.enums.PropertyMetadata;
-import com.google.common.base.CaseFormat;
-import com.google.common.base.Joiner;
-import com.google.common.collect.Multimap;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.lang.reflect.*;
+import java.util.*;
 
 public class PojoStrategy extends Introspector {
 
index 1f03cc4..38bdf82 100644 (file)
@@ -21,7 +21,6 @@
 package org.openecomp.aai.introspection;
 
 import java.util.function.BiPredicate;
-import java.util.function.Predicate;
 
 public interface PropertyPredicate<T, U> extends BiPredicate<T, U> {
 
index c9d7866..c7bbb0c 100644 (file)
 
 package org.openecomp.aai.introspection;
 
+import org.openecomp.aai.schema.enums.PropertyMetadata;
+
 import java.util.Map;
 import java.util.Set;
 
-import org.openecomp.aai.schema.enums.PropertyMetadata;
-
 public final class PropertyPredicates {
 
        private PropertyPredicates() {
index 8c7998b..9e1fab2 100644 (file)
@@ -23,7 +23,7 @@ package org.openecomp.aai.introspection;
 public enum Version {
        v8,
        v9,
-       v10, 
+       v10,
        v11;
        
        public static boolean isLatest(Version v) {
index 327bbac..5429d99 100644 (file)
 
 package org.openecomp.aai.introspection;
 
-import java.util.List;
-
 import org.openecomp.aai.exceptions.AAIException;
 
+import java.util.List;
+
 public interface Wanderer {
 
        /**
index fd25846..1b3444f 100644 (file)
 
 package org.openecomp.aai.introspection.generator;
 
+import org.openecomp.aai.exceptions.AAIException;
+import org.openecomp.aai.introspection.*;
+
 import java.security.SecureRandom;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.openecomp.aai.exceptions.AAIException;
-import org.openecomp.aai.introspection.Introspector;
-import org.openecomp.aai.introspection.IntrospectorWalker;
-import org.openecomp.aai.introspection.Loader;
-import org.openecomp.aai.introspection.PropertyPredicates;
-import org.openecomp.aai.introspection.Wanderer;
-
 public class CreateExample implements Wanderer {
 
        private SecureRandom rand = new SecureRandom();
index e9a439d..53c8501 100644 (file)
 
 package org.openecomp.aai.introspection.sideeffect;
 
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map.Entry;
-import java.util.Objects;
-import java.util.Optional;
-
-import javax.ws.rs.core.MultivaluedMap;
-
 import org.apache.tinkerpop.gremlin.structure.Vertex;
-
 import org.openecomp.aai.exceptions.AAIException;
 import org.openecomp.aai.introspection.Introspector;
 import org.openecomp.aai.introspection.sideeffect.exceptions.AAIMissingRequiredPropertyException;
@@ -43,6 +31,16 @@ import org.openecomp.aai.schema.enums.PropertyMetadata;
 import org.openecomp.aai.serialization.db.DBSerializer;
 import org.openecomp.aai.serialization.engines.TransactionalGraphEngine;
 
+import javax.ws.rs.core.MultivaluedMap;
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map.Entry;
+import java.util.Objects;
+import java.util.Optional;
+
 
 public class DataCopy extends SideEffect {
 
index db3dd5a..89b03ea 100644 (file)
 
 package org.openecomp.aai.introspection.sideeffect;
 
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Optional;
-import java.util.regex.Matcher;
-
-import javax.ws.rs.core.MultivaluedMap;
-
 import org.apache.tinkerpop.gremlin.structure.Vertex;
-
 import org.openecomp.aai.db.props.AAIProperties;
 import org.openecomp.aai.exceptions.AAIException;
 import org.openecomp.aai.introspection.Introspector;
@@ -44,6 +31,17 @@ import org.openecomp.aai.schema.enums.PropertyMetadata;
 import org.openecomp.aai.serialization.db.DBSerializer;
 import org.openecomp.aai.serialization.engines.TransactionalGraphEngine;
 
+import javax.ws.rs.core.MultivaluedMap;
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Optional;
+import java.util.regex.Matcher;
+
 public class DataLinkReader extends SideEffect {
        
        public DataLinkReader(Introspector obj, Vertex self, TransactionalGraphEngine dbEngine, DBSerializer serializer) {
index 3f07015..6e93098 100644 (file)
 
 package org.openecomp.aai.introspection.sideeffect;
 
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.List;
-import java.util.Map.Entry;
-import java.util.Optional;
-
-import javax.ws.rs.core.MultivaluedMap;
-
 import org.apache.tinkerpop.gremlin.structure.Vertex;
-
 import org.openecomp.aai.db.props.AAIProperties;
 import org.openecomp.aai.exceptions.AAIException;
 import org.openecomp.aai.introspection.Introspector;
@@ -42,6 +32,14 @@ import org.openecomp.aai.schema.enums.PropertyMetadata;
 import org.openecomp.aai.serialization.db.DBSerializer;
 import org.openecomp.aai.serialization.engines.TransactionalGraphEngine;
 
+import javax.ws.rs.core.MultivaluedMap;
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.List;
+import java.util.Map.Entry;
+import java.util.Optional;
+
 public class DataLinkWriter extends SideEffect {
 
        public DataLinkWriter(Introspector obj, Vertex self, TransactionalGraphEngine dbEngine, DBSerializer serializer) {
index 92402e3..95da72f 100644 (file)
 
 package org.openecomp.aai.introspection.sideeffect;
 
-import java.io.UnsupportedEncodingException;
-import java.net.URISyntaxException;
-import java.util.HashMap;
-import java.util.LinkedHashSet;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Optional;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
 import org.apache.tinkerpop.gremlin.structure.Vertex;
-
 import org.openecomp.aai.db.props.AAIProperties;
 import org.openecomp.aai.exceptions.AAIException;
 import org.openecomp.aai.introspection.Introspector;
@@ -44,6 +32,13 @@ import org.openecomp.aai.schema.enums.PropertyMetadata;
 import org.openecomp.aai.serialization.db.DBSerializer;
 import org.openecomp.aai.serialization.engines.TransactionalGraphEngine;
 
+import java.io.UnsupportedEncodingException;
+import java.net.URISyntaxException;
+import java.util.*;
+import java.util.Map.Entry;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
 public abstract class SideEffect {
 
        protected static final Pattern template = Pattern.compile("\\{(.*?)\\}");
index 64a4d0c..3b33be1 100644 (file)
 
 package org.openecomp.aai.introspection.sideeffect;
 
-import java.io.UnsupportedEncodingException;
-import java.lang.reflect.InvocationTargetException;
-import java.net.URISyntaxException;
-import java.util.LinkedHashSet;
-import java.util.Set;
-
 import org.apache.tinkerpop.gremlin.structure.Vertex;
-
 import org.openecomp.aai.exceptions.AAIException;
 import org.openecomp.aai.introspection.Introspector;
 import org.openecomp.aai.serialization.db.DBSerializer;
 import org.openecomp.aai.serialization.engines.TransactionalGraphEngine;
 
+import java.io.UnsupportedEncodingException;
+import java.lang.reflect.InvocationTargetException;
+import java.net.URISyntaxException;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
 public class SideEffectRunner {
 
        protected final TransactionalGraphEngine dbEngine;
index 8a55ce8..d94cd4a 100644 (file)
 
 package org.openecomp.aai.introspection.sideeffect;
 
-import java.io.UnsupportedEncodingException;
-import java.lang.reflect.InvocationTargetException;
-import java.net.URISyntaxException;
-import java.util.List;
-import java.util.Set;
-
 import org.openecomp.aai.exceptions.AAIException;
 import org.openecomp.aai.introspection.Introspector;
 import org.openecomp.aai.introspection.Wanderer;
 import org.openecomp.aai.serialization.db.DBSerializer;
 import org.openecomp.aai.serialization.engines.TransactionalGraphEngine;
 
+import java.io.UnsupportedEncodingException;
+import java.lang.reflect.InvocationTargetException;
+import java.net.URISyntaxException;
+import java.util.List;
+import java.util.Set;
+
 class SideEffectRunnerHelper implements Wanderer {
 
        
index 1d0c603..f88a099 100644 (file)
 
 package org.openecomp.aai.introspection.tools;
 
-import java.util.Map;
-import java.util.UUID;
-
 import org.openecomp.aai.introspection.Introspector;
 import org.openecomp.aai.schema.enums.PropertyMetadata;
 
+import java.util.Map;
+import java.util.UUID;
+
 public class CreateUUID implements IssueResolver {
 
        /**
index 2a34e72..c242d98 100644 (file)
 
 package org.openecomp.aai.introspection.tools;
 
-import java.util.Map;
-
 import org.openecomp.aai.introspection.Introspector;
 import org.openecomp.aai.schema.enums.PropertyMetadata;
 
+import java.util.Map;
+
 public class DefaultFields implements IssueResolver {
 
        /**
index d58ee7c..d9aea00 100644 (file)
 
 package org.openecomp.aai.introspection.tools;
 
-import java.net.URI;
-
 import org.openecomp.aai.introspection.Introspector;
 import org.openecomp.aai.introspection.Loader;
 import org.openecomp.aai.parsers.uri.URIToObject;
 
+import java.net.URI;
+
 public class InjectKeysFromURI  implements IssueResolver {
 
        private URI uri = null;
index 6d451cd..cf77a3b 100644 (file)
 
 package org.openecomp.aai.introspection.tools;
 
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Optional;
-import java.util.Set;
-
 import org.openecomp.aai.db.props.AAIProperties;
 import org.openecomp.aai.exceptions.AAIException;
 import org.openecomp.aai.introspection.Introspector;
@@ -34,6 +28,8 @@ import org.openecomp.aai.introspection.Visibility;
 import org.openecomp.aai.introspection.Wanderer;
 import org.openecomp.aai.schema.enums.PropertyMetadata;
 
+import java.util.*;
+
 public class IntrospectorValidator implements Wanderer {
 
        
@@ -49,7 +45,7 @@ public class IntrospectorValidator implements Wanderer {
         *
         * @param builder the builder
         */
-       private IntrospectorValidator(IntrospectorValidator.Builder builder) {
+       private IntrospectorValidator(Builder builder) {
                this.validateRequired = builder.getValidateRequired();
                this.issueResolvers = builder.getResolvers();
                this.maximumDepth = builder.getMaximumDepth();
index f542bef..5679fc9 100644 (file)
 
 package org.openecomp.aai.parsers.query;
 
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-
-import javax.ws.rs.core.MultivaluedMap;
-
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
 import org.openecomp.aai.exceptions.AAIException;
 import org.openecomp.aai.introspection.Introspector;
 import org.openecomp.aai.introspection.Loader;
@@ -43,8 +33,13 @@ import org.openecomp.aai.query.builder.QueryBuilder;
 import org.openecomp.aai.restcore.util.URITools;
 import org.openecomp.aai.schema.enums.PropertyMetadata;
 import org.openecomp.aai.serialization.db.EdgeType;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
+
+import javax.ws.rs.core.MultivaluedMap;
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.*;
+import java.util.Map.Entry;
 
 /**
  * The Class LegacyQueryParser.
index 90d9fef..ee4e394 100644 (file)
 
 package org.openecomp.aai.parsers.query;
 
-import java.net.URI;
-
 import org.apache.tinkerpop.gremlin.structure.Vertex;
-
 import org.openecomp.aai.db.props.AAIProperties;
 import org.openecomp.aai.introspection.Loader;
 import org.openecomp.aai.introspection.LoaderFactory;
 import org.openecomp.aai.query.builder.QueryBuilder;
 
+import java.net.URI;
+
 /**
  * The Class QueryParser.
  */
index fa0dfa7..b0e6cc2 100644 (file)
 
 package org.openecomp.aai.parsers.query;
 
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-
-import javax.ws.rs.core.MultivaluedMap;
-
 import org.openecomp.aai.exceptions.AAIException;
 import org.openecomp.aai.introspection.Introspector;
 import org.openecomp.aai.introspection.Loader;
 import org.openecomp.aai.query.builder.QueryBuilder;
 
+import javax.ws.rs.core.MultivaluedMap;
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+
 /**
  * The Class QueryParserStrategy.
  */
index 10f7c05..fb4200e 100644 (file)
 
 package org.openecomp.aai.parsers.query;
 
-import java.io.UnsupportedEncodingException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
 import org.openecomp.aai.exceptions.AAIException;
 import org.openecomp.aai.introspection.Introspector;
-import org.openecomp.aai.introspection.IntrospectorFactory;
 import org.openecomp.aai.introspection.Loader;
 import org.openecomp.aai.introspection.ModelType;
 import org.openecomp.aai.parsers.relationship.RelationshipToURI;
 import org.openecomp.aai.parsers.uri.URIParser;
 import org.openecomp.aai.query.builder.QueryBuilder;
 import org.openecomp.aai.serialization.db.EdgeRules;
-import com.google.common.base.CaseFormat;
+
+import java.io.UnsupportedEncodingException;
 
 /**
  * The Class RelationshipQueryParser.
index 6f85708..4106459 100644 (file)
 
 package org.openecomp.aai.parsers.query;
 
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-
-import javax.ws.rs.core.MultivaluedMap;
-
 import org.openecomp.aai.exceptions.AAIException;
 import org.openecomp.aai.introspection.Introspector;
 import org.openecomp.aai.introspection.Loader;
 import org.openecomp.aai.query.builder.QueryBuilder;
 
+import javax.ws.rs.core.MultivaluedMap;
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+
 /**
  * The Class TraversalStrategy.
  */
index 0a210ab..4739aa4 100644 (file)
 
 package org.openecomp.aai.parsers.query;
 
-import java.io.UnsupportedEncodingException;
-
 import org.openecomp.aai.exceptions.AAIException;
 import org.openecomp.aai.introspection.Introspector;
 import org.openecomp.aai.introspection.Loader;
 import org.openecomp.aai.parsers.relationship.RelationshipToURI;
 import org.openecomp.aai.query.builder.QueryBuilder;
 
+import java.io.UnsupportedEncodingException;
+
 /**
  * The Class UniqueRelationshipQueryParser.
  */
index f1e67dc..5668036 100644 (file)
 
 package org.openecomp.aai.parsers.query;
 
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-
-import javax.ws.rs.core.MultivaluedMap;
-
 import org.openecomp.aai.exceptions.AAIException;
 import org.openecomp.aai.introspection.Introspector;
 import org.openecomp.aai.introspection.Loader;
 import org.openecomp.aai.query.builder.QueryBuilder;
 
+import javax.ws.rs.core.MultivaluedMap;
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+
 /**
  * The Class UniqueStrategy.
  */
index 203de01..64fc3df 100644 (file)
 
 package org.openecomp.aai.parsers.query;
 
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-
-import javax.ws.rs.core.MultivaluedMap;
-import javax.ws.rs.core.UriBuilder;
-
 import org.openecomp.aai.exceptions.AAIException;
 import org.openecomp.aai.introspection.Introspector;
 import org.openecomp.aai.introspection.Loader;
@@ -35,6 +29,11 @@ import org.openecomp.aai.parsers.uri.URIToDBKey;
 import org.openecomp.aai.query.builder.QueryBuilder;
 import org.openecomp.aai.serialization.db.EdgeType;
 
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.UriBuilder;
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+
 
 /**
  * The Class UniqueURIQueryParser.
index bd9280f..873f721 100644 (file)
 
 package org.openecomp.aai.parsers.relationship;
 
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Optional;
-
-import javax.ws.rs.core.UriBuilder;
-
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
 import org.apache.tinkerpop.gremlin.structure.Direction;
 import org.openecomp.aai.exceptions.AAIException;
-import org.openecomp.aai.introspection.Introspector;
-import org.openecomp.aai.introspection.IntrospectorFactory;
-import org.openecomp.aai.introspection.Loader;
-import org.openecomp.aai.introspection.ModelType;
-import org.openecomp.aai.introspection.Version;
+import org.openecomp.aai.introspection.*;
 import org.openecomp.aai.introspection.exceptions.AAIUnknownObjectException;
 import org.openecomp.aai.parsers.exceptions.AAIIdentityMapParseException;
 import org.openecomp.aai.parsers.exceptions.AmbiguousMapAAIException;
 import org.openecomp.aai.parsers.uri.URIParser;
 import org.openecomp.aai.schema.enums.ObjectMetadata;
+import org.openecomp.aai.serialization.db.AAIDirection;
 import org.openecomp.aai.serialization.db.EdgeRule;
 import org.openecomp.aai.serialization.db.EdgeRules;
 import org.openecomp.aai.serialization.db.EdgeType;
 import org.openecomp.aai.workarounds.LegacyURITransformer;
 
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
+import javax.ws.rs.core.UriBuilder;
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Optional;
 
 /**
  * The Class RelationshipToURI.
@@ -254,7 +249,7 @@ public class RelationshipToURI {
                                rule = edgeRules.getEdgeRule(EdgeType.TREE, startType, objectType);
                                direction = rule.getDirection();
                                if (direction != null) {
-                                       if ((rule.getIsParent().equals("true") && direction.equals(Direction.IN)) || (rule.getIsParent().equals("reverse") && direction.equals(Direction.OUT))) {
+                                       if ((rule.getContains().equals(AAIDirection.OUT.toString()) && direction.equals(Direction.IN)) || (rule.getContains().equals(AAIDirection.IN.toString()) && direction.equals(Direction.OUT))) {
                                                displacedObject = data.set((data.size() - i) - 1, data.get(j));
                                                data.set(j, displacedObject);
                                                if (sortRelationships(data, objectType, i+1)) {
index 57a8d8a..2488980 100644 (file)
 
 package org.openecomp.aai.parsers.uri;
 
-import javax.ws.rs.core.MultivaluedMap;
-
 import org.openecomp.aai.exceptions.AAIException;
 import org.openecomp.aai.introspection.Introspector;
 import org.openecomp.aai.serialization.db.EdgeType;
 
+import javax.ws.rs.core.MultivaluedMap;
+
 /**
  * The Interface Parsable.
  */
index b145717..7b08f44 100644 (file)
 
 package org.openecomp.aai.parsers.uri;
 
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.util.Set;
-
-import javax.ws.rs.core.MultivaluedHashMap;
-import javax.ws.rs.core.MultivaluedMap;
-import javax.ws.rs.core.UriBuilder;
-
 import org.openecomp.aai.exceptions.AAIException;
 import org.openecomp.aai.introspection.Introspector;
 import org.openecomp.aai.introspection.Loader;
@@ -41,6 +33,13 @@ import org.openecomp.aai.serialization.db.EdgeType;
 import org.openecomp.aai.util.AAIConfig;
 import org.springframework.web.util.UriUtils;
 
+import javax.ws.rs.core.MultivaluedHashMap;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.UriBuilder;
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.util.Set;
+
 
 /**
  * The Class URIParser.
index ae6ff60..6aa28e2 100644 (file)
 
 package org.openecomp.aai.parsers.uri;
 
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.ws.rs.core.MultivaluedMap;
-
+import com.google.common.base.Joiner;
 import org.openecomp.aai.exceptions.AAIException;
 import org.openecomp.aai.introspection.Introspector;
 import org.openecomp.aai.introspection.Loader;
 import org.openecomp.aai.serialization.db.EdgeType;
-import com.google.common.base.Joiner;
+
+import javax.ws.rs.core.MultivaluedMap;
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * Creates a Unique database key from a URI
index 9906437..d32facf 100644 (file)
 
 package org.openecomp.aai.parsers.uri;
 
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.ws.rs.core.MultivaluedMap;
-
+import com.google.common.base.CaseFormat;
+import com.google.common.base.Joiner;
 import org.openecomp.aai.exceptions.AAIException;
 import org.openecomp.aai.introspection.Introspector;
 import org.openecomp.aai.introspection.Loader;
 import org.openecomp.aai.restcore.HttpMethod;
 import org.openecomp.aai.serialization.db.EdgeType;
-import com.google.common.base.CaseFormat;
-import com.google.common.base.Joiner;
+
+import javax.ws.rs.core.MultivaluedMap;
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * The Class URIToExtensionInformation.
index 57a1de5..decd803 100644 (file)
 
 package org.openecomp.aai.parsers.uri;
 
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.util.HashMap;
-import java.util.List;
-
-import javax.ws.rs.core.MultivaluedMap;
-
 import org.openecomp.aai.exceptions.AAIException;
 import org.openecomp.aai.introspection.Introspector;
 import org.openecomp.aai.introspection.Loader;
@@ -34,6 +27,12 @@ import org.openecomp.aai.introspection.Version;
 import org.openecomp.aai.schema.enums.ObjectMetadata;
 import org.openecomp.aai.serialization.db.EdgeType;
 
+import javax.ws.rs.core.MultivaluedMap;
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.util.HashMap;
+import java.util.List;
+
 /**
  * Given a URI this class returns an object, or series of nested objects
  * with their keys populated based off the values in the URI.
index 853b787..a542900 100644 (file)
 
 package org.openecomp.aai.parsers.uri;
 
-import java.io.UnsupportedEncodingException;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.List;
-
-import javax.ws.rs.core.MultivaluedMap;
-
 import org.openecomp.aai.exceptions.AAIException;
 import org.openecomp.aai.introspection.Introspector;
 import org.openecomp.aai.introspection.Loader;
@@ -37,6 +29,13 @@ import org.openecomp.aai.serialization.db.EdgeType;
 import org.openecomp.aai.util.AAIApiServerURLBase;
 import org.openecomp.aai.workarounds.LegacyURITransformer;
 
+import javax.ws.rs.core.MultivaluedMap;
+import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.List;
+
 /**
  * Given a URI a Relationship Object is returned.
  * 
@@ -103,7 +102,7 @@ public class URIToRelationshipObject implements Parsable {
        public String getCloudRegionTransform(){
                return "remove";
        }
-
+       
        /**
         * @{inheritDoc}
         */
@@ -139,9 +138,9 @@ public class URIToRelationshipObject implements Parsable {
                        //only return the path section of the URI past v10
                        relatedLink = new URI(relatedLink.getRawPath());
                }
-
+               
                this.relationship.setValue("related-link", relatedLink.toString());
-
+               
                this.result = relationship;
                return this.result;
        }
@@ -154,7 +153,7 @@ public class URIToRelationshipObject implements Parsable {
                                Introspector data = loader.introspectorFromName("relationship-data");
                                data.setValue("relationship-key", obj.getDbName() + "." + key);
                                data.setValue("relationship-value", obj.getValue(key));
-
+                               
                                ((List<Object>)relationship.getValue("relationship-data")).add(data.getUnderlyingObject());
                        } catch (AAIUnknownObjectException e) {
                                throw new RuntimeException("Fatal error - relationship-data object not found!");
index 6eed095..b7c0958 100644 (file)
 
 package org.openecomp.aai.parsers.uri;
 
-import javax.ws.rs.core.MultivaluedMap;
-
 import org.openecomp.aai.exceptions.AAIException;
 import org.openecomp.aai.introspection.Introspector;
 import org.openecomp.aai.serialization.db.EdgeType;
 
+import javax.ws.rs.core.MultivaluedMap;
+
 class URIValidate implements Parsable {
 
        @Override
index 13699e9..e7b6858 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=========================================================
  */
 
diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/db/AAIDirection.java b/aai-core/src/main/java/org/openecomp/aai/serialization/db/AAIDirection.java
new file mode 100644 (file)
index 0000000..fe9be36
--- /dev/null
@@ -0,0 +1,34 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * org.openecomp.aai
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.aai.serialization.db;
+
+public enum AAIDirection {
+       IN, OUT, BOTH, NONE;
+
+       public AAIDirection opposite() {
+               if (this.equals(OUT))
+                       return IN;
+               else if (this.equals(IN))
+                       return OUT;
+               else
+                       return BOTH;
+       }
+}
index 49bcfd5..3536d13 100644 (file)
 package org.openecomp.aai.serialization.db;
 
 
-import java.io.UnsupportedEncodingException;
-import java.lang.reflect.Array;
-import java.lang.reflect.InvocationTargetException;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.Set;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Future;
-
-import javax.ws.rs.core.UriBuilder;
-
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import com.google.common.base.CaseFormat;
+import com.thinkaurelius.titan.core.SchemaViolationException;
 import org.apache.commons.collections.IteratorUtils;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree;
-import org.apache.tinkerpop.gremlin.structure.Direction;
-import org.apache.tinkerpop.gremlin.structure.Edge;
-import org.apache.tinkerpop.gremlin.structure.Element;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.apache.tinkerpop.gremlin.structure.VertexProperty;
+import org.apache.tinkerpop.gremlin.structure.*;
 import org.javatuples.Pair;
 import org.openecomp.aai.db.props.AAIProperties;
 import org.openecomp.aai.exceptions.AAIException;
-import org.openecomp.aai.introspection.Introspector;
-import org.openecomp.aai.introspection.IntrospectorFactory;
-import org.openecomp.aai.introspection.Loader;
-import org.openecomp.aai.introspection.LoaderFactory;
-import org.openecomp.aai.introspection.ModelType;
-import org.openecomp.aai.introspection.PropertyPredicates;
-import org.openecomp.aai.introspection.Version;
+import org.openecomp.aai.introspection.*;
 import org.openecomp.aai.introspection.exceptions.AAIUnknownObjectException;
 import org.openecomp.aai.introspection.sideeffect.DataCopy;
 import org.openecomp.aai.introspection.sideeffect.DataLinkReader;
@@ -81,10 +54,18 @@ import org.openecomp.aai.util.AAIConfig;
 import org.openecomp.aai.util.AAIConstants;
 import org.openecomp.aai.workarounds.NamingExceptions;
 
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import com.google.common.base.CaseFormat;
-import com.thinkaurelius.titan.core.SchemaViolationException;
+import javax.ws.rs.core.UriBuilder;
+import java.io.UnsupportedEncodingException;
+import java.lang.reflect.Array;
+import java.lang.reflect.InvocationTargetException;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.*;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Future;
 
 public class DBSerializer {
        
@@ -125,9 +106,6 @@ public class DBSerializer {
         * @param v the v
         * @param isNewVertex the is new vertex
         */
-       /*
-        * to be defined and expanded later
-        */
        public void touchStandardVertexProperties(Vertex v, boolean isNewVertex) {
                
                long unixTimeNow = System.currentTimeMillis();
@@ -143,12 +121,12 @@ public class DBSerializer {
        }
        
        private void touchStandardVertexProperties(String nodeType, Vertex v, boolean isNewVertex) {
-
+               
                v.property(AAIProperties.NODE_TYPE, nodeType);
                touchStandardVertexProperties(v, isNewVertex);
 
        }
-
+       
        
        
        /**
@@ -434,6 +412,10 @@ public class DBSerializer {
                        
                        if (cousinVertex != null) {
                                try {
+                                       if (!edgeRules.hasEdgeRule(v, cousinVertex)) {
+                                               throw new AAIException("AAI_6120", "No EdgeRule found for passed nodeTypes: " + v.property(AAIProperties.NODE_TYPE).value().toString() + ", " 
+                                                               + cousinVertex.property(AAIProperties.NODE_TYPE).value().toString() + "."); 
+                                       }
                                        e = this.getEdgeBetween(EdgeType.COUSIN, v, cousinVertex);
 
                                        if (e == null) {
@@ -724,7 +706,7 @@ public class DBSerializer {
                                                EdgeRule rule;
                                                
                                                rule = edgeRules.getEdgeRule(EdgeType.TREE, vType, childDbName);
-                                               if (rule.getIsParent().equals("true") || rule.getIsParent().equals("reverse")) {
+                                               if (!rule.getContains().equals(AAIDirection.NONE.toString())) {
                                                        //vertices = this.queryEngine.findRelatedVertices(v, Direction.OUT, rule.getLabel(), childDbName);
                                                        Direction ruleDirection = rule.getDirection();
                                                        Iterator<Vertex> itr = v.vertices(ruleDirection, rule.getLabel());
@@ -954,8 +936,8 @@ public class DBSerializer {
                }
 
         if(list.size() > 0 && this.version.compareTo(Version.v8) >= 0){
-            this.addRelatedToProperty(result, list.get(0));
-        }
+                       this.addRelatedToProperty(result, list.get(0));
+               }
 
                return result.getUnderlyingObject();
        }
@@ -1337,87 +1319,20 @@ public class DBSerializer {
         * @throws AAIException the AAI exception
         */
        private boolean verifyDeleteSemantics(Vertex vertex, String resourceVersion, boolean enableResourceVersion) throws AAIException {
-               boolean result = false;
+               boolean result = true;
                String nodeType = "";
-               DeleteSemantic semantic = null;
-               List<Edge> inEdges = null;
-               List<Edge> outEdges = null;
                String errorDetail = " unknown delete semantic found";
                String aaiExceptionCode = "";
                nodeType = vertex.<String>property(AAIProperties.NODE_TYPE).orElse(null);
                if (enableResourceVersion && !this.verifyResourceVersion("delete", nodeType, vertex.<String>property(AAIProperties.RESOURCE_VERSION).orElse(null), resourceVersion, nodeType)) {
                }
-               semantic = edgeRules.getDeleteSemantic(nodeType);
-               inEdges = (List<Edge>)IteratorUtils.toList(vertex.edges(Direction.IN));
-               outEdges = (List<Edge>)IteratorUtils.toList(vertex.edges(Direction.OUT));
-               if (semantic.equals(DeleteSemantic.CASCADE_TO_CHILDREN)) {
-                       result = true;
-               } else if (semantic.equals(DeleteSemantic.ERROR_IF_ANY_EDGES)) {
-                       if (inEdges.isEmpty() && outEdges.isEmpty()) {
-                               result = true;
-                       } else {
-                               errorDetail = " Node cannot be deleted because it still has Edges and the " + semantic + " scope was used.\n";
-                               aaiExceptionCode = "AAI_6110";
-                       }
-               } else if (semantic.equals(DeleteSemantic.ERROR_IF_ANY_IN_EDGES) || semantic.equals(DeleteSemantic.ERROR_4_IN_EDGES_OR_CASCADE)) {
-                       
-                       if (inEdges.isEmpty()) {
-                               result = true;
-                       } else {
-                               //are there any cousin edges?
-                               long children = 0;
-                               for (Edge e : inEdges) {
-                                       if (e.<Boolean>property(EdgeProperties.out(EdgeProperty.IS_PARENT)).orElse(false)) {
-                                               children++;
-                                       }
-                               }
-                               for (Edge e : outEdges) {
-                                       if (e.<Boolean>property(EdgeProperties.in(EdgeProperty.IS_PARENT)).orElse(false)) {
-                                               children++;
-                                       }
-                               }
-                               
-                               result = children == inEdges.size();
-                       }
-                       
-                       if (!result) {
-                               errorDetail = " Node cannot be deleted because it still has Edges and the " + semantic + " scope was used.\n";
-                               aaiExceptionCode = "AAI_6110";
-                       }
-               } else if (semantic.equals(DeleteSemantic.THIS_NODE_ONLY)) {
-                       if (outEdges.isEmpty() && inEdges.isEmpty()) {
-                               result = true;
-                       } else {
-                               result = true;
-                               for (Edge edge : outEdges) {
-                                       Object property = edge.<Boolean>property(EdgeProperties.out(EdgeProperty.IS_PARENT)).orElse(null);
-                                       if (property != null && property.equals(Boolean.TRUE)) {
-                                               Vertex v = edge.inVertex();
-                                               String vType = v.<String>property(AAIProperties.NODE_TYPE).orElse(null);
-                                               errorDetail = " Node cannot be deleted using scope = " + semantic + 
-                                                               " another node (type = " + vType + ") depends on it for uniqueness.";
-                                               aaiExceptionCode = "AAI_6110";
-                                               result = false;
-                                               break;
-                                       }
-                               }
-                               
-                               for (Edge edge : inEdges) {
-                                       Object property = edge.<Boolean>property(EdgeProperties.in(EdgeProperty.IS_PARENT)).orElse(null);
-                                       if (property != null && property.equals(Boolean.TRUE)) {
-                                               Vertex v = edge.outVertex();
-                                               String vType = v.<String>property(AAIProperties.NODE_TYPE).orElse(null);
-                                               errorDetail = " Node cannot be deleted using scope = " + semantic + 
-                                                               " another node (type = " + vType + ") depends on it for uniqueness.";
-                                               aaiExceptionCode = "AAI_6110";
-                                               result = false;
-                                               break;
-                                       }
-                               }
-                       }
-               }
-               
+               List<Object> preventDeleteVertices = this.engine.asAdmin().getReadOnlyTraversalSource().V(vertex).union(__.inE().has(EdgeProperty.PREVENT_DELETE.toString(), AAIDirection.IN.toString()).outV().values(AAIProperties.NODE_TYPE), __.outE().has(EdgeProperty.PREVENT_DELETE.toString(), AAIDirection.OUT.toString()).inV().values(AAIProperties.NODE_TYPE)).dedup().toList();
                
+               if (preventDeleteVertices.size() > 0) {
+                       aaiExceptionCode = "AAI_6110";
+                       errorDetail = String.format("Object is being reference by additional objects preventing it from being deleted. Please clean up references from the following types %s", preventDeleteVertices);
+                       result = false;
+               }
                if (!result) {
                        throw new AAIException(aaiExceptionCode, errorDetail); 
                }
index ce21431..29461bc 100644 (file)
 package org.openecomp.aai.serialization.db;
 
 public enum EdgeProperty {
-       IS_PARENT("isParent"),
-       USES_RESOURCE("usesResource"),
-       HAS_DEL_TARGET("hasDelTarget"),
-       SVC_INFRA("SVC-INFRA");
+       CONTAINS("contains-other-v"),
+       DELETE_OTHER_V("delete-other-v"),
+       SVC_INFRA("SVC-INFRA"),
+       PREVENT_DELETE("prevent-delete");
        private final String name;
 
        private EdgeProperty(String name) {
diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/db/EdgePropertyMap.java b/aai-core/src/main/java/org/openecomp/aai/serialization/db/EdgePropertyMap.java
new file mode 100644 (file)
index 0000000..bce2c31
--- /dev/null
@@ -0,0 +1,59 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * org.openecomp.aai
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.aai.serialization.db;
+
+import org.apache.tinkerpop.gremlin.structure.Direction;
+
+import java.util.HashMap;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class EdgePropertyMap<K, V> extends HashMap<K, V> {
+
+       private static final long serialVersionUID = -8298355506617458683L;
+       
+       private static final Pattern variablePattern = Pattern.compile("(!)?\\$\\{(\\w+)\\}");
+       
+       @Override
+       public V get(Object arg0) {
+               
+               V value = super.get(arg0);
+               
+               Matcher m = variablePattern.matcher(value.toString());
+               if (m.find()) {
+                       if (m.groupCount() == 2) {
+                               if (m.group(1) == null) {
+                                       value = super.get(m.group(2));
+                               } else {
+                                       value = reverse(super.get(m.group(2)));
+                               }
+                       }
+               }
+               
+               return value;
+       }
+
+       
+       protected V reverse(V value) {
+               
+               return (V)Direction.valueOf(value.toString()).opposite().toString();
+       }
+}
index 12548f9..1b6c19f 100644 (file)
 
 package org.openecomp.aai.serialization.db;
 
+import org.apache.tinkerpop.gremlin.structure.Direction;
+
 import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.tinkerpop.gremlin.structure.Direction;
-
 public class EdgeRule {
 
        private String label = "";
        private MultiplicityRule multiplicityRule = null;
        private Direction direction = null;
-       private Map<String, String> edgeProperties = null;
-       private final String IS_PARENT = "isParent";
-       private final String USES_RESOURCE  = "usesResource";
-       private final String HAS_DEL_TARGET = "hasDelTarget";
-       private final String SVC_INFRA = "SVC-INFRA";
+       private Map<EdgeProperty, String> edgeProperties = null;
        
        /**
         * Instantiates a new edge rule.
@@ -124,8 +120,8 @@ public class EdgeRule {
         *
         * @return the checks if is parent
         */
-       public String getIsParent() {
-               return this.getProp(this.IS_PARENT);
+       public String getContains() {
+               return this.getProp(EdgeProperty.CONTAINS);
        }
        
        /**
@@ -133,26 +129,8 @@ public class EdgeRule {
         *
         * @param isParent the new checks if is parent
         */
-       public void setIsParent(String isParent) {
-               this.setProp(this.IS_PARENT, isParent);
-       }
-       
-       /**
-        * Gets the uses resource.
-        *
-        * @return the uses resource
-        */
-       public String getUsesResource() {
-               return this.getProp(this.USES_RESOURCE);
-       }
-       
-       /**
-        * Sets the uses resource.
-        *
-        * @param usesResource the new uses resource
-        */
-       public void setUsesResource(String usesResource) {
-               this.setProp(this.USES_RESOURCE, usesResource);
+       public void setContains(String isParent) {
+               this.setProp(EdgeProperty.CONTAINS, isParent);
        }
        
        /**
@@ -160,8 +138,8 @@ public class EdgeRule {
         *
         * @return the checks for del target
         */
-       public String getHasDelTarget() {
-               return this.getProp(this.HAS_DEL_TARGET);
+       public String getDeleteOtherV() {
+               return this.getProp(EdgeProperty.DELETE_OTHER_V);
        }
        
        /**
@@ -169,8 +147,8 @@ public class EdgeRule {
         *
         * @param hasDelTarget the new checks for del target
         */
-       public void setHasDelTarget(String hasDelTarget) {
-               this.setProp(this.HAS_DEL_TARGET, hasDelTarget);
+       public void setDeleteOtherV(String hasDelTarget) {
+               this.setProp(EdgeProperty.DELETE_OTHER_V, hasDelTarget);
        }
        
        /**
@@ -179,7 +157,7 @@ public class EdgeRule {
         * @return the service infrastructure
         */
        public String getServiceInfrastructure() {
-               return this.getProp(this.SVC_INFRA);
+               return this.getProp(EdgeProperty.SVC_INFRA);
        }
        
        /**
@@ -188,7 +166,15 @@ public class EdgeRule {
         * @param serviceInfrastructure the new service infrastructure
         */
        public void setServiceInfrastructure(String serviceInfrastructure) {
-               this.setProp(this.SVC_INFRA, serviceInfrastructure);
+               this.setProp(EdgeProperty.SVC_INFRA, serviceInfrastructure);
+       }
+       
+       public String getPreventDelete() {
+               return this.getProp(EdgeProperty.PREVENT_DELETE);
+       }
+       
+       public void setPreventDelete(String preventDelete) {
+               this.setProp(EdgeProperty.PREVENT_DELETE, preventDelete);
        }
        
        /**
@@ -196,7 +182,7 @@ public class EdgeRule {
         *
         * @return the edge properties
         */
-       public Map<String, String> getEdgeProperties() {
+       public Map<EdgeProperty, String> getEdgeProperties() {
                return this.edgeProperties;
        }
        
@@ -206,7 +192,7 @@ public class EdgeRule {
         * @param key the key
         * @param value the value
         */
-       private void setProp(String key, String value) {
+       private void setProp(EdgeProperty key, String value) {
                this.edgeProperties.put(key, value);
        }
        
@@ -216,7 +202,7 @@ public class EdgeRule {
         * @param key the key
         * @return the prop
         */
-       private String getProp(String key) {
+       private String getProp(EdgeProperty key) {
                return this.edgeProperties.get(key);
        }
        
index 454aa1e..6e5201b 100644 (file)
 
 package org.openecomp.aai.serialization.db;
 
-import static com.jayway.jsonpath.Criteria.where;
-import static com.jayway.jsonpath.Filter.filter;
-
-import java.io.InputStream;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.EnumMap;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.Scanner;
-import java.util.concurrent.ConcurrentHashMap;
-
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import com.google.common.collect.ArrayListMultimap;
+import com.google.common.collect.Multimap;
+import com.jayway.jsonpath.DocumentContext;
+import com.jayway.jsonpath.Filter;
+import com.jayway.jsonpath.JsonPath;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
 import org.apache.tinkerpop.gremlin.structure.Direction;
@@ -46,13 +39,13 @@ import org.openecomp.aai.introspection.Version;
 import org.openecomp.aai.serialization.db.exceptions.EdgeMultiplicityException;
 import org.openecomp.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
 
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import com.google.common.collect.ArrayListMultimap;
-import com.google.common.collect.Multimap;
-import com.jayway.jsonpath.DocumentContext;
-import com.jayway.jsonpath.Filter;
-import com.jayway.jsonpath.JsonPath;
+import java.io.InputStream;
+import java.util.*;
+import java.util.Map.Entry;
+import java.util.concurrent.ConcurrentHashMap;
+
+import static com.jayway.jsonpath.Criteria.where;
+import static com.jayway.jsonpath.Filter.filter;
 
 public class EdgeRules {
        
@@ -230,21 +223,10 @@ public class EdgeRules {
                // Items starting at "firstTagIndex" and up are all assumed to be booleans that map according to 
                // tags as defined in EdgeInfoMap.
                // Note - if they are tagged as 'reverse', that means they get the tag name with "-REV" on it
-               Map<String, String> propMap = rule.getEdgeProperties();
+               Map<EdgeProperty, String> propMap = rule.getEdgeProperties();
                
-               for (String key : propMap.keySet()) {
-                       String revKeyname = key + "-REV";
-                       String triple = propMap.get(key);
-                       if(triple.equals("true")){
-                               edge.property(key, true);
-                               edge.property(revKeyname,false);
-                       } else if (triple.equals("false")) {
-                               edge.property(key, false);
-                               edge.property(revKeyname,false);
-                       } else if (triple.equals("reverse")) {
-                               edge.property(key, false);
-                               edge.property(revKeyname,true);
-                       }
+               for (Entry<EdgeProperty, String> entry : propMap.entrySet()) {
+                       edge.property(entry.getKey().toString(), entry.getValue());
                }
        }
        
@@ -355,12 +337,12 @@ public class EdgeRules {
        private Filter buildFilter(EdgeType type, String nodeA, String nodeB) {
                if (EdgeType.COUSIN.equals(type)) {
                        return filter(
-                                       where("from").is(nodeA).and("to").is(nodeB).and("isParent").is("false")
+                                       where("from").is(nodeA).and("to").is(nodeB).and(EdgeProperty.CONTAINS.toString()).is(AAIDirection.NONE.toString())
                                        );
                } else {
                        return filter(
-                                       where("from").is(nodeA).and("to").is(nodeB).and("isParent").is("true")).or(
-                                                       where("from").is(nodeA).and("to").is(nodeB).and("isParent").is("reverse")       
+                                       where("from").is(nodeA).and("to").is(nodeB).and(EdgeProperty.CONTAINS.toString()).is("${direction}")).or(
+                                                       where("from").is(nodeA).and("to").is(nodeB).and(EdgeProperty.CONTAINS.toString()).is("!${direction}")   
                                        );
                }
        }
@@ -371,15 +353,19 @@ public class EdgeRules {
         * @param edge - the edge information returned from JsonPath
         * @return EdgeRule containing that information
         */
-       private EdgeRule buildRule(Map<String, String> edge) {
+       private EdgeRule buildRule(Map<String, String> map) {
+               Map<String, String> edge = new EdgePropertyMap<>();
+               edge.putAll(map);
+               
                EdgeRule rule = new EdgeRule();
                rule.setLabel(edge.get("label"));
                rule.setDirection(edge.get("direction"));
                rule.setMultiplicityRule(edge.get("multiplicity"));
-               rule.setIsParent(edge.get("isParent"));
-               rule.setUsesResource(edge.get("usesResource"));
-               rule.setHasDelTarget(edge.get("hasDelTarget"));
-               rule.setServiceInfrastructure(edge.get("SVC-INFRA"));
+               rule.setContains(edge.get(EdgeProperty.CONTAINS.toString()));
+               rule.setDeleteOtherV(edge.get(EdgeProperty.DELETE_OTHER_V.toString()));
+               rule.setServiceInfrastructure(edge.get(EdgeProperty.SVC_INFRA.toString()));
+               rule.setPreventDelete(edge.get(EdgeProperty.PREVENT_DELETE.toString()));
+               
                return rule;
        }
        
@@ -423,20 +409,6 @@ public class EdgeRules {
                
        }
        
-       /**
-        * Gets the delete semantic.
-        *
-        * @param nodeType the node type
-        * @return the delete semantic
-        */
-       public DeleteSemantic getDeleteSemantic(String nodeType) {
-               Collection<String> semanticCollection = deleteScope.get(nodeType);
-               String semantic = semanticCollection.iterator().next();
-               
-               return DeleteSemantic.valueOf(semantic);
-               
-       }
-       
        /**
         * Validate multiplicity.
         *
@@ -510,4 +482,19 @@ public class EdgeRules {
                return this.deleteScope;
        }
        
+       public Set<EdgeRule> getChildren(String nodeType) {
+               
+               final Filter filter = filter(
+                               where("from").is(nodeType).and(EdgeProperty.CONTAINS.toString()).is("${direction}")
+                               ).or(where("to").is(nodeType).and(EdgeProperty.CONTAINS.toString()).is("!${direction}"));
+               
+               final List<Map<String, String>> rules = rulesDoc.read("$.rules.[?]", filter);
+               final Set<EdgeRule> result = new HashSet<>();
+               rules.forEach(item -> {
+                       result.add(buildRule(item));
+               });
+       
+               return result;
+               
+       }
 }
index 46cdca5..ba61638 100644 (file)
 
 package org.openecomp.aai.serialization.db;
 
-import java.util.concurrent.atomic.AtomicInteger;
-
+import com.thinkaurelius.titan.core.TitanGraph;
 import org.openecomp.aai.dbmap.AAIGraph;
 import org.openecomp.aai.dbmap.DBConnectionType;
-import com.thinkaurelius.titan.core.TitanGraph;
+
+import java.util.concurrent.atomic.AtomicInteger;
 
 /* This class simply calls AAIGraph under the covers for now */
 public class GraphSingleton {
index 3646961..5d41985 100644 (file)
@@ -24,7 +24,6 @@ import org.openecomp.aai.exceptions.AAIException;
 import org.openecomp.aai.introspection.ModelType;
 import org.openecomp.aai.introspection.Version;
 import org.openecomp.aai.serialization.engines.TransactionalGraphEngine;
-import org.apache.tinkerpop.gremlin.structure.Graph;
 
 public class LegacyDBSerializer extends DBSerializer {
 
index 8611ba6..0d00705 100644 (file)
 
 package org.openecomp.aai.serialization.engines;
 
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.tinkerpop.gremlin.structure.VertexProperty;
 import org.openecomp.aai.dbmap.DBConnectionType;
 import org.openecomp.aai.introspection.Loader;
 import org.openecomp.aai.serialization.db.TitanGraphSingleton;
 
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
 public class TitanDBEngine extends TransactionalGraphEngine {
 
        /**
index ef91a86..51917fe 100644 (file)
@@ -20,9 +20,8 @@
 
 package org.openecomp.aai.serialization.engines;
 
-import java.util.List;
-import java.util.concurrent.atomic.AtomicInteger;
-
+import com.thinkaurelius.titan.core.TitanGraph;
+import com.thinkaurelius.titan.core.schema.TitanManagement;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy;
 import org.apache.tinkerpop.gremlin.structure.Graph;
@@ -37,8 +36,8 @@ import org.openecomp.aai.serialization.db.GraphSingleton;
 import org.openecomp.aai.serialization.engines.query.GraphTraversalQueryEngine;
 import org.openecomp.aai.serialization.engines.query.QueryEngine;
 
-import com.thinkaurelius.titan.core.TitanGraph;
-import com.thinkaurelius.titan.core.schema.TitanManagement;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
 
 public abstract class TransactionalGraphEngine {
        
index a196722..074441c 100644 (file)
@@ -20,8 +20,6 @@
 
 package org.openecomp.aai.serialization.engines.query;
 
-import java.util.List;
-import java.util.Set;
 
 import org.apache.tinkerpop.gremlin.process.traversal.P;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
@@ -34,8 +32,13 @@ import org.apache.tinkerpop.gremlin.structure.Element;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.openecomp.aai.db.props.AAIProperties;
 import org.openecomp.aai.introspection.Loader;
-import org.openecomp.aai.serialization.db.EdgeProperties;
-import org.openecomp.aai.serialization.db.EdgeProperty;
+
+import java.util.List;
+import java.util.Set;
+
+import static org.openecomp.aai.serialization.db.AAIDirection.*;
+import static org.openecomp.aai.serialization.db.EdgeProperty.CONTAINS;
+import static org.openecomp.aai.serialization.db.EdgeProperty.DELETE_OTHER_V;
 
 /*
  * This class needs some big explanation despite its compact size.
@@ -63,7 +66,7 @@ public class GraphTraversalQueryEngine extends QueryEngine {
        @Override
        public List<Vertex> findParents(Vertex start) {
                
-               final GraphTraversal<Vertex, Vertex> pipe = this.g.V(start).emit(v -> true).repeat(__.union(__.inE().has(EdgeProperties.out(EdgeProperty.IS_PARENT), true).outV(), __.outE().has(EdgeProperties.in(EdgeProperty.IS_PARENT), true).inV()));
+               final GraphTraversal<Vertex, Vertex> pipe = this.g.V(start).emit(v -> true).repeat(__.union(__.inE().has(CONTAINS.toString(), OUT.toString()).outV(), __.outE().has(CONTAINS.toString(), IN.toString()).inV()));
                return pipe.toList();
        }
 
@@ -74,7 +77,7 @@ public class GraphTraversalQueryEngine extends QueryEngine {
        public List<Vertex> findAllChildren(Vertex start) {
                
                GraphTraversal<Vertex, Vertex> pipe =  this.g
-                               .V(start).emit(v -> true).repeat(__.union(__.outE().has(EdgeProperties.out(EdgeProperty.IS_PARENT), true).inV(), __.inE().has(EdgeProperties.in(EdgeProperty.IS_PARENT), true).outV()));
+                               .V(start).emit(v -> true).repeat(__.union(__.outE().has(CONTAINS.toString(), OUT.toString()).inV(), __.inE().has(CONTAINS.toString(), IN.toString()).outV()));
                
 
                return pipe.toList();
@@ -83,8 +86,8 @@ public class GraphTraversalQueryEngine extends QueryEngine {
 
        public List<Vertex> findChildrenOfType(Vertex start, String type) {
                GraphTraversal<Vertex, Vertex> pipe =  this.g.V(start).union(
-                                       __.outE().has(EdgeProperties.out(EdgeProperty.IS_PARENT), true).inV(),
-                                       __.inE().has(EdgeProperties.in(EdgeProperty.IS_PARENT), true).outV()
+                                       __.outE().has(CONTAINS.toString(), OUT.toString()).inV(),
+                                       __.inE().has(CONTAINS.toString(), IN.toString()).outV()
                                ).has(AAIProperties.NODE_TYPE, type).dedup();
  
                return pipe.toList();
@@ -92,8 +95,8 @@ public class GraphTraversalQueryEngine extends QueryEngine {
        
        public List<Vertex> findChildren(Vertex start) {
                GraphTraversal<Vertex, Vertex> pipe =  this.g.V(start).union(
-                                       __.outE().has(EdgeProperties.out(EdgeProperty.IS_PARENT), true),
-                                       __.inE().has(EdgeProperties.in(EdgeProperty.IS_PARENT), true)
+                                       __.outE().has(CONTAINS.toString(), OUT.toString()),
+                                       __.inE().has(CONTAINS.toString(), IN.toString())
                                ).otherV().dedup();
  
                return pipe.toList();
@@ -108,12 +111,12 @@ public class GraphTraversalQueryEngine extends QueryEngine {
                                .V(start).emit(v -> true).repeat(
                                        __.union(
                                                __.outE().or(
-                                                       __.has(EdgeProperties.out(EdgeProperty.IS_PARENT), true),
-                                                       __.has(EdgeProperties.out(EdgeProperty.HAS_DEL_TARGET), true)
+                                                       __.has(CONTAINS.toString(), OUT.toString()),
+                                                       __.has(DELETE_OTHER_V.toString(), OUT.toString())
                                                ).inV(),
                                                __.inE().or(
-                                                               __.has(EdgeProperties.in(EdgeProperty.IS_PARENT), true),
-                                                               __.has(EdgeProperties.in(EdgeProperty.HAS_DEL_TARGET), true)
+                                                               __.has(CONTAINS.toString(), IN.toString()),
+                                                               __.has(DELETE_OTHER_V.toString(), IN.toString())
                                                ).outV()
                                        )
                                );
@@ -149,14 +152,14 @@ public class GraphTraversalQueryEngine extends QueryEngine {
        public Tree<Element> findSubGraph(Vertex start, int iterations, boolean nodeOnly) {
                final GraphTraversal<Vertex, ?> t = this.g.V(start).emit(v -> true).times(iterations).repeat(
                                __.union(
-                                       __.outE().has(EdgeProperties.out(EdgeProperty.IS_PARENT), true).inV(),
-                                       __.inE().has(EdgeProperties.in(EdgeProperty.IS_PARENT), true).outV())
+                                       __.outE().has(CONTAINS.toString(), OUT.toString()).inV(),
+                                       __.inE().has(CONTAINS.toString(), IN.toString()).outV())
                                );
                        
                if (!nodeOnly) {
                        t.union(
                                        __.identity(),
-                                       __.bothE().and(__.has(EdgeProperties.out(EdgeProperty.IS_PARENT), false), __.has(EdgeProperties.in(EdgeProperty.IS_PARENT), false)).dedup().otherV()
+                                       __.bothE().has(CONTAINS.toString(), NONE.toString()).dedup().otherV()
                        );
                }
                t.tree();
@@ -171,8 +174,8 @@ public class GraphTraversalQueryEngine extends QueryEngine {
        public List<Edge> findEdgesForVersion(Vertex start, Loader loader) {
                final Set<String> objects = loader.getAllObjects().keySet();
                GraphTraversal<Vertex, Edge> pipeline = this.g.V(start).union(
-                               __.inE().has(EdgeProperties.out(EdgeProperty.IS_PARENT), false).has(EdgeProperties.in(EdgeProperty.IS_PARENT), false).where(__.outV().has(AAIProperties.NODE_TYPE, P.within(objects))),
-                               __.outE().has(EdgeProperties.out(EdgeProperty.IS_PARENT), false).has(EdgeProperties.in(EdgeProperty.IS_PARENT), false).where(__.inV().has(AAIProperties.NODE_TYPE, P.within(objects)))
+                               __.inE().has(CONTAINS.toString(), NONE.toString()).where(__.outV().has(AAIProperties.NODE_TYPE, P.within(objects))),
+                               __.outE().has(CONTAINS.toString(), NONE.toString()).where(__.inV().has(AAIProperties.NODE_TYPE, P.within(objects)))
                        ).dedup();
                
                return pipeline.toList();
@@ -182,8 +185,8 @@ public class GraphTraversalQueryEngine extends QueryEngine {
        @Override
        public List<Vertex> findCousinVertices(Vertex start) {
                GraphTraversal<Vertex, Vertex> pipeline = this.g.V(start).union(
-                               __.inE().has(EdgeProperties.out(EdgeProperty.IS_PARENT), false).has(EdgeProperties.in(EdgeProperty.IS_PARENT), false),
-                               __.outE().has(EdgeProperties.out(EdgeProperty.IS_PARENT), false).has(EdgeProperties.in(EdgeProperty.IS_PARENT), false)).otherV().dedup();
+                               __.inE().has(CONTAINS.toString(), NONE.toString()),
+                               __.outE().has(CONTAINS.toString(), NONE.toString())).otherV().dedup();
                                
                return pipeline.toList();
        }
index a690ff6..809b6d9 100644 (file)
@@ -1,4 +1,4 @@
-/*-
+package org.openecomp.aai.serialization.engines.query;/*-
  * ============LICENSE_START=======================================================
  * org.openecomp.aai
  * ================================================================================
index 1a6aa6d..1ca0211 100644 (file)
@@ -1,4 +1,4 @@
-/*-
+package org.openecomp.aai.serialization.engines.query;/*-
  * ============LICENSE_START=======================================================
  * org.openecomp.aai
  * ================================================================================
index f77f726..5ac94d6 100644 (file)
 
 package org.openecomp.aai.serialization.engines.query;
 
-import java.util.List;
-
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree;
 import org.apache.tinkerpop.gremlin.structure.Direction;
 import org.apache.tinkerpop.gremlin.structure.Edge;
 import org.apache.tinkerpop.gremlin.structure.Element;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
-
 import org.openecomp.aai.db.props.AAIProperties;
 import org.openecomp.aai.introspection.Loader;
 
+import java.util.List;
+
 public abstract class QueryEngine {
 
        final protected GraphTraversalSource g;
index c574632..561fd6c 100644 (file)
@@ -20,8 +20,8 @@
 
 package org.openecomp.aai.serialization.queryformats;
 
-import org.openecomp.aai.serialization.queryformats.exceptions.AAIFormatVertexException;
 import com.google.gson.JsonObject;
+import org.openecomp.aai.serialization.queryformats.exceptions.AAIFormatVertexException;
 
 public class Console implements FormatMapper {
 
index 031e2a3..7753ae7 100644 (file)
@@ -30,6 +30,9 @@ import org.openecomp.aai.serialization.queryformats.exceptions.QueryParamInjecti
 import org.openecomp.aai.serialization.queryformats.utils.QueryParamInjector;
 import org.openecomp.aai.serialization.queryformats.utils.UrlBuilder;
 
+import javax.ws.rs.core.MultivaluedHashMap;
+import javax.ws.rs.core.MultivaluedMap;
+
 public class FormatFactory {
 
        private final Loader loader;
index 6759d3b..e9f17c6 100644 (file)
@@ -20,8 +20,8 @@
 
 package org.openecomp.aai.serialization.queryformats;
 
-import org.openecomp.aai.serialization.queryformats.exceptions.AAIFormatVertexException;
 import com.google.gson.JsonObject;
+import org.openecomp.aai.serialization.queryformats.exceptions.AAIFormatVertexException;
 
 public interface FormatMapper {
 
index 783d52e..26b0411 100644 (file)
 
 package org.openecomp.aai.serialization.queryformats;
 
-import java.util.List;
-import java.util.Optional;
-import java.util.stream.Stream;
-
-import org.openecomp.aai.serialization.queryformats.exceptions.AAIFormatVertexException;
 import com.att.eelf.configuration.EELFLogger;
 import com.att.eelf.configuration.EELFManager;
 import com.google.gson.JsonArray;
 import com.google.gson.JsonObject;
 import com.google.gson.JsonParser;
+import org.openecomp.aai.serialization.queryformats.exceptions.AAIFormatVertexException;
+
+import java.util.List;
+import java.util.Optional;
+import java.util.stream.Stream;
 
 public class Formatter {
 
index fa0d965..9d11987 100644 (file)
 
 package org.openecomp.aai.serialization.queryformats;
 
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
+import com.thinkaurelius.titan.graphdb.tinkerpop.TitanIoRegistry;
 import org.apache.tinkerpop.gremlin.structure.Direction;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONMapper;
 import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONWriter;
 
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
-import com.thinkaurelius.titan.graphdb.tinkerpop.TitanIoRegistry;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
 
 public class GraphSON implements FormatMapper {
 
index 25f291a..d0496c6 100644 (file)
@@ -20,8 +20,9 @@
 
 package org.openecomp.aai.serialization.queryformats;
 
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
-
 import org.openecomp.aai.db.props.AAIProperties;
 import org.openecomp.aai.exceptions.AAIException;
 import org.openecomp.aai.introspection.Introspector;
@@ -29,8 +30,6 @@ import org.openecomp.aai.introspection.Loader;
 import org.openecomp.aai.introspection.exceptions.AAIUnknownObjectException;
 import org.openecomp.aai.serialization.queryformats.exceptions.AAIFormatVertexException;
 import org.openecomp.aai.serialization.queryformats.utils.UrlBuilder;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
 
 public class IdURL implements FormatMapper {
 
index a74150f..09383c9 100644 (file)
@@ -20,8 +20,9 @@
 
 package org.openecomp.aai.serialization.queryformats;
 
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
-
 import org.openecomp.aai.db.props.AAIProperties;
 import org.openecomp.aai.exceptions.AAIException;
 import org.openecomp.aai.introspection.Introspector;
@@ -29,8 +30,6 @@ import org.openecomp.aai.introspection.Loader;
 import org.openecomp.aai.introspection.exceptions.AAIUnknownObjectException;
 import org.openecomp.aai.serialization.queryformats.exceptions.AAIFormatVertexException;
 import org.openecomp.aai.serialization.queryformats.utils.UrlBuilder;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
 
 public final class PathedURL implements FormatMapper {
 
index 070e22f..489df26 100644 (file)
 
 package org.openecomp.aai.serialization.queryformats;
 
-import java.util.Iterator;
-import java.util.List;
-
+import com.google.gson.Gson;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
 import org.apache.tinkerpop.gremlin.structure.Direction;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.tinkerpop.gremlin.structure.VertexProperty;
@@ -34,10 +35,8 @@ import org.openecomp.aai.serialization.queryformats.params.Depth;
 import org.openecomp.aai.serialization.queryformats.params.NodesOnly;
 import org.openecomp.aai.serialization.queryformats.utils.UrlBuilder;
 
-import com.google.gson.Gson;
-import com.google.gson.JsonArray;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
+import java.util.Iterator;
+import java.util.List;
 
 
 public class RawFormat implements FormatMapper {
index 9a090a4..0a557ff 100644 (file)
 
 package org.openecomp.aai.serialization.queryformats;
 
-import java.io.UnsupportedEncodingException;
-import java.util.ArrayList;
-import java.util.List;
-
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.openecomp.aai.db.props.AAIProperties;
 import org.openecomp.aai.exceptions.AAIException;
@@ -36,8 +34,9 @@ import org.openecomp.aai.serialization.queryformats.params.Depth;
 import org.openecomp.aai.serialization.queryformats.params.NodesOnly;
 import org.openecomp.aai.serialization.queryformats.utils.UrlBuilder;
 
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.List;
 
 public class Resource implements FormatMapper {
 
index c14f9b7..6e15319 100644 (file)
 
 package org.openecomp.aai.serialization.queryformats;
 
-import java.io.UnsupportedEncodingException;
-import java.util.ArrayList;
-import java.util.List;
-
+import com.google.gson.JsonObject;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.openecomp.aai.db.props.AAIProperties;
 import org.openecomp.aai.exceptions.AAIException;
@@ -31,7 +28,9 @@ import org.openecomp.aai.introspection.Introspector;
 import org.openecomp.aai.introspection.exceptions.AAIUnknownObjectException;
 import org.openecomp.aai.serialization.queryformats.exceptions.AAIFormatVertexException;
 
-import com.google.gson.JsonObject;
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.List;
 
 public class SimpleFormat extends RawFormat {
 
@@ -59,7 +58,7 @@ public class SimpleFormat extends RawFormat {
                        wrapper.add(v);
 
                        try {
-                               serializer.dbToObject(wrapper, obj, this.depth, false, "false");
+                               serializer.dbToObject(wrapper, obj, this.depth, true, "false");
                        } catch (AAIException | UnsupportedEncodingException  e) {
                                throw new AAIFormatVertexException("Failed to format vertex - error while serializing: " + e.getMessage(), e);
                        }
index 725152d..22ff9b3 100644 (file)
 
 package org.openecomp.aai.serialization.queryformats.utils;
 
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.Set;
-
-import javax.ws.rs.core.MultivaluedMap;
-
 import org.openecomp.aai.serialization.queryformats.exceptions.QueryParamInjectionException;
 import org.openecomp.aai.serialization.queryformats.params.Inject;
 import org.openecomp.aai.serialization.queryformats.params.Setter;
 import org.reflections.Reflections;
 
+import javax.ws.rs.core.MultivaluedMap;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Set;
+
 public class QueryParamInjector {
 
        private final Set<Class<?>> results;
index 7f08856..f988ee9 100644 (file)
 
 package org.openecomp.aai.serialization.queryformats.utils;
 
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.net.URISyntaxException;
-
 import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.openecomp.aai.db.props.AAIProperties;
 import org.openecomp.aai.exceptions.AAIException;
 import org.openecomp.aai.introspection.Version;
 import org.openecomp.aai.serialization.db.DBSerializer;
 import org.openecomp.aai.serialization.queryformats.exceptions.AAIFormatVertexException;
 import org.openecomp.aai.util.AAIApiServerURLBase;
+import org.openecomp.aai.util.AAIConstants;
 import org.openecomp.aai.workarounds.LegacyURITransformer;
 
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.net.URISyntaxException;
+
 public class UrlBuilder {
 
        private final DBSerializer serializer;
        private final Version version;
        private final String serverBase;
-
+       
        public UrlBuilder (Version version, DBSerializer serializer) throws AAIException {
                this.serializer = serializer;
                this.version = version;
-        this.serverBase = AAIApiServerURLBase.get(AAIProperties.LATEST);
+               this.serverBase = this.getServerBase(version);
        }
-
+       
        public UrlBuilder (Version version, DBSerializer serializer, String serverBase) {
                this.serializer = serializer;
                this.version = version;
@@ -57,9 +57,13 @@ public class UrlBuilder {
                        final StringBuilder result = new StringBuilder();
                        final URI uri = this.serializer.getURIForVertex(v);
 
-                       result.append(this.serverBase);
+                       if (this.version.compareTo(Version.v11) >= 0) {
+                               result.append(AAIConstants.AAI_APP_ROOT);
+                       } else {
+                               result.append(this.serverBase);
+                       }
                        result.append(this.version);
-                       result.append(uri.getRawPath());
+                       result.append(uri);
 
                        return result.toString();
                } catch (UnsupportedEncodingException | IllegalArgumentException | SecurityException e) {
@@ -72,11 +76,15 @@ public class UrlBuilder {
 
                result.append("/resources/id/" + v.id());
                result.insert(0, this.version);
-               result.insert(0, this.serverBase);
+               if (this.version.compareTo(Version.v11) >= 0) {
+                       result.insert(0, AAIConstants.AAI_APP_ROOT);
+               } else {
+                       result.insert(0, this.serverBase);
+               }
 
                return result.toString();
        }
-
+       
        protected String getServerBase(Version v) throws AAIException {
                return AAIApiServerURLBase.get(v);
        }
index cb71383..774ab28 100644 (file)
@@ -20,8 +20,6 @@
 
 package org.openecomp.aai.serialization.tinkerpop;
 
-import java.util.Iterator;
-
 import org.apache.tinkerpop.gremlin.structure.Direction;
 import org.apache.tinkerpop.gremlin.structure.Edge;
 import org.apache.tinkerpop.gremlin.structure.Graph;
@@ -29,6 +27,8 @@ import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedEdge;
 import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
 
+import java.util.Iterator;
+
 
 /**
  * Represents a {@link Edge} that is disconnected from a {@link Graph} however, 
index c51c3c2..7ebad21 100644 (file)
 
 package org.openecomp.aai.serialization.tinkerpop;
 
+import org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree;
+import org.apache.tinkerpop.gremlin.structure.*;
+import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex;
+
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 
-import org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree;
-import org.apache.tinkerpop.gremlin.structure.Direction;
-import org.apache.tinkerpop.gremlin.structure.Edge;
-import org.apache.tinkerpop.gremlin.structure.Element;
-import org.apache.tinkerpop.gremlin.structure.Graph;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex;
-
 /**
  * Represents a {@link Vertex} that is disconnected from a {@link Graph} however, 
  * traversals are supported as they are backed by a Tree with saturated {@link Vertex} and {@link Edge} objects.
index 397bc36..0c00f2c 100644 (file)
@@ -4,8 +4,8 @@
        "label" : "${rule.label}",
        "direction" : "${rule.direction}",
        "multiplicity" : "${rule.multiplicity}",
-       "isParent" : "${rule.isParent}",
-       "usesResource" : "${rule.usesResource}",
-       "hasDelTarget" : "${rule.hasDelTarget}",
+       "contains" : "${rule.isParent}",
+       "uses-resource" : "${rule.usesResource}",
+       "delete-other-v" : "${rule.hasDelTarget}",
        "SVC-INFRA" : "${rule.svcInfra}"
 }
\ No newline at end of file
index 87f52eb..3236a68 100644 (file)
@@ -97,7 +97,7 @@ public class EdgeRulesTest {
        
        @Test
        public void verifyOldEdgeDeleteSemantics() throws AAIException, ClassNotFoundException, IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException {
-               assertEquals(DeleteSemantic.ERROR_4_IN_EDGES_OR_CASCADE, EdgeRules.getInstance().getDeleteSemantic("model"));
-               assertEquals(DeleteSemantic.CASCADE_TO_CHILDREN, EdgeRules.getInstance(Version.v8).getDeleteSemantic("model"));
+//             assertEquals(DeleteSemantic.ERROR_4_IN_EDGES_OR_CASCADE, EdgeRules.getInstance().getDeleteSemantic("model"));
+//             assertEquals(DeleteSemantic.CASCADE_TO_CHILDREN, EdgeRules.getInstance(Version.v8).getDeleteSemantic("model"));
        }
 }
index 481e3bb..dd22c0b 100644 (file)
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * org.openecomp.aai
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
 package org.openecomp.aai.serialization.queryformats.utils;
 import static org.junit.Assert.assertEquals;
 import static org.mockito.Matchers.any;
index c39e4ee..775400f 100644 (file)
@@ -6,9 +6,9 @@
        "label" : "has",
        "direction" : "OUT",
        "multiplicity" : "Many2Many",
-       "isParent" : "false",
-       "usesResource" : "false",
-       "hasDelTarget" : "false",
+       "contains" : "false",
+       "uses-resource" : "false",
+       "delete-other-v" : "false",
        "SVC-INFRA" : "false"
 },
 {
@@ -17,9 +17,9 @@
        "label" : "treatsVeryKindly",
        "direction" : "IN",
        "multiplicity" : "One2One",
-       "isParent" : "true",
-       "usesResource" : "true",
-       "hasDelTarget" : "true",
+       "contains" : "true",
+       "uses-resource" : "true",
+       "delete-other-v" : "true",
        "SVC-INFRA" : "true"
 }
 ]
index 43114d4..3a2654f 100644 (file)
                                                <xml-property name="description" value="Readable name of tenant" />
                                        </xml-properties>
                                </xml-element>
-                               <xml-element java-attribute="tenantContext" name="tenant-context" required="true" type="java.lang.String">
+                               <xml-element java-attribute="tenantContext" name="tenant-context" type="java.lang.String">
                                        <xml-properties>
                                                <xml-property name="description" value="This field will store the tenant context." />
                                        </xml-properties>
                                        <xml-properties>
                                                <xml-property name="description" value="Whether A&amp;AI should be managing this interface of not. Could have value like CUSTOMER" />
                                        </xml-properties>
-                               </xml-element>
+                               </xml-element>  
                                <xml-element java-attribute="interfaceDescription" name="interface-description" type="java.lang.String">
                                        <xml-properties>
                                                <xml-property name="description" value="Human friendly text regarding this interface." />
                                        </xml-properties>
-                               </xml-element>
+                               </xml-element>                  
                                <xml-element java-attribute="isPortMirrored" name="is-port-mirrored" required="true" type="java.lang.Boolean">
                                        <xml-properties>
                                                <xml-property name="defaultValue" value="false"/>
                                                <xml-property name="description" value="boolean indicatating whether or not port is a mirrored." />
                                        </xml-properties>
-                               </xml-element>
+                               </xml-element>                                  
                                <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String">
                                        <xml-properties>
                                                <xml-property name="description" value="Used for optimistic concurrency.  Must be empty on create, valid on update and delete." />
                                                <xml-property name="description" value="Prov Status of the logical interface. Valid values [PREPROV/NVTPROV/PROV]." />
                                        </xml-properties>
                                </xml-element>
+                               <xml-element default-value="false" java-attribute="isIpUnnumbered" name="is-ip-unnumbered" required="true" type="java.lang.Boolean">
+                                       <xml-properties>
+                                               <xml-property name="defaultValue" value="false"/>
+                                               <xml-property name="description" value="Flag indicating the interface uses the IP Unnumbered configuration." />
+                                       </xml-properties>
+                               </xml-element>                          
                                <xml-element java-attribute="vlans" name="vlans" type="inventory.aai.onap.org.v11.Vlans" />
                                <xml-element java-attribute="sriovVfs" name="sriov-vfs" type="inventory.aai.onap.org.v11.SriovVfs" />
                                <xml-element java-attribute="lInterfaces" name="l-interfaces" type="inventory.aai.onap.org.v11.LInterfaces" />
                                        <xml-properties>
                                                <xml-property name="description" value="Whether customer is going to use this VLAN for backdoor connection to another customer premise device." />
                                        </xml-properties>
-                               </xml-element>
+                               </xml-element>                                  
                                <xml-element java-attribute="vpnKey" name="vpn-key" type="java.lang.String">
                                        <xml-properties>
                                                <xml-property name="description" value="This indicates the customers VPN ID associated with this vlan" />
                                                <xml-property name="description" value="Prov Status of the VLAN configuration related to a logical interface. Valid values [PREPROV/NVTPROV/PROV]." />
                                        </xml-properties>
                                </xml-element>
+                               <xml-element default-value="false" java-attribute="isIpUnnumbered" name="is-ip-unnumbered" required="true" type="java.lang.Boolean">
+                                       <xml-properties>
+                                               <xml-property name="defaultValue" value="false"/>
+                                               <xml-property name="description" value="Flag indicating the interface uses the IP Unnumbered configuration." />
+                                       </xml-properties>
+                               </xml-element>                  
                                <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.onap.org.v11.RelationshipList" />
                                <xml-element container-type="java.util.ArrayList" java-attribute="l3InterfaceIpv4AddressList" name="l3-interface-ipv4-address-list" type="inventory.aai.onap.org.v11.L3InterfaceIpv4AddressList" />
                                <xml-element container-type="java.util.ArrayList" java-attribute="l3InterfaceIpv6AddressList" name="l3-interface-ipv6-address-list" type="inventory.aai.onap.org.v11.L3InterfaceIpv6AddressList" />
                                <xml-property name="container" value="flavors" />
                        </xml-properties>
                </java-type>
-
+               
                <java-type name="Snapshots">
                        <xml-properties>
                                <xml-property name="description" value="Collection of openstack snapshots" />
                        <xml-root-element name="snapshots" />
                        <java-attributes>
                                <xml-element container-type="java.util.ArrayList" java-attribute="snapshot" name="snapshot" type="inventory.aai.onap.org.v11.Snapshot" />
-                       </java-attributes>
+                       </java-attributes>              
                </java-type>
-
+               
                <java-type name="Snapshot">
                        <xml-root-element name="snapshot" />
                        <java-attributes>
                                <xml-property name="indexedProps" value="application,snapshot-name,application-vendor,snapshot-id,application-version,prev-snapshot-id" />
                                <xml-property name="dependentOn" value="cloud-region" />
                                <xml-property name="container" value="snapshots" />
-                       </xml-properties>
+                       </xml-properties>       
                </java-type>
-
+               
                <java-type name="GroupAssignments">
                        <xml-properties>
                                <xml-property name="description" value="Collection of openstack group assignments" />
                                <xml-element container-type="java.util.ArrayList" java-attribute="groupAssignment" name="group-assignment" type="inventory.aai.onap.org.v11.GroupAssignment" />
                        </java-attributes>
                </java-type>
-
+               
                <java-type name="GroupAssignment">
                        <xml-root-element name="group-assignment" />
                        <java-attributes>
                                        <xml-properties>
                                                <xml-property name="description" value="Group type - the type of group this instance refers to" />
                                        </xml-properties>
-                               </xml-element>
+                               </xml-element>                          
                                <xml-element java-attribute="groupName" name="group-name" required="true" type="java.lang.String">
                                        <xml-properties>
                                                <xml-property name="description" value="Group name - name assigned to the group" />
                                        <xml-properties>
                                                <xml-property name="description" value="Group description - description of the group" />
                                        </xml-properties>
-                               </xml-element>
+                               </xml-element>  
                                <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String">
                                        <xml-properties>
                                                <xml-property name="description" value="Used for optimistic concurrency.  Must be empty on create, valid on update and delete." />
                                        </xml-properties>
-                               </xml-element>
+                               </xml-element>          
                                <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.onap.org.v11.RelationshipList" />
                        </java-attributes>
                        <xml-properties>
                                <xml-property name="dependentOn" value="cloud-region" />
                                <xml-property name="container" value="group-assignments" />
                        </xml-properties>
-               </java-type>
+               </java-type>                    
 
                <java-type name="Images">
                        <xml-properties>
                                        <xml-properties>
                                                <xml-property name="description" value="Human friendly text regarding this interface." />
                                        </xml-properties>
-                               </xml-element>
+                               </xml-element>  
                                <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String">
                                        <xml-properties>
                                                <xml-property name="description" value="Used for optimistic concurrency.  Must be empty on create, valid on update and delete." />
                        </java-attributes>
                        <xml-properties>
                                <xml-property name="description" value="Link aggregate interface" />
-                <xml-property name="indexedProps" value="interface-name,interface-id,interface-role" />
-                               <xml-property name="dependentOn" value="generic-vnf,pserver,vpls-pe" />
+                               <xml-property name="indexedProps" value="interface-name,interface-id,interface-role" />
+                               <xml-property name="dependentOn" value="generic-vnf,pserver,vpls-pe,pnf" />
                                <xml-property name="container" value="lag-interfaces" />
                        </xml-properties>
                </java-type>
                                <xml-element java-attribute="pnfs" name="pnfs" type="inventory.aai.onap.org.v11.Pnfs" />
                                <xml-element java-attribute="physicalLinks" name="physical-links" type="inventory.aai.onap.org.v11.PhysicalLinks" />
                                <xml-element java-attribute="ipsecConfigurations" name="ipsec-configurations" type="inventory.aai.onap.org.v11.IpsecConfigurations" />
+                               <xml-element java-attribute="routeTableReferences" name="route-table-references" type="inventory.aai.onap.org.v11.RouteTableReferences" />
+                               <xml-element java-attribute="instanceGroups" name="instance-groups" type="inventory.aai.onap.org.v11.InstanceGroups" />
+                               <xml-element java-attribute="zones" name="zones" type="inventory.aai.onap.org.v11.Zones" />
                        </java-attributes>
                </java-type>
 
                        </java-attributes>
                        <xml-properties>
                                <xml-property name="description" value="Logical links generally connect l-interfaces but are used to express logical connectivity between two points" />
-                               <xml-property name="indexedProps" value="link-name,model-invariant-id,in-maint,model-version-id,widget-model-id,widget-model-version,link-id,prov-status,circuit-id,purpose" />
+                               <xml-property name="indexedProps" value="link-name,model-invariant-id,model-version-id,widget-model-id,widget-model-version,link-id,prov-status,circuit-id,purpose" />
                                <xml-property name="uniqueProps" value="link-id" />
                                <xml-property name="container" value="logical-links" />
                                <xml-property name="namespace" value="network" />
                        </java-attributes>
                        <xml-properties>
                                <xml-property name="indexedProps" value="routing-instance-id" />
-                               <xml-property name="uniqueProps" value="routing-instance-id" />
                                <xml-property name="dependentOn" value="site-pair-set" />
                                <xml-property name="container" value="routing-instances" />
                        </xml-properties>
                                        <xml-properties>
                                                <xml-property name="description" value="The type of destinatination equipment. Could be Router, UCPE, etc." />
                                        </xml-properties>
-                               </xml-element>
+                               </xml-element>                                  
                                <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String">
                                        <xml-properties>
                                                <xml-property name="description" value="Used for optimistic concurrency.  Must be empty on create, valid on update and delete." />
                                                <xml-property name="visibility" value="deployment" />
                                                <xml-property name="requires" value="model-invariant-id" />
                                        </xml-properties>
-                               </xml-element>
+                               </xml-element>                          
                                <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String">
                                        <xml-properties>
                                                <xml-property name="description" value="Used for optimistic concurrency.  Must be empty on create, valid on update and delete." />
                                        <xml-properties>
                                                <xml-property name="description" value="role of the subnet, referenced when assigning IPs" />
                                        </xml-properties>
-                               </xml-element>
+                               </xml-element>                  
                                <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String">
                                        <xml-properties>
                                                <xml-property name="description" value="Used for optimistic concurrency.  Must be empty on create, valid on update and delete." />
                                        <xml-properties>
                                                <xml-property name="description" value="English description of Network function that the specific VNF deployment is providing" />
                                        </xml-properties>
-                               </xml-element>
+                               </xml-element>  
                                <xml-element java-attribute="nfRole" name="nf-role" type="java.lang.String">
                                        <xml-properties>
                                                <xml-property name="description" value="role in the network that this model will be providing" />
+                                               <xml-property name="suggestibleOnSearch" value="true"/>
                                        </xml-properties>
-                               </xml-element>
+                               </xml-element>  
                                <xml-element java-attribute="nfNamingCode" name="nf-naming-code" type="java.lang.String">
                                        <xml-properties>
                                                <xml-property name="description" value="string assigned to this model used for naming purposes" />
                                        </xml-properties>
-                               </xml-element>
+                               </xml-element>  
                                <xml-element java-attribute="selflink" name="selflink" type="java.lang.String">
                                        <xml-properties>
                                                <xml-property name="description" value="Path to the controller object." />
                                        <xml-properties>
                                                <xml-property name="description" value="Network Management profile of this VNF" />
                                        </xml-properties>
-                               </xml-element>
+                               </xml-element>                  
                                <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.onap.org.v11.RelationshipList" />
                                <xml-element java-attribute="lInterfaces" name="l-interfaces" type="inventory.aai.onap.org.v11.LInterfaces" />
                                <xml-element java-attribute="lagInterfaces" name="lag-interfaces" type="inventory.aai.onap.org.v11.LagInterfaces" />
                                        <xml-properties>
                                                <xml-property name="description" value="Name of the service Provider on this link." />
                                        </xml-properties>
-                               </xml-element>
+                               </xml-element>                                  
                                <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String">
                                        <xml-properties>
                                                <xml-property name="description" value="Used for optimistic concurrency.  Must be empty on create, valid on update and delete." />
                                <xml-element java-attribute="edgeLabel" name="edgeLabel" type="java.lang.String" />
                                <xml-element java-attribute="direction" name="direction" type="java.lang.String" />
                                <xml-element java-attribute="multiplicityRule" name="multiplicityRule" type="java.lang.String" />
-                               <xml-element java-attribute="isParent" name="isParent" type="java.lang.Boolean" />
-                               <xml-element java-attribute="usesResource" name="usesResource" type="java.lang.Boolean" />
-                               <xml-element java-attribute="hasDelTarget" name="hasDelTarget" type="java.lang.Boolean" />
-                               <xml-element java-attribute="SVC-INFRA" name="SVC-INFRA" type="java.lang.Boolean" />
-                               <xml-element java-attribute="SVC-INFRA-REV" name="SVC-INFRA-REV" type="java.lang.Boolean" />
+                               <xml-element java-attribute="containsOtherV" name="contains-other-v" type="java.lang.String" />
+                               <xml-element java-attribute="deleteOtherV" name="delete-other-v" type="java.lang.String" />
+                               <xml-element java-attribute="svcinfra" name="SVC-INFRA" type="java.lang.String" />
+                               <xml-element java-attribute="preventDelete" name="prevent-delete" type="java.lang.String" />
                        </java-attributes>
                </java-type>
 
                                <xml-element container-type="java.util.ArrayList" java-attribute="modelVer" name="model-ver" type="inventory.aai.onap.org.v11.ModelVer" />
                        </java-attributes>
                </java-type>
-
+               
                <java-type name="ModelVer">
                        <xml-root-element name="model-ver" />
                        <xml-properties>
                                <xml-any-element container-type="java.util.ArrayList" java-attribute="any" lax="true" name="any" />
                        </java-attributes>
                </java-type>
-
+               
                <java-type name="SecondaryFilts">
                        <xml-properties>
                                <xml-property name="description" value="SecondaryFilts for performing a named-query or model query" />
                                <xml-element container-type="java.util.ArrayList" java-attribute="secondaryFilt" name="secondary-filt" type="inventory.aai.onap.org.v11.SecondaryFilt" />
                        </java-attributes>
                </java-type>
-
+               
                <java-type name="SecondaryFilt">
                        <xml-properties>
                                <xml-property name="description" value="SecondaryFilt for performing a named-query or model query" />
                                <xml-element java-attribute="propertyValue" name="property-value" type="java.lang.String" />
                        </java-attributes>
                </java-type>
-
+               
                <java-type name="RouteTableReferences">
                        <xml-properties>
                                <xml-property name="description" value="Collection of openstack route table references" />
                                <xml-element container-type="java.util.ArrayList" java-attribute="routeTableReference" name="route-table-reference" type="inventory.aai.onap.org.v11.RouteTableReference" />
                        </java-attributes>
                </java-type>
-
+               
                <java-type name="RouteTableReference">
                        <xml-root-element name="route-table-reference" />
                        <java-attributes>
                                </xml-element>
                                <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.onap.org.v11.RelationshipList" />
                        </java-attributes>
-
+                       
                        <xml-properties>
                                <xml-property name="description" value="Openstack route table reference." />
                                <xml-property name="nameProps" value="route-table-reference-fqdn" />
                                <xml-property name="namespace" value="network" />
                        </xml-properties>
                </java-type>
-
+               
                <java-type name="InstanceGroups">
                        <xml-properties>
                                <xml-property name="description" value="Collection of openstack route table references" />
                                <xml-element container-type="java.util.ArrayList" java-attribute="instanceGroup" name="instance-group" type="inventory.aai.onap.org.v11.InstanceGroup" />
                        </java-attributes>
                </java-type>
-
+               
                <java-type name="InstanceGroup">
                        <xml-root-element name="instance-group" />
                        <java-attributes>
                                </xml-element>
                                <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.onap.org.v11.RelationshipList" />
                        </java-attributes>
-
+                       
                        <xml-properties>
                                <xml-property name="description" value="General mechanism for grouping instances" />
                                <xml-property name="nameProps" value="description" />
                                <xml-property name="namespace" value="network" />
                        </xml-properties>
                </java-type>
-
+               
 
                <java-type name="SegmentationAssignments">
                        <xml-properties>
                                <xml-element container-type="java.util.ArrayList" java-attribute="segmentationAssignment" name="segmentation-assignment" type="inventory.aai.onap.org.v11.SegmentationAssignment" />
                        </java-attributes>
                </java-type>
-
+                               
                <java-type name="SegmentationAssignment">
                        <xml-root-element name="segmentation-assignment" />
                        <java-attributes>
                                <xml-property name="container" value="segmentation-assignments" />
                        </xml-properties>
                </java-type>
-
+               
                <java-type name="AllottedResources">
                        <xml-properties>
                                <xml-property name="description" value="This object is used to store slices of services being offered" />
                                <xml-element container-type="java.util.ArrayList" java-attribute="allottedResource" name="allotted-resource" type="inventory.aai.onap.org.v11.AllottedResource" />
                        </java-attributes>
                </java-type>
-
+               
                <java-type name="AllottedResource">
                        <xml-root-element name="allotted-resource" />
                        <java-attributes>
                                <xml-element java-attribute="tunnelXconnects" name="tunnel-xconnects" type="inventory.aai.onap.org.v11.TunnelXconnects" />
                                <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.onap.org.v11.RelationshipList" />
                        </java-attributes>
-
+                       
                        <xml-properties>
                                <xml-property name="description" value="Represents a slice or partial piece of a resource that gets separately allotted" />
                                <xml-property name="nameProps" value="description" />
                                <xml-property name="container" value="allotted-resources" />
                                <!--  <xml-property name="namespace" value="network" /> -->
                        </xml-properties>
-               </java-type>
-
+               </java-type>    
+               
                <java-type name="TunnelXconnects">
                        <xml-properties>
                                <xml-property name="description" value="This object is used to store the specific tunnel cross connect aspects of an allotted resource" />
                                <xml-element container-type="java.util.ArrayList" java-attribute="tunnelXconnect" name="tunnel-xconnect" type="inventory.aai.onap.org.v11.TunnelXconnect" />
                        </java-attributes>
                </java-type>
-
+               
                <java-type name="TunnelXconnect">
                        <xml-root-element name="tunnel-xconnect" />
                        <java-attributes>
                                </xml-element>
                                <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.onap.org.v11.RelationshipList" />
                        </java-attributes>
-
+                       
                        <xml-properties>
                                <xml-property name="description" value="Represents the specifics of a tunnel cross connect piece of a resource that gets separately allotted" />
                                <xml-property name="uniqueProps" value="id" />
                                <!--  <xml-property name="namespace" value="network" /> -->
                        </xml-properties>
                </java-type>
-
+               
                <java-type name="Entitlements">
                        <xml-properties>
                                <xml-property name="description" value="Entitlements, keyed by group-uuid and resource-uuid, related to license management" />
                                <xml-element container-type="java.util.ArrayList" java-attribute="entitlement" name="entitlement" type="inventory.aai.onap.org.v11.Entitlement" />
                        </java-attributes>
                </java-type>
-
+                               
                <java-type name="Entitlement">
                        <xml-root-element name="entitlement" />
                        <java-attributes>
                        <xml-properties>
                                <xml-property name="description" value="Metadata for entitlement group." />
                                <xml-property name="indexedProps" value="group-uuid,resource-uuid" />
-                               <xml-property name="dependentOn" value="generic-vnf,vce,vpe" />
+                               <xml-property name="dependentOn" value="generic-vnf,vce" />
                                <xml-property name="container" value="entitlements" />
                        </xml-properties>
                </java-type>
-
-
+               
+               
                <java-type name="Licenses">
                        <xml-properties>
                                <xml-property name="description" value="Licenses to be allocated across resources, keyed by group-uuid and resource-uuid, related to license management" />
                                <xml-element container-type="java.util.ArrayList" java-attribute="license" name="license" type="inventory.aai.onap.org.v11.License" />
                        </java-attributes>
                </java-type>
-
+                               
                <java-type name="License">
                        <xml-root-element name="license" />
                        <java-attributes>
                        <xml-properties>
                                <xml-property name="description" value="Metadata for license group." />
                                <xml-property name="indexedProps" value="group-uuid,resource-uuid" />
-                               <xml-property name="dependentOn" value="generic-vnf,vce,vpe" />
+                               <xml-property name="dependentOn" value="generic-vnf,vce" />
                                <xml-property name="container" value="licenses" />
                        </xml-properties>
                </java-type>
-
+               
                <java-type name="Vnf">
                        <xml-root-element name="vnf"/>
                        <java-attributes>
                                <xml-property name="abstract" value="true" />
                        </xml-properties>
                </java-type>
-
+               
                <java-type name="Zones">
                        <xml-properties>
                                <xml-property name="description" value="Collection of zones" />
                                <xml-property name="canBeLinked" value="true" />
                        </xml-properties>
                </java-type>
-
+                                               
                <java-type name="SriovPfs">
                        <xml-properties>
                                <xml-property name="description" value="Collection of SR-IOV Physical Functions." />