diff options
Diffstat (limited to 'src/main/java/org')
3 files changed, 16 insertions, 27 deletions
diff --git a/src/main/java/org/onap/clamp/clds/model/CldsToscaModel.java b/src/main/java/org/onap/clamp/clds/model/CldsToscaModel.java index 25b8d4016..6184b3946 100644 --- a/src/main/java/org/onap/clamp/clds/model/CldsToscaModel.java +++ b/src/main/java/org/onap/clamp/clds/model/CldsToscaModel.java @@ -36,7 +36,12 @@ public class CldsToscaModel extends CldsToscaModelRevision { private String id; private String policyType; private String toscaModelName; - private String toscaModelYaml; + + /** + * Construct + */ + public CldsToscaModel () { + } /** * Creates or updates Tosca Model to DB @@ -123,21 +128,4 @@ public class CldsToscaModel extends CldsToscaModelRevision { this.toscaModelName = toscaModelName; } - /** - * @return the toscaModelYaml - */ - @Override - public String getToscaModelYaml() { - return toscaModelYaml; - } - - /** - * @param toscaModelYaml - * the toscaModelYaml to set - */ - @Override - public void setToscaModelYaml(String toscaModelYaml) { - this.toscaModelYaml = toscaModelYaml; - } - } 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 42e9cf713..e3a379b36 100644 --- a/src/main/java/org/onap/clamp/clds/service/CldsService.java +++ b/src/main/java/org/onap/clamp/clds/service/CldsService.java @@ -394,11 +394,14 @@ public class CldsService extends SecureServiceBase { errorMessage = e.getMessage(); } - if (!errorMessage.isEmpty()) { + if (null == errorMessage || (null != errorMessage && !errorMessage.isEmpty())) { CldsEvent.insEvent(cldsDao, model.getControlName(), getUserId(), actionCd, CldsEvent.ACTION_STATE_ERROR, null); // Need a refresh as new events have been inserted model = CldsModel.retrieve(cldsDao, modelName, false); + if (null == errorMessage) { + errorMessage = "No response from Policy"; + } model.setErrorMessageForUi(errorMessage); util.exiting(HttpStatus.INTERNAL_SERVER_ERROR.toString(), "putModelAndProcessAction failed", Level.INFO, ONAPLogConstants.ResponseStatus.ERROR); diff --git a/src/main/java/org/onap/clamp/clds/service/CldsToscaService.java b/src/main/java/org/onap/clamp/clds/service/CldsToscaService.java index 04205b704..adebd7853 100644 --- a/src/main/java/org/onap/clamp/clds/service/CldsToscaService.java +++ b/src/main/java/org/onap/clamp/clds/service/CldsToscaService.java @@ -101,7 +101,7 @@ public class CldsToscaService extends SecureServiceBase { * * @return clds tosca models - list of CLDS tosca models */ - public ResponseEntity<List<CldsToscaModel>> getAllToscaModels() { + public List<CldsToscaModel> getAllToscaModels() { Date startTime = new Date(); LoggingUtils.setRequestContext("CldsToscaService: Get All tosca models", getPrincipalName()); @@ -111,7 +111,7 @@ public class CldsToscaService extends SecureServiceBase { LoggingUtils.setTimeContext(startTime, new Date()); LoggingUtils.setResponseContext("0", "Get All tosca models success", this.getClass().getName()); auditLogger.info("Get All tosca models"); - return new ResponseEntity<>(cldsToscaModels, HttpStatus.OK); + return cldsToscaModels; } /** @@ -123,7 +123,7 @@ public class CldsToscaService extends SecureServiceBase { * * @return clds tosca model - CLDS tosca model for a given tosca model name */ - public ResponseEntity<CldsToscaModel> getToscaModel(String toscaModelName) { + public CldsToscaModel getToscaModel(String toscaModelName) { Date startTime = new Date(); LoggingUtils.setRequestContext("CldsToscaService: Get tosca models by model name", getPrincipalName()); // TODO revisit based on new permissions @@ -132,8 +132,7 @@ public class CldsToscaService extends SecureServiceBase { LoggingUtils.setTimeContext(startTime, new Date()); LoggingUtils.setResponseContext("0", "Get tosca models by model name success", this.getClass().getName()); auditLogger.info("GET tosca models by model name completed"); - return new ResponseEntity<>(Optional.ofNullable(cldsToscaModels).get().stream().findFirst().get(), - HttpStatus.OK); + return cldsToscaModels.get(0); } /** @@ -143,7 +142,7 @@ public class CldsToscaService extends SecureServiceBase { * @param policyType * @return clds tosca model - CLDS tosca model for a given policy type */ - public ResponseEntity<CldsToscaModel> getToscaModelsByPolicyType(String policyType) { + public CldsToscaModel getToscaModelsByPolicyType(String policyType) { Date startTime = new Date(); LoggingUtils.setRequestContext("CldsToscaService: Get tosca models by policyType", getPrincipalName()); // TODO revisit based on new permissions @@ -152,8 +151,7 @@ public class CldsToscaService extends SecureServiceBase { LoggingUtils.setTimeContext(startTime, new Date()); LoggingUtils.setResponseContext("0", "Get tosca models by policyType success", this.getClass().getName()); auditLogger.info("GET tosca models by policyType completed"); - return new ResponseEntity<>(Optional.ofNullable(cldsToscaModels).get().stream().findFirst().get(), - HttpStatus.OK); + return cldsToscaModels.get(0); } public ResponseEntity<?> deleteToscaModelById(String toscaModeId) { |