aboutsummaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java
diff options
context:
space:
mode:
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java')
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java19
1 files changed, 16 insertions, 3 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java
index c46e27b844..86e2f5ce93 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java
@@ -626,7 +626,7 @@ public class RequestHandlerUtils extends AbstractRestHandler {
protected InfraActiveRequests createNewRecordCopyFromInfraActiveRequest(InfraActiveRequests infraActiveRequest,
String requestId, Timestamp startTimeStamp, String source, String requestUri, String requestorId,
- String originalRequestId) {
+ String originalRequestId) throws ApiException {
InfraActiveRequests request = new InfraActiveRequests();
request.setRequestId(requestId);
request.setStartTime(startTimeStamp);
@@ -649,11 +649,24 @@ public class RequestHandlerUtils extends AbstractRestHandler {
}
protected void setInstanceIdAndName(InfraActiveRequests infraActiveRequest,
- InfraActiveRequests currentActiveRequest) {
+ InfraActiveRequests currentActiveRequest) throws ApiException {
String requestScope = infraActiveRequest.getRequestScope();
try {
ModelType type = ModelType.valueOf(requestScope);
- type.setName(currentActiveRequest, type.getName(infraActiveRequest));
+ String instanceName = type.getName(infraActiveRequest);
+ if (instanceName == null && type.equals(ModelType.vfModule)) {
+ logger.error("vfModule for requestId: {} being resumed does not have an instanceName.",
+ infraActiveRequest.getRequestId());
+ ValidateException validateException = new ValidateException.Builder(
+ "vfModule for requestId: " + infraActiveRequest.getRequestId()
+ + " being resumed does not have an instanceName.",
+ HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).build();
+ updateStatus(currentActiveRequest, Status.FAILED, validateException.getMessage());
+ throw validateException;
+ }
+ if (instanceName != null) {
+ type.setName(currentActiveRequest, instanceName);
+ }
type.setId(currentActiveRequest, type.getId(infraActiveRequest));
} catch (IllegalArgumentException e) {
logger.error(