summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/onap/schema
diff options
context:
space:
mode:
authorDaniel Silverthorn <daniel.silverthorn@amdocs.com>2018-01-29 16:44:38 -0500
committerDaniel Silverthorn <daniel.silverthorn@amdocs.com>2018-01-29 16:48:10 -0500
commit1bb61ff3e013bcd41beffc5d9f01964f422f8a9e (patch)
treeb5f844cdeb807fe558123c8e48a2b84135c18086 /src/main/java/org/onap/schema
parent3435321e01b7c997bd92b18c8681a870f9451d6c (diff)
Allow filtering by reserved properties
Change-Id: Ie43de57b63651fccb13147c9086276f0867a828c Issue-ID: AAI-702 Signed-off-by: Daniel Silverthorn <daniel.silverthorn@amdocs.com>
Diffstat (limited to 'src/main/java/org/onap/schema')
-rw-r--r--src/main/java/org/onap/schema/OxmModelValidator.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/main/java/org/onap/schema/OxmModelValidator.java b/src/main/java/org/onap/schema/OxmModelValidator.java
index 6260f83..ae3e18b 100644
--- a/src/main/java/org/onap/schema/OxmModelValidator.java
+++ b/src/main/java/org/onap/schema/OxmModelValidator.java
@@ -87,12 +87,18 @@ public class OxmModelValidator {
}
final DynamicType modelObjectType = jaxbContext.getDynamicType(
CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_CAMEL, type)));
+ final DynamicType reservedObjectType = jaxbContext.getDynamicType("ReservedPropNames");
for (String key : filter.keySet()) {
String keyJavaName = CaseFormat.LOWER_HYPHEN.to(CaseFormat.LOWER_CAMEL, key);
- if (modelObjectType.getDescriptor().getMappingForAttributeName(keyJavaName) != null) {
+ DatabaseMapping mapping = modelObjectType.getDescriptor().getMappingForAttributeName(keyJavaName);
+
+ // Try both the model for the specified type and the reserved properties for our key
+ if (mapping == null) {
+ mapping = reservedObjectType.getDescriptor().getMappingForAttributeName(keyJavaName);
+ }
+ if (mapping != null) {
try {
- DatabaseMapping mapping = modelObjectType.getDescriptor().getMappingForAttributeName(keyJavaName);
Object value = CrudServiceUtil.validateFieldType(filter.get(key), mapping.getField().getType());
result.put(key, value);
} catch (Exception ex) {