summaryrefslogtreecommitdiffstats
path: root/ONAP-REST/src/main/java/org/onap/policy/rest/util/MSModelUtils.java
diff options
context:
space:
mode:
Diffstat (limited to 'ONAP-REST/src/main/java/org/onap/policy/rest/util/MSModelUtils.java')
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/util/MSModelUtils.java20
1 files changed, 17 insertions, 3 deletions
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/util/MSModelUtils.java b/ONAP-REST/src/main/java/org/onap/policy/rest/util/MSModelUtils.java
index 3880b35d8..e96396e0c 100644
--- a/ONAP-REST/src/main/java/org/onap/policy/rest/util/MSModelUtils.java
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/util/MSModelUtils.java
@@ -315,7 +315,11 @@ public class MSModelUtils {
if (annotation && obj instanceof EReference) {
EClass refType = ((EReference) obj).getEReferenceType();
if(!refType.toString().contains(eProxyURI)){
- subAttribute.put(eStrucClassifier.getName(), refType.getName());
+ String required = ":required-false";
+ if(eStrucClassifier.getLowerBound() == 1){
+ required = ":required-true";
+ }
+ subAttribute.put(eStrucClassifier.getName(), refType.getName() + required);
}
}
}
@@ -390,18 +394,28 @@ public class MSModelUtils {
refAttribute.put(eStrucClassifier.getName(), refValue);
} else {
String array = arrayCheck(((EStructuralFeature) obj).getUpperBound());
- refAttribute.put(eStrucClassifier.getName(), refType.getName() + array);
+ String required = ":required-false";
+ if(((EStructuralFeature) obj).getLowerBound() == 1){
+ required = ":required-true";
+ }
+ refAttribute.put(eStrucClassifier.getName(), refType.getName() + array + required);
}
} else if (annotation && obj instanceof EAttributeImpl){
EClassifier refType = ((EAttributeImpl) obj).getEType();
if (refType instanceof EEnumImpl){
String array = arrayCheck(((EStructuralFeature) obj).getUpperBound());
- refAttribute.put(eStrucClassifier.getName(), refType.getName() + array); }
+ String required = ":required-false";
+ if(((EStructuralFeature) obj).getLowerBound() == 1){
+ required = ":required-true";
+ }
+ refAttribute.put(eStrucClassifier.getName(), refType.getName() + array + required);
+ }
}
}
}
}
}
+
return refAttribute;
}