diff options
Diffstat (limited to 'aai-core/src/main/java')
73 files changed, 548 insertions, 408 deletions
diff --git a/aai-core/src/main/java/org/openecomp/aai/dbgen/DataGrooming.java b/aai-core/src/main/java/org/openecomp/aai/dbgen/DataGrooming.java index fb70f302..f0aaf607 100644 --- a/aai-core/src/main/java/org/openecomp/aai/dbgen/DataGrooming.java +++ b/aai-core/src/main/java/org/openecomp/aai/dbgen/DataGrooming.java @@ -20,15 +20,33 @@ package org.openecomp.aai.dbgen; -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.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 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.*; +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.openecomp.aai.db.props.AAIProperties; import org.openecomp.aai.dbmap.AAIGraph; import org.openecomp.aai.exceptions.AAIException; @@ -44,9 +62,11 @@ import org.openecomp.aai.util.AAIConfig; import org.openecomp.aai.util.AAIConstants; import org.openecomp.aai.util.FormatDate; -import java.io.*; -import java.util.*; -import java.util.Map.Entry; +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; public class DataGrooming { @@ -1018,13 +1038,13 @@ public class DataGrooming { + misMatchedHash.size() + "\n"); bw.write("\n ------------- Delete Candidates ---------\n"); - for (Entry<String, Vertex> entry : ghostNodeHash + for (Map.Entry<String, Vertex> entry : ghostNodeHash .entrySet()) { String vid = entry.getKey(); bw.write("DeleteCandidate: Phantom Vid = [" + vid + "]\n"); cleanupCandidateCount++; } - for (Entry<String, Vertex> entry : orphanNodeHash + for (Map.Entry<String, Vertex> entry : orphanNodeHash .entrySet()) { String vid = entry.getKey(); bw.write("DeleteCandidate: OrphanDepNode Vid = [" + vid + "]\n"); @@ -1032,12 +1052,12 @@ public class DataGrooming { cleanupCandidateCount++; } } - for (Entry<String, Edge> entry : oneArmedEdgeHash.entrySet()) { + for (Map.Entry<String, Edge> entry : oneArmedEdgeHash.entrySet()) { String eid = entry.getKey(); bw.write("DeleteCandidate: Bad EDGE Edge-id = [" + eid + "]\n"); cleanupCandidateCount++; } - for (Entry<String, Vertex> entry : missingDepNodeHash + for (Map.Entry<String, Vertex> entry : missingDepNodeHash .entrySet()) { String vid = entry.getKey(); bw.write("DeleteCandidate: (maybe) missingDepNode Vid = [" @@ -1047,7 +1067,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 (Entry<String, Vertex> entry : ghostNodeHash + for (Map.Entry<String, Vertex> entry : ghostNodeHash .entrySet()) { try { String vid = entry.getKey(); @@ -1069,7 +1089,7 @@ public class DataGrooming { } bw.write("\n ------------- Missing Dependent Edge ORPHAN NODES - detail: "); - for (Entry<String, Vertex> entry : orphanNodeHash + for (Map.Entry<String, Vertex> entry : orphanNodeHash .entrySet()) { try { String vid = entry.getKey(); @@ -1091,7 +1111,7 @@ public class DataGrooming { } bw.write("\n ------------- Missing Dependent Edge (but not orphan) NODES: "); - for (Entry<String, Vertex> entry : missingDepNodeHash + for (Map.Entry<String, Vertex> entry : missingDepNodeHash .entrySet()) { try { String vid = entry.getKey(); @@ -1114,7 +1134,7 @@ public class DataGrooming { } bw.write("\n ------------- EDGES pointing to empty/bad vertices: "); - for (Entry<String, Edge> entry : oneArmedEdgeHash.entrySet()) { + for (Map.Entry<String, Edge> entry : oneArmedEdgeHash.entrySet()) { try { String eid = entry.getKey(); Edge thisE = entry.getValue(); @@ -1214,7 +1234,7 @@ public class DataGrooming { }// while - work on each group of dupes bw.write("\n ------------- Mis-matched Label/aai-node-type Nodes: \n "); - for (Entry<String, String> entry : misMatchedHash.entrySet()) { + for (Map.Entry<String, String> entry : misMatchedHash.entrySet()) { String msg = entry.getValue(); bw.write("MixedMsg = " + msg + "\n"); } @@ -1320,7 +1340,7 @@ public class DataGrooming { while( it.hasNext() ){ String propName = ""; String propVal = ""; - Entry <?,?>propEntry = (Entry<?,?>)it.next(); + Map.Entry <?,?>propEntry = (Map.Entry<?,?>)it.next(); Object propNameObj = propEntry.getKey(); if( propNameObj != null ){ propName = propNameObj.toString(); @@ -1816,7 +1836,7 @@ public class DataGrooming { HashMap<String, ArrayList<Vertex>> vertsGroupedByParentHash = groupVertsByDepNodes( transId, fromAppId, source, version, nType, checkVertList, loader); - for (Entry<String, ArrayList<Vertex>> entry : vertsGroupedByParentHash + for (Map.Entry<String, ArrayList<Vertex>> entry : vertsGroupedByParentHash .entrySet()) { ArrayList<Vertex> thisParentsVertList = entry .getValue(); @@ -2066,7 +2086,7 @@ public class DataGrooming { } int i = -1; - for( Entry<String, Object> entry : keyPropsHash.entrySet() ){ + for( Map.Entry<String, Object> entry : keyPropsHash.entrySet() ){ i++; kName.add(i, entry.getKey()); kVal.add(i, entry.getValue()); diff --git a/aai-core/src/main/java/org/openecomp/aai/dbgen/GenTester.java b/aai-core/src/main/java/org/openecomp/aai/dbgen/GenTester.java index 7847d3d6..14c58cb5 100644 --- a/aai-core/src/main/java/org/openecomp/aai/dbgen/GenTester.java +++ b/aai-core/src/main/java/org/openecomp/aai/dbgen/GenTester.java @@ -20,17 +20,19 @@ 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 { diff --git a/aai-core/src/main/java/org/openecomp/aai/dbgen/SchemaGenerator.java b/aai-core/src/main/java/org/openecomp/aai/dbgen/SchemaGenerator.java index 165c7029..c3f55cdd 100644 --- a/aai-core/src/main/java/org/openecomp/aai/dbgen/SchemaGenerator.java +++ b/aai-core/src/main/java/org/openecomp/aai/dbgen/SchemaGenerator.java @@ -21,14 +21,12 @@ package org.openecomp.aai.dbgen; -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.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Optional; +import java.util.Set; + import org.apache.tinkerpop.gremlin.structure.Vertex; import org.openecomp.aai.db.props.AAIProperties; import org.openecomp.aai.introspection.Introspector; @@ -40,7 +38,15 @@ import org.openecomp.aai.serialization.db.EdgeRule; import org.openecomp.aai.serialization.db.EdgeRules; import org.openecomp.aai.util.AAIConfig; -import java.util.*; +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; + public class SchemaGenerator{ diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/Introspector.java b/aai-core/src/main/java/org/openecomp/aai/introspection/Introspector.java index 1c8baa10..78f59844 100644 --- a/aai-core/src/main/java/org/openecomp/aai/introspection/Introspector.java +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/Introspector.java @@ -20,9 +20,17 @@ package org.openecomp.aai.introspection; -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.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 org.apache.commons.lang.ClassUtils; import org.eclipse.persistence.exceptions.DynamicException; import org.openecomp.aai.introspection.exceptions.AAIUnknownObjectException; @@ -32,9 +40,9 @@ import org.openecomp.aai.schema.enums.ObjectMetadata; import org.openecomp.aai.schema.enums.PropertyMetadata; import org.openecomp.aai.workarounds.NamingExceptions; -import java.io.UnsupportedEncodingException; -import java.lang.reflect.InvocationTargetException; -import java.util.*; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import com.google.common.base.CaseFormat; public abstract class Introspector implements Cloneable { diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/IntrospectorWalker.java b/aai-core/src/main/java/org/openecomp/aai/introspection/IntrospectorWalker.java index 8eddac3b..8bea4dce 100644 --- a/aai-core/src/main/java/org/openecomp/aai/introspection/IntrospectorWalker.java +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/IntrospectorWalker.java @@ -20,16 +20,16 @@ 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); diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/JSONStrategy.java b/aai-core/src/main/java/org/openecomp/aai/introspection/JSONStrategy.java index 7dae20ee..bec1af6c 100644 --- a/aai-core/src/main/java/org/openecomp/aai/introspection/JSONStrategy.java +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/JSONStrategy.java @@ -20,16 +20,17 @@ 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; diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/Loader.java b/aai-core/src/main/java/org/openecomp/aai/introspection/Loader.java index b5a029ed..13b0ccaa 100644 --- a/aai-core/src/main/java/org/openecomp/aai/introspection/Loader.java +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/Loader.java @@ -20,12 +20,12 @@ 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; diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/ModelInjestor.java b/aai-core/src/main/java/org/openecomp/aai/introspection/ModelInjestor.java index c6503a69..a8574d89 100644 --- a/aai-core/src/main/java/org/openecomp/aai/introspection/ModelInjestor.java +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/ModelInjestor.java @@ -20,13 +20,6 @@ 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; @@ -36,6 +29,15 @@ 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<>(); diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/MoxyLoader.java b/aai-core/src/main/java/org/openecomp/aai/introspection/MoxyLoader.java index 80b05aee..0a3fe73d 100644 --- a/aai-core/src/main/java/org/openecomp/aai/introspection/MoxyLoader.java +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/MoxyLoader.java @@ -20,10 +20,20 @@ package org.openecomp.aai.introspection; -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 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 org.eclipse.persistence.dynamic.DynamicEntity; import org.eclipse.persistence.jaxb.UnmarshallerProperties; import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext; @@ -37,18 +47,10 @@ import org.w3c.dom.Document; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; -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; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import com.google.common.base.CaseFormat; +import com.google.common.collect.ImmutableMap; public class MoxyLoader extends Loader { diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/MoxyStrategy.java b/aai-core/src/main/java/org/openecomp/aai/introspection/MoxyStrategy.java index b3cda8d3..5b9e1051 100644 --- a/aai-core/src/main/java/org/openecomp/aai/introspection/MoxyStrategy.java +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/MoxyStrategy.java @@ -20,8 +20,24 @@ package org.openecomp.aai.introspection; -import com.google.common.base.CaseFormat; -import com.google.common.base.Joiner; +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 org.eclipse.persistence.descriptors.ClassDescriptor; import org.eclipse.persistence.dynamic.DynamicEntity; import org.eclipse.persistence.dynamic.DynamicType; @@ -32,20 +48,13 @@ 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 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; +import com.google.common.base.CaseFormat; +import com.google.common.base.Joiner; public class MoxyStrategy extends Introspector { diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/PojoInjestor.java b/aai-core/src/main/java/org/openecomp/aai/introspection/PojoInjestor.java index 3eea2420..56d4368e 100644 --- a/aai-core/src/main/java/org/openecomp/aai/introspection/PojoInjestor.java +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/PojoInjestor.java @@ -20,13 +20,15 @@ package org.openecomp.aai.introspection; -import org.eclipse.persistence.jaxb.JAXBContextFactory; -import org.openecomp.aai.db.props.AAIProperties; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; -import java.util.regex.Matcher; -import java.util.regex.Pattern; + +import org.eclipse.persistence.jaxb.JAXBContextFactory; + +import org.openecomp.aai.db.props.AAIProperties; public class PojoInjestor { diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/PojoLoader.java b/aai-core/src/main/java/org/openecomp/aai/introspection/PojoLoader.java index 927ac4bc..dec830a9 100644 --- a/aai-core/src/main/java/org/openecomp/aai/introspection/PojoLoader.java +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/PojoLoader.java @@ -20,9 +20,14 @@ package org.openecomp.aai.introspection; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; -import com.google.common.base.CaseFormat; +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 org.eclipse.persistence.jaxb.JAXBContextFactory; import org.eclipse.persistence.jaxb.UnmarshallerProperties; import org.openecomp.aai.db.props.AAIProperties; @@ -32,12 +37,9 @@ import org.openecomp.aai.logging.ErrorLogHelper; import org.openecomp.aai.restcore.MediaType; import org.openecomp.aai.workarounds.NamingExceptions; -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; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import com.google.common.base.CaseFormat; public class PojoLoader extends Loader { diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/PojoStrategy.java b/aai-core/src/main/java/org/openecomp/aai/introspection/PojoStrategy.java index 7f114bd3..4b8266b9 100644 --- a/aai-core/src/main/java/org/openecomp/aai/introspection/PojoStrategy.java +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/PojoStrategy.java @@ -20,15 +20,21 @@ package org.openecomp.aai.introspection; -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 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 javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; @@ -36,10 +42,17 @@ import javax.xml.bind.Marshaller; import javax.xml.bind.Unmarshaller; import javax.xml.bind.annotation.XmlElement; import javax.xml.transform.stream.StreamSource; -import java.io.StringReader; -import java.io.StringWriter; -import java.lang.reflect.*; -import java.util.*; + +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; public class PojoStrategy extends Introspector { diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/PropertyPredicate.java b/aai-core/src/main/java/org/openecomp/aai/introspection/PropertyPredicate.java index 38bdf82c..1f03cc41 100644 --- a/aai-core/src/main/java/org/openecomp/aai/introspection/PropertyPredicate.java +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/PropertyPredicate.java @@ -21,6 +21,7 @@ package org.openecomp.aai.introspection; import java.util.function.BiPredicate; +import java.util.function.Predicate; public interface PropertyPredicate<T, U> extends BiPredicate<T, U> { diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/PropertyPredicates.java b/aai-core/src/main/java/org/openecomp/aai/introspection/PropertyPredicates.java index c7bbb0c0..c9d7866c 100644 --- a/aai-core/src/main/java/org/openecomp/aai/introspection/PropertyPredicates.java +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/PropertyPredicates.java @@ -20,11 +20,11 @@ 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() { diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/Wanderer.java b/aai-core/src/main/java/org/openecomp/aai/introspection/Wanderer.java index 5429d999..327bbacc 100644 --- a/aai-core/src/main/java/org/openecomp/aai/introspection/Wanderer.java +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/Wanderer.java @@ -20,10 +20,10 @@ package org.openecomp.aai.introspection; -import org.openecomp.aai.exceptions.AAIException; - import java.util.List; +import org.openecomp.aai.exceptions.AAIException; + public interface Wanderer { /** diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/generator/CreateExample.java b/aai-core/src/main/java/org/openecomp/aai/introspection/generator/CreateExample.java index 1b3444fd..fd258460 100644 --- a/aai-core/src/main/java/org/openecomp/aai/introspection/generator/CreateExample.java +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/generator/CreateExample.java @@ -20,13 +20,17 @@ 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(); diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/DataCopy.java b/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/DataCopy.java index 53c85013..e9a439dd 100644 --- a/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/DataCopy.java +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/DataCopy.java @@ -20,7 +20,19 @@ 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; @@ -31,16 +43,6 @@ 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 { diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/DataLinkReader.java b/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/DataLinkReader.java index 89b03eab..db3dd5ac 100644 --- a/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/DataLinkReader.java +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/DataLinkReader.java @@ -20,7 +20,20 @@ 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; @@ -31,17 +44,6 @@ 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) { diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/DataLinkWriter.java b/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/DataLinkWriter.java index 6e93098d..3f070153 100644 --- a/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/DataLinkWriter.java +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/DataLinkWriter.java @@ -20,7 +20,17 @@ 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; @@ -32,14 +42,6 @@ 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) { diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/SideEffect.java b/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/SideEffect.java index 95da72f3..92402e32 100644 --- a/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/SideEffect.java +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/SideEffect.java @@ -20,7 +20,19 @@ 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; @@ -32,13 +44,6 @@ 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("\\{(.*?)\\}"); diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/SideEffectRunner.java b/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/SideEffectRunner.java index 3b33be1f..64a4d0cd 100644 --- a/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/SideEffectRunner.java +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/SideEffectRunner.java @@ -20,18 +20,19 @@ package org.openecomp.aai.introspection.sideeffect; -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; +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; + public class SideEffectRunner { protected final TransactionalGraphEngine dbEngine; diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/SideEffectRunnerHelper.java b/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/SideEffectRunnerHelper.java index d94cd4a1..8a55ce82 100644 --- a/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/SideEffectRunnerHelper.java +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/SideEffectRunnerHelper.java @@ -20,18 +20,18 @@ package org.openecomp.aai.introspection.sideeffect; -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; +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; + class SideEffectRunnerHelper implements Wanderer { diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/tools/CreateUUID.java b/aai-core/src/main/java/org/openecomp/aai/introspection/tools/CreateUUID.java index f88a099c..1d0c6033 100644 --- a/aai-core/src/main/java/org/openecomp/aai/introspection/tools/CreateUUID.java +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/tools/CreateUUID.java @@ -20,12 +20,12 @@ package org.openecomp.aai.introspection.tools; -import org.openecomp.aai.introspection.Introspector; -import org.openecomp.aai.schema.enums.PropertyMetadata; - import java.util.Map; import java.util.UUID; +import org.openecomp.aai.introspection.Introspector; +import org.openecomp.aai.schema.enums.PropertyMetadata; + public class CreateUUID implements IssueResolver { /** diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/tools/DefaultFields.java b/aai-core/src/main/java/org/openecomp/aai/introspection/tools/DefaultFields.java index c242d983..2a34e72c 100644 --- a/aai-core/src/main/java/org/openecomp/aai/introspection/tools/DefaultFields.java +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/tools/DefaultFields.java @@ -20,11 +20,11 @@ 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 { /** diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/tools/InjectKeysFromURI.java b/aai-core/src/main/java/org/openecomp/aai/introspection/tools/InjectKeysFromURI.java index d9aea008..d58ee7c4 100644 --- a/aai-core/src/main/java/org/openecomp/aai/introspection/tools/InjectKeysFromURI.java +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/tools/InjectKeysFromURI.java @@ -20,12 +20,12 @@ 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; diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/tools/IntrospectorValidator.java b/aai-core/src/main/java/org/openecomp/aai/introspection/tools/IntrospectorValidator.java index cf77a3be..6d451cdf 100644 --- a/aai-core/src/main/java/org/openecomp/aai/introspection/tools/IntrospectorValidator.java +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/tools/IntrospectorValidator.java @@ -20,6 +20,12 @@ 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; @@ -28,8 +34,6 @@ 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 { @@ -45,7 +49,7 @@ public class IntrospectorValidator implements Wanderer { * * @param builder the builder */ - private IntrospectorValidator(Builder builder) { + private IntrospectorValidator(IntrospectorValidator.Builder builder) { this.validateRequired = builder.getValidateRequired(); this.issueResolvers = builder.getResolvers(); this.maximumDepth = builder.getMaximumDepth(); diff --git a/aai-core/src/main/java/org/openecomp/aai/parsers/query/LegacyQueryParser.java b/aai-core/src/main/java/org/openecomp/aai/parsers/query/LegacyQueryParser.java index 5679fc90..f542bef2 100644 --- a/aai-core/src/main/java/org/openecomp/aai/parsers/query/LegacyQueryParser.java +++ b/aai-core/src/main/java/org/openecomp/aai/parsers/query/LegacyQueryParser.java @@ -20,8 +20,18 @@ package org.openecomp.aai.parsers.query; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; +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 org.openecomp.aai.exceptions.AAIException; import org.openecomp.aai.introspection.Introspector; import org.openecomp.aai.introspection.Loader; @@ -33,13 +43,8 @@ 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 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; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; /** * The Class LegacyQueryParser. diff --git a/aai-core/src/main/java/org/openecomp/aai/parsers/query/QueryParser.java b/aai-core/src/main/java/org/openecomp/aai/parsers/query/QueryParser.java index ee4e3941..90d9fefc 100644 --- a/aai-core/src/main/java/org/openecomp/aai/parsers/query/QueryParser.java +++ b/aai-core/src/main/java/org/openecomp/aai/parsers/query/QueryParser.java @@ -20,14 +20,15 @@ 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. */ diff --git a/aai-core/src/main/java/org/openecomp/aai/parsers/query/QueryParserStrategy.java b/aai-core/src/main/java/org/openecomp/aai/parsers/query/QueryParserStrategy.java index b0e6cc23..fa0dfa7a 100644 --- a/aai-core/src/main/java/org/openecomp/aai/parsers/query/QueryParserStrategy.java +++ b/aai-core/src/main/java/org/openecomp/aai/parsers/query/QueryParserStrategy.java @@ -20,15 +20,16 @@ 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. */ diff --git a/aai-core/src/main/java/org/openecomp/aai/parsers/query/RelationshipQueryParser.java b/aai-core/src/main/java/org/openecomp/aai/parsers/query/RelationshipQueryParser.java index fb4200e5..10f7c05a 100644 --- a/aai-core/src/main/java/org/openecomp/aai/parsers/query/RelationshipQueryParser.java +++ b/aai-core/src/main/java/org/openecomp/aai/parsers/query/RelationshipQueryParser.java @@ -20,16 +20,21 @@ 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 java.io.UnsupportedEncodingException; +import com.google.common.base.CaseFormat; /** * The Class RelationshipQueryParser. diff --git a/aai-core/src/main/java/org/openecomp/aai/parsers/query/TraversalStrategy.java b/aai-core/src/main/java/org/openecomp/aai/parsers/query/TraversalStrategy.java index 41064597..6f857088 100644 --- a/aai-core/src/main/java/org/openecomp/aai/parsers/query/TraversalStrategy.java +++ b/aai-core/src/main/java/org/openecomp/aai/parsers/query/TraversalStrategy.java @@ -20,15 +20,16 @@ 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. */ diff --git a/aai-core/src/main/java/org/openecomp/aai/parsers/query/UniqueRelationshipQueryParser.java b/aai-core/src/main/java/org/openecomp/aai/parsers/query/UniqueRelationshipQueryParser.java index 4739aa47..0a210ab4 100644 --- a/aai-core/src/main/java/org/openecomp/aai/parsers/query/UniqueRelationshipQueryParser.java +++ b/aai-core/src/main/java/org/openecomp/aai/parsers/query/UniqueRelationshipQueryParser.java @@ -20,14 +20,14 @@ 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. */ diff --git a/aai-core/src/main/java/org/openecomp/aai/parsers/query/UniqueStrategy.java b/aai-core/src/main/java/org/openecomp/aai/parsers/query/UniqueStrategy.java index 5668036f..f1e67dc3 100644 --- a/aai-core/src/main/java/org/openecomp/aai/parsers/query/UniqueStrategy.java +++ b/aai-core/src/main/java/org/openecomp/aai/parsers/query/UniqueStrategy.java @@ -20,15 +20,16 @@ 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. */ diff --git a/aai-core/src/main/java/org/openecomp/aai/parsers/query/UniqueURIQueryParser.java b/aai-core/src/main/java/org/openecomp/aai/parsers/query/UniqueURIQueryParser.java index 64fc3df2..203de01b 100644 --- a/aai-core/src/main/java/org/openecomp/aai/parsers/query/UniqueURIQueryParser.java +++ b/aai-core/src/main/java/org/openecomp/aai/parsers/query/UniqueURIQueryParser.java @@ -20,6 +20,12 @@ 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; @@ -29,11 +35,6 @@ 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. diff --git a/aai-core/src/main/java/org/openecomp/aai/parsers/relationship/RelationshipToURI.java b/aai-core/src/main/java/org/openecomp/aai/parsers/relationship/RelationshipToURI.java index 873f7211..19d11271 100644 --- a/aai-core/src/main/java/org/openecomp/aai/parsers/relationship/RelationshipToURI.java +++ b/aai-core/src/main/java/org/openecomp/aai/parsers/relationship/RelationshipToURI.java @@ -20,11 +20,23 @@ package org.openecomp.aai.parsers.relationship; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; +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 org.apache.tinkerpop.gremlin.structure.Direction; import org.openecomp.aai.exceptions.AAIException; -import org.openecomp.aai.introspection.*; +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.exceptions.AAIUnknownObjectException; import org.openecomp.aai.parsers.exceptions.AAIIdentityMapParseException; import org.openecomp.aai.parsers.exceptions.AmbiguousMapAAIException; @@ -36,14 +48,8 @@ import org.openecomp.aai.serialization.db.EdgeRules; import org.openecomp.aai.serialization.db.EdgeType; import org.openecomp.aai.workarounds.LegacyURITransformer; -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; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; /** * The Class RelationshipToURI. diff --git a/aai-core/src/main/java/org/openecomp/aai/parsers/uri/Parsable.java b/aai-core/src/main/java/org/openecomp/aai/parsers/uri/Parsable.java index 2488980e..57a8d8aa 100644 --- a/aai-core/src/main/java/org/openecomp/aai/parsers/uri/Parsable.java +++ b/aai-core/src/main/java/org/openecomp/aai/parsers/uri/Parsable.java @@ -20,12 +20,12 @@ 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. */ diff --git a/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIParser.java b/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIParser.java index 7b08f44f..b4d5ee80 100644 --- a/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIParser.java +++ b/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIParser.java @@ -20,6 +20,14 @@ 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; @@ -33,13 +41,6 @@ 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. @@ -76,8 +77,8 @@ public class URIParser { //Load the latest version because we need it for cloud region - this.loader = loader; - } + this.loader = loader; + } /** * Instantiates a new URI parser. @@ -245,8 +246,8 @@ public class URIParser { * @return the uri */ protected URI handleCloudRegion(String action, URI uri) { - - return uri; + + return uri; } diff --git a/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIToDBKey.java b/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIToDBKey.java index 6aa28e27..ae6ff600 100644 --- a/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIToDBKey.java +++ b/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIToDBKey.java @@ -20,18 +20,19 @@ package org.openecomp.aai.parsers.uri; -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 javax.ws.rs.core.MultivaluedMap; import java.io.UnsupportedEncodingException; import java.net.URI; import java.util.ArrayList; 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; +import org.openecomp.aai.serialization.db.EdgeType; +import com.google.common.base.Joiner; + /** * Creates a Unique database key from a URI * diff --git a/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIToExtensionInformation.java b/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIToExtensionInformation.java index d32facfa..9906437b 100644 --- a/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIToExtensionInformation.java +++ b/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIToExtensionInformation.java @@ -20,19 +20,20 @@ package org.openecomp.aai.parsers.uri; -import com.google.common.base.CaseFormat; -import com.google.common.base.Joiner; +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.util.ArrayList; +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; import org.openecomp.aai.restcore.HttpMethod; import org.openecomp.aai.serialization.db.EdgeType; - -import javax.ws.rs.core.MultivaluedMap; -import java.io.UnsupportedEncodingException; -import java.net.URI; -import java.util.ArrayList; -import java.util.List; +import com.google.common.base.CaseFormat; +import com.google.common.base.Joiner; /** * The Class URIToExtensionInformation. diff --git a/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIToObject.java b/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIToObject.java index decd803f..57a1de57 100644 --- a/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIToObject.java +++ b/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIToObject.java @@ -20,6 +20,13 @@ 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; @@ -27,12 +34,6 @@ 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. diff --git a/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIToRelationshipObject.java b/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIToRelationshipObject.java index a5429000..830b0bf3 100644 --- a/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIToRelationshipObject.java +++ b/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIToRelationshipObject.java @@ -20,6 +20,14 @@ 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; @@ -29,13 +37,6 @@ 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. * diff --git a/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIValidate.java b/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIValidate.java index b7c0958c..6eed095e 100644 --- a/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIValidate.java +++ b/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIValidate.java @@ -20,12 +20,12 @@ 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 diff --git a/aai-core/src/main/java/org/openecomp/aai/rest/db/HttpEntry.java b/aai-core/src/main/java/org/openecomp/aai/rest/db/HttpEntry.java index b2358110..226e6023 100644 --- a/aai-core/src/main/java/org/openecomp/aai/rest/db/HttpEntry.java +++ b/aai-core/src/main/java/org/openecomp/aai/rest/db/HttpEntry.java @@ -268,7 +268,7 @@ public class HttpEntry { } break; - case PUT: + case PUT: if (isNewVertex) { v = serializer.createNewVertex(obj); } @@ -469,8 +469,8 @@ public class HttpEntry { return obj; } - + /** * Creates the not found message. * diff --git a/aai-core/src/main/java/org/openecomp/aai/rest/ueb/UEBNotification.java b/aai-core/src/main/java/org/openecomp/aai/rest/ueb/UEBNotification.java index 1c739870..fdba3081 100644 --- a/aai-core/src/main/java/org/openecomp/aai/rest/ueb/UEBNotification.java +++ b/aai-core/src/main/java/org/openecomp/aai/rest/ueb/UEBNotification.java @@ -51,7 +51,7 @@ public class UEBNotification { private Loader currentVersionLoader = null; protected List<NotificationEvent> events = null; private Version notificationVersion = null; - + /** * Instantiates a new UEB notification. * diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/db/DBSerializer.java b/aai-core/src/main/java/org/openecomp/aai/serialization/db/DBSerializer.java index 3536d137..c04c460a 100644 --- a/aai-core/src/main/java/org/openecomp/aai/serialization/db/DBSerializer.java +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/db/DBSerializer.java @@ -21,19 +21,46 @@ package org.openecomp.aai.serialization.db; -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 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 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.*; +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.javatuples.Pair; import org.openecomp.aai.db.props.AAIProperties; import org.openecomp.aai.exceptions.AAIException; -import org.openecomp.aai.introspection.*; +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.exceptions.AAIUnknownObjectException; import org.openecomp.aai.introspection.sideeffect.DataCopy; import org.openecomp.aai.introspection.sideeffect.DataLinkReader; @@ -54,18 +81,10 @@ import org.openecomp.aai.util.AAIConfig; import org.openecomp.aai.util.AAIConstants; import org.openecomp.aai.workarounds.NamingExceptions; -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; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import com.google.common.base.CaseFormat; +import com.thinkaurelius.titan.core.SchemaViolationException; public class DBSerializer { @@ -531,7 +550,7 @@ public class DBSerializer { String parentUri = parent.<String>property(AAIProperties.AAI_URI).orElse(null); if (parentUri != null) { String uri; - uri = obj.getURI(); + uri = obj.getURI(); child.property(AAIProperties.AAI_URI, parentUri + uri); } processObject(obj, child, requestContext); diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/db/EdgeRule.java b/aai-core/src/main/java/org/openecomp/aai/serialization/db/EdgeRule.java index 1b6c19f0..d8e3f47c 100644 --- a/aai-core/src/main/java/org/openecomp/aai/serialization/db/EdgeRule.java +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/db/EdgeRule.java @@ -20,11 +20,11 @@ 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 = ""; diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/db/EdgeRules.java b/aai-core/src/main/java/org/openecomp/aai/serialization/db/EdgeRules.java index 6e5201b2..0aeafabc 100644 --- a/aai-core/src/main/java/org/openecomp/aai/serialization/db/EdgeRules.java +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/db/EdgeRules.java @@ -20,13 +20,20 @@ package org.openecomp.aai.serialization.db; -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 static com.jayway.jsonpath.Criteria.where; +import static com.jayway.jsonpath.Filter.filter; + +import java.io.InputStream; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Optional; +import java.util.Scanner; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; + 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; @@ -39,13 +46,13 @@ import org.openecomp.aai.introspection.Version; import org.openecomp.aai.serialization.db.exceptions.EdgeMultiplicityException; import org.openecomp.aai.serialization.db.exceptions.NoEdgeRuleFoundException; -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; +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; public class EdgeRules { diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/db/GraphSingleton.java b/aai-core/src/main/java/org/openecomp/aai/serialization/db/GraphSingleton.java index ba616387..46cdca5a 100644 --- a/aai-core/src/main/java/org/openecomp/aai/serialization/db/GraphSingleton.java +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/db/GraphSingleton.java @@ -20,11 +20,11 @@ package org.openecomp.aai.serialization.db; -import com.thinkaurelius.titan.core.TitanGraph; +import java.util.concurrent.atomic.AtomicInteger; + import org.openecomp.aai.dbmap.AAIGraph; import org.openecomp.aai.dbmap.DBConnectionType; - -import java.util.concurrent.atomic.AtomicInteger; +import com.thinkaurelius.titan.core.TitanGraph; /* This class simply calls AAIGraph under the covers for now */ public class GraphSingleton { diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/db/LegacyDBSerializer.java b/aai-core/src/main/java/org/openecomp/aai/serialization/db/LegacyDBSerializer.java index 5d419852..36469610 100644 --- a/aai-core/src/main/java/org/openecomp/aai/serialization/db/LegacyDBSerializer.java +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/db/LegacyDBSerializer.java @@ -24,6 +24,7 @@ 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 { diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/engines/TitanDBEngine.java b/aai-core/src/main/java/org/openecomp/aai/serialization/engines/TitanDBEngine.java index 0d00705f..8611ba6b 100644 --- a/aai-core/src/main/java/org/openecomp/aai/serialization/engines/TitanDBEngine.java +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/engines/TitanDBEngine.java @@ -20,16 +20,16 @@ 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 { /** diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/engines/TransactionalGraphEngine.java b/aai-core/src/main/java/org/openecomp/aai/serialization/engines/TransactionalGraphEngine.java index 51917fe6..ef91a868 100644 --- a/aai-core/src/main/java/org/openecomp/aai/serialization/engines/TransactionalGraphEngine.java +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/engines/TransactionalGraphEngine.java @@ -20,8 +20,9 @@ package org.openecomp.aai.serialization.engines; -import com.thinkaurelius.titan.core.TitanGraph; -import com.thinkaurelius.titan.core.schema.TitanManagement; +import java.util.List; +import java.util.concurrent.atomic.AtomicInteger; + 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; @@ -36,8 +37,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 java.util.List; -import java.util.concurrent.atomic.AtomicInteger; +import com.thinkaurelius.titan.core.TitanGraph; +import com.thinkaurelius.titan.core.schema.TitanManagement; public abstract class TransactionalGraphEngine { diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/engines/query/GraphTraversalQueryEngine.java b/aai-core/src/main/java/org/openecomp/aai/serialization/engines/query/GraphTraversalQueryEngine.java index 074441c5..ac8b21e1 100644 --- a/aai-core/src/main/java/org/openecomp/aai/serialization/engines/query/GraphTraversalQueryEngine.java +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/engines/query/GraphTraversalQueryEngine.java @@ -21,6 +21,15 @@ package org.openecomp.aai.serialization.engines.query; +import static org.openecomp.aai.serialization.db.AAIDirection.IN; +import static org.openecomp.aai.serialization.db.AAIDirection.NONE; +import static org.openecomp.aai.serialization.db.AAIDirection.OUT; +import static org.openecomp.aai.serialization.db.EdgeProperty.CONTAINS; +import static org.openecomp.aai.serialization.db.EdgeProperty.DELETE_OTHER_V; + +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; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; @@ -33,13 +42,6 @@ import org.apache.tinkerpop.gremlin.structure.Vertex; import org.openecomp.aai.db.props.AAIProperties; import org.openecomp.aai.introspection.Loader; -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. * This controls all the queries performed by the CRUD API in A&AI. diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/engines/query/GremlinPipelineQueryEngine.java b/aai-core/src/main/java/org/openecomp/aai/serialization/engines/query/GremlinPipelineQueryEngine.java index 809b6d96..a690ff65 100644 --- a/aai-core/src/main/java/org/openecomp/aai/serialization/engines/query/GremlinPipelineQueryEngine.java +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/engines/query/GremlinPipelineQueryEngine.java @@ -1,4 +1,4 @@ -package org.openecomp.aai.serialization.engines.query;/*- +/*- * ============LICENSE_START======================================================= * org.openecomp.aai * ================================================================================ diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/engines/query/GremlinQueryEngine.java b/aai-core/src/main/java/org/openecomp/aai/serialization/engines/query/GremlinQueryEngine.java index 1ca02112..1a6aa6d0 100644 --- a/aai-core/src/main/java/org/openecomp/aai/serialization/engines/query/GremlinQueryEngine.java +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/engines/query/GremlinQueryEngine.java @@ -1,4 +1,4 @@ -package org.openecomp.aai.serialization.engines.query;/*- +/*- * ============LICENSE_START======================================================= * org.openecomp.aai * ================================================================================ diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/engines/query/QueryEngine.java b/aai-core/src/main/java/org/openecomp/aai/serialization/engines/query/QueryEngine.java index 5ac94d6c..f77f726d 100644 --- a/aai-core/src/main/java/org/openecomp/aai/serialization/engines/query/QueryEngine.java +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/engines/query/QueryEngine.java @@ -20,17 +20,18 @@ 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; diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/Console.java b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/Console.java index 561fd6cf..c5746327 100644 --- a/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/Console.java +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/Console.java @@ -20,8 +20,8 @@ package org.openecomp.aai.serialization.queryformats; -import com.google.gson.JsonObject; import org.openecomp.aai.serialization.queryformats.exceptions.AAIFormatVertexException; +import com.google.gson.JsonObject; public class Console implements FormatMapper { diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/FormatFactory.java b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/FormatFactory.java index 7753ae77..031e2a32 100644 --- a/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/FormatFactory.java +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/FormatFactory.java @@ -30,9 +30,6 @@ 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; diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/FormatMapper.java b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/FormatMapper.java index e9f17c6b..6759d3b7 100644 --- a/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/FormatMapper.java +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/FormatMapper.java @@ -20,8 +20,8 @@ package org.openecomp.aai.serialization.queryformats; -import com.google.gson.JsonObject; import org.openecomp.aai.serialization.queryformats.exceptions.AAIFormatVertexException; +import com.google.gson.JsonObject; public interface FormatMapper { diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/Formatter.java b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/Formatter.java index 26b0411e..783d52e1 100644 --- a/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/Formatter.java +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/Formatter.java @@ -20,16 +20,16 @@ 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 { diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/GraphSON.java b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/GraphSON.java index 9d119875..fa0d9650 100644 --- a/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/GraphSON.java +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/GraphSON.java @@ -20,17 +20,18 @@ package org.openecomp.aai.serialization.queryformats; -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; + 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 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; public class GraphSON implements FormatMapper { diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/IdURL.java b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/IdURL.java index d0496c65..25f291a1 100644 --- a/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/IdURL.java +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/IdURL.java @@ -20,9 +20,8 @@ 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; @@ -30,6 +29,8 @@ 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 { diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/PathedURL.java b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/PathedURL.java index 09383c9a..a74150f6 100644 --- a/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/PathedURL.java +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/PathedURL.java @@ -20,9 +20,8 @@ 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; @@ -30,6 +29,8 @@ 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 { diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/RawFormat.java b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/RawFormat.java index 489df26d..070e22f4 100644 --- a/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/RawFormat.java +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/RawFormat.java @@ -20,10 +20,9 @@ package org.openecomp.aai.serialization.queryformats; -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; + import org.apache.tinkerpop.gremlin.structure.Direction; import org.apache.tinkerpop.gremlin.structure.Vertex; import org.apache.tinkerpop.gremlin.structure.VertexProperty; @@ -35,8 +34,10 @@ 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 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; public class RawFormat implements FormatMapper { diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/Resource.java b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/Resource.java index 0a557ff9..9a090a4b 100644 --- a/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/Resource.java +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/Resource.java @@ -20,8 +20,10 @@ package org.openecomp.aai.serialization.queryformats; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.List; + import org.apache.tinkerpop.gremlin.structure.Vertex; import org.openecomp.aai.db.props.AAIProperties; import org.openecomp.aai.exceptions.AAIException; @@ -34,9 +36,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 java.io.UnsupportedEncodingException; -import java.util.ArrayList; -import java.util.List; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; public class Resource implements FormatMapper { diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/SimpleFormat.java b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/SimpleFormat.java index 6e153193..f3a2990c 100644 --- a/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/SimpleFormat.java +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/SimpleFormat.java @@ -20,7 +20,10 @@ package org.openecomp.aai.serialization.queryformats; -import com.google.gson.JsonObject; +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.List; + import org.apache.tinkerpop.gremlin.structure.Vertex; import org.openecomp.aai.db.props.AAIProperties; import org.openecomp.aai.exceptions.AAIException; @@ -28,9 +31,7 @@ import org.openecomp.aai.introspection.Introspector; import org.openecomp.aai.introspection.exceptions.AAIUnknownObjectException; import org.openecomp.aai.serialization.queryformats.exceptions.AAIFormatVertexException; -import java.io.UnsupportedEncodingException; -import java.util.ArrayList; -import java.util.List; +import com.google.gson.JsonObject; public class SimpleFormat extends RawFormat { diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/utils/QueryParamInjector.java b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/utils/QueryParamInjector.java index 22ff9b33..725152dd 100644 --- a/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/utils/QueryParamInjector.java +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/utils/QueryParamInjector.java @@ -20,16 +20,17 @@ 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; diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/utils/UrlBuilder.java b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/utils/UrlBuilder.java index f988ee9e..5579c8a6 100644 --- a/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/utils/UrlBuilder.java +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/utils/UrlBuilder.java @@ -20,6 +20,10 @@ 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.exceptions.AAIException; import org.openecomp.aai.introspection.Version; @@ -29,10 +33,6 @@ 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; @@ -56,7 +56,7 @@ public class UrlBuilder { try { final StringBuilder result = new StringBuilder(); final URI uri = this.serializer.getURIForVertex(v); - + if (this.version.compareTo(Version.v11) >= 0) { result.append(AAIConstants.AAI_APP_ROOT); } else { @@ -65,7 +65,7 @@ public class UrlBuilder { result.append(this.version); result.append(uri); - return result.toString(); + return result.toString(); } catch (UnsupportedEncodingException | IllegalArgumentException | SecurityException e) { throw new AAIFormatVertexException(e); } diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/tinkerpop/TreeBackedEdge.java b/aai-core/src/main/java/org/openecomp/aai/serialization/tinkerpop/TreeBackedEdge.java index 774ab28f..cb71383f 100644 --- a/aai-core/src/main/java/org/openecomp/aai/serialization/tinkerpop/TreeBackedEdge.java +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/tinkerpop/TreeBackedEdge.java @@ -20,6 +20,8 @@ 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; @@ -27,8 +29,6 @@ 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, diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/tinkerpop/TreeBackedVertex.java b/aai-core/src/main/java/org/openecomp/aai/serialization/tinkerpop/TreeBackedVertex.java index 7ebad216..c51c3c2d 100644 --- a/aai-core/src/main/java/org/openecomp/aai/serialization/tinkerpop/TreeBackedVertex.java +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/tinkerpop/TreeBackedVertex.java @@ -20,15 +20,19 @@ 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. diff --git a/aai-core/src/main/java/org/openecomp/aai/util/AAIApiServerURLBase.java b/aai-core/src/main/java/org/openecomp/aai/util/AAIApiServerURLBase.java index 38419cb1..12a2c06d 100644 --- a/aai-core/src/main/java/org/openecomp/aai/util/AAIApiServerURLBase.java +++ b/aai-core/src/main/java/org/openecomp/aai/util/AAIApiServerURLBase.java @@ -72,8 +72,8 @@ public class AAIApiServerURLBase { */ public static String get(Version v) throws AAIException { String hostName = null; - hostName = AAIApiServerURLBase.get(); - + hostName = AAIApiServerURLBase.get(); + return hostName; } diff --git a/aai-core/src/main/java/org/openecomp/aai/util/AAIConstants.java b/aai-core/src/main/java/org/openecomp/aai/util/AAIConstants.java index 293ee723..6c23c6e3 100644 --- a/aai-core/src/main/java/org/openecomp/aai/util/AAIConstants.java +++ b/aai-core/src/main/java/org/openecomp/aai/util/AAIConstants.java @@ -81,8 +81,8 @@ public final class AAIConstants { public static final String AAI_OLDSERVER_URL = "aai.oldserver.url"; public static final String AAI_GLOBAL_CALLBACK_URL = "aai.global.callback.url"; public static final String AAI_LOCAL_REST = "https://localhost:%d/aai/" + AAIProperties.LATEST + "/"; - public static final String AAI_APP_ROOT = "/aai/"; - + public static final String AAI_APP_ROOT = "/aai/"; + public static final int AAI_RESOURCES_PORT = 8447; public static final int AAI_QUERY_PORT = 8446; public static final int AAI_LEGACY_PORT = 8443; diff --git a/aai-core/src/main/java/org/openecomp/aai/util/GenerateXsd.java b/aai-core/src/main/java/org/openecomp/aai/util/GenerateXsd.java index 7c79cdb0..76c954e7 100644 --- a/aai-core/src/main/java/org/openecomp/aai/util/GenerateXsd.java +++ b/aai-core/src/main/java/org/openecomp/aai/util/GenerateXsd.java @@ -22,59 +22,46 @@ package org.openecomp.aai.util; import java.io.BufferedWriter; import java.io.File; -import java.io.FileWriter; +import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; -import java.io.FileInputStream; -import java.nio.file.Path; -import java.nio.file.Paths; +import java.lang.reflect.Field; import java.nio.charset.Charset; import java.nio.file.Files; -import java.lang.reflect.Field; +import java.nio.file.Path; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; +import java.util.Collections; import java.util.HashMap; -import java.util.HashSet; import java.util.Iterator; -import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Scanner; -import java.util.Set; import java.util.StringTokenizer; import java.util.Vector; import javax.xml.XMLConstants; -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.SchemaOutputResolver; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.transform.Result; -import javax.xml.transform.stream.StreamResult; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathExpression; import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathFactory; +import org.openecomp.aai.dbmodel.DbEdgeRules; +import org.openecomp.aai.introspection.Version; +import org.openecomp.aai.serialization.db.EdgeProperty; import org.w3c.dom.Attr; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.NodeList; -import org.openecomp.aai.dbmodel.DbEdgeRules; -import org.openecomp.aai.db.props.AAIProperties; -import org.openecomp.aai.introspection.Version; -import org.openecomp.aai.serialization.db.EdgeRule; -import org.openecomp.aai.serialization.db.EdgeRules; - import com.google.common.base.Joiner; import com.google.common.collect.Multimap; -import com.jayway.jsonpath.Criteria; -import com.jayway.jsonpath.DocumentContext; import com.jayway.jsonpath.JsonPath; @@ -334,7 +321,7 @@ public class GenerateXsd { if ( fileTypeToGen.equals(generateTypeXSD) ) { useAnnotationsInXsd = versionUsesAnnotations(apiVersion); outfileName = xsd_dir + "/aai_schema_" + apiVersion + "." + generateTypeXSD; - fileContent = processOxmFile( oxm_file); + fileContent = processOxmFile(oxm_file, v); } else if ( versionSupportsSwagger(apiVersion )) { outfileName = yaml_dir + "/aai_swagger_" + apiVersion + "." + generateTypeYAML; fileContent = generateSwaggerFromOxmFile( oxm_file); @@ -703,9 +690,9 @@ public class GenerateXsd { } - public static String processOxmFile( File oxmFile ) + public static String processOxmFile( File oxmFile, Version v ) { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n"); String namespace = "org.openecomp"; if ( useAnnotationsInXsd ) { @@ -871,13 +858,13 @@ public class GenerateXsd { edgeDes.setDirection(direction); multiplicity = (String)edgeMap.get("multiplicity"); edgeDes.setMultiplicity(multiplicity); - isParent = (String)edgeMap.get("isParent"); - if ( isParent != null && isParent.equals("true")) { + isParent = (String)edgeMap.get(EdgeProperty.CONTAINS.toString()); + if ( "${direction}".equals(isParent)) { edgeDes.setType(LineageType.PARENT); } else { edgeDes.setType(LineageType.UNRELATED); } - hasDelTarget = (String)edgeMap.get("hasDelTarget"); + hasDelTarget = (String)edgeMap.get(EdgeProperty.DELETE_OTHER_V.toString()); edgeDes.setHasDelTarget(hasDelTarget); result.add(edgeDes); |