diff options
Diffstat (limited to 'services/activity-spec/activity-spec-web')
-rw-r--r-- | services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/onap/sdc/activityspec/api/rest/services/ActivitySpecsImpl.java | 11 |
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(); } - } |