aboutsummaryrefslogtreecommitdiffstats
path: root/services/activity-spec
diff options
context:
space:
mode:
authorsheetalm <sheetal.mudholkar@amdocs.com>2018-05-07 11:41:36 +0530
committerOren Kleks <orenkle@amdocs.com>2018-05-08 11:59:25 +0000
commit5a7f092400ddb7a86e4be77531dcbe26f81c1c26 (patch)
tree5e78fa8a7ade712a06d3696807279708e685695a /services/activity-spec
parent70a3309f5e3e531981691e08d74cf89fa832c2a4 (diff)
ActivitySpec validation for mandatory action
Add validation for mandatory action Change-Id: Iff84526e1a6a359529124ab014c864260d8c2a8d Issue-ID: SDC-1303 Signed-off-by: sheetalm <sheetal.mudholkar@amdocs.com>
Diffstat (limited to 'services/activity-spec')
-rw-r--r--services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/onap/sdc/activityspec/api/rest/services/ActivitySpecsImpl.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/onap/sdc/activityspec/api/rest/services/ActivitySpecsImpl.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/onap/sdc/activityspec/api/rest/services/ActivitySpecsImpl.java
index e0eec80fcb..168f4ffb8e 100644
--- a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/onap/sdc/activityspec/api/rest/services/ActivitySpecsImpl.java
+++ b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/onap/sdc/activityspec/api/rest/services/ActivitySpecsImpl.java
@@ -33,6 +33,8 @@ import org.onap.sdc.activityspec.api.rest.types.ActivitySpecCreateResponse;
import org.onap.sdc.activityspec.be.dao.impl.ActivitySpecDaoZusammenImpl;
import org.openecomp.core.dao.UniqueValueDaoFactory;
import org.openecomp.core.zusammen.api.ZusammenAdaptorFactory;
+import org.openecomp.sdc.common.errors.CoreException;
+import org.openecomp.sdc.common.errors.ErrorCode;
import org.openecomp.sdc.versioning.ItemManagerFactory;
import org.openecomp.sdc.versioning.VersioningManagerFactory;
import org.openecomp.sdc.versioning.dao.types.Version;
@@ -94,6 +96,10 @@ public class ActivitySpecsImpl implements ActivitySpecs {
@Override
public Response actOnActivitySpec(ActivitySpecActionRequestDto request, String activitySpecId, String versionId) {
+ if (request.getAction() == null) {
+ throw new CoreException(new ErrorCode.ErrorCodeBuilder().withMessage("Mandatory action field is missing")
+ .build());
+ }
activitySpecManager.actOnAction(activitySpecId, versionId, request.getAction());
return Response.ok(new InternalEmptyObject()).build();
}
@@ -105,10 +111,9 @@ public class ActivitySpecsImpl implements ActivitySpecs {
MapItemToListResponseDto mapper = new MapItemToListResponseDto();
activitySpecManager.list(versionStatus).stream()
.sorted((o1, o2) -> o2.getModificationTime().compareTo(o1.getModificationTime())).forEach(
- activitySpecItem -> results.add(
- mapper.applyMapping(activitySpecItem, ActivitySpecListResponseDto.class)));
+ activitySpecItem -> results.add(mapper.applyMapping(activitySpecItem,
+ ActivitySpecListResponseDto.class)));
return Response.ok(results).build();
}
-
}