aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--aai-core/pom.xml23
-rw-r--r--aai-core/src/main/java/org/onap/aai/domain/responseMessage/AAIResponseMessageData.java58
-rw-r--r--aai-core/src/main/java/org/onap/aai/query/builder/GremlinQueryBuilder.java1420
-rw-r--r--aai-schema-ingest/pom.xml10
-rw-r--r--aai-schema/src/main/resources/onap/aai_schema/aai_schema_v14.xsd35
-rw-r--r--aai-schema/src/main/resources/onap/dbedgerules/v14/DbEdgeRules_hpa_v14.json25
-rw-r--r--aai-schema/src/main/resources/onap/oxm/v14/aai_oxm_v14.xml61
-rw-r--r--aai-utils/pom.xml2
8 files changed, 886 insertions, 748 deletions
diff --git a/aai-core/pom.xml b/aai-core/pom.xml
index 4715bcf6..6ba76996 100644
--- a/aai-core/pom.xml
+++ b/aai-core/pom.xml
@@ -45,10 +45,11 @@
<eelf.core.version>1.0.0</eelf.core.version>
<logback.version>1.2.3</logback.version>
<freemarker.version>2.3.21</freemarker.version>
- <activemq.version>5.15.3</activemq.version>
+ <activemq.version>5.15.6</activemq.version>
<jacoco.line.coverage.limit>0.50</jacoco.line.coverage.limit>
<gremlin.version>3.2.2</gremlin.version>
- <jetty.version>9.4.6.v20170531</jetty.version>
+ <groovy.version>2.4.15</groovy.version>
+ <jetty.version>9.4.11.v20180605</jetty.version>
<!-- Start of Default ONAP Schema Properties -->
<aai.wiki.link>https://wiki.onap.org/</aai.wiki.link>
@@ -781,6 +782,10 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>dom4j</groupId>
+ <artifactId>dom4j</artifactId>
+ </exclusion>
</exclusions>
</dependency>
<dependency>
@@ -796,12 +801,12 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
- <version>4.3.6.RELEASE</version>
+ <version>4.3.18.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
- <version>4.3.6.RELEASE</version>
+ <version>4.3.18.RELEASE</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
@@ -943,10 +948,16 @@
<artifactId>json-patch</artifactId>
<version>1.9</version>
</dependency>
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy</artifactId>
+ <version>${groovy.version}</version>
+ <classifier>indy</classifier>
+ </dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
- <version>4.3.16.RELEASE</version>
+ <version>4.3.18.RELEASE</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -980,7 +991,7 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jms</artifactId>
- <version>4.3.16.RELEASE</version>
+ <version>4.3.18.RELEASE</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
diff --git a/aai-core/src/main/java/org/onap/aai/domain/responseMessage/AAIResponseMessageData.java b/aai-core/src/main/java/org/onap/aai/domain/responseMessage/AAIResponseMessageData.java
index 49fb0c1e..1f40906f 100644
--- a/aai-core/src/main/java/org/onap/aai/domain/responseMessage/AAIResponseMessageData.java
+++ b/aai-core/src/main/java/org/onap/aai/domain/responseMessage/AAIResponseMessageData.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright © 2018 IBM.
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -39,39 +41,39 @@ import javax.xml.bind.annotation.XmlType;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
- "aaiResponseMessageDatum",
- "any"
+ "aaiResponseMessageDatum",
+ "any"
})
@XmlRootElement(name = "aai-response-message-data", namespace = "http://org.onap.aai.inventory")
public class AAIResponseMessageData {
- @XmlElement(name = "aai-response-message-datum")
- protected List<AAIResponseMessageDatum> aaiResponseMessageDatum;
- @XmlAnyElement(lax = true)
- protected List<Object> any;
+ @XmlElement(name = "aai-response-message-datum")
+ protected List<AAIResponseMessageDatum> aaiResponseMessageDatum;
+ @XmlAnyElement(lax = true)
+ protected List<Object> any;
- /**
- * Gets the AAI response message datum.
- *
- * @return the AAI response message datum
- */
- public List<AAIResponseMessageDatum> getAAIResponseMessageDatum() {
- if (aaiResponseMessageDatum == null) {
- aaiResponseMessageDatum = new ArrayList<AAIResponseMessageDatum>();
- }
- return this.aaiResponseMessageDatum;
- }
+ /**
+ * Gets the AAI response message datum.
+ *
+ * @return the AAI response message datum
+ */
+ public List<AAIResponseMessageDatum> getAAIResponseMessageDatum() {
+ if (aaiResponseMessageDatum == null) {
+ aaiResponseMessageDatum = new ArrayList<>();
+ }
+ return this.aaiResponseMessageDatum;
+ }
- /**
- * Gets the any.
- *
- * @return the any
- */
- public List<Object> getAny() {
- if (any == null) {
- any = new ArrayList<Object>();
- }
- return this.any;
- }
+ /**
+ * Gets the any.
+ *
+ * @return the any
+ */
+ public List<Object> getAny() {
+ if (any == null) {
+ any = new ArrayList<>();
+ }
+ return this.any;
+ }
}
diff --git a/aai-core/src/main/java/org/onap/aai/query/builder/GremlinQueryBuilder.java b/aai-core/src/main/java/org/onap/aai/query/builder/GremlinQueryBuilder.java
index 683f4729..2cc78f44 100644
--- a/aai-core/src/main/java/org/onap/aai/query/builder/GremlinQueryBuilder.java
+++ b/aai-core/src/main/java/org/onap/aai/query/builder/GremlinQueryBuilder.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright © 2018 IBM.
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -49,100 +51,102 @@ import java.util.*;
*/
public abstract class GremlinQueryBuilder<E> extends QueryBuilder<E> {
- private GremlinGroovyShellSingleton gremlinGroovy = GremlinGroovyShellSingleton.getInstance();
- private GraphTraversal<?, ?> completeTraversal = null;
- protected List<String> list = null;
-
- /**
- * Instantiates a new gremlin query builder.
- *
- * @param loader the loader
- */
- public GremlinQueryBuilder(Loader loader, GraphTraversalSource source) {
- super(loader, source);
- list = new ArrayList<>();
- }
-
- /**
- * Instantiates a new gremlin query builder.
- *
- * @param loader the loader
- * @param start the start
- */
- public GremlinQueryBuilder(Loader loader, GraphTraversalSource source, Vertex start) {
- super(loader, source, start);
- list = new ArrayList<>();
- }
-
- @Override
- public QueryBuilder<Vertex> exactMatchQuery(Introspector obj) {
- // TODO not implemented because this is implementation is no longer used
- this.createKeyQuery(obj);
- this.createContainerQuery(obj);
- return (QueryBuilder<Vertex>) this;
- }
-
- /**
- * @{inheritDoc}
- */
- @Override
- public QueryBuilder<Vertex> getVerticesByProperty(String key, Object value) {
-
- String term = "";
- if (value != null && !(value instanceof String) ) {
- term = value.toString();
- } else {
- term = "'" + value + "'";
- }
- list.add(".has('" + key + "', " + term + ")");
- stepIndex++;
- return (QueryBuilder<Vertex>) this;
- }
-
- @Override
- public QueryBuilder<Vertex> getVerticesByBooleanProperty(String key, Object value) {
- boolean bValue = false;
-
- if(value instanceof String){
- bValue = Boolean.valueOf(value.toString());
- } else if(value instanceof Boolean){
- bValue = (Boolean) value;
- }
-
- list.add(".has('" + key + "', " + bValue + ")");
- stepIndex++;
- return (QueryBuilder<Vertex>) this;
- }
-
- /**
- * @{inheritDoc}
- */
- @Override
- public QueryBuilder<Vertex> getVerticesByProperty(String key, List<?> values) {
-
- String predicate = "P.within(#!#argument#!#)";
- List<String> arguments = new ArrayList<>();
- for (Object item : values) {
- if (item != null && !(item instanceof String)) {
- arguments.add(item.toString());
- } else {
- arguments.add("'" + item + "'");
- }
- }
- String argument = Joiner.on(",").join(arguments);
- predicate = predicate.replace("#!#argument#!#", argument);
- list.add(".has('" + key + "', " + predicate + ")");
- stepIndex++;
- return (QueryBuilder<Vertex>) this;
- }
-
- /**
+ private static final String ARGUMENT2 = "#!#argument#!#";
+ private static final String HAS = ".has('";
+ private GremlinGroovyShellSingleton gremlinGroovy = GremlinGroovyShellSingleton.getInstance();
+ private GraphTraversal<?, ?> completeTraversal = null;
+ protected List<String> list = null;
+
+ /**
+ * Instantiates a new gremlin query builder.
+ *
+ * @param loader the loader
+ */
+ public GremlinQueryBuilder(Loader loader, GraphTraversalSource source) {
+ super(loader, source);
+ list = new ArrayList<>();
+ }
+
+ /**
+ * Instantiates a new gremlin query builder.
+ *
+ * @param loader the loader
+ * @param start the start
+ */
+ public GremlinQueryBuilder(Loader loader, GraphTraversalSource source, Vertex start) {
+ super(loader, source, start);
+ list = new ArrayList<>();
+ }
+
+ @Override
+ public QueryBuilder<Vertex> exactMatchQuery(Introspector obj) {
+ // TODO not implemented because this is implementation is no longer used
+ this.createKeyQuery(obj);
+ this.createContainerQuery(obj);
+ return (QueryBuilder<Vertex>) this;
+ }
+
+ /**
+ * @{inheritDoc}
+ */
+ @Override
+ public QueryBuilder<Vertex> getVerticesByProperty(String key, Object value) {
+
+ String term = "";
+ if (value != null && !(value instanceof String) ) {
+ term = value.toString();
+ } else {
+ term = "'" + value + "'";
+ }
+ list.add(HAS + key + "', " + term + ")");
+ stepIndex++;
+ return (QueryBuilder<Vertex>) this;
+ }
+
+ @Override
+ public QueryBuilder<Vertex> getVerticesByBooleanProperty(String key, Object value) {
+ boolean bValue = false;
+
+ if(value instanceof String){
+ bValue = Boolean.valueOf(value.toString());
+ } else if(value instanceof Boolean){
+ bValue = (Boolean) value;
+ }
+
+ list.add(HAS + key + "', " + bValue + ")");
+ stepIndex++;
+ return (QueryBuilder<Vertex>) this;
+ }
+
+ /**
+ * @{inheritDoc}
+ */
+ @Override
+ public QueryBuilder<Vertex> getVerticesByProperty(String key, List<?> values) {
+
+ String predicate = "P.within(#!#argument#!#)";
+ List<String> arguments = new ArrayList<>();
+ for (Object item : values) {
+ if (item != null && !(item instanceof String)) {
+ arguments.add(item.toString());
+ } else {
+ arguments.add("'" + item + "'");
+ }
+ }
+ String argument = Joiner.on(",").join(arguments);
+ predicate = predicate.replace(ARGUMENT2, argument);
+ list.add(HAS + key + "', " + predicate + ")");
+ stepIndex++;
+ return (QueryBuilder<Vertex>) this;
+ }
+
+ /**
* @{inheritDoc}
*/
@Override
public QueryBuilder<Vertex> getVerticesByProperty(String key) {
- list.add(".has('" + key + "')");
+ list.add(HAS + key + "')");
stepIndex++;
return (QueryBuilder<Vertex>) this;
}
@@ -153,72 +157,71 @@ public abstract class GremlinQueryBuilder<E> extends QueryBuilder<E> {
@Override
public QueryBuilder<Vertex> getVerticesExcludeByProperty(String key) {
- String term = "";
list.add(".hasNot('" + key + "')");
stepIndex++;
return (QueryBuilder<Vertex>) this;
}
- /**
- * @{inheritDoc}
- */
- @Override
- public QueryBuilder<Vertex> getVerticesStartsWithProperty(String key, Object value) {
-
- String term = "";
- String predicate = "org.janusgraph.core.attribute.Text.textPrefix(#!#argument#!#)";
- if (value != null && !(value instanceof String) ) {
- term = value.toString();
- } else {
- term = "'" + value + "'";
- }
- predicate = predicate.replace("#!#argument#!#", term);
- list.add(".has('" + key + "', " + predicate + ")");
- stepIndex++;
- return (QueryBuilder<Vertex>) this;
- }
-
- /**
- * @{inheritDoc}
- */
- @Override
- public QueryBuilder<Vertex> getVerticesExcludeByProperty(String key, Object value) {
-
- String term = "";
- String predicate = "P.neq(#!#argument#!#)";
- if (value != null && !(value instanceof String) ) {
- term = value.toString();
- } else {
- term = "'" + value + "'";
- }
- predicate = predicate.replace("#!#argument#!#", term);
- list.add(".has('" + key + "', " + predicate + ")");
- stepIndex++;
- return (QueryBuilder<Vertex>) this;
- }
-
- /**
- * @{inheritDoc}
- */
- @Override
- public QueryBuilder<Vertex> getVerticesExcludeByProperty(String key, List<?> values) {
-
- String predicate = "P.without(#!#argument#!#)";
- List<String> arguments = new ArrayList<>();
- for (Object item : values) {
- if (item != null && !(item instanceof String)) {
- arguments.add(item.toString());
- } else {
- arguments.add("'" + item + "'");
- }
- }
- String argument = Joiner.on(",").join(arguments);
- predicate = predicate.replace("#!#argument#!#", argument);
- list.add(".has('" + key + "', " + predicate + ")");
- stepIndex++;
- return (QueryBuilder<Vertex>) this;
- }
-
+ /**
+ * @{inheritDoc}
+ */
+ @Override
+ public QueryBuilder<Vertex> getVerticesStartsWithProperty(String key, Object value) {
+
+ String term = "";
+ String predicate = "org.janusgraph.core.attribute.Text.textPrefix(#!#argument#!#)";
+ if (value != null && !(value instanceof String) ) {
+ term = value.toString();
+ } else {
+ term = "'" + value + "'";
+ }
+ predicate = predicate.replace(ARGUMENT2, term);
+ list.add(HAS + key + "', " + predicate + ")");
+ stepIndex++;
+ return (QueryBuilder<Vertex>) this;
+ }
+
+ /**
+ * @{inheritDoc}
+ */
+ @Override
+ public QueryBuilder<Vertex> getVerticesExcludeByProperty(String key, Object value) {
+
+ String term = "";
+ String predicate = "P.neq(#!#argument#!#)";
+ if (value != null && !(value instanceof String) ) {
+ term = value.toString();
+ } else {
+ term = "'" + value + "'";
+ }
+ predicate = predicate.replace(ARGUMENT2, term);
+ list.add(HAS + key + "', " + predicate + ")");
+ stepIndex++;
+ return (QueryBuilder<Vertex>) this;
+ }
+
+ /**
+ * @{inheritDoc}
+ */
+ @Override
+ public QueryBuilder<Vertex> getVerticesExcludeByProperty(String key, List<?> values) {
+
+ String predicate = "P.without(#!#argument#!#)";
+ List<String> arguments = new ArrayList<>();
+ for (Object item : values) {
+ if (item != null && !(item instanceof String)) {
+ arguments.add(item.toString());
+ } else {
+ arguments.add("'" + item + "'");
+ }
+ }
+ String argument = Joiner.on(",").join(arguments);
+ predicate = predicate.replace(ARGUMENT2, argument);
+ list.add(HAS + key + "', " + predicate + ")");
+ stepIndex++;
+ return (QueryBuilder<Vertex>) this;
+ }
+
@Override
public QueryBuilder<Vertex> getVerticesGreaterThanProperty(String key, Object value) {
String predicate = "P.gte(#!#argument1#!#)";
@@ -229,7 +232,7 @@ public abstract class GremlinQueryBuilder<E> extends QueryBuilder<E> {
term = "'" + value + "'";
}
predicate = predicate.replace("#!#argument1#!#", term);
- list.add(".has('" + key + "', " + predicate + ")");
+ list.add(HAS + key + "', " + predicate + ")");
stepIndex++;
return (QueryBuilder<Vertex>) this;
}
@@ -244,7 +247,7 @@ public abstract class GremlinQueryBuilder<E> extends QueryBuilder<E> {
term = "'" + value + "'";
}
predicate = predicate.replace("#!#argument1#!#", term);
- list.add(".has('" + key + "', " + predicate + ")");
+ list.add(HAS + key + "', " + predicate + ")");
stepIndex++;
return (QueryBuilder<Vertex>) this;
}
@@ -252,563 +255,558 @@ public abstract class GremlinQueryBuilder<E> extends QueryBuilder<E> {
- /**
- * @{inheritDoc}
- */
- @Override
- public QueryBuilder<Vertex> getChildVerticesFromParent(String parentKey, String parentValue, String childType) {
- /*
- String query = ".has('aai-node-type', '" + childType + "')";
-
- return this.processGremlinQuery(parentKey, parentValue, query);
- */
- //TODO
- return (QueryBuilder<Vertex>) this;
- }
-
- /**
- * @{inheritDoc}
- */
- @Override
- public QueryBuilder<Vertex> getTypedVerticesByMap(String type, Map<String, String> map) {
-
- for (Map.Entry<String, String> es : map.entrySet()) {
- list.add(".has('" + es.getKey() + "', '" + es.getValue() + "')");
- stepIndex++;
- }
- list.add(".has('aai-node-type', '" + type + "')");
- stepIndex++;
- return (QueryBuilder<Vertex>) this;
- }
-
- /**
- * @{inheritDoc}
- */
- @Override
- public QueryBuilder<Vertex> createKeyQuery(Introspector obj) {
- Set<String> keys = obj.getKeys();
-
- for (String key : keys) {
-
- this.getVerticesByProperty(key, obj.<Object>getValue(key));
-
- }
- return (QueryBuilder<Vertex>) this;
- }
-
- /**
- * @throws NoEdgeRuleFoundException
- * @throws AAIException
- * @{inheritDoc}
- */
- @Override
- public QueryBuilder createEdgeTraversal(EdgeType type, Introspector parent, Introspector child) throws AAIException {
- String parentName = parent.getDbName();
- String childName = child.getDbName();
- if (parent.isContainer()) {
- parentName = parent.getChildDBName();
- }
- if (child.isContainer()) {
- childName = child.getChildDBName();
- }
- this.edgeQueryToVertex(type, parentName, childName, null);
- return this;
-
- }
-
- @Override
- public QueryBuilder createPrivateEdgeTraversal(EdgeType type, Introspector parent, Introspector child) throws AAIException{
- String parentName = parent.getDbName();
- String childName = child.getDbName();
- if (parent.isContainer()) {
- parentName = parent.getChildDBName();
- }
- if (child.isContainer()) {
- childName = child.getChildDBName();
- }
- this.edgeQueryToVertex(type, parentName, childName, null, true);
- return this;
- }
-
- /**
- *
- * @{inheritDoc}
- */
- @Override
- public QueryBuilder<Vertex> createEdgeTraversalWithLabels(EdgeType type, Introspector out, Introspector in, List<String> labels) throws AAIException {
- String parentName = out.getDbName();
- String childName = in.getDbName();
- if (out.isContainer()) {
- parentName = out.getChildDBName();
- }
- if (in.isContainer()) {
- childName = in.getChildDBName();
- }
- this.edgeQueryToVertex(type, parentName, childName, labels);
- return (QueryBuilder<Vertex>) this;
- }
-
-
- public QueryBuilder<Edge> getEdgesBetweenWithLabels(EdgeType type, String outNodeType, String inNodeType, List<String> labels) throws AAIException {
- this.edgeQuery(type, outNodeType, inNodeType, labels);
- return (QueryBuilder<Edge>)this;
- }
-
- private void edgeQueryToVertex(EdgeType type, String outType, String inType, List<String> labels) throws AAIException {
- this.edgeQueryToVertex(type, outType, inType, labels, false);
- }
-
- /**
- * Edge query.
- *
- * @param outType the out type
- * @param inType the in type
- * @throws NoEdgeRuleFoundException
- * @throws AAIException
- */
- private void edgeQueryToVertex(EdgeType type, String outType, String inType, List<String> labels, boolean isPrivateEdge) throws AAIException {
- markParentBoundary();
- Multimap<String, EdgeRule> rules = ArrayListMultimap.create();
- EdgeRuleQuery.Builder qB = new EdgeRuleQuery.Builder(outType, inType).edgeType(type).setPrivate(isPrivateEdge);
-
- try {
- if (labels == null) {
- rules.putAll(edgeRules.getRules(qB.build()));
- } else {
- for (String label : labels) {
- rules.putAll(edgeRules.getRules(qB.label(label).build()));
- }
- }
- } catch (EdgeRuleNotFoundException e) {
- throw new NoEdgeRuleFoundException(e);
- }
-
- final List<String> inLabels = new ArrayList<>();
- final List<String> outLabels = new ArrayList<>();
-
- for (EdgeRule rule : rules.values()) {
- if (labels != null && !labels.contains(rule.getLabel())) {
- return;
- } else {
- if (Direction.IN.equals(rule.getDirection())) {
- inLabels.add(rule.getLabel());
- } else {
- outLabels.add(rule.getLabel());
- }
- }
- }
-
- if(inLabels.isEmpty() && outLabels.isEmpty()) {
- throw new NoEdgeRuleFoundException("no " + type.toString() + " edge rule between " + outType + " and " + inType );
- } else if (inLabels.isEmpty() && !outLabels.isEmpty()) {
- list.add(".out('" + String.join("','", outLabels) + "')");
- } else if (outLabels.isEmpty() && !inLabels.isEmpty()) {
- list.add(".in('" + String.join("','", inLabels) + "')");
- } else {
- list.add(".union(__.in('" + String.join("','", inLabels) + "')" + ", __.out('" + String.join("','", outLabels) + "'))");
- }
- stepIndex++;
- list.add(".has('" + AAIProperties.NODE_TYPE + "', '" + inType + "')");
- stepIndex++;
-
- }
-
- /**
- * Edge query.
- *
- * @param outType the out type
- * @param inType the in type
- * @throws NoEdgeRuleFoundException
- * @throws AAIException
- */
- private void edgeQuery(EdgeType type, String outType, String inType, List<String> labels) throws AAIException {
- markParentBoundary();
- Multimap<String, EdgeRule> rules = ArrayListMultimap.create();
- EdgeRuleQuery.Builder qB = new EdgeRuleQuery.Builder(outType, inType).edgeType(type);
- try {
- if (labels == null) {
- rules.putAll(edgeRules.getRules(qB.build()));
- } else {
- for (String label : labels) {
- rules.putAll(edgeRules.getRules(qB.label(label).build()));
- }
- }
- } catch (EdgeRuleNotFoundException e) {
- throw new NoEdgeRuleFoundException(e);
- }
-
- final List<String> inLabels = new ArrayList<>();
- final List<String> outLabels = new ArrayList<>();
-
- for (EdgeRule rule : rules.values()) {
- if (labels != null && !labels.contains(rule.getLabel())) {
- return;
- } else {
- if (Direction.IN.equals(rule.getDirection())) {
- inLabels.add(rule.getLabel());
- } else {
- outLabels.add(rule.getLabel());
- }
- }
- }
-
- if(inLabels.isEmpty() && outLabels.isEmpty()) {
- throw new NoEdgeRuleFoundException("no " + type.toString() + " edge rule between " + outType + " and " + inType );
- } else if (inLabels.isEmpty() && !outLabels.isEmpty()) {
- list.add(".outE('" + String.join("','", outLabels) + "')");
- } else if (outLabels.isEmpty() && !inLabels.isEmpty()) {
- list.add(".inE('" + String.join("','", inLabels) + "')");
- } else {
- list.add(".union(__.inE('" + String.join("','", inLabels) + "')" + ", __.outE('" + String.join("','", outLabels) + "'))");
- }
-
- stepIndex++;
-
- }
- @Override
- public QueryBuilder<E> limit(long amount) {
- list.add(".limit(" + amount + ")");
- return this;
- }
- /**
- * @{inheritDoc}
- */
- @Override
- public QueryBuilder<Vertex> createContainerQuery(Introspector obj) {
- String type = obj.getChildDBName();
- String abstractType = obj.getMetadata(ObjectMetadata.ABSTRACT);
- if (abstractType != null) {
- String[] inheritors = obj.getMetadata(ObjectMetadata.INHERITORS).split(",");
- String[] wrapped = new String[inheritors.length];
- StringBuilder command = new StringBuilder();
- command.append("P.within(");
- for (int i = 0; i < inheritors.length; i++) {
- wrapped[i] = "'" + inheritors[i] + "'";
- }
- command.append(Joiner.on(",").join(wrapped));
- command.append(")");
- list.add(".has('aai-node-type', " + command + ")");
-
- } else {
- list.add(".has('aai-node-type', '" + type + "')");
- }
- stepIndex++;
- this.markContainer();
- return (QueryBuilder<Vertex>) this;
- }
-
- @Override
- public QueryBuilder<E> union(QueryBuilder<E>... builder) {
- markParentBoundary();
- String[] traversals = new String[builder.length];
- StringBuilder command = new StringBuilder();
- for (int i = 0; i < builder.length; i++) {
- traversals[i] = "__" + builder[i].getQuery();
- }
- command.append(".union(");
- command.append(Joiner.on(",").join(traversals));
- command.append(")");
- list.add(command.toString());
- stepIndex++;
-
- return this;
- }
-
- @Override
- public QueryBuilder<E> where(QueryBuilder<E>... builder) {
- markParentBoundary();
- List<String> traversals = new ArrayList<>();
- for (int i = 0; i < builder.length; i++) {
- traversals.add(".where(__" + builder[i].getQuery() + ")");
- stepIndex++;
- }
- list.addAll(traversals);
-
-
- return this;
- }
-
- @Override
- public QueryBuilder<E> or(QueryBuilder<E>... builder) {
- markParentBoundary();
- String[] traversals = new String[builder.length];
- StringBuilder command = new StringBuilder();
- for (int i = 0; i < builder.length; i++) {
- traversals[i] = "__" + builder[i].getQuery();
- }
- command.append(".or(");
- command.append(Joiner.on(",").join(traversals));
- command.append(")");
- list.add(command.toString());
- stepIndex++;
-
- return this;
- }
-
- @Override
- public QueryBuilder<E> store(String name) {
- this.list.add(".store('"+ name + "')");
- stepIndex++;
-
- return this;
- }
-
- @Override
- public QueryBuilder<E> cap(String name) {
- this.list.add(".cap('"+ name + "')");
- stepIndex++;
-
- return this;
- }
-
- @Override
- public QueryBuilder<E> unfold() {
- this.list.add(".unfold()");
- stepIndex++;
-
- return this;
- }
-
- @Override
- public QueryBuilder<E> dedup() {
- this.list.add(".dedup()");
- stepIndex++;
-
- return this;
- }
-
- @Override
- public QueryBuilder<E> emit() {
- this.list.add(".emit()");
- stepIndex++;
-
- return this;
- }
-
- @Override
- public QueryBuilder<E> repeat(QueryBuilder<E> builder) {
- this.list.add(".repeat(__" + builder.getQuery() + ")");
- stepIndex++;
-
- return this;
- }
-
- @Override
- public QueryBuilder<E> until(QueryBuilder<E> builder) {
- this.list.add(".until(__" + builder.getQuery() + ")");
- stepIndex++;
-
- return this;
- }
-
- @Override
- public QueryBuilder<E> groupCount() {
- this.list.add(".groupCount()");
- stepIndex++;
-
- return this;
- }
-
- @Override
- public QueryBuilder<E> both() {
- this.list.add(".both()");
- stepIndex++;
-
- return this;
- }
-
- @Override
- public QueryBuilder<Tree> tree() {
- this.list.add(".tree()");
- stepIndex++;
-
- return (QueryBuilder<Tree>)this;
- }
-
- @Override
- public QueryBuilder<E> by(String name) {
- this.list.add(".by('"+ name + "')");
- stepIndex++;
-
- return this;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public QueryBuilder<E> simplePath(){
- this.list.add(".simplePath()");
- stepIndex++;
- return this;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public QueryBuilder<Path> path(){
- this.list.add(".path()");
- stepIndex++;
- return (QueryBuilder<Path>)this;
- }
-
- @Override
- public QueryBuilder<Edge> outE() {
- this.list.add(".outE()");
- stepIndex++;
-
- return (QueryBuilder<Edge>)this;
- }
-
- @Override
- public QueryBuilder<Edge> inE() {
- this.list.add(".inE()");
- stepIndex++;
-
- return (QueryBuilder<Edge>)this;
- }
-
- @Override
- public QueryBuilder<Vertex> outV() {
- this.list.add(".outV()");
- stepIndex++;
-
- return (QueryBuilder<Vertex>)this;
- }
-
- @Override
- public QueryBuilder<Vertex> inV() {
- this.list.add(".inV()");
- stepIndex++;
-
- return (QueryBuilder<Vertex>)this;
- }
-
- @Override
- public QueryBuilder<E> not(QueryBuilder<E> builder) {
- this.list.add(".not(" + "__" + builder.getQuery() + ")");
- stepIndex++;
-
- return this;
- }
-
- @Override
- public QueryBuilder<E> as(String name) {
- this.list.add(".as('" + name + "')");
- stepIndex++;
-
- return this;
- }
-
- @Override
- public QueryBuilder<E> select(String name) {
- this.list.add(".select('" + name + "')");
- stepIndex++;
-
- return this;
- }
- /**
- * @{inheritDoc}
- */
- @Override
- public QueryBuilder<E> getParentQuery() {
- return cloneQueryAtStep(parentStepIndex);
- }
-
- @Override
- public QueryBuilder<E> getContainerQuery() {
- return cloneQueryAtStep(containerStepIndex);
- }
-
- /**
- * @{inheritDoc}
- */
- @Override
- public <T2> T2 getQuery() {
- StringBuilder sb = new StringBuilder();
-
- for (String piece : this.list) {
- sb.append(piece);
- }
-
- return (T2)sb.toString();
- }
-
- /**
- * @{inheritDoc}
- */
- @Override
- public void markParentBoundary() {
- parentStepIndex = stepIndex;
- }
-
- @Override
- public void markContainer() {
- this.containerStepIndex = stepIndex;
- }
-
- /**
- * @{inheritDoc}
- */
- @Override
- public Vertex getStart() {
- return this.start;
- }
-
- protected int getParentStepIndex() {
- return parentStepIndex;
- }
-
- protected int getContainerStepIndex() {
- return containerStepIndex;
- }
-
- protected int getStepIndex() {
- return stepIndex;
- }
-
- private void executeQuery() {
- String queryString = "g" + Joiner.on("").join(list);
- Map<String, Object> params = new HashMap<>();
- if (this.start == null) {
- params.put("g", source.V());
- } else {
- params.put("g", source.V(this.start));
- }
- this.completeTraversal = this.gremlinGroovy.executeTraversal(queryString, params);
- }
- @Override
- public boolean hasNext() {
- if (this.completeTraversal == null) {
- executeQuery();
- }
-
- return this.completeTraversal.hasNext();
- }
-
- @Override
- public E next() {
- if (this.completeTraversal == null) {
- executeQuery();
- }
-
- return (E)this.completeTraversal.next();
- }
-
- @Override
- public List<E> toList() {
- if (this.completeTraversal == null) {
- executeQuery();
- }
-
- return (List<E>)this.completeTraversal.toList();
- }
-
- protected QueryBuilder<Edge> has(String key, String value) {
- this.list.add(".has('" + key + "','" + value + "')");
-
- return (QueryBuilder<Edge>)this;
- }
-
+ /**
+ * @{inheritDoc}
+ */
+ @Override
+ public QueryBuilder<Vertex> getChildVerticesFromParent(String parentKey, String parentValue, String childType) {
+ //TODO
+ return (QueryBuilder<Vertex>) this;
+ }
+
+ /**
+ * @{inheritDoc}
+ */
+ @Override
+ public QueryBuilder<Vertex> getTypedVerticesByMap(String type, Map<String, String> map) {
+
+ for (Map.Entry<String, String> es : map.entrySet()) {
+ list.add(HAS + es.getKey() + "', '" + es.getValue() + "')");
+ stepIndex++;
+ }
+ list.add(".has('aai-node-type', '" + type + "')");
+ stepIndex++;
+ return (QueryBuilder<Vertex>) this;
+ }
+
+ /**
+ * @{inheritDoc}
+ */
+ @Override
+ public QueryBuilder<Vertex> createKeyQuery(Introspector obj) {
+ Set<String> keys = obj.getKeys();
+
+ for (String key : keys) {
+
+ this.getVerticesByProperty(key, obj.<Object>getValue(key));
+
+ }
+ return (QueryBuilder<Vertex>) this;
+ }
+
+ /**
+ * @throws NoEdgeRuleFoundException
+ * @throws AAIException
+ * @{inheritDoc}
+ */
+ @Override
+ public QueryBuilder createEdgeTraversal(EdgeType type, Introspector parent, Introspector child) throws AAIException {
+ String parentName = parent.getDbName();
+ String childName = child.getDbName();
+ if (parent.isContainer()) {
+ parentName = parent.getChildDBName();
+ }
+ if (child.isContainer()) {
+ childName = child.getChildDBName();
+ }
+ this.edgeQueryToVertex(type, parentName, childName, null);
+ return this;
+
+ }
+
+ @Override
+ public QueryBuilder createPrivateEdgeTraversal(EdgeType type, Introspector parent, Introspector child) throws AAIException{
+ String parentName = parent.getDbName();
+ String childName = child.getDbName();
+ if (parent.isContainer()) {
+ parentName = parent.getChildDBName();
+ }
+ if (child.isContainer()) {
+ childName = child.getChildDBName();
+ }
+ this.edgeQueryToVertex(type, parentName, childName, null, true);
+ return this;
+ }
+
+ /**
+ *
+ * @{inheritDoc}
+ */
+ @Override
+ public QueryBuilder<Vertex> createEdgeTraversalWithLabels(EdgeType type, Introspector out, Introspector in, List<String> labels) throws AAIException {
+ String parentName = out.getDbName();
+ String childName = in.getDbName();
+ if (out.isContainer()) {
+ parentName = out.getChildDBName();
+ }
+ if (in.isContainer()) {
+ childName = in.getChildDBName();
+ }
+ this.edgeQueryToVertex(type, parentName, childName, labels);
+ return (QueryBuilder<Vertex>) this;
+ }
+
+
+ public QueryBuilder<Edge> getEdgesBetweenWithLabels(EdgeType type, String outNodeType, String inNodeType, List<String> labels) throws AAIException {
+ this.edgeQuery(type, outNodeType, inNodeType, labels);
+ return (QueryBuilder<Edge>)this;
+ }
+
+ private void edgeQueryToVertex(EdgeType type, String outType, String inType, List<String> labels) throws AAIException {
+ this.edgeQueryToVertex(type, outType, inType, labels, false);
+ }
+
+ /**
+ * Edge query.
+ *
+ * @param outType the out type
+ * @param inType the in type
+ * @throws NoEdgeRuleFoundException
+ * @throws AAIException
+ */
+ private void edgeQueryToVertex(EdgeType type, String outType, String inType, List<String> labels, boolean isPrivateEdge) throws AAIException {
+ markParentBoundary();
+ Multimap<String, EdgeRule> rules = ArrayListMultimap.create();
+ EdgeRuleQuery.Builder qB = new EdgeRuleQuery.Builder(outType, inType).edgeType(type).setPrivate(isPrivateEdge);
+
+ try {
+ if (labels == null) {
+ rules.putAll(edgeRules.getRules(qB.build()));
+ } else {
+ for (String label : labels) {
+ rules.putAll(edgeRules.getRules(qB.label(label).build()));
+ }
+ }
+ } catch (EdgeRuleNotFoundException e) {
+ throw new NoEdgeRuleFoundException(e);
+ }
+
+ final List<String> inLabels = new ArrayList<>();
+ final List<String> outLabels = new ArrayList<>();
+
+ for (EdgeRule rule : rules.values()) {
+ if (labels != null && !labels.contains(rule.getLabel())) {
+ return;
+ } else {
+ if (Direction.IN.equals(rule.getDirection())) {
+ inLabels.add(rule.getLabel());
+ } else {
+ outLabels.add(rule.getLabel());
+ }
+ }
+ }
+
+ if(inLabels.isEmpty() && outLabels.isEmpty()) {
+ throw new NoEdgeRuleFoundException("no " + type.toString() + " edge rule between " + outType + " and " + inType );
+ } else if (inLabels.isEmpty() && !outLabels.isEmpty()) {
+ list.add(".out('" + String.join("','", outLabels) + "')");
+ } else if (outLabels.isEmpty() && !inLabels.isEmpty()) {
+ list.add(".in('" + String.join("','", inLabels) + "')");
+ } else {
+ list.add(".union(__.in('" + String.join("','", inLabels) + "')" + ", __.out('" + String.join("','", outLabels) + "'))");
+ }
+ stepIndex++;
+ list.add(HAS + AAIProperties.NODE_TYPE + "', '" + inType + "')");
+ stepIndex++;
+
+ }
+
+ /**
+ * Edge query.
+ *
+ * @param outType the out type
+ * @param inType the in type
+ * @throws NoEdgeRuleFoundException
+ * @throws AAIException
+ */
+ private void edgeQuery(EdgeType type, String outType, String inType, List<String> labels) throws AAIException {
+ markParentBoundary();
+ Multimap<String, EdgeRule> rules = ArrayListMultimap.create();
+ EdgeRuleQuery.Builder qB = new EdgeRuleQuery.Builder(outType, inType).edgeType(type);
+ try {
+ if (labels == null) {
+ rules.putAll(edgeRules.getRules(qB.build()));
+ } else {
+ for (String label : labels) {
+ rules.putAll(edgeRules.getRules(qB.label(label).build()));
+ }
+ }
+ } catch (EdgeRuleNotFoundException e) {
+ throw new NoEdgeRuleFoundException(e);
+ }
+
+ final List<String> inLabels = new ArrayList<>();
+ final List<String> outLabels = new ArrayList<>();
+
+ for (EdgeRule rule : rules.values()) {
+ if (labels != null && !labels.contains(rule.getLabel())) {
+ return;
+ } else {
+ if (Direction.IN.equals(rule.getDirection())) {
+ inLabels.add(rule.getLabel());
+ } else {
+ outLabels.add(rule.getLabel());
+ }
+ }
+ }
+
+ if(inLabels.isEmpty() && outLabels.isEmpty()) {
+ throw new NoEdgeRuleFoundException("no " + type.toString() + " edge rule between " + outType + " and " + inType );
+ } else if (inLabels.isEmpty() && !outLabels.isEmpty()) {
+ list.add(".outE('" + String.join("','", outLabels) + "')");
+ } else if (outLabels.isEmpty() && !inLabels.isEmpty()) {
+ list.add(".inE('" + String.join("','", inLabels) + "')");
+ } else {
+ list.add(".union(__.inE('" + String.join("','", inLabels) + "')" + ", __.outE('" + String.join("','", outLabels) + "'))");
+ }
+
+ stepIndex++;
+
+ }
+ @Override
+ public QueryBuilder<E> limit(long amount) {
+ list.add(".limit(" + amount + ")");
+ return this;
+ }
+ /**
+ * @{inheritDoc}
+ */
+ @Override
+ public QueryBuilder<Vertex> createContainerQuery(Introspector obj) {
+ String type = obj.getChildDBName();
+ String abstractType = obj.getMetadata(ObjectMetadata.ABSTRACT);
+ if (abstractType != null) {
+ String[] inheritors = obj.getMetadata(ObjectMetadata.INHERITORS).split(",");
+ String[] wrapped = new String[inheritors.length];
+ StringBuilder command = new StringBuilder();
+ command.append("P.within(");
+ for (int i = 0; i < inheritors.length; i++) {
+ wrapped[i] = "'" + inheritors[i] + "'";
+ }
+ command.append(Joiner.on(",").join(wrapped));
+ command.append(")");
+ list.add(".has('aai-node-type', " + command + ")");
+
+ } else {
+ list.add(".has('aai-node-type', '" + type + "')");
+ }
+ stepIndex++;
+ this.markContainer();
+ return (QueryBuilder<Vertex>) this;
+ }
+
+ @Override
+ public QueryBuilder<E> union(QueryBuilder<E>... builder) {
+ markParentBoundary();
+ String[] traversals = new String[builder.length];
+ StringBuilder command = new StringBuilder();
+ for (int i = 0; i < builder.length; i++) {
+ traversals[i] = "__" + builder[i].getQuery();
+ }
+ command.append(".union(");
+ command.append(Joiner.on(",").join(traversals));
+ command.append(")");
+ list.add(command.toString());
+ stepIndex++;
+
+ return this;
+ }
+
+ @Override
+ public QueryBuilder<E> where(QueryBuilder<E>... builder) {
+ markParentBoundary();
+ List<String> traversals = new ArrayList<>();
+ for (int i = 0; i < builder.length; i++) {
+ traversals.add(".where(__" + builder[i].getQuery() + ")");
+ stepIndex++;
+ }
+ list.addAll(traversals);
+
+
+ return this;
+ }
+
+ @Override
+ public QueryBuilder<E> or(QueryBuilder<E>... builder) {
+ markParentBoundary();
+ String[] traversals = new String[builder.length];
+ StringBuilder command = new StringBuilder();
+ for (int i = 0; i < builder.length; i++) {
+ traversals[i] = "__" + builder[i].getQuery();
+ }
+ command.append(".or(");
+ command.append(Joiner.on(",").join(traversals));
+ command.append(")");
+ list.add(command.toString());
+ stepIndex++;
+
+ return this;
+ }
+
+ @Override
+ public QueryBuilder<E> store(String name) {
+ this.list.add(".store('"+ name + "')");
+ stepIndex++;
+
+ return this;
+ }
+
+ @Override
+ public QueryBuilder<E> cap(String name) {
+ this.list.add(".cap('"+ name + "')");
+ stepIndex++;
+
+ return this;
+ }
+
+ @Override
+ public QueryBuilder<E> unfold() {
+ this.list.add(".unfold()");
+ stepIndex++;
+
+ return this;
+ }
+
+ @Override
+ public QueryBuilder<E> dedup() {
+ this.list.add(".dedup()");
+ stepIndex++;
+
+ return this;
+ }
+
+ @Override
+ public QueryBuilder<E> emit() {
+ this.list.add(".emit()");
+ stepIndex++;
+
+ return this;
+ }
+
+ @Override
+ public QueryBuilder<E> repeat(QueryBuilder<E> builder) {
+ this.list.add(".repeat(__" + builder.getQuery() + ")");
+ stepIndex++;
+
+ return this;
+ }
+
+ @Override
+ public QueryBuilder<E> until(QueryBuilder<E> builder) {
+ this.list.add(".until(__" + builder.getQuery() + ")");
+ stepIndex++;
+
+ return this;
+ }
+
+ @Override
+ public QueryBuilder<E> groupCount() {
+ this.list.add(".groupCount()");
+ stepIndex++;
+
+ return this;
+ }
+
+ @Override
+ public QueryBuilder<E> both() {
+ this.list.add(".both()");
+ stepIndex++;
+
+ return this;
+ }
+
+ @Override
+ public QueryBuilder<Tree> tree() {
+ this.list.add(".tree()");
+ stepIndex++;
+
+ return (QueryBuilder<Tree>)this;
+ }
+
+ @Override
+ public QueryBuilder<E> by(String name) {
+ this.list.add(".by('"+ name + "')");
+ stepIndex++;
+
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public QueryBuilder<E> simplePath(){
+ this.list.add(".simplePath()");
+ stepIndex++;
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public QueryBuilder<Path> path(){
+ this.list.add(".path()");
+ stepIndex++;
+ return (QueryBuilder<Path>)this;
+ }
+
+ @Override
+ public QueryBuilder<Edge> outE() {
+ this.list.add(".outE()");
+ stepIndex++;
+
+ return (QueryBuilder<Edge>)this;
+ }
+
+ @Override
+ public QueryBuilder<Edge> inE() {
+ this.list.add(".inE()");
+ stepIndex++;
+
+ return (QueryBuilder<Edge>)this;
+ }
+
+ @Override
+ public QueryBuilder<Vertex> outV() {
+ this.list.add(".outV()");
+ stepIndex++;
+
+ return (QueryBuilder<Vertex>)this;
+ }
+
+ @Override
+ public QueryBuilder<Vertex> inV() {
+ this.list.add(".inV()");
+ stepIndex++;
+
+ return (QueryBuilder<Vertex>)this;
+ }
+
+ @Override
+ public QueryBuilder<E> not(QueryBuilder<E> builder) {
+ this.list.add(".not(" + "__" + builder.getQuery() + ")");
+ stepIndex++;
+
+ return this;
+ }
+
+ @Override
+ public QueryBuilder<E> as(String name) {
+ this.list.add(".as('" + name + "')");
+ stepIndex++;
+
+ return this;
+ }
+
+ @Override
+ public QueryBuilder<E> select(String name) {
+ this.list.add(".select('" + name + "')");
+ stepIndex++;
+
+ return this;
+ }
+ /**
+ * @{inheritDoc}
+ */
+ @Override
+ public QueryBuilder<E> getParentQuery() {
+ return cloneQueryAtStep(parentStepIndex);
+ }
+
+ @Override
+ public QueryBuilder<E> getContainerQuery() {
+ return cloneQueryAtStep(containerStepIndex);
+ }
+
+ /**
+ * @{inheritDoc}
+ */
+ @Override
+ public <T2> T2 getQuery() {
+ StringBuilder sb = new StringBuilder();
+
+ for (String piece : this.list) {
+ sb.append(piece);
+ }
+
+ return (T2)sb.toString();
+ }
+
+ /**
+ * @{inheritDoc}
+ */
+ @Override
+ public void markParentBoundary() {
+ parentStepIndex = stepIndex;
+ }
+
+ @Override
+ public void markContainer() {
+ this.containerStepIndex = stepIndex;
+ }
+
+ /**
+ * @{inheritDoc}
+ */
+ @Override
+ public Vertex getStart() {
+ return this.start;
+ }
+
+ protected int getParentStepIndex() {
+ return parentStepIndex;
+ }
+
+ protected int getContainerStepIndex() {
+ return containerStepIndex;
+ }
+
+ protected int getStepIndex() {
+ return stepIndex;
+ }
+
+ private void executeQuery() {
+ String queryString = "g" + Joiner.on("").join(list);
+ Map<String, Object> params = new HashMap<>();
+ if (this.start == null) {
+ params.put("g", source.V());
+ } else {
+ params.put("g", source.V(this.start));
+ }
+ this.completeTraversal = this.gremlinGroovy.executeTraversal(queryString, params);
+ }
+ @Override
+ public boolean hasNext() {
+ if (this.completeTraversal == null) {
+ executeQuery();
+ }
+
+ return this.completeTraversal.hasNext();
+ }
+
+ @Override
+ public E next() {
+ if (this.completeTraversal == null) {
+ executeQuery();
+ }
+
+ return (E)this.completeTraversal.next();
+ }
+
+ @Override
+ public List<E> toList() {
+ if (this.completeTraversal == null) {
+ executeQuery();
+ }
+
+ return (List<E>)this.completeTraversal.toList();
+ }
+
+ protected QueryBuilder<Edge> has(String key, String value) {
+ this.list.add(HAS + key + "','" + value + "')");
+
+ return (QueryBuilder<Edge>)this;
+ }
+
}
diff --git a/aai-schema-ingest/pom.xml b/aai-schema-ingest/pom.xml
index ab8be115..71869c9e 100644
--- a/aai-schema-ingest/pom.xml
+++ b/aai-schema-ingest/pom.xml
@@ -64,6 +64,12 @@
<artifactId>guava</artifactId>
<version>16.0</version>
</dependency>
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy</artifactId>
+ <version>2.4.15</version>
+ <classifier>indy</classifier>
+ </dependency>
<dependency>
<groupId>org.apache.tinkerpop</groupId>
<artifactId>gremlin-core</artifactId>
@@ -77,12 +83,12 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
- <version>4.3.16.RELEASE</version>
+ <version>4.3.18.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
- <version>4.3.16.RELEASE</version>
+ <version>4.3.18.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
diff --git a/aai-schema/src/main/resources/onap/aai_schema/aai_schema_v14.xsd b/aai-schema/src/main/resources/onap/aai_schema/aai_schema_v14.xsd
index c31850d8..a0115514 100644
--- a/aai-schema/src/main/resources/onap/aai_schema/aai_schema_v14.xsd
+++ b/aai-schema/src/main/resources/onap/aai_schema/aai_schema_v14.xsd
@@ -2211,6 +2211,13 @@ xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
</xs:appinfo>
</xs:annotation>
</xs:element>
+ <xs:element name="openstack-region-id" type="xs:string" minOccurs="0">
+ <xs:annotation>
+ <xs:appinfo>
+ <annox:annotate target="field">@org.onap.aai.annotations.Metadata(description="OpenStack region ID used by MultiCloud plugin to interact with an OpenStack instance.")</annox:annotate>
+ </xs:appinfo>
+ </xs:annotation>
+ </xs:element>
<xs:element name="resource-version" type="xs:string" minOccurs="0">
<xs:annotation>
<xs:appinfo>
@@ -3941,6 +3948,34 @@ xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
</xs:appinfo>
</xs:annotation>
</xs:element>
+ <xs:element name="operational-status" type="xs:string" minOccurs="0">
+ <xs:annotation>
+ <xs:appinfo>
+ <annox:annotate target="field">@org.onap.aai.annotations.Metadata(description="Store the operational-status for this sp-partner.")</annox:annotate>
+ </xs:appinfo>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="model-customization-id" type="xs:string" minOccurs="0">
+ <xs:annotation>
+ <xs:appinfo>
+ <annox:annotate target="field">@org.onap.aai.annotations.Metadata(description="Store the model-customization-id for this sp-partner.")</annox:annotate>
+ </xs:appinfo>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="model-invariant-id" type="xs:string" minOccurs="0">
+ <xs:annotation>
+ <xs:appinfo>
+ <annox:annotate target="field">@org.onap.aai.annotations.Metadata(description="the ASDC model id for this sp-partner model.",visibility="deployment",requires="model-version-id",dbAlias="model-invariant-id-local")</annox:annotate>
+ </xs:appinfo>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="model-version-id" type="xs:string" minOccurs="0">
+ <xs:annotation>
+ <xs:appinfo>
+ <annox:annotate target="field">@org.onap.aai.annotations.Metadata(description="the ASDC model version for this sp-partner model.",visibility="deployment",requires="model-invariant-id",dbAlias="model-version-id-local")</annox:annotate>
+ </xs:appinfo>
+ </xs:annotation>
+ </xs:element>
<xs:element ref="tns:relationship-list" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
diff --git a/aai-schema/src/main/resources/onap/dbedgerules/v14/DbEdgeRules_hpa_v14.json b/aai-schema/src/main/resources/onap/dbedgerules/v14/DbEdgeRules_hpa_v14.json
index 11ea1b54..a2d44442 100644
--- a/aai-schema/src/main/resources/onap/dbedgerules/v14/DbEdgeRules_hpa_v14.json
+++ b/aai-schema/src/main/resources/onap/dbedgerules/v14/DbEdgeRules_hpa_v14.json
@@ -38,6 +38,31 @@
"prevent-delete": "NONE",
"default": "true",
"description":""
+ },
+ {
+ "from": "hpa-capacity",
+ "to": "pserver",
+ "label": "org.onap.relationships.inventory.BelongsTo",
+ "direction": "OUT",
+ "multiplicity": "MANY2ONE",
+ "contains-other-v": "!${direction}",
+ "delete-other-v": "!${direction}",
+ "SVC-INFRA": "!${direction}",
+ "prevent-delete": "NONE",
+ "default": "true",
+ "description":"HPA Capacity KV for given compute node"
+ },
+ {
+ "from": "flavor",
+ "to": "pserver",
+ "label": "org.onap.relationships.inventory.CanBeInstantiatedIn",
+ "direction": "OUT",
+ "multiplicity": "MANY2MANY",
+ "contains-other-v": "NONE",
+ "delete-other-v": "NONE",
+ "prevent-delete": "NONE",
+ "default": "true",
+ "description":"HPA Capacity getting the compute nodes from given flavor"
}
]
}
diff --git a/aai-schema/src/main/resources/onap/oxm/v14/aai_oxm_v14.xml b/aai-schema/src/main/resources/onap/oxm/v14/aai_oxm_v14.xml
index 15ef2770..cfd0672b 100644
--- a/aai-schema/src/main/resources/onap/oxm/v14/aai_oxm_v14.xml
+++ b/aai-schema/src/main/resources/onap/oxm/v14/aai_oxm_v14.xml
@@ -475,6 +475,11 @@
<xml-property name="description" value="the status of external system." />
</xml-properties>
</xml-element>
+ <xml-element java-attribute="openstackRegionId" name="openstack-region-id" type="java.lang.String">
+ <xml-properties>
+ <xml-property name="description" value="OpenStack region ID used by MultiCloud plugin to interact with an OpenStack instance." />
+ </xml-properties>
+ </xml-element>
<xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String">
<xml-properties>
<xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." />
@@ -2106,6 +2111,7 @@
<xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.onap.org.v14.RelationshipList"/>
<xml-element java-attribute="pInterfaces" name="p-interfaces" type="inventory.aai.onap.org.v14.PInterfaces"/>
<xml-element java-attribute="lagInterfaces" name="lag-interfaces" type="inventory.aai.onap.org.v14.LagInterfaces"/>
+ <xml-element container-type="java.util.ArrayList" java-attribute="hpaCapacity" name="hpa-capacity" type="inventory.aai.onap.org.v14.HpaCapacity"/>
</java-attributes>
<xml-properties>
<xml-property name="description" value="Compute host whose hostname must be unique and must exactly match what is sent as a relationship to a vserver."/>
@@ -2119,6 +2125,33 @@
</xml-properties>
</java-type>
+ <java-type name="HpaCapacity">
+ <xml-root-element name="hpa-capacity"/>
+ <java-attributes>
+ <xml-element java-attribute="hpaCapacityKey" name="hpa-capacity-key" required="true" type="java.lang.String" xml-key="true">
+ <xml-properties>
+ <xml-property name="description" value="Composite key formed with hpaFeature and append list of hpaFeatureAttributes needed for capacity check"/>
+ </xml-properties>
+ </xml-element>
+ <xml-element java-attribute="hpaCapacityValue" name="hpa-capacity-value" type="java.lang.String">
+ <xml-properties>
+ <xml-property name="description" value="JSON string specifying the capacity (total,free), unit and metadata of the specific HPA attribute"/>
+ </xml-properties>
+ </xml-element>
+ <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String">
+ <xml-properties>
+ <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete."/>
+ </xml-properties>
+ </xml-element>
+ <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.onap.org.v14.RelationshipList"/>
+ </java-attributes>
+ <xml-properties>
+ <xml-property name="description" value="HPA Capacity information for compute node"/>
+ <xml-property name="indexedProps" value="hpa-capacity-key"/>
+ <xml-property name="dependentOn" value="hpa-capacity"/>
+ </xml-properties>
+ </java-type>
+
<java-type name="PInterfaces">
<xml-properties>
<xml-property name="description" value="Collection of physical interfaces."/>
@@ -7362,6 +7395,33 @@
<xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete."/>
</xml-properties>
</xml-element>
+ <xml-element java-attribute="operationalStatus" name="operational-status" type="java.lang.String">
+ <xml-properties>
+ <xml-property name="description" value="Store the operational-status for this sp-partner." />
+ </xml-properties>
+ </xml-element>
+ <xml-element java-attribute="modelCustomizationId" name="model-customization-id" type="java.lang.String">
+ <xml-properties>
+ <xml-property name="description" value="Store the model-customization-id for this sp-partner." />
+ </xml-properties>
+ </xml-element>
+ <xml-element java-attribute="modelInvariantId" name="model-invariant-id" type="java.lang.String">
+ <xml-properties>
+ <xml-property name="description" value="the ASDC model id for this sp-partner model." />
+ <xml-property name="visibility" value="deployment" />
+ <xml-property name="requires" value="model-version-id" />
+ <xml-property name="dbAlias" value="model-invariant-id-local" />
+ </xml-properties>
+ </xml-element>
+ <xml-element java-attribute="modelVersionId" name="model-version-id" type="java.lang.String">
+ <xml-properties>
+ <xml-property name="description" value="the ASDC model version for this sp-partner model." />
+ <xml-property name="visibility" value="deployment" />
+ <xml-property name="requires" value="model-invariant-id" />
+ <xml-property name="dbAlias" value="model-version-id-local" />
+ </xml-properties>
+ </xml-element>
+
<xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.onap.org.v14.RelationshipList" />
</java-attributes>
<xml-properties>
@@ -7505,6 +7565,7 @@
<xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete."/>
</xml-properties>
</xml-element>
+
<xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.onap.org.v14.RelationshipList" />
</java-attributes>
<xml-properties>
diff --git a/aai-utils/pom.xml b/aai-utils/pom.xml
index 5b2c7021..4eadb513 100644
--- a/aai-utils/pom.xml
+++ b/aai-utils/pom.xml
@@ -71,7 +71,7 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
- <version>4.3.10.RELEASE</version>
+ <version>4.3.18.RELEASE</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>