summaryrefslogtreecommitdiffstats
path: root/POLICY-SDK-APP/src/main/java/org
diff options
context:
space:
mode:
authorrb7147 <rb7147@att.com>2017-12-11 16:25:23 -0500
committerrb7147 <rb7147@att.com>2017-12-11 16:27:04 -0500
commit0368cb99d6108970d172d4dc7145c67e4524b4a9 (patch)
tree76c4d303c34d4b1146835bf520dcd776badcfc53 /POLICY-SDK-APP/src/main/java/org
parent428150834ee60899b9a8da019bae3c8bf009adf1 (diff)
Resolved the Policy GUI Javascript issues
Issue-ID: POLICY-440 Change-Id: I44d5304699da19bee7ae2997565802fc7d44cb0e Signed-off-by: rb7147 <rb7147@att.com>
Diffstat (limited to 'POLICY-SDK-APP/src/main/java/org')
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateDcaeMicroServiceController.java38
1 files changed, 29 insertions, 9 deletions
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateDcaeMicroServiceController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateDcaeMicroServiceController.java
index 7d2fe23c6..a40b48aa2 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateDcaeMicroServiceController.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateDcaeMicroServiceController.java
@@ -708,17 +708,25 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
//The "." in the value determines if its a string or a user defined type.
if (!value.contains(".")){
//This is string
- constraints.add(keyValues.get(key));
+ if(StringUtils.isNumeric(key) ){ //only integer key for the value of Constrains
+ constraints.add(keyValues.get(key));
+ }
}else{
- //This is userdefined string
+ //This is user defined string
String trimValue=value.substring(value.lastIndexOf('.')+1);
StringBuilder referenceIndividualStringBuilder= new StringBuilder();
referenceIndividualStringBuilder.append(keySetString+"="+trimValue+":MANY-true");
referenceStringBuilder.append(referenceIndividualStringBuilder+",");
}
- }
+ }
+
}
+ if(keyValues.get("type").equalsIgnoreCase(LIST)){
+ if(constraints == null || constraints.isEmpty()){
+ referenceStringBuilder.append(keySetString+"=MANY-true"+",");
+ }
+ }
}else{
//User defined Datatype.
String value=keyValues.get("type");
@@ -1014,7 +1022,7 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
if(allkeys != null){
Iterator<String> iter = allkeys.iterator();
while(iter.hasNext()){
- //convert to array values for MANY-true keys
+ //Convert to array values for MANY-true keys
finalJsonObject = convertToArrayElement(jsonObject, iter.next());
}
}
@@ -1036,7 +1044,7 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
if(finalJsonObject != null){
LOGGER.info(finalJsonObject.toString());
- jsonModel = finalJsonObject.toString();
+ jsonModel = finalJsonObject.toString();
}
}
@@ -1562,10 +1570,7 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
else {
this.newModel.setVersion(this.newFile.toString().split("-v")[1].replace(".xmi", ""));
}
- }else{
- errorMsg = "Upload error: The file name should contain '-v', such as xxx-v1802.yml";
- }
-
+ }
}catch(Exception e){
LOGGER.error("Upload error : ", e);
errorMsg = "Upload error:" + e.getMessage();
@@ -1573,6 +1578,21 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
}
}
+
+ if(!errorMsg.isEmpty()){
+
+ PrintWriter out = response.getWriter();
+
+ response.setCharacterEncoding("UTF-8");
+ response.setContentType("application / json");
+ request.setCharacterEncoding("UTF-8");
+
+ JSONObject j = new JSONObject();
+ j.put("errorMsg", errorMsg);
+ out.write(j.toString());
+ return;
+ }
+
List<File> fileList = new ArrayList<>();
this.directory = "model";
if (zip){