From 5f0ef13aa4d83caadd1056d5115952adcb780514 Mon Sep 17 00:00:00 2001 From: sebdet Date: Fri, 9 Nov 2018 18:27:20 +0100 Subject: Save DCAE url Save DCAE url before the triggering otherwise, it may be very long Issue-ID: CLAMP-246 Change-Id: Ide9431a7e8bbbf9b8a15ba9efec6eb5983811cb4 Signed-off-by: sebdet --- .../java/org/onap/clamp/clds/service/CldsService.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 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 8e7785d6a..be19e31c0 100644 --- a/src/main/java/org/onap/clamp/clds/service/CldsService.java +++ b/src/main/java/org/onap/clamp/clds/service/CldsService.java @@ -261,8 +261,8 @@ public class CldsService extends SecureServiceBase { && !CldsModel.STATUS_ACTIVE.equals(cldsModel.getStatus()) && cldsModel.getDeploymentId() != null && cldsModel.getDeploymentStatusUrl() != null) { checkDcaeDeploymentStatus(cldsModel, CldsEvent.ACTION_DEPLOY, false); - // refresh because new event may have been added - cldsModel = CldsModel.retrieve(cldsDao, modelName, false); + // Refresh the model object in any cases for new event + cldsModel = CldsModel.retrieve(cldsDao, cldsModel.getName(), false); } } catch (Exception e) { LoggingUtils.setErrorContext("900", "Set event inventory error"); @@ -737,10 +737,11 @@ public class CldsService extends SecureServiceBase { modelProp.getGlobal().getDeployParameters())); CldsEvent.insEvent(cldsDao, model.getControlName(), getUserId(), CldsEvent.ACTION_DEPLOY, CldsEvent.ACTION_STATE_INITIATED, null); + model.save(cldsDao, getUserId()); // This is a blocking call checkDcaeDeploymentStatus(model, CldsEvent.ACTION_DEPLOY, true); - - model.save(cldsDao, getUserId()); + // Refresh the model object in any cases for new event + model = CldsModel.retrieve(cldsDao, model.getName(), false); // audit log LoggingUtils.setTimeContext(startTime, new Date()); auditLogger.info("Deploy model completed"); @@ -772,11 +773,13 @@ public class CldsService extends SecureServiceBase { dcaeDispatcherServices.deleteExistingDeployment(model.getDeploymentId(), model.getTypeId())); CldsEvent.insEvent(cldsDao, model.getControlName(), getUserId(), CldsEvent.ACTION_UNDEPLOY, CldsEvent.ACTION_STATE_INITIATED, null); - // This is a blocking call - checkDcaeDeploymentStatus(model, CldsEvent.ACTION_UNDEPLOY, true); // clean the deployment ID model.setDeploymentId(null); model.save(cldsDao, getUserId()); + // This is a blocking call + checkDcaeDeploymentStatus(model, CldsEvent.ACTION_UNDEPLOY, true); + // Refresh the model object in any cases for new event + model = CldsModel.retrieve(cldsDao, model.getName(), false); // audit log LoggingUtils.setTimeContext(startTime, new Date()); auditLogger.info("Undeploy model completed"); -- cgit 1.2.3-korg