diff options
Diffstat (limited to 'services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest')
16 files changed, 653 insertions, 0 deletions
diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/ActivitySpecs.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/ActivitySpecs.java new file mode 100644 index 0000000000..f646a3b87a --- /dev/null +++ b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/ActivitySpecs.java @@ -0,0 +1,83 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openecomp.activityspec.api.rest; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import org.openecomp.activityspec.api.rest.types.ActivitySpecActionRequestDto; +import org.openecomp.activityspec.api.rest.types.ActivitySpecRequestDto; +import org.springframework.validation.annotation.Validated; + +import javax.validation.Valid; +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + +@Path("/v1.0/activity-spec/") +@Produces(MediaType.APPLICATION_JSON) +@Consumes(MediaType.APPLICATION_JSON) +@Api(value = "Activity Specs") +@Validated +public interface ActivitySpecs { + @POST + @Path("/") + @ApiOperation(value = "Create Activity Spec") + Response createActivitySpec(@Valid ActivitySpecRequestDto request); + + @GET + @Path("/{id}/versions/{versionId}") + @ApiOperation(value = "Get Activity Spec") + Response getActivitySpec(@ApiParam(value = "Activity Spec Id") @PathParam("id") + String id, + @ApiParam(value = "Version Id") @PathParam("versionId") + String versionId); + + @PUT + @Path("/{id}/versions/{versionId}") + @ApiOperation(value = "Update Activity Spec") + Response updateActivitySpec(@Valid ActivitySpecRequestDto request, + @ApiParam(value = "Activity Spec Id") @PathParam("id") + String id, + @ApiParam(value = "Version Id") @PathParam("versionId") + String versionId); + + @PUT + @Path("/{id}/versions/{versionId}/actions") + @ApiOperation(value = "Actions on a activity spec", + notes = "Performs one of the following actions on a activity spec: |" + + "Submit: Finalize its active version.|" + + "Deprecate: Deprecate activity spec.|") + Response actOnActivitySpec(ActivitySpecActionRequestDto request, + @ApiParam(value = "Activity Spec Id") @PathParam("id") String id, + @ApiParam(value = "Version Id") @PathParam("versionId") String versionId); + + @GET + @Path("/") + @ApiOperation(value = "Get list of activity specs ", + responseContainer = "List") + Response list(@ApiParam( + value = "Currently supported values: 'Certified' - only activity specs with Certified status") + @QueryParam("status") String versionStatus); +} diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/mapping/MapActivityParameterToDto.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/mapping/MapActivityParameterToDto.java new file mode 100644 index 0000000000..bd644ff4d6 --- /dev/null +++ b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/mapping/MapActivityParameterToDto.java @@ -0,0 +1,31 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openecomp.activityspec.api.rest.mapping; + +import org.openecomp.activityspec.be.datatypes.ActivitySpecParameter; +import org.openecomp.activityspec.api.rest.types.ActivitySpecParameterDto; +import org.openecomp.sdcrests.mapping.MappingBase; + +public class MapActivityParameterToDto extends MappingBase<ActivitySpecParameter, + ActivitySpecParameterDto> { + @Override + public void doMapping(ActivitySpecParameter source, ActivitySpecParameterDto target) { + target.setName(source.getName()); + target.setType(source.getType()); + target.setValue(source.getValue()); + } +} diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/mapping/MapActivitySpecRequestDtoToActivitySpecEntity.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/mapping/MapActivitySpecRequestDtoToActivitySpecEntity.java new file mode 100644 index 0000000000..2062fe273b --- /dev/null +++ b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/mapping/MapActivitySpecRequestDtoToActivitySpecEntity.java @@ -0,0 +1,51 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openecomp.activityspec.api.rest.mapping; + +import java.util.ArrayList; +import org.openecomp.activityspec.be.dao.types.ActivitySpecEntity; +import org.openecomp.activityspec.be.datatypes.ActivitySpecParameter; +import org.openecomp.activityspec.api.rest.types.ActivitySpecRequestDto; +import org.openecomp.sdcrests.mapping.MappingBase; + +import java.util.Objects; +import java.util.stream.Collectors; + +public class MapActivitySpecRequestDtoToActivitySpecEntity + extends MappingBase<ActivitySpecRequestDto, + ActivitySpecEntity> { + + @Override + public void doMapping(ActivitySpecRequestDto source, ActivitySpecEntity target) { + target.setName(source.getName()); + target.setDescription(source.getDescription()); + target.setCategoryList(source.getCategoryList() == null ? new ArrayList<String>() + : source.getCategoryList()); + if (Objects.nonNull(source.getInputParameters())) { + target.setInputParameters(source.getInputParameters().stream() + .map(activitySpecParameterDto -> new MapDtoToActivityParameter() + .applyMapping(activitySpecParameterDto, ActivitySpecParameter.class)) + .collect(Collectors.toList())); + } + if (Objects.nonNull(source.getOutputParameters())) { + target.setOutputParameters(source.getOutputParameters().stream() + .map(activitySpecParameterDto -> new MapDtoToActivityParameter() + .applyMapping(activitySpecParameterDto, ActivitySpecParameter.class)) + .collect(Collectors.toList())); + } + } +} diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/mapping/MapActivitySpecToActivitySpecCreateResponse.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/mapping/MapActivitySpecToActivitySpecCreateResponse.java new file mode 100644 index 0000000000..13c881404f --- /dev/null +++ b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/mapping/MapActivitySpecToActivitySpecCreateResponse.java @@ -0,0 +1,32 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openecomp.activityspec.api.rest.mapping; + +import java.util.Objects; +import org.openecomp.activityspec.be.dao.types.ActivitySpecEntity; +import org.openecomp.activityspec.api.rest.types.ActivitySpecCreateResponse; +import org.openecomp.sdcrests.mapping.MappingBase; + +public class MapActivitySpecToActivitySpecCreateResponse extends MappingBase<ActivitySpecEntity, + ActivitySpecCreateResponse> { + + @Override + public void doMapping(ActivitySpecEntity source, ActivitySpecCreateResponse target) { + target.setId(source.getId()); + target.setVersionId(Objects.nonNull(source.getVersion()) ? source.getVersion().getId() : null); + } +} diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/mapping/MapActivitySpecToActivitySpecGetResponse.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/mapping/MapActivitySpecToActivitySpecGetResponse.java new file mode 100644 index 0000000000..25e0f6e9c4 --- /dev/null +++ b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/mapping/MapActivitySpecToActivitySpecGetResponse.java @@ -0,0 +1,49 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openecomp.activityspec.api.rest.mapping; + +import org.openecomp.activityspec.be.dao.types.ActivitySpecEntity; +import org.openecomp.activityspec.api.rest.types.ActivitySpecGetResponse; +import org.openecomp.activityspec.api.rest.types.ActivitySpecParameterDto; +import org.openecomp.sdcrests.mapping.MappingBase; + +import java.util.Objects; +import java.util.stream.Collectors; + +public class MapActivitySpecToActivitySpecGetResponse extends MappingBase<ActivitySpecEntity, + ActivitySpecGetResponse> { + + @Override + public void doMapping(ActivitySpecEntity source, ActivitySpecGetResponse target) { + target.setName(source.getName()); + target.setDescription(source.getDescription()); + target.setCategoryList(source.getCategoryList()); + if (Objects.nonNull(source.getInputParameters())) { + target.setInputParameters(source.getInputParameters().stream().map( + activitySpecParameter -> new MapActivityParameterToDto() + .applyMapping(activitySpecParameter, ActivitySpecParameterDto + .class)).collect(Collectors.toList())); + } + if (Objects.nonNull(source.getOutputParameters())) { + target.setOutputParameters(source.getOutputParameters().stream().map( + activitySpecParameter -> new MapActivityParameterToDto() + .applyMapping(activitySpecParameter, ActivitySpecParameterDto + .class)).collect(Collectors.toList())); + } + target.setStatus(source.getStatus()); + } +} diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/mapping/MapDtoToActivityParameter.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/mapping/MapDtoToActivityParameter.java new file mode 100644 index 0000000000..ccffaead76 --- /dev/null +++ b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/mapping/MapDtoToActivityParameter.java @@ -0,0 +1,31 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openecomp.activityspec.api.rest.mapping; + +import org.openecomp.activityspec.be.datatypes.ActivitySpecParameter; +import org.openecomp.activityspec.api.rest.types.ActivitySpecParameterDto; +import org.openecomp.sdcrests.mapping.MappingBase; + +public class MapDtoToActivityParameter extends MappingBase<ActivitySpecParameterDto, + ActivitySpecParameter> { + @Override + public void doMapping(ActivitySpecParameterDto source, ActivitySpecParameter target) { + target.setName(source.getName()); + target.setType(source.getType()); + target.setValue(source.getValue()); + } +} diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/mapping/MapItemToListResponseDto.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/mapping/MapItemToListResponseDto.java new file mode 100644 index 0000000000..c85d5af427 --- /dev/null +++ b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/mapping/MapItemToListResponseDto.java @@ -0,0 +1,45 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openecomp.activityspec.api.rest.mapping; + +import org.openecomp.activityspec.api.rest.types.ActivitySpecListResponseDto; +import org.openecomp.sdc.versioning.dao.types.VersionStatus; +import org.openecomp.sdc.versioning.types.Item; +import org.openecomp.sdcrests.mapping.MappingBase; + +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +import static org.openecomp.activityspec.utils.ActivitySpecConstant.CATEGORY_ATTRIBUTE_NAME; + +public class MapItemToListResponseDto extends MappingBase<Item, ActivitySpecListResponseDto> { + @Override + public void doMapping(Item source, ActivitySpecListResponseDto target) { + target.setId(source.getId()); + target.setName(source.getName()); + target.setCategoryList((List<String>) source.getProperties().get( + CATEGORY_ATTRIBUTE_NAME)); + final Map<VersionStatus, Integer> versionStatusCounters = source.getVersionStatusCounters(); + if (Objects.nonNull(versionStatusCounters) && !versionStatusCounters.isEmpty()) { + final Set<VersionStatus> versionStatuses = versionStatusCounters.keySet(); + target.setStatus(versionStatuses.stream().findFirst().isPresent() + ? versionStatuses.stream().findFirst().get().name() : null); + } + } +} diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/services/ActivitySpecsImpl.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/services/ActivitySpecsImpl.java new file mode 100644 index 0000000000..db2db40f6e --- /dev/null +++ b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/services/ActivitySpecsImpl.java @@ -0,0 +1,117 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openecomp.activityspec.api.rest.services; + +import org.openecomp.activityspec.api.rest.ActivitySpecs; +import org.openecomp.activityspec.api.rest.mapping.MapActivitySpecRequestDtoToActivitySpecEntity; +import org.openecomp.activityspec.api.rest.mapping.MapActivitySpecToActivitySpecCreateResponse; +import org.openecomp.activityspec.api.rest.mapping.MapActivitySpecToActivitySpecGetResponse; +import org.openecomp.activityspec.api.rest.mapping.MapItemToListResponseDto; +import org.openecomp.activityspec.api.rest.types.ActivitySpecActionRequestDto; +import org.openecomp.activityspec.api.rest.types.ActivitySpecCreateResponse; +import org.openecomp.activityspec.api.rest.types.ActivitySpecGetResponse; +import org.openecomp.activityspec.api.rest.types.ActivitySpecListResponseDto; +import org.openecomp.activityspec.api.rest.types.ActivitySpecRequestDto; +import org.openecomp.activityspec.api.rest.types.InternalEmptyObject; +import org.openecomp.activityspec.be.ActivitySpecManager; +import org.openecomp.activityspec.be.dao.impl.ActivitySpecDaoZusammenImpl; +import org.openecomp.activityspec.be.dao.types.ActivitySpecEntity; +import org.openecomp.activityspec.be.impl.ActivitySpecManagerImpl; +import org.openecomp.core.dao.UniqueValueDaoFactory; +import org.openecomp.core.zusammen.api.ZusammenAdaptorFactory; +import org.openecomp.sdc.versioning.ItemManagerFactory; +import org.openecomp.sdc.versioning.VersioningManagerFactory; +import org.openecomp.sdc.versioning.dao.types.Version; + +import org.openecomp.sdcrests.wrappers.GenericCollectionWrapper; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +import javax.ws.rs.core.Response; + +@Service("activitySpecs") +@Scope(value = "singleton") +@Validated +public class ActivitySpecsImpl implements ActivitySpecs { + + + private final ActivitySpecManager activitySpecManager = + new ActivitySpecManagerImpl(ItemManagerFactory.getInstance().createInterface(), + VersioningManagerFactory.getInstance().createInterface(), + new ActivitySpecDaoZusammenImpl(ZusammenAdaptorFactory.getInstance().createInterface()), + UniqueValueDaoFactory.getInstance().createInterface()); + + @Override + public Response createActivitySpec(ActivitySpecRequestDto request) { + ActivitySpecEntity activitySpec = new MapActivitySpecRequestDtoToActivitySpecEntity() + .applyMapping(request, ActivitySpecEntity.class); + + activitySpec = activitySpecManager.createActivitySpec(activitySpec); + ActivitySpecCreateResponse createActivitySpecResponse = + new MapActivitySpecToActivitySpecCreateResponse().applyMapping(activitySpec, + ActivitySpecCreateResponse.class); + + return Response.ok(createActivitySpecResponse).build(); + } + + @Override + public Response getActivitySpec(String activitySpecId, String versionId) { + ActivitySpecEntity activitySpec = new ActivitySpecEntity(); + activitySpec.setId(activitySpecId); + activitySpec.setVersion(new Version(versionId)); + final ActivitySpecEntity retrieved = activitySpecManager.get(activitySpec); + ActivitySpecGetResponse getResponse = new MapActivitySpecToActivitySpecGetResponse() + .applyMapping(retrieved, ActivitySpecGetResponse.class); + return Response.ok(getResponse).build(); + } + + @Override + public Response updateActivitySpec(ActivitySpecRequestDto request, String activitySpecId, + String versionId) { + ActivitySpecEntity activitySpec = new MapActivitySpecRequestDtoToActivitySpecEntity() + .applyMapping(request, ActivitySpecEntity.class); + + activitySpec.setId(activitySpecId); + activitySpec.setVersion(new Version(versionId)); + + activitySpecManager.update(activitySpec); + + return Response.ok(new InternalEmptyObject()).build(); + } + + @Override + public Response actOnActivitySpec(ActivitySpecActionRequestDto request, String activitySpecId, + String versionId) { + activitySpecManager.actOnAction(activitySpecId, versionId, request.getAction()); + return Response.ok(new InternalEmptyObject()).build(); + } + + @Override + public Response list(String versionStatus) { + + GenericCollectionWrapper<ActivitySpecListResponseDto> results = new GenericCollectionWrapper<>(); + 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))); + + return Response.ok(results).build(); + } + +} diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/ActivitySpecAction.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/ActivitySpecAction.java new file mode 100644 index 0000000000..bedcfcb2da --- /dev/null +++ b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/ActivitySpecAction.java @@ -0,0 +1,23 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openecomp.activityspec.api.rest.types; + +public enum ActivitySpecAction { + CERTIFY, + DEPRECATE, + DELETE +}
\ No newline at end of file diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/ActivitySpecActionRequestDto.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/ActivitySpecActionRequestDto.java new file mode 100644 index 0000000000..c9012120f1 --- /dev/null +++ b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/ActivitySpecActionRequestDto.java @@ -0,0 +1,22 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openecomp.activityspec.api.rest.types; + +@lombok.Data +public class ActivitySpecActionRequestDto { + private ActivitySpecAction action; +} diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/ActivitySpecCreateResponse.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/ActivitySpecCreateResponse.java new file mode 100644 index 0000000000..9a654f780c --- /dev/null +++ b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/ActivitySpecCreateResponse.java @@ -0,0 +1,24 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openecomp.activityspec.api.rest.types; + +@lombok.Data +public class ActivitySpecCreateResponse { + private String id; + private String versionId; +} + diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/ActivitySpecGetResponse.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/ActivitySpecGetResponse.java new file mode 100644 index 0000000000..cf3fa969fa --- /dev/null +++ b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/ActivitySpecGetResponse.java @@ -0,0 +1,29 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openecomp.activityspec.api.rest.types; + +import java.util.List; + +@lombok.Data +public class ActivitySpecGetResponse { + private String name; + private String description; + private List<String> categoryList; + private List<ActivitySpecParameterDto> inputParameters; + private List<ActivitySpecParameterDto> outputParameters; + private String status; +} diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/ActivitySpecListResponseDto.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/ActivitySpecListResponseDto.java new file mode 100644 index 0000000000..782143f620 --- /dev/null +++ b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/ActivitySpecListResponseDto.java @@ -0,0 +1,28 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openecomp.activityspec.api.rest.types; + +import java.util.List; + +@lombok.Data +public class ActivitySpecListResponseDto { + private String id; + private String version; + String name; + List<String> categoryList; + private String status; +} diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/ActivitySpecParameterDto.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/ActivitySpecParameterDto.java new file mode 100644 index 0000000000..76e8262984 --- /dev/null +++ b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/ActivitySpecParameterDto.java @@ -0,0 +1,24 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openecomp.activityspec.api.rest.types; + +@lombok.Data +public class ActivitySpecParameterDto { + private String name; + private String type; + private String value; +} diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/ActivitySpecRequestDto.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/ActivitySpecRequestDto.java new file mode 100644 index 0000000000..77ea393ce3 --- /dev/null +++ b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/ActivitySpecRequestDto.java @@ -0,0 +1,37 @@ +/* + * Copyright © 2016-2017 European Support Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openecomp.activityspec.api.rest.types; + +import io.swagger.annotations.ApiModel; +import org.hibernate.validator.constraints.NotBlank; + +import javax.validation.constraints.Pattern; +import java.util.List; + +@ApiModel(value = "ActivitySpecRequest") +@lombok.Data +public class ActivitySpecRequestDto { + + @NotBlank(message = "is mandatory and should not be empty") + @Pattern(regexp = "^[a-zA-Z0-9-]*$", message = "must match \"^[a-zA-Z0-9-]*$\"") + private String name; + private String description; + + private List<String> categoryList; + private List<ActivitySpecParameterDto> inputParameters; + private List<ActivitySpecParameterDto> outputParameters; +} diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/InternalEmptyObject.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/InternalEmptyObject.java new file mode 100644 index 0000000000..2faf7bcafa --- /dev/null +++ b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/api/rest/types/InternalEmptyObject.java @@ -0,0 +1,27 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openecomp.activityspec.api.rest.types; + +import org.codehaus.jackson.annotate.JsonAutoDetect; + +/** + * Object of this class can be used to create empty Response body like "{}" + */ +@JsonAutoDetect +public class InternalEmptyObject { + +} |