diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/onap/clamp/clds/service/CldsService.java | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/src/main/java/org/onap/clamp/clds/service/CldsService.java b/src/main/java/org/onap/clamp/clds/service/CldsService.java index 7eff681a..bce50e52 100644 --- a/src/main/java/org/onap/clamp/clds/service/CldsService.java +++ b/src/main/java/org/onap/clamp/clds/service/CldsService.java @@ -401,8 +401,72 @@ public class CldsService extends SecureServiceBase { @PathParam("modelName") String modelName, @QueryParam("test") String test, CldsModel model) throws TransformerException, ParseException, GeneralSecurityException, DecoderException { Date startTime = new Date(); +<<<<<<< Upstream, based on f7e5aab99d6c2a0a9d5e56b561ba0513aafd504e CldsModel retrievedModel = null; Boolean errorCase = false; +======= + LoggingUtils.setRequestContext("CldsService: Process model action", getPrincipalName()); + String actionCd = action.toUpperCase(); + SecureServicePermission permisionManage = SecureServicePermission.create(cldsPermissionTypeClManage, + cldsPermissionInstance, actionCd); + isAuthorized(permisionManage); + isAuthorizedForVf(model); + String userId = getUserId(); + String actionStateCd = CldsEvent.ACTION_STATE_INITIATED; + logger.info("PUT actionCd={}", actionCd); + logger.info("PUT actionStateCd={}", actionStateCd); + logger.info("PUT modelName={}", modelName); + logger.info("PUT test={}", test); + logger.info("PUT bpmnText={}", model.getBpmnText()); + logger.info("PUT propText={}", model.getPropText()); + logger.info("PUT userId={}", userId); + logger.info("PUT getTypeId={}", model.getTypeId()); + logger.info("PUT deploymentId={}", model.getDeploymentId()); + if (model.getTemplateName() != null) { + CldsTemplate template = cldsDao.getTemplate(model.getTemplateName()); + if (template != null) { + model.setTemplateId(template.getId()); + model.setDocText(template.getPropText()); + // This is to provide the Bpmn XML when Template part in UI is + // disabled + model.setBpmnText(template.getBpmnText()); + } + } + // save model to db + model.setName(modelName); + model.save(cldsDao, getUserId()); + // get vars and format if necessary + String prop = model.getPropText(); + String bpmn = model.getBpmnText(); + String docText = model.getDocText(); + String controlName = model.getControlName(); + String bpmnJson = cldsBpmnTransformer.doXslTransformToString(bpmn); + logger.info("PUT bpmnJson={}", bpmnJson); + // Flag indicates whether it is triggered by Validation Test button from + // UI + boolean isTest = false; + if (test != null && test.equalsIgnoreCase("true")) { + isTest = true; + } else { + String actionTestOverride = refProp.getStringValue("action.test.override"); + if (actionTestOverride != null && actionTestOverride.equalsIgnoreCase("true")) { + logger.info("PUT actionTestOverride={}", actionTestOverride); + logger.info("PUT override test indicator and setting it to true"); + isTest = true; + } + } + logger.info("PUT isTest={}", isTest); + boolean isInsertTestEvent = false; + String insertTestEvent = refProp.getStringValue("action.insert.test.event"); + if (insertTestEvent != null && insertTestEvent.equalsIgnoreCase("true")) { + isInsertTestEvent = true; + } + logger.info("PUT isInsertTestEvent={}", isInsertTestEvent); + // determine if requested action is permitted + model.validateAction(actionCd); + logger.info("modelProp - " + prop); + logger.info("docText - " + docText); +>>>>>>> 95a4d95 Remove the test flag try { LoggingUtils.setRequestContext("CldsService: Process model action", getPrincipalName()); String actionCd = action.toUpperCase(); @@ -806,8 +870,12 @@ public class CldsService extends SecureServiceBase { @Path("/deploy/{modelName}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) +<<<<<<< Upstream, based on f7e5aab99d6c2a0a9d5e56b561ba0513aafd504e public Response deployModel(@PathParam("modelName") String modelName, CldsModel model) { +======= + public CldsModel deployModel(@PathParam("modelName") String modelName, CldsModel model) { +>>>>>>> 95a4d95 Remove the test flag Date startTime = new Date(); LoggingUtils.setRequestContext("CldsService: Deploy model", getPrincipalName()); Boolean errorCase = false; @@ -874,8 +942,12 @@ public class CldsService extends SecureServiceBase { @Path("/undeploy/{modelName}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) +<<<<<<< Upstream, based on f7e5aab99d6c2a0a9d5e56b561ba0513aafd504e public Response unDeployModel(@PathParam("modelName") String modelName, CldsModel model) { +======= + public CldsModel unDeployModel(@PathParam("modelName") String modelName, CldsModel model) { +>>>>>>> 95a4d95 Remove the test flag Date startTime = new Date(); LoggingUtils.setRequestContext("CldsService: Undeploy model", getPrincipalName()); |