summaryrefslogtreecommitdiffstats
path: root/context/context-management/src/main/java
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@ericsson.com>2018-10-04 07:06:41 +0100
committerliamfallon <liam.fallon@ericsson.com>2018-10-04 16:44:57 +0100
commitb213e23edf68d36b4c0984d94d38d444f96949e2 (patch)
treebd7b60df8e8220abe93094fbbe373bc9c19791d0 /context/context-management/src/main/java
parent16a8f59fed2e53b1bbedaf65a33165bb4d3225f8 (diff)
Fix creation of sub Avro items
When an Avro object is created, nested sub avro objects are not created automatically. This change allows invocation of a method to create sub objects of Avro objects. Issue-ID: POLICY-954 Change-Id: Ie510867f2631ba6a8c6f5452c08aef5db67e8997 Signed-off-by: liamfallon <liam.fallon@ericsson.com>
Diffstat (limited to 'context/context-management/src/main/java')
-rw-r--r--context/context-management/src/main/java/org/onap/policy/apex/context/SchemaHelper.java8
-rw-r--r--context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/AbstractSchemaHelper.java9
-rw-r--r--context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelper.java1
3 files changed, 17 insertions, 1 deletions
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/SchemaHelper.java b/context/context-management/src/main/java/org/onap/policy/apex/context/SchemaHelper.java
index 44ec06c6d..b6d21a20d 100644
--- a/context/context-management/src/main/java/org/onap/policy/apex/context/SchemaHelper.java
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/SchemaHelper.java
@@ -92,6 +92,14 @@ public interface SchemaHelper {
Object createNewInstance(Object incomingObject);
/**
+ * Create an object of a sub type of this object.
+ *
+ * @param subType the sub type definition of this type
+ * @return a new object of the sub type
+ */
+ Object createNewSubInstance(String subType);
+
+ /**
* Unmarshal an object in schema format into a Java object.
*
* @param object the object as a Java object
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/AbstractSchemaHelper.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/AbstractSchemaHelper.java
index f50eb5914..6d98313ed 100644
--- a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/AbstractSchemaHelper.java
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/AbstractSchemaHelper.java
@@ -22,6 +22,7 @@ package org.onap.policy.apex.context.impl.schema;
import java.lang.reflect.Constructor;
+import org.apache.commons.lang3.NotImplementedException;
import org.onap.policy.apex.context.ContextRuntimeException;
import org.onap.policy.apex.context.SchemaHelper;
import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
@@ -169,4 +170,12 @@ public abstract class AbstractSchemaHelper implements SchemaHelper {
throw new ContextRuntimeException(returnString);
}
}
+
+ /* (non-Javadoc)
+ * @see org.onap.policy.apex.context.SchemaHelper#createNewSubInstance(java.lang.String)
+ */
+ @Override
+ public Object createNewSubInstance(String subType) {
+ throw new NotImplementedException("sub types are not supported on this schema helper");
+ }
}
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelper.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelper.java
index 8b61f718a..fcc7c4d60 100644
--- a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelper.java
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelper.java
@@ -279,5 +279,4 @@ public class JavaSchemaHelper extends AbstractSchemaHelper {
return gsonBuilder.create();
}
-
}