aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp')
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/ComponentProcesses.java168
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/ComponentUploads.java104
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/Components.java142
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/Networks.java107
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/Nics.java144
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/Processes.java151
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/VendorSoftwareProducts.java193
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentDataToComponentDto.java35
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentEntityToComponentDto.java37
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentRequestDtoToComponentEntity.java38
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapCompositionEntityResponseToDto.java47
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapCompositionEntityValidationDataToDto.java44
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapMibUploadStatusToDto.java33
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapNetworkEntityToNetworkDto.java37
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapNetworkRequestDtoToNetworkEntity.java37
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapNetworkToNetworkDto.java33
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapNicEntityToNicDto.java37
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapNicRequestDtoToNicEntity.java37
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapNicToNicDto.java35
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapPackageInfoToPackageInfoDto.java42
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapProcessEntityToProcessEntityDto.java36
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapProcessRequestDtoToProcessEntity.java34
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapQuestionnaireResponseToQuestionnaireResponseDto.java35
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapUploadFileResponseToUploadFileResponseDto.java36
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapValidationResponseToDto.java90
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVersionedVendorSoftwareProductInfoToVspDetailsDto.java74
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDescriptionDtoToVspDetails.java56
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MspVspDetailsToVspCreationDto.java32
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ComponentProcessesImpl.java144
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ComponentUploadsImpl.java87
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ComponentsImpl.java145
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/NetworksImpl.java115
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/NicsImpl.java140
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ProcessesImpl.java89
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java228
35 files changed, 2842 insertions, 0 deletions
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/ComponentProcesses.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/ComponentProcesses.java
new file mode 100644
index 0000000000..3fae16cf7f
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/ComponentProcesses.java
@@ -0,0 +1,168 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vsp.rest;
+
+import static org.openecomp.sdcrests.common.RestConstants.USER_HEADER_PARAM;
+import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.apache.cxf.jaxrs.ext.multipart.Attachment;
+import org.apache.cxf.jaxrs.ext.multipart.Multipart;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.ProcessEntityDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.ProcessRequestDto;
+import org.springframework.validation.annotation.Validated;
+
+import javax.validation.Valid;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Pattern;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.HeaderParam;
+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/vendor-software-products/{vspId}/components/{componentId}/processes")
+@Produces(MediaType.APPLICATION_JSON)
+@Consumes(MediaType.APPLICATION_JSON)
+@Api(value = "Vendor Software Product Component Processes")
+@Validated
+public interface ComponentProcesses {
+ @GET
+ @Path("/")
+ @ApiOperation(value = "List vendor software product component processes",
+ response = ProcessEntityDto.class,
+ responseContainer = "List")
+ Response list(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
+ @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
+ String componentId,
+ @Pattern(regexp = Version.VERSION_REGEX,
+ message = Version.VERSION_STRING_VIOLATION_MSG) @QueryParam("version")
+ String version,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
+ String user);
+
+ @DELETE
+ @Path("/")
+ @ApiOperation(value = "Delete vendor software product processes",
+ responseContainer = "List")
+ Response deleteList(
+ @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
+ @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
+ String componentId,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM) String user);
+
+ @POST
+ @Path("/")
+ @ApiOperation(value = "Create a vendor software product process")
+ Response create(@Valid ProcessRequestDto request,
+ @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
+ @ApiParam(value = "Vendor software product component Id")
+ @PathParam("componentId") String componentId,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
+ String user);
+
+ @GET
+ @Path("/{processId}")
+ @ApiOperation(value = "Get vendor software product process",
+ response = ProcessEntityDto.class)
+ Response get(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
+ @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
+ String componentId,
+ @ApiParam(value = "Vendor software product process Id") @PathParam("processId")
+ String processId,
+ @Pattern(regexp = Version.VERSION_REGEX,
+ message = Version.VERSION_STRING_VIOLATION_MSG) @QueryParam("version")
+ String version,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
+ String user);
+
+ @DELETE
+ @Path("/{processId}")
+ @ApiOperation(value = "Delete vendor software product process")
+ Response delete(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
+ @ApiParam(value = "Vendor software product component Id")
+ @PathParam("componentId") String componentId,
+ @ApiParam(value = "Vendor software product process Id") @PathParam("processId")
+ String processId,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
+ String user);
+
+ @PUT
+ @Path("/{processId}")
+ @ApiOperation(value = "Update vendor software product process")
+ Response update(@Valid ProcessRequestDto request,
+ @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
+ @ApiParam(value = "Vendor software product component Id")
+ @PathParam("componentId") String componentId,
+ @ApiParam(value = "Vendor software product process Id") @PathParam("processId")
+ String processId,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
+ String user);
+
+ @GET
+ @Path("/{processId}/upload")
+ @Produces(MediaType.APPLICATION_OCTET_STREAM)
+ @ApiOperation(value = "Get vendor software product process uploaded file")
+ Response getUploadedFile(
+ @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
+ @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
+ String componentId,
+ @ApiParam(value = "Vendor software product process Id") @PathParam("processId")
+ String processId,
+ @Pattern(regexp = Version.VERSION_REGEX, message = Version.VERSION_STRING_VIOLATION_MSG)
+ @QueryParam("version") String version,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM) String user);
+
+ @DELETE
+ @Path("/{processId}/upload")
+ @ApiOperation(value = "Delete vendor software product process uploaded file")
+ Response deleteUploadedFile(
+ @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
+ @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
+ String componentId,
+ @ApiParam(value = "Vendor software product process Id") @PathParam("processId")
+ String processId,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM) String user);
+
+ @POST
+ @Path("/{processId}/upload")
+ @Consumes(MediaType.MULTIPART_FORM_DATA)
+ @ApiOperation(value = "Update vendor software product process upload")
+ Response uploadFile(@Multipart("upload") Attachment attachment,
+ @ApiParam(value = "Vendor software product Id") @PathParam("vspId")
+ String vspId,
+ @ApiParam(value = "Vendor software product component Id")
+ @PathParam("componentId") String componentId,
+ @ApiParam(value = "Vendor software product process Id")
+ @PathParam("processId") String processId,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
+ String user);
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/ComponentUploads.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/ComponentUploads.java
new file mode 100644
index 0000000000..c7ad2f7fe5
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/ComponentUploads.java
@@ -0,0 +1,104 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vsp.rest;
+
+import static org.openecomp.sdcrests.common.RestConstants.USER_HEADER_PARAM;
+import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.apache.cxf.jaxrs.ext.multipart.Attachment;
+import org.apache.cxf.jaxrs.ext.multipart.Multipart;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.MibUploadStatusDto;
+import org.springframework.validation.annotation.Validated;
+
+import javax.validation.constraints.NotNull;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.HeaderParam;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+
+@Path("/v1.0/vendor-software-products/{vspId}/components/{componentId}/monitors")
+@Produces(MediaType.APPLICATION_JSON)
+@Consumes(MediaType.APPLICATION_JSON)
+@Api(value = "Vendor Software Product Component MIB Uploads")
+@Validated
+public interface ComponentUploads {
+ @POST
+ @Path("/snmp-trap/upload")
+ @Consumes(MediaType.MULTIPART_FORM_DATA)
+ @ApiOperation(value = "Upload vendor software product MIB Trap Definitions file")
+ Response uploadTrapMibFile(@Multipart("upload") Attachment attachment,
+ @ApiParam(value = "Vendor software product Id") @PathParam("vspId")
+ String vspId,
+ @ApiParam(value = "Vendor software product component Id")
+ @PathParam("componentId") String componentId,
+ @NotNull(message = USER_MISSING_ERROR_MSG)
+ @HeaderParam(USER_HEADER_PARAM) String user);
+
+ @DELETE
+ @Path("/snmp-trap")
+ @ApiOperation(value = "Delete vendor software product MIB Trap Definitions file")
+ Response deleteTrapMibFile(
+ @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
+ @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
+ String componentId,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM) String user);
+
+ @POST
+ @Path("/snmp/upload")
+ @Consumes(MediaType.MULTIPART_FORM_DATA)
+ @ApiOperation(value = "Upload vendor software product MIB Poll Definitions file")
+ Response uploadPollMibFile(@Multipart("upload") Attachment attachment,
+ @ApiParam(value = "Vendor software product Id") @PathParam("vspId")
+ String vspId,
+ @ApiParam(value = "Vendor software product component Id")
+ @PathParam("componentId") String componentId,
+ @NotNull(message = USER_MISSING_ERROR_MSG)
+ @HeaderParam(USER_HEADER_PARAM) String user);
+
+ @DELETE
+ @Path("/snmp")
+ @ApiOperation(value = "Delete vendor software product MIB Poll Definitions file")
+ Response deletePollMibFile(
+ @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
+ @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
+ String componentId,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM) String user);
+
+ @GET
+ @Path("/snmp/")
+ @ApiOperation(value = "Get the filenames of uploaded MIB definitions",
+ response = MibUploadStatusDto.class)
+ Response list(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
+ @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
+ String componentId,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
+ String user);
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/Components.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/Components.java
new file mode 100644
index 0000000000..949a40cfbb
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/Components.java
@@ -0,0 +1,142 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vsp.rest;
+
+import static org.openecomp.sdcrests.common.RestConstants.USER_HEADER_PARAM;
+import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentData;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComponentDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComponentRequestDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.QuestionnaireResponseDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.validation.IsValidJson;
+import org.springframework.validation.annotation.Validated;
+
+import javax.validation.Valid;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Pattern;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.HeaderParam;
+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/vendor-software-products/{vspId}/components")
+@Produces(MediaType.APPLICATION_JSON)
+@Consumes(MediaType.APPLICATION_JSON)
+@Api(value = "Vendor Software Product Components")
+@Validated
+public interface Components {
+ @GET
+ @Path("/")
+ @ApiOperation(value = "List vendor software product components",
+ response = ComponentDto.class,
+ responseContainer = "List")
+ Response list(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
+ @Pattern(regexp = Version.VERSION_REGEX,
+ message = Version.VERSION_STRING_VIOLATION_MSG) @QueryParam("version")
+ String version,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
+ String user);
+
+ @DELETE
+ @Path("/")
+ @ApiOperation(value = "Delete vendor software product components",
+ responseContainer = "List")
+ Response deleteList(
+ @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM) String user);
+
+ @POST
+ @Path("/")
+ @ApiOperation(value = "Create a vendor software product component")
+ Response create(@Valid ComponentRequestDto request,
+ @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
+ String user);
+
+ @GET
+ @Path("/{componentId}")
+ @ApiOperation(value = "Get vendor software product component",
+ response = ComponentData.class,
+ responseContainer = "CompositionEntityResponse")
+ Response get(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
+ @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
+ String componentId,
+ @Pattern(regexp = Version.VERSION_REGEX,
+ message = Version.VERSION_STRING_VIOLATION_MSG) @QueryParam("version")
+ String version,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
+ String user);
+
+ @DELETE
+ @Path("/{componentId}")
+ @ApiOperation(value = "Delete vendor software product component")
+ Response delete(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
+ @ApiParam(value = "Vendor software product component Id")
+ @PathParam("componentId") String componentId,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
+ String user);
+
+ @PUT
+ @Path("/{componentId}")
+ @ApiOperation(value = "Update vendor software product component")
+ Response update(@Valid ComponentRequestDto request,
+ @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
+ @ApiParam(value = "Vendor software product component Id")
+ @PathParam("componentId") String componentId,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
+ String user);
+
+ @GET
+ @Path("/{componentId}/questionnaire")
+ @ApiOperation(value = "Get vendor software product component questionnaire",
+ response = QuestionnaireResponseDto.class)
+ Response getQuestionnaire(
+ @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
+ @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
+ String componentId,
+ @Pattern(regexp = Version.VERSION_REGEX, message = Version.VERSION_STRING_VIOLATION_MSG)
+ @QueryParam("version") String version,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM) String user);
+
+ @PUT
+ @Path("/{componentId}/questionnaire")
+ @ApiOperation(value = "Update vendor software product component questionnaire")
+ Response updateQuestionnaire(@NotNull @IsValidJson String questionnaireData,
+ @ApiParam(value = "Vendor software product Id") @PathParam("vspId")
+ String vspId,
+ @ApiParam(value = "Vendor software product component Id")
+ @PathParam("componentId") String componentId,
+ @NotNull(message = USER_MISSING_ERROR_MSG)
+ @HeaderParam(USER_HEADER_PARAM) String user);
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/Networks.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/Networks.java
new file mode 100644
index 0000000000..5c7c9d7bd8
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/Networks.java
@@ -0,0 +1,107 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vsp.rest;
+
+import static org.openecomp.sdcrests.common.RestConstants.USER_HEADER_PARAM;
+import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.NetworkDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.NetworkRequestDto;
+import org.springframework.validation.annotation.Validated;
+
+import javax.validation.Valid;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Pattern;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.HeaderParam;
+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/vendor-software-products/{vspId}/networks")
+@Produces(MediaType.APPLICATION_JSON)
+@Consumes(MediaType.APPLICATION_JSON)
+@Api(value = "Vendor Software Product Networks")
+@Validated
+public interface Networks {
+ @GET
+ @Path("/")
+ @ApiOperation(value = "List vendor software product networks",
+ response = NetworkDto.class,
+ responseContainer = "List")
+ Response list(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
+ @Pattern(regexp = Version.VERSION_REGEX,
+ message = Version.VERSION_STRING_VIOLATION_MSG) @QueryParam("version")
+ String version,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
+ String user);
+
+ @POST
+ @Path("/")
+ @ApiOperation(value = "Create a vendor software product network")
+ Response create(@Valid NetworkRequestDto request,
+ @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
+ String user);
+
+ @GET
+ @Path("/{networkId}")
+ @ApiOperation(value = "Get vendor software product network",
+ response = NetworkDto.class)
+ Response get(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
+ @ApiParam(value = "Vendor software product network Id") @PathParam("networkId")
+ String networkId,
+ @Pattern(regexp = Version.VERSION_REGEX,
+ message = Version.VERSION_STRING_VIOLATION_MSG) @QueryParam("version")
+ String version,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
+ String user);
+
+ @DELETE
+ @Path("/{networkId}")
+ @ApiOperation(value = "Delete vendor software product network")
+ Response delete(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
+ @ApiParam(value = "Vendor software product network Id") @PathParam("networkId")
+ String networkId,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
+ String user);
+
+ @PUT
+ @Path("/{networkId}")
+ @ApiOperation(value = "Update vendor software product network")
+ Response update(@Valid NetworkRequestDto request,
+ @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
+ @ApiParam(value = "Vendor software product network Id") @PathParam("networkId")
+ String networkId,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
+ String user);
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/Nics.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/Nics.java
new file mode 100644
index 0000000000..8cf26a405b
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/Nics.java
@@ -0,0 +1,144 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vsp.rest;
+
+import static org.openecomp.sdcrests.common.RestConstants.USER_HEADER_PARAM;
+import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.NicDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.NicRequestDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.QuestionnaireResponseDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.validation.IsValidJson;
+import org.springframework.validation.annotation.Validated;
+
+import javax.validation.Valid;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Pattern;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.HeaderParam;
+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/vendor-software-products/{vspId}/components/{componentId}/nics")
+@Produces(MediaType.APPLICATION_JSON)
+@Consumes(MediaType.APPLICATION_JSON)
+@Api(value = "Vendor Software Product Component NICs")
+@Validated
+public interface Nics {
+ @GET
+ @Path("/")
+ @ApiOperation(value = "List vendor software product component NICs",
+ response = NicDto.class,
+ responseContainer = "List")
+ Response list(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
+ @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
+ String componentId,
+ @Pattern(regexp = Version.VERSION_REGEX,
+ message = Version.VERSION_STRING_VIOLATION_MSG) @QueryParam("version")
+ String version,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
+ String user);
+
+ @POST
+ @Path("/")
+ @ApiOperation(value = "Create a vendor software product NIC")
+ Response create(@Valid NicRequestDto request,
+ @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
+ @ApiParam(value = "Vendor software product component Id")
+ @PathParam("componentId") String componentId,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
+ String user);
+
+ @GET
+ @Path("/{nicId}")
+ @ApiOperation(value = "Get vendor software product NIC",
+ response = NicDto.class)
+ Response get(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
+ @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
+ String componentId,
+ @ApiParam(value = "Vendor software product NIC Id") @PathParam("nicId") String nicId,
+ @Pattern(regexp = Version.VERSION_REGEX,
+ message = Version.VERSION_STRING_VIOLATION_MSG) @QueryParam("version")
+ String version,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
+ String user);
+
+ @DELETE
+ @Path("/{nicId}")
+ @ApiOperation(value = "Delete vendor software product NIC")
+ Response delete(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
+ @ApiParam(value = "Vendor software product component Id")
+ @PathParam("componentId") String componentId,
+ @ApiParam(value = "Vendor software product NIC Id") @PathParam("nicId")
+ String nicId,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
+ String user);
+
+ @PUT
+ @Path("/{nicId}")
+ @ApiOperation(value = "Update vendor software product NIC")
+ Response update(@Valid NicRequestDto request,
+ @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
+ @ApiParam(value = "Vendor software product component Id")
+ @PathParam("componentId") String componentId,
+ @ApiParam(value = "Vendor software product NIC Id") @PathParam("nicId")
+ String nicId,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
+ String user);
+
+ @GET
+ @Path("/{nicId}/questionnaire")
+ @ApiOperation(value = "Get vendor software product component NIC questionnaire",
+ response = QuestionnaireResponseDto.class)
+ Response getQuestionnaire(
+ @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
+ @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
+ String componentId,
+ @ApiParam(value = "Vendor software product NIC Id") @PathParam("nicId") String nicId,
+ @Pattern(regexp = Version.VERSION_REGEX, message = Version.VERSION_STRING_VIOLATION_MSG)
+ @QueryParam("version") String version,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM) String user);
+
+ @PUT
+ @Path("/{nicId}/questionnaire")
+ @ApiOperation(value = "Update vendor software product component NIC questionnaire")
+ Response updateQuestionnaire(@NotNull @IsValidJson String questionnaireData,
+ @ApiParam(value = "Vendor software product Id") @PathParam("vspId")
+ String vspId,
+ @ApiParam(value = "Vendor software product component Id")
+ @PathParam("componentId") String componentId,
+ @ApiParam(value = "Vendor software product NIC Id")
+ @PathParam("nicId") String nicId,
+ @NotNull(message = USER_MISSING_ERROR_MSG)
+ @HeaderParam(USER_HEADER_PARAM) String user);
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/Processes.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/Processes.java
new file mode 100644
index 0000000000..b5c74587e4
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/Processes.java
@@ -0,0 +1,151 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vsp.rest;
+
+import static org.openecomp.sdcrests.common.RestConstants.USER_HEADER_PARAM;
+import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.apache.cxf.jaxrs.ext.multipart.Attachment;
+import org.apache.cxf.jaxrs.ext.multipart.Multipart;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.ProcessEntityDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.ProcessRequestDto;
+
+import org.springframework.validation.annotation.Validated;
+
+import javax.validation.Valid;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Pattern;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.HeaderParam;
+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/vendor-software-products/{vspId}/processes")
+@Produces(MediaType.APPLICATION_JSON)
+@Consumes(MediaType.APPLICATION_JSON)
+@Api(value = "Vendor Software Product Processes")
+@Validated
+public interface Processes {
+ @GET
+ @Path("/")
+ @ApiOperation(value = "List vendor software product processes",
+ response = ProcessEntityDto.class,
+ responseContainer = "List")
+ Response list(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
+ @Pattern(regexp = Version.VERSION_REGEX,
+ message = Version.VERSION_STRING_VIOLATION_MSG) @QueryParam("version")
+ String version,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
+ String user);
+
+ @DELETE
+ @Path("/")
+ @ApiOperation(value = "Delete vendor software product processes",
+ responseContainer = "List")
+ Response deleteList(
+ @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM) String user);
+
+ @POST
+ @Path("/")
+ @ApiOperation(value = "Create a vendor software product process")
+ Response create(@Valid ProcessRequestDto request,
+ @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
+ String user);
+
+ @GET
+ @Path("/{processId}")
+ @ApiOperation(value = "Get vendor software product process",
+ response = ProcessEntityDto.class)
+ Response get(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
+ @ApiParam(value = "Vendor software product process Id") @PathParam("processId")
+ String processId,
+ @Pattern(regexp = Version.VERSION_REGEX,
+ message = Version.VERSION_STRING_VIOLATION_MSG) @QueryParam("version")
+ String version,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
+ String user);
+
+ @DELETE
+ @Path("/{processId}")
+ @ApiOperation(value = "Delete vendor software product process")
+ Response delete(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
+ @ApiParam(value = "Vendor software product process Id") @PathParam("processId")
+ String processId,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
+ String user);
+
+ @PUT
+ @Path("/{processId}")
+ @ApiOperation(value = "Update vendor software product process")
+ Response update(@Valid ProcessRequestDto request,
+ @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
+ @ApiParam(value = "Vendor software product process Id") @PathParam("processId")
+ String processId,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
+ String user);
+
+ @GET
+ @Path("/{processId}/upload")
+ @Produces(MediaType.APPLICATION_OCTET_STREAM)
+ @ApiOperation(value = "Get vendor software product process uploaded file")
+ Response getUploadedFile(
+ @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
+ @ApiParam(value = "Vendor software product process Id") @PathParam("processId")
+ String processId,
+ @Pattern(regexp = Version.VERSION_REGEX, message = Version.VERSION_STRING_VIOLATION_MSG)
+ @QueryParam("version") String version,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM) String user);
+
+ @DELETE
+ @Path("/{processId}/upload")
+ @ApiOperation(value = "Delete vendor software product process uploaded file")
+ Response deleteUploadedFile(
+ @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
+ @ApiParam(value = "Vendor software product process Id") @PathParam("processId")
+ String processId,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM) String user);
+
+ @POST
+ @Path("/{processId}/upload")
+ @Consumes(MediaType.MULTIPART_FORM_DATA)
+ @ApiOperation(value = "Update vendor software product process upload")
+ Response uploadFile(@Multipart("upload") Attachment attachment,
+ @ApiParam(value = "Vendor software product Id") @PathParam("vspId")
+ String vspId,
+ @ApiParam(value = "Vendor software product process Id")
+ @PathParam("processId") String processId,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
+ String user);
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/VendorSoftwareProducts.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/VendorSoftwareProducts.java
new file mode 100644
index 0000000000..259ef723c6
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/VendorSoftwareProducts.java
@@ -0,0 +1,193 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vsp.rest;
+
+import static org.openecomp.sdcrests.common.RestConstants.USER_HEADER_PARAM;
+import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+
+import org.apache.cxf.jaxrs.ext.multipart.Multipart;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.PackageInfoDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.QuestionnaireResponseDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.UploadFileResponseDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.VersionSoftwareProductActionRequestDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspCreationDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspDescriptionDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.validation.IsValidJson;
+import org.springframework.validation.annotation.Validated;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import javax.validation.Valid;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Pattern;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.HeaderParam;
+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/vendor-software-products")
+@Produces(MediaType.APPLICATION_JSON)
+@Consumes(MediaType.APPLICATION_JSON)
+@Api(value = "Vendor Software Products")
+@Validated
+public interface VendorSoftwareProducts {
+
+ @POST
+ @Path("/")
+ @ApiOperation(value = "Create a new vendor software product",
+ response = VspCreationDto.class)
+ Response createNewVsp(@Valid VspDescriptionDto vspDescriptionDto,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
+ String user);
+
+ @GET
+ @Path("/")
+ @ApiOperation(value = "Get list of vendor software products and their description",
+ responseContainer = "List")
+ Response getVspList(@ApiParam(
+ value = "Currently supported values: 'Final' - only vendor software products with final "
+ + "version will be return - with their latest final version")
+ @QueryParam("versionFilter") String versionFilter,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
+ String user);
+
+ @GET
+ @Path("/packages")
+ @ApiOperation(value = "Get list of translated CSAR files details",
+ response = PackageInfoDto.class,
+ responseContainer = "List")
+ Response listPackages(@ApiParam("Category") @QueryParam("category") String category,
+ @ApiParam("Sub-category") @QueryParam("subCategory") String subCategory,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
+ String user);
+
+ @GET
+ @Path("/{vspId}")
+ @ApiOperation(value = "Get details of a vendor software product")
+ Response getVspDetails(@PathParam("vspId") String vspId,
+ @Pattern(regexp = Version.VERSION_REGEX,
+ message = Version.VERSION_STRING_VIOLATION_MSG) @QueryParam("version")
+ String version,
+ @NotNull(message = USER_MISSING_ERROR_MSG)
+ @HeaderParam(USER_HEADER_PARAM) String user);
+
+ @PUT
+ @Path("/{vspId}")
+ @ApiOperation(value = "Update an existing vendor software product")
+ Response updateVsp(@PathParam("vspId") String vspId, @Valid VspDescriptionDto vspDescriptionDto,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
+ String user);
+
+ @DELETE
+ @Path("/{vspId}")
+ @ApiOperation(value = "Deletes vendor software product by given id")
+ Response deleteVsp(@PathParam("vspId") String vspId,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
+ String user);
+
+ @POST
+ @Path("{vspId}/upload")
+ @Consumes(MediaType.MULTIPART_FORM_DATA)
+ @ApiOperation(value = "Uploads a HEAT package to translate",
+ response = UploadFileResponseDto.class)
+ Response uploadFile(@PathParam("vspId") String vspId,
+ @Multipart("upload") InputStream heatFileToUpload,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
+ String user);
+
+ @GET
+ @Path("/{vspId}/downloadHeat")
+ @Produces(MediaType.APPLICATION_OCTET_STREAM)
+ @ApiOperation(value = "Get uploaded HEAT file",
+ notes = "Downloads the latest HEAT package",
+ response = File.class)
+ Response getLatestHeatPackage(@PathParam("vspId") String vspId,
+ /*@NotNull(message = USER_MISSING_ERROR_MSG)*/
+ @HeaderParam(USER_HEADER_PARAM) String user);
+
+
+ @PUT
+ @Path("/{vspId}/actions")
+ @ApiOperation(value = "Actions on a vendor software product",
+ notes = "Performs one of the following actions on a vendor software product: |"
+ + "Checkout: Locks it for edits by other users. Only the locking user sees the edited "
+ + "version.|"
+ + "Undo_Checkout: Unlocks it and deletes the edits that were done.|"
+ + "Checkin: Unlocks it and activates the edited version to all users.| "
+ + "Submit: Finalize its active version.|"
+ + "Create_Package: Creates a CSAR zip file.|")
+ /*@ApiResponses(value = {
+ @ApiResponse(code = 200, message = "Action succeeded"),
+ @ApiResponse(code = 417, message = "Validation before submit has failed",
+ response = ValidationResponseDto.class)})*/
+ Response actOnVendorSoftwareProduct(@PathParam("vspId") String vspId,
+ VersionSoftwareProductActionRequestDto request,
+ @NotNull(message = USER_MISSING_ERROR_MSG)
+ @HeaderParam(USER_HEADER_PARAM) String user)
+ throws IOException;
+
+ @GET
+ @Path("/packages/{vspId}")
+ @Produces(MediaType.APPLICATION_OCTET_STREAM)
+ @ApiOperation(value = "Get translated CSAR file",
+ notes = "Exports translated file to a zip file",
+ response = File.class)
+ Response getTranslatedFile(@PathParam("vspId") String vspId,
+ @Pattern(regexp = Version.VERSION_REGEX,
+ message = Version.VERSION_STRING_VIOLATION_MSG)
+ @QueryParam("version") String version,
+ /*@NotNull(message = USER_MISSING_ERROR_MSG)*/
+ @HeaderParam(USER_HEADER_PARAM) String user);
+
+ @GET
+ @Path("/{vspId}/questionnaire")
+ @ApiOperation(value = "Get vendor software product questionnaire",
+ response = QuestionnaireResponseDto.class)
+ Response getQuestionnaire(@PathParam("vspId") String vspId,
+ @Pattern(regexp = Version.VERSION_REGEX,
+ message = Version.VERSION_STRING_VIOLATION_MSG)
+ @QueryParam("version") String version,
+ @NotNull(message = USER_MISSING_ERROR_MSG)
+ @HeaderParam(USER_HEADER_PARAM) String user);
+
+ @PUT
+ @Path("/{vspId}/questionnaire")
+ @ApiOperation(value = "Update vendor software product questionnaire")
+ Response updateQuestionnaire(@NotNull @IsValidJson String questionnaireData,
+ @PathParam("vspId") String vspId,
+ @NotNull(message = USER_MISSING_ERROR_MSG)
+ @HeaderParam(USER_HEADER_PARAM) String user);
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentDataToComponentDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentDataToComponentDto.java
new file mode 100644
index 0000000000..e448ed6ca7
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentDataToComponentDto.java
@@ -0,0 +1,35 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vsp.rest.mapping;
+
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentData;
+import org.openecomp.sdcrests.mapping.MappingBase;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComponentDto;
+
+public class MapComponentDataToComponentDto extends MappingBase<ComponentData, ComponentDto> {
+ @Override
+ public void doMapping(ComponentData source, ComponentDto target) {
+ target.setName(source.getName());
+ target.setDisplayName(
+ source.getDisplayName() == null ? source.getName() : source.getDisplayName());
+ target.setDescription(source.getDescription());
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentEntityToComponentDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentEntityToComponentDto.java
new file mode 100644
index 0000000000..8878581d1c
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentEntityToComponentDto.java
@@ -0,0 +1,37 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vsp.rest.mapping;
+
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentData;
+import org.openecomp.sdcrests.mapping.MappingBase;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComponentDto;
+
+public class MapComponentEntityToComponentDto extends MappingBase<ComponentEntity, ComponentDto> {
+ @Override
+ public void doMapping(ComponentEntity source, ComponentDto target) {
+ target.setId(source.getId());
+ ComponentData component = source.getComponentCompositionData();
+ if (component != null) {
+ new MapComponentDataToComponentDto().doMapping(component, target);
+ }
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentRequestDtoToComponentEntity.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentRequestDtoToComponentEntity.java
new file mode 100644
index 0000000000..ce9e32770c
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentRequestDtoToComponentEntity.java
@@ -0,0 +1,38 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vsp.rest.mapping;
+
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentData;
+import org.openecomp.sdcrests.mapping.MappingBase;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComponentRequestDto;
+
+public class MapComponentRequestDtoToComponentEntity
+ extends MappingBase<ComponentRequestDto, ComponentEntity> {
+ @Override
+ public void doMapping(ComponentRequestDto source, ComponentEntity target) {
+ ComponentData component = new ComponentData();
+ component.setName(source.getName());
+ component.setDisplayName(source.getDisplayName());
+ component.setDescription(source.getDescription());
+ target.setComponentCompositionData(component);
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapCompositionEntityResponseToDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapCompositionEntityResponseToDto.java
new file mode 100644
index 0000000000..b5b7ccdfee
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapCompositionEntityResponseToDto.java
@@ -0,0 +1,47 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vsp.rest.mapping;
+
+import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionDataEntity;
+import org.openecomp.sdcrests.mapping.MappingBase;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.CompositionDataEntityDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.CompositionEntityResponseDto;
+
+public class MapCompositionEntityResponseToDto<S extends CompositionDataEntity,
+ T extends CompositionDataEntityDto, M extends MappingBase<S, T>>
+ extends MappingBase<CompositionEntityResponse<S>, CompositionEntityResponseDto<T>> {
+ private M dataMapper;
+ private Class<T> targetDataClass;
+
+ public MapCompositionEntityResponseToDto(M dataMapper, Class<T> targetDataClass) {
+ this.dataMapper = dataMapper;
+ this.targetDataClass = targetDataClass;
+ }
+
+ @Override
+ public void doMapping(CompositionEntityResponse<S> source,
+ CompositionEntityResponseDto<T> target) {
+ target.setId(source.getId());
+ target.setSchema(source.getSchema());
+ target.setData(dataMapper.applyMapping(source.getData(), targetDataClass));
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapCompositionEntityValidationDataToDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapCompositionEntityValidationDataToDto.java
new file mode 100644
index 0000000000..cb726dfc79
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapCompositionEntityValidationDataToDto.java
@@ -0,0 +1,44 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vsp.rest.mapping;
+
+import org.apache.commons.collections4.CollectionUtils;
+import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityValidationData;
+import org.openecomp.sdcrests.mapping.MappingBase;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.CompositionEntityValidationDataDto;
+
+import java.util.stream.Collectors;
+
+public class MapCompositionEntityValidationDataToDto
+ extends MappingBase<CompositionEntityValidationData, CompositionEntityValidationDataDto> {
+ @Override
+ public void doMapping(CompositionEntityValidationData source,
+ CompositionEntityValidationDataDto target) {
+ target.setEntityType(source.getEntityType());
+ target.setEntityId(source.getEntityId());
+ target.setErrors(source.getErrors());
+ if (CollectionUtils.isNotEmpty(source.getSubEntitiesValidationData())) {
+ target.setSubEntitiesValidationData(source.getSubEntitiesValidationData().stream()
+ .map(sub -> applyMapping(sub, CompositionEntityValidationDataDto.class))
+ .collect(Collectors.toList()));
+ }
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapMibUploadStatusToDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapMibUploadStatusToDto.java
new file mode 100644
index 0000000000..d69e078ac1
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapMibUploadStatusToDto.java
@@ -0,0 +1,33 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vsp.rest.mapping;
+
+import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.MibUploadStatus;
+import org.openecomp.sdcrests.mapping.MappingBase;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.MibUploadStatusDto;
+
+public class MapMibUploadStatusToDto extends MappingBase<MibUploadStatus, MibUploadStatusDto> {
+ @Override
+ public void doMapping(MibUploadStatus source, MibUploadStatusDto target) {
+ target.setSnmpPoll(source.getSnmpPoll());
+ target.setSnmpTrap(source.getSnmpTrap());
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapNetworkEntityToNetworkDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapNetworkEntityToNetworkDto.java
new file mode 100644
index 0000000000..1d79f35769
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapNetworkEntityToNetworkDto.java
@@ -0,0 +1,37 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vsp.rest.mapping;
+
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Network;
+import org.openecomp.sdcrests.mapping.MappingBase;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.NetworkDto;
+
+public class MapNetworkEntityToNetworkDto extends MappingBase<NetworkEntity, NetworkDto> {
+ @Override
+ public void doMapping(NetworkEntity source, NetworkDto target) {
+ target.setId(source.getId());
+ Network network = source.getNetworkCompositionData();
+ if (network != null) {
+ new MapNetworkToNetworkDto().doMapping(network, target);
+ }
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapNetworkRequestDtoToNetworkEntity.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapNetworkRequestDtoToNetworkEntity.java
new file mode 100644
index 0000000000..00395c4b99
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapNetworkRequestDtoToNetworkEntity.java
@@ -0,0 +1,37 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vsp.rest.mapping;
+
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Network;
+import org.openecomp.sdcrests.mapping.MappingBase;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.NetworkRequestDto;
+
+public class MapNetworkRequestDtoToNetworkEntity
+ extends MappingBase<NetworkRequestDto, NetworkEntity> {
+ @Override
+ public void doMapping(NetworkRequestDto source, NetworkEntity target) {
+ Network network = new Network();
+ network.setName(source.getName());
+ network.setDhcp(source.isDhcp());
+ target.setNetworkCompositionData(network);
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapNetworkToNetworkDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapNetworkToNetworkDto.java
new file mode 100644
index 0000000000..dd819de1a6
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapNetworkToNetworkDto.java
@@ -0,0 +1,33 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vsp.rest.mapping;
+
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Network;
+import org.openecomp.sdcrests.mapping.MappingBase;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.NetworkDto;
+
+public class MapNetworkToNetworkDto extends MappingBase<Network, NetworkDto> {
+ @Override
+ public void doMapping(Network source, NetworkDto target) {
+ target.setName(source.getName());
+ target.setDhcp(source.isDhcp());
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapNicEntityToNicDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapNicEntityToNicDto.java
new file mode 100644
index 0000000000..2af7e2ff6b
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapNicEntityToNicDto.java
@@ -0,0 +1,37 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vsp.rest.mapping;
+
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic;
+import org.openecomp.sdcrests.mapping.MappingBase;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.NicDto;
+
+public class MapNicEntityToNicDto extends MappingBase<NicEntity, NicDto> {
+ @Override
+ public void doMapping(NicEntity source, NicDto target) {
+ target.setId(source.getId());
+ Nic nic = source.getNicCompositionData();
+ if (nic != null) {
+ new MapNicToNicDto().doMapping(nic, target);
+ }
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapNicRequestDtoToNicEntity.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapNicRequestDtoToNicEntity.java
new file mode 100644
index 0000000000..4744364ea6
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapNicRequestDtoToNicEntity.java
@@ -0,0 +1,37 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vsp.rest.mapping;
+
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic;
+import org.openecomp.sdcrests.mapping.MappingBase;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.NicRequestDto;
+
+public class MapNicRequestDtoToNicEntity extends MappingBase<NicRequestDto, NicEntity> {
+ @Override
+ public void doMapping(NicRequestDto source, NicEntity target) {
+ Nic nic = new Nic();
+ nic.setName(source.getName());
+ nic.setDescription(source.getDescription());
+ nic.setNetworkId(source.getNetworkId());
+ target.setNicCompositionData(nic);
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapNicToNicDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapNicToNicDto.java
new file mode 100644
index 0000000000..2fcfd36b3f
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapNicToNicDto.java
@@ -0,0 +1,35 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vsp.rest.mapping;
+
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic;
+import org.openecomp.sdcrests.mapping.MappingBase;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.NicDto;
+
+public class MapNicToNicDto extends MappingBase<Nic, NicDto> {
+ @Override
+ public void doMapping(Nic source, NicDto target) {
+ target.setName(source.getName());
+ target.setDescription(source.getDescription());
+ target.setNetworkId(source.getNetworkId());
+ target.setNetworkName(source.getNetworkName());
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapPackageInfoToPackageInfoDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapPackageInfoToPackageInfoDto.java
new file mode 100644
index 0000000000..9cd365480e
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapPackageInfoToPackageInfoDto.java
@@ -0,0 +1,42 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vsp.rest.mapping;
+
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.PackageInfo;
+import org.openecomp.sdcrests.mapping.MappingBase;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.PackageInfoDto;
+
+public class MapPackageInfoToPackageInfoDto extends MappingBase<PackageInfo, PackageInfoDto> {
+ @Override
+ public void doMapping(PackageInfo source, PackageInfoDto target) {
+ target.setDisplayName(source.getDisplayName());
+ target.setVspName(source.getVspName());
+ target.setPackageId(source.getVspId());
+ target.setDescription(source.getVspDescription());
+ target.setVersion(source.getVersion() == null ? null : source.getVersion().toString());
+ target.setPackageType(source.getPackageType());
+ target.setCategory(source.getCategory());
+ target.setSubCategory(source.getSubCategory());
+ target.setPackageChecksum(source.getPackageChecksum());
+ target.setVendorRelease(source.getVendorRelease());
+ target.setVendorName(source.getVendorName());
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapProcessEntityToProcessEntityDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapProcessEntityToProcessEntityDto.java
new file mode 100644
index 0000000000..5842a30b70
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapProcessEntityToProcessEntityDto.java
@@ -0,0 +1,36 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vsp.rest.mapping;
+
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity;
+import org.openecomp.sdcrests.mapping.MappingBase;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.ProcessEntityDto;
+
+public class MapProcessEntityToProcessEntityDto
+ extends MappingBase<ProcessEntity, ProcessEntityDto> {
+ @Override
+ public void doMapping(ProcessEntity source, ProcessEntityDto target) {
+ target.setId(source.getId());
+ target.setName(source.getName());
+ target.setDescription(source.getDescription());
+ target.setArtifactName(source.getArtifactName());
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapProcessRequestDtoToProcessEntity.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapProcessRequestDtoToProcessEntity.java
new file mode 100644
index 0000000000..1fd35d1960
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapProcessRequestDtoToProcessEntity.java
@@ -0,0 +1,34 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vsp.rest.mapping;
+
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity;
+import org.openecomp.sdcrests.mapping.MappingBase;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.ProcessRequestDto;
+
+public class MapProcessRequestDtoToProcessEntity
+ extends MappingBase<ProcessRequestDto, ProcessEntity> {
+ @Override
+ public void doMapping(ProcessRequestDto source, ProcessEntity target) {
+ target.setName(source.getName());
+ target.setDescription(source.getDescription());
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapQuestionnaireResponseToQuestionnaireResponseDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapQuestionnaireResponseToQuestionnaireResponseDto.java
new file mode 100644
index 0000000000..23fdf385e4
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapQuestionnaireResponseToQuestionnaireResponseDto.java
@@ -0,0 +1,35 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vsp.rest.mapping;
+
+import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireResponse;
+import org.openecomp.sdcrests.mapping.MappingBase;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.QuestionnaireResponseDto;
+
+public class MapQuestionnaireResponseToQuestionnaireResponseDto
+ extends MappingBase<QuestionnaireResponse, QuestionnaireResponseDto> {
+
+ @Override
+ public void doMapping(QuestionnaireResponse source, QuestionnaireResponseDto target) {
+ target.setData(source.getData());
+ target.setSchema(source.getSchema());
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapUploadFileResponseToUploadFileResponseDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapUploadFileResponseToUploadFileResponseDto.java
new file mode 100644
index 0000000000..29b6701413
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapUploadFileResponseToUploadFileResponseDto.java
@@ -0,0 +1,36 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vsp.rest.mapping;
+
+
+import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileResponse;
+import org.openecomp.sdcrests.mapping.MappingBase;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.UploadFileResponseDto;
+
+public class MapUploadFileResponseToUploadFileResponseDto
+ extends MappingBase<UploadFileResponse, UploadFileResponseDto> {
+ @Override
+ public void doMapping(UploadFileResponse source, UploadFileResponseDto target) {
+ target.setStatus(source.getStatus());
+ target.setErrors(source.getErrors());
+ target.setFileNames(source.getFileNames());
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapValidationResponseToDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapValidationResponseToDto.java
new file mode 100644
index 0000000000..68bc97d1a6
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapValidationResponseToDto.java
@@ -0,0 +1,90 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vsp.rest.mapping;
+
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.collections4.MapUtils;
+import org.openecomp.sdc.common.errors.ErrorCode;
+import org.openecomp.sdc.datatypes.error.ErrorMessage;
+import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireValidationResult;
+import org.openecomp.sdc.vendorsoftwareproduct.types.ValidationResponse;
+import org.openecomp.sdcrests.common.mapping.MapErrorCodeToDto;
+import org.openecomp.sdcrests.common.mapping.MapErrorMessageToDto;
+import org.openecomp.sdcrests.common.types.ErrorCodeDto;
+import org.openecomp.sdcrests.common.types.ErrorMessageDto;
+import org.openecomp.sdcrests.mapping.MappingBase;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.CompositionEntityValidationDataDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.QuestionnaireValidationResultDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.ValidationResponseDto;
+
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+public class MapValidationResponseToDto
+ extends MappingBase<ValidationResponse, ValidationResponseDto> {
+ private static Map<String, List<ErrorMessageDto>> mapUploadDataErrors(
+ Map<String, List<ErrorMessage>> uploadDataErrors) {
+ if (MapUtils.isEmpty(uploadDataErrors)) {
+ return null;
+ }
+ return uploadDataErrors.entrySet().stream().collect(
+ Collectors.toMap(entry -> entry.getKey(), entry -> mapErrorMessages(entry.getValue())));
+ }
+
+ private static QuestionnaireValidationResultDto mapQuestionnaireValidationResult(
+ QuestionnaireValidationResult questionnaireValidationResult) {
+ if (questionnaireValidationResult == null) {
+ return null;
+ }
+ QuestionnaireValidationResultDto questionnaireValidationResultDto =
+ new QuestionnaireValidationResultDto();
+ questionnaireValidationResultDto.setValid(questionnaireValidationResult.isValid());
+ questionnaireValidationResultDto.setValidationData(new MapCompositionEntityValidationDataToDto()
+ .applyMapping(questionnaireValidationResult.getValidationData(),
+ CompositionEntityValidationDataDto.class));
+ return questionnaireValidationResultDto;
+ }
+
+ private static List<ErrorMessageDto> mapErrorMessages(List<ErrorMessage> errorMessages) {
+ return errorMessages == null ? null : errorMessages.stream().map(
+ errorMessage -> new MapErrorMessageToDto()
+ .applyMapping(errorMessage, ErrorMessageDto.class)).collect(Collectors.toList());
+ }
+
+ private static Collection<ErrorCodeDto> mapErrorCodes(Collection<ErrorCode> errorCodes) {
+ return CollectionUtils.isEmpty(errorCodes) ? null : errorCodes.stream()
+ .map(errorCode -> new MapErrorCodeToDto().applyMapping(errorCode, ErrorCodeDto.class))
+ .collect(Collectors.toList());
+ }
+
+ @Override
+ public void doMapping(ValidationResponse source, ValidationResponseDto target) {
+ target.setValid(source.isValid());
+ target.setVspErrors(mapErrorCodes(source.getVspErrors()));
+ target.setLicensingDataErrors(mapErrorCodes(source.getLicensingDataErrors()));
+ target.setUploadDataErrors(mapUploadDataErrors(source.getUploadDataErrors()));
+ target.setQuestionnaireValidationResult(
+ mapQuestionnaireValidationResult(source.getQuestionnaireValidationResult()));
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVersionedVendorSoftwareProductInfoToVspDetailsDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVersionedVendorSoftwareProductInfoToVspDetailsDto.java
new file mode 100644
index 0000000000..9f03f7ff0d
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVersionedVendorSoftwareProductInfoToVspDetailsDto.java
@@ -0,0 +1,74 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vsp.rest.mapping;
+
+import org.openecomp.core.utilities.CommonMethods;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
+import org.openecomp.sdc.vendorsoftwareproduct.types.LicensingData;
+import org.openecomp.sdc.vendorsoftwareproduct.types.VersionedVendorSoftwareProductInfo;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdcrests.mapping.MappingBase;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspDetailsDto;
+
+import java.util.stream.Collectors;
+
+public class MapVersionedVendorSoftwareProductInfoToVspDetailsDto
+ extends MappingBase<VersionedVendorSoftwareProductInfo, VspDetailsDto> {
+
+ @Override
+ public void doMapping(VersionedVendorSoftwareProductInfo source, VspDetailsDto target) {
+ VspDetails vsp = source.getVspDetails();
+
+ target.setId(vsp.getId());
+ target.setVersion(vsp.getVersion().toString());
+ target.setName(vsp.getName());
+ target.setDescription(vsp.getDescription());
+ target.setCategory(vsp.getCategory());
+ target.setSubCategory(vsp.getSubCategory());
+ target.setVendorId(vsp.getVendorId());
+ target.setVendorName(vsp.getVendorName());
+ target.setLicensingVersion(vsp.getVlmVersion() == null ? null : vsp.getVlmVersion().toString());
+
+ if (vsp.getLicenseAgreement() != null || vsp.getFeatureGroups() != null) {
+ LicensingData licensingData = new LicensingData();
+ licensingData.setLicenseAgreement(vsp.getLicenseAgreement());
+ licensingData.setFeatureGroups(vsp.getFeatureGroups());
+ target.setLicensingData(licensingData);
+ }
+
+ target.setValidationData(vsp.getValidationDataStructure());
+
+ target.setStatus(source.getVersionInfo().getStatus());
+ target.setLockingUser(source.getVersionInfo().getLockingUser());
+
+ if (!CommonMethods.isEmpty(source.getVersionInfo().getViewableVersions())) {
+ target.setViewableVersions(
+ source.getVersionInfo().getViewableVersions().stream().map(Version::toString)
+ .collect(Collectors.toList()));
+ }
+
+ if (!CommonMethods.isEmpty(source.getVersionInfo().getFinalVersions())) {
+ target.setFinalVersions(
+ source.getVersionInfo().getFinalVersions().stream().map(Version::toString)
+ .collect(Collectors.toList()));
+ }
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDescriptionDtoToVspDetails.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDescriptionDtoToVspDetails.java
new file mode 100644
index 0000000000..77093fe682
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDescriptionDtoToVspDetails.java
@@ -0,0 +1,56 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vsp.rest.mapping;
+
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
+import org.openecomp.sdc.vendorsoftwareproduct.types.LicensingData;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdcrests.mapping.MappingBase;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspDescriptionDto;
+
+import java.util.regex.Pattern;
+
+public class MapVspDescriptionDtoToVspDetails extends MappingBase<VspDescriptionDto, VspDetails> {
+
+ @Override
+ public void doMapping(VspDescriptionDto source, VspDetails target) {
+ target.setName(source.getName());
+ target.setDescription(source.getDescription());
+ target.setCategory(source.getCategory());
+ target.setSubCategory(source.getSubCategory());
+ target.setIcon(source.getIcon());
+ target.setVendorName(source.getVendorName());
+ target.setVendorId(source.getVendorId());
+
+ String vlmVersion = source.getLicensingVersion();
+ if (vlmVersion != null) {
+ target.setVlmVersion(
+ Pattern.compile(Version.VERSION_REGEX).matcher(vlmVersion).find() ? Version
+ .valueOf(vlmVersion) : null);
+ }
+
+ LicensingData licensingData = source.getLicensingData();
+ if (licensingData != null) {
+ target.setLicenseAgreement(licensingData.getLicenseAgreement());
+ target.setFeatureGroups(licensingData.getFeatureGroups());
+ }
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MspVspDetailsToVspCreationDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MspVspDetailsToVspCreationDto.java
new file mode 100644
index 0000000000..a2de1741a3
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MspVspDetailsToVspCreationDto.java
@@ -0,0 +1,32 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vsp.rest.mapping;
+
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
+import org.openecomp.sdcrests.mapping.MappingBase;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspCreationDto;
+
+public class MspVspDetailsToVspCreationDto extends MappingBase<VspDetails, VspCreationDto> {
+ @Override
+ public void doMapping(VspDetails source, VspCreationDto target) {
+ target.setVspId(source.getId());
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ComponentProcessesImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ComponentProcessesImpl.java
new file mode 100644
index 0000000000..2b16fea6c0
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ComponentProcessesImpl.java
@@ -0,0 +1,144 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vsp.rest.services;
+
+import org.apache.cxf.jaxrs.ext.multipart.Attachment;
+import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductManager;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.ProcessEntityDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.ProcessRequestDto;
+import org.openecomp.sdcrests.vsp.rest.ComponentProcesses;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapProcessEntityToProcessEntityDto;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapProcessRequestDtoToProcessEntity;
+import org.openecomp.sdcrests.wrappers.GenericCollectionWrapper;
+import org.openecomp.sdcrests.wrappers.StringWrapperResponse;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Service;
+
+import java.io.File;
+import java.io.InputStream;
+import java.util.Collection;
+import javax.inject.Named;
+import javax.ws.rs.core.Response;
+
+
+@Named
+@Service("componentProcesses")
+@Scope(value = "prototype")
+public class ComponentProcessesImpl implements ComponentProcesses {
+ @Autowired
+ private VendorSoftwareProductManager vendorSoftwareProductManager;
+
+ @Override
+ public Response list(String vspId, String componentId, String version, String user) {
+ Collection<ProcessEntity> processes = vendorSoftwareProductManager
+ .listProcesses(vspId, Version.valueOf(version), componentId, user);
+
+ MapProcessEntityToProcessEntityDto mapper = new MapProcessEntityToProcessEntityDto();
+ GenericCollectionWrapper<ProcessEntityDto> results = new GenericCollectionWrapper<>();
+ for (ProcessEntity process : processes) {
+ results.add(mapper.applyMapping(process, ProcessEntityDto.class));
+ }
+
+ return Response.ok(results).build();
+ }
+
+ @Override
+ public Response deleteList(String vspId, String componentId, String user) {
+ vendorSoftwareProductManager.deleteProcesses(vspId, componentId, user);
+ return Response.ok().build();
+ }
+
+ @Override
+ public Response create(ProcessRequestDto request, String vspId, String componentId, String user) {
+ ProcessEntity process =
+ new MapProcessRequestDtoToProcessEntity().applyMapping(request, ProcessEntity.class);
+ process.setVspId(vspId);
+ process.setComponentId(componentId);
+
+ ProcessEntity createdProcess = vendorSoftwareProductManager.createProcess(process, user);
+ return Response
+ .ok(createdProcess != null ? new StringWrapperResponse(createdProcess.getId()) : null)
+ .build();
+ }
+
+ @Override
+ public Response get(String vspId, String componentId, String processId, String version,
+ String user) {
+ ProcessEntity process = vendorSoftwareProductManager
+ .getProcess(vspId, Version.valueOf(version), componentId, processId, user);
+ ProcessEntityDto result =
+ new MapProcessEntityToProcessEntityDto().applyMapping(process, ProcessEntityDto.class);
+ return Response.ok(result).build();
+ }
+
+ @Override
+ public Response delete(String vspId, String componentId, String processId, String user) {
+ vendorSoftwareProductManager.deleteProcess(vspId, componentId, processId, user);
+ return Response.ok().build();
+ }
+
+ @Override
+ public Response update(ProcessRequestDto request, String vspId, String componentId,
+ String processId, String user) {
+ ProcessEntity processEntity =
+ new MapProcessRequestDtoToProcessEntity().applyMapping(request, ProcessEntity.class);
+ processEntity.setVspId(vspId);
+ processEntity.setComponentId(componentId);
+ processEntity.setId(processId);
+
+ vendorSoftwareProductManager.updateProcess(processEntity, user);
+ return Response.ok().build();
+ }
+
+ @Override
+ public Response getUploadedFile(String vspId, String componentId, String processId,
+ String version, String user) {
+ File file = vendorSoftwareProductManager
+ .getProcessArtifact(vspId, Version.valueOf(version), componentId, processId, user);
+
+ Response.ResponseBuilder response = Response.ok(file);
+ if (file == null) {
+ return Response.status(Response.Status.NOT_FOUND).build();
+ }
+ response.header("Content-Disposition", "attachment; filename=" + file.getName());
+ return response.build();
+ }
+
+ @Override
+ public Response deleteUploadedFile(String vspId, String componentId, String processId,
+ String user) {
+ vendorSoftwareProductManager.deleteProcessArtifact(vspId, componentId, processId, user);
+ return Response.ok().build();
+ }
+
+ @Override
+ public Response uploadFile(Attachment attachment, String vspId, String componentId,
+ String processId, String user) {
+ vendorSoftwareProductManager.uploadProcessArtifact(attachment.getObject(InputStream.class),
+ attachment.getContentDisposition().getParameter("filename"), vspId, componentId, processId,
+ user);
+ return Response.ok().build();
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ComponentUploadsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ComponentUploadsImpl.java
new file mode 100644
index 0000000000..3cd384d7e7
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ComponentUploadsImpl.java
@@ -0,0 +1,87 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vsp.rest.services;
+
+import org.apache.cxf.jaxrs.ext.multipart.Attachment;
+import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductManager;
+import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.MibUploadStatus;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.MibUploadStatusDto;
+import org.openecomp.sdcrests.vsp.rest.ComponentUploads;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapMibUploadStatusToDto;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Service;
+import org.springframework.validation.annotation.Validated;
+
+import java.io.InputStream;
+import javax.inject.Named;
+import javax.ws.rs.core.Response;
+
+@Named
+@Service("componentUploads")
+@Scope(value = "prototype")
+@Validated
+public class ComponentUploadsImpl implements ComponentUploads {
+ @Autowired
+ private VendorSoftwareProductManager vendorSoftwareProductManager;
+
+ @Override
+ public Response uploadTrapMibFile(Attachment attachment, String vspId, String componentId,
+ String user) {
+ vendorSoftwareProductManager.uploadComponentMib(attachment.getObject(InputStream.class),
+ attachment.getContentDisposition().getParameter("filename"), vspId, componentId, true,
+ user);
+ return Response.ok().build();
+ }
+
+ @Override
+ public Response deleteTrapMibFile(String vspId, String componentId, String user) {
+ vendorSoftwareProductManager.deleteComponentMib(vspId, componentId, true, user);
+ return Response.ok().build();
+ }
+
+ @Override
+ public Response uploadPollMibFile(Attachment attachment, String vspId, String componentId,
+ String user) {
+ vendorSoftwareProductManager.uploadComponentMib(attachment.getObject(InputStream.class),
+ attachment.getContentDisposition().getParameter("filename"), vspId, componentId, false,
+ user);
+ return Response.ok().build();
+ }
+
+ @Override
+ public Response deletePollMibFile(String vspId, String componentId, String user) {
+ vendorSoftwareProductManager.deleteComponentMib(vspId, componentId, false, user);
+ return Response.ok().build();
+ }
+
+ @Override
+ public Response list(String vspId, String componentId, String user) {
+ MibUploadStatus response =
+ vendorSoftwareProductManager.listMibFilenames(vspId, componentId, user);
+
+ MibUploadStatusDto returnEntity =
+ new MapMibUploadStatusToDto().applyMapping(response, MibUploadStatusDto.class);
+ return Response.status(Response.Status.OK).entity(returnEntity).build();
+
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ComponentsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ComponentsImpl.java
new file mode 100644
index 0000000000..cba9abbdbc
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ComponentsImpl.java
@@ -0,0 +1,145 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vsp.rest.services;
+
+import org.apache.commons.collections4.CollectionUtils;
+import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductManager;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse;
+import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityValidationData;
+import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireResponse;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentData;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComponentDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComponentRequestDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.CompositionEntityResponseDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.CompositionEntityValidationDataDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.QuestionnaireResponseDto;
+import org.openecomp.sdcrests.vsp.rest.Components;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapComponentDataToComponentDto;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapComponentEntityToComponentDto;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapComponentRequestDtoToComponentEntity;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapCompositionEntityResponseToDto;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapCompositionEntityValidationDataToDto;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapQuestionnaireResponseToQuestionnaireResponseDto;
+import org.openecomp.sdcrests.wrappers.GenericCollectionWrapper;
+import org.openecomp.sdcrests.wrappers.StringWrapperResponse;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Service;
+
+import java.util.Collection;
+import javax.inject.Named;
+import javax.ws.rs.core.Response;
+
+
+@Named
+@Service("components")
+@Scope(value = "prototype")
+public class ComponentsImpl implements Components {
+ @Autowired
+ private VendorSoftwareProductManager vendorSoftwareProductManager;
+
+ @Override
+ public Response list(String vspId, String version, String user) {
+ Collection<ComponentEntity> components =
+ vendorSoftwareProductManager.listComponents(vspId, Version.valueOf(version), user);
+
+ MapComponentEntityToComponentDto mapper = new MapComponentEntityToComponentDto();
+ GenericCollectionWrapper<ComponentDto> results = new GenericCollectionWrapper<>();
+ for (ComponentEntity component : components) {
+ results.add(mapper.applyMapping(component, ComponentDto.class));
+ }
+
+ return Response.ok(results).build();
+ }
+
+ @Override
+ public Response deleteList(String vspId, String user) {
+ vendorSoftwareProductManager.deleteComponents(vspId, user);
+ return Response.ok().build();
+ }
+
+ @Override
+ public Response create(ComponentRequestDto request, String vspId, String user) {
+ ComponentEntity component =
+ new MapComponentRequestDtoToComponentEntity().applyMapping(request, ComponentEntity.class);
+ component.setVspId(vspId);
+ ComponentEntity createdComponent =
+ vendorSoftwareProductManager.createComponent(component, user);
+ return Response
+ .ok(createdComponent != null ? new StringWrapperResponse(createdComponent.getId()) : null)
+ .build();
+ }
+
+ @Override
+ public Response get(String vspId, String componentId, String version, String user) {
+ CompositionEntityResponse<ComponentData> response = vendorSoftwareProductManager
+ .getComponent(vspId, Version.valueOf(version), componentId, user);
+
+ CompositionEntityResponseDto<ComponentDto> responseDto = new CompositionEntityResponseDto<>();
+ new MapCompositionEntityResponseToDto<>(new MapComponentDataToComponentDto(),
+ ComponentDto.class).doMapping(response, responseDto);
+ return Response.ok(responseDto).build();
+ }
+
+ @Override
+ public Response delete(String vspId, String componentId, String user) {
+ vendorSoftwareProductManager.deleteComponent(vspId, componentId, user);
+ return Response.ok().build();
+ }
+
+ @Override
+ public Response update(ComponentRequestDto request, String vspId, String componentId,
+ String user) {
+ ComponentEntity componentEntity =
+ new MapComponentRequestDtoToComponentEntity().applyMapping(request, ComponentEntity.class);
+ componentEntity.setVspId(vspId);
+ componentEntity.setId(componentId);
+
+ CompositionEntityValidationData validationData =
+ vendorSoftwareProductManager.updateComponent(componentEntity, user);
+ return validationData != null && CollectionUtils.isNotEmpty(validationData.getErrors())
+ ? Response.status(Response.Status.EXPECTATION_FAILED).entity(
+ new MapCompositionEntityValidationDataToDto()
+ .applyMapping(validationData, CompositionEntityValidationDataDto.class)).build() :
+ Response.ok().build();
+ }
+
+ @Override
+ public Response getQuestionnaire(String vspId, String componentId, String version, String user) {
+ QuestionnaireResponse questionnaireResponse = vendorSoftwareProductManager
+ .getComponentQuestionnaire(vspId, Version.valueOf(version), componentId, user);
+
+ QuestionnaireResponseDto result = new MapQuestionnaireResponseToQuestionnaireResponseDto()
+ .applyMapping(questionnaireResponse, QuestionnaireResponseDto.class);
+ return Response.ok(result).build();
+ }
+
+ @Override
+ public Response updateQuestionnaire(String questionnaireData, String vspId, String componentId,
+ String user) {
+ vendorSoftwareProductManager
+ .updateComponentQuestionnaire(vspId, componentId, questionnaireData, user);
+ return Response.ok().build();
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/NetworksImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/NetworksImpl.java
new file mode 100644
index 0000000000..afc25ab4b0
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/NetworksImpl.java
@@ -0,0 +1,115 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vsp.rest.services;
+
+import org.apache.commons.collections4.CollectionUtils;
+import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductManager;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse;
+import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityValidationData;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Network;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.CompositionEntityResponseDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.CompositionEntityValidationDataDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.NetworkDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.NetworkRequestDto;
+import org.openecomp.sdcrests.vsp.rest.Networks;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapCompositionEntityResponseToDto;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapCompositionEntityValidationDataToDto;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapNetworkEntityToNetworkDto;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapNetworkRequestDtoToNetworkEntity;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapNetworkToNetworkDto;
+import org.openecomp.sdcrests.wrappers.GenericCollectionWrapper;
+import org.openecomp.sdcrests.wrappers.StringWrapperResponse;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Service;
+
+import java.util.Collection;
+import javax.inject.Named;
+import javax.ws.rs.core.Response;
+
+
+@Named
+@Service("networks")
+@Scope(value = "prototype")
+public class NetworksImpl implements Networks {
+ @Autowired
+ private VendorSoftwareProductManager vendorSoftwareProductManager;
+
+ @Override
+ public Response list(String vspId, String version, String user) {
+ Collection<NetworkEntity> networks =
+ vendorSoftwareProductManager.listNetworks(vspId, Version.valueOf(version), user);
+
+ MapNetworkEntityToNetworkDto mapper = new MapNetworkEntityToNetworkDto();
+ GenericCollectionWrapper<NetworkDto> results = new GenericCollectionWrapper<>();
+ for (NetworkEntity network : networks) {
+ results.add(mapper.applyMapping(network, NetworkDto.class));
+ }
+
+ return Response.ok(results).build();
+ }
+
+ @Override
+ public Response create(NetworkRequestDto request, String vspId, String user) {
+ NetworkEntity network =
+ new MapNetworkRequestDtoToNetworkEntity().applyMapping(request, NetworkEntity.class);
+ network.setVspId(vspId);
+ NetworkEntity createdNetwork = vendorSoftwareProductManager.createNetwork(network, user);
+ return Response
+ .ok(createdNetwork != null ? new StringWrapperResponse(createdNetwork.getId()) : null)
+ .build();
+ }
+
+ @Override
+ public Response get(String vspId, String networkId, String version, String user) {
+ CompositionEntityResponse<Network> response =
+ vendorSoftwareProductManager.getNetwork(vspId, Version.valueOf(version), networkId, user);
+
+ CompositionEntityResponseDto<NetworkDto> responseDto = new CompositionEntityResponseDto<>();
+ new MapCompositionEntityResponseToDto<>(new MapNetworkToNetworkDto(), NetworkDto.class)
+ .doMapping(response, responseDto);
+ return Response.ok(responseDto).build();
+ }
+
+ @Override
+ public Response delete(String vspId, String networkId, String user) {
+ vendorSoftwareProductManager.deleteNetwork(vspId, networkId, user);
+ return Response.ok().build();
+ }
+
+ @Override
+ public Response update(NetworkRequestDto request, String vspId, String networkId, String user) {
+ NetworkEntity networkEntity =
+ new MapNetworkRequestDtoToNetworkEntity().applyMapping(request, NetworkEntity.class);
+ networkEntity.setVspId(vspId);
+ networkEntity.setId(networkId);
+
+ CompositionEntityValidationData validationData =
+ vendorSoftwareProductManager.updateNetwork(networkEntity, user);
+ return validationData != null && CollectionUtils.isNotEmpty(validationData.getErrors())
+ ? Response.status(Response.Status.EXPECTATION_FAILED).entity(
+ new MapCompositionEntityValidationDataToDto()
+ .applyMapping(validationData, CompositionEntityValidationDataDto.class)).build() :
+ Response.ok().build();
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/NicsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/NicsImpl.java
new file mode 100644
index 0000000000..ce601ec999
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/NicsImpl.java
@@ -0,0 +1,140 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vsp.rest.services;
+
+import org.apache.commons.collections4.CollectionUtils;
+import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductManager;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse;
+import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityValidationData;
+import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireResponse;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic;
+import org.openecomp.sdc.versioning.dao.types.Version;
+
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.CompositionEntityResponseDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.CompositionEntityValidationDataDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.NicDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.NicRequestDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.QuestionnaireResponseDto;
+import org.openecomp.sdcrests.vsp.rest.Nics;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapCompositionEntityResponseToDto;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapCompositionEntityValidationDataToDto;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapNicEntityToNicDto;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapNicRequestDtoToNicEntity;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapNicToNicDto;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapQuestionnaireResponseToQuestionnaireResponseDto;
+import org.openecomp.sdcrests.wrappers.GenericCollectionWrapper;
+import org.openecomp.sdcrests.wrappers.StringWrapperResponse;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Service;
+
+import java.util.Collection;
+import javax.inject.Named;
+import javax.ws.rs.core.Response;
+
+
+@Named
+@Service("nics")
+@Scope(value = "prototype")
+public class NicsImpl implements Nics {
+ @Autowired
+ private VendorSoftwareProductManager vendorSoftwareProductManager;
+
+ @Override
+ public Response list(String vspId, String componentId, String version, String user) {
+ Collection<NicEntity> nics =
+ vendorSoftwareProductManager.listNics(vspId, Version.valueOf(version), componentId, user);
+
+ MapNicEntityToNicDto mapper = new MapNicEntityToNicDto();
+ GenericCollectionWrapper<NicDto> results = new GenericCollectionWrapper<>();
+ for (NicEntity nic : nics) {
+ results.add(mapper.applyMapping(nic, NicDto.class));
+ }
+
+ return Response.ok(results).build();
+ }
+
+ @Override
+ public Response create(NicRequestDto request, String vspId, String componentId, String user) {
+ NicEntity nic = new MapNicRequestDtoToNicEntity().applyMapping(request, NicEntity.class);
+ nic.setVspId(vspId);
+ nic.setComponentId(componentId);
+
+ NicEntity createdNic = vendorSoftwareProductManager.createNic(nic, user);
+ return Response.ok(createdNic != null ? new StringWrapperResponse(createdNic.getId()) : null)
+ .build();
+ }
+
+ @Override
+ public Response get(String vspId, String componentId, String nicId, String version, String user) {
+ CompositionEntityResponse<Nic> response = vendorSoftwareProductManager
+ .getNic(vspId, Version.valueOf(version), componentId, nicId, user);
+
+ CompositionEntityResponseDto<NicDto> responseDto = new CompositionEntityResponseDto<>();
+ new MapCompositionEntityResponseToDto<>(new MapNicToNicDto(), NicDto.class)
+ .doMapping(response, responseDto);
+ return Response.ok(responseDto).build();
+ }
+
+ @Override
+ public Response delete(String vspId, String componentId, String nicId, String user) {
+ vendorSoftwareProductManager.deleteNic(vspId, componentId, nicId, user);
+ return Response.ok().build();
+ }
+
+ @Override
+ public Response update(NicRequestDto request, String vspId, String componentId, String nicId,
+ String user) {
+ NicEntity nicEntity = new MapNicRequestDtoToNicEntity().applyMapping(request, NicEntity.class);
+ nicEntity.setVspId(vspId);
+ nicEntity.setComponentId(componentId);
+ nicEntity.setId(nicId);
+
+ CompositionEntityValidationData validationData =
+ vendorSoftwareProductManager.updateNic(nicEntity, user);
+ return validationData != null && CollectionUtils.isNotEmpty(validationData.getErrors())
+ ? Response.status(Response.Status.EXPECTATION_FAILED).entity(
+ new MapCompositionEntityValidationDataToDto()
+ .applyMapping(validationData, CompositionEntityValidationDataDto.class)).build() :
+ Response.ok().build();
+ }
+
+ @Override
+ public Response getQuestionnaire(String vspId, String componentId, String nicId, String version,
+ String user) {
+ QuestionnaireResponse questionnaireResponse = vendorSoftwareProductManager
+ .getNicQuestionnaire(vspId, Version.valueOf(version), componentId, nicId, user);
+
+ QuestionnaireResponseDto result = new MapQuestionnaireResponseToQuestionnaireResponseDto()
+ .applyMapping(questionnaireResponse, QuestionnaireResponseDto.class);
+ return Response.ok(result).build();
+ }
+
+ @Override
+ public Response updateQuestionnaire(String questionnaireData, String vspId, String componentId,
+ String nicId, String user) {
+ vendorSoftwareProductManager
+ .updateNicQuestionnaire(vspId, componentId, nicId, questionnaireData, user);
+ return Response.ok().build();
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ProcessesImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ProcessesImpl.java
new file mode 100644
index 0000000000..004d84591a
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ProcessesImpl.java
@@ -0,0 +1,89 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vsp.rest.services;
+
+import static org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants.GENERAL_COMPONENT_ID;
+
+import org.apache.cxf.jaxrs.ext.multipart.Attachment;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.ProcessRequestDto;
+import org.openecomp.sdcrests.vsp.rest.ComponentProcesses;
+import org.openecomp.sdcrests.vsp.rest.Processes;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Service;
+
+import javax.inject.Named;
+import javax.ws.rs.core.Response;
+
+@Named
+@Service("processes")
+@Scope(value = "prototype")
+public class ProcessesImpl implements Processes {
+
+ @Autowired
+ private ComponentProcesses componentProcesses;
+
+ @Override
+ public Response list(String vspId, String version, String user) {
+ return componentProcesses.list(vspId, GENERAL_COMPONENT_ID, version, user);
+ }
+
+ @Override
+ public Response deleteList(String vspId, String user) {
+ return componentProcesses.deleteList(vspId, GENERAL_COMPONENT_ID, user);
+ }
+
+ @Override
+ public Response create(ProcessRequestDto request, String vspId, String user) {
+ return componentProcesses.create(request, vspId, GENERAL_COMPONENT_ID, user);
+ }
+
+ @Override
+ public Response get(String vspId, String processId, String version, String user) {
+ return componentProcesses.get(vspId, GENERAL_COMPONENT_ID, processId, version, user);
+ }
+
+ @Override
+ public Response delete(String vspId, String processId, String user) {
+ return componentProcesses.delete(vspId, GENERAL_COMPONENT_ID, processId, user);
+ }
+
+ @Override
+ public Response update(ProcessRequestDto request, String vspId, String processId, String user) {
+ return componentProcesses.update(request, vspId, GENERAL_COMPONENT_ID, processId, user);
+ }
+
+ @Override
+ public Response getUploadedFile(String vspId, String processId, String version, String user) {
+ return componentProcesses
+ .getUploadedFile(vspId, GENERAL_COMPONENT_ID, processId, version, user);
+ }
+
+ @Override
+ public Response deleteUploadedFile(String vspId, String processId, String user) {
+ return componentProcesses.deleteUploadedFile(vspId, GENERAL_COMPONENT_ID, processId, user);
+ }
+
+ @Override
+ public Response uploadFile(Attachment attachment, String vspId, String processId, String user) {
+ return componentProcesses.uploadFile(attachment, vspId, GENERAL_COMPONENT_ID, processId, user);
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java
new file mode 100644
index 0000000000..1c13f172f1
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java
@@ -0,0 +1,228 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vsp.rest.services;
+
+import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductManager;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.PackageInfo;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
+import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireResponse;
+import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileResponse;
+import org.openecomp.sdc.vendorsoftwareproduct.types.ValidationResponse;
+import org.openecomp.sdc.vendorsoftwareproduct.types.VersionedVendorSoftwareProductInfo;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.PackageInfoDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.QuestionnaireResponseDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.UploadFileResponseDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.ValidationResponseDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.VersionSoftwareProductActionRequestDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspCreationDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspDescriptionDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspDetailsDto;
+import org.openecomp.sdcrests.vsp.rest.VendorSoftwareProducts;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapPackageInfoToPackageInfoDto;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapQuestionnaireResponseToQuestionnaireResponseDto;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapUploadFileResponseToUploadFileResponseDto;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapValidationResponseToDto;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapVersionedVendorSoftwareProductInfoToVspDetailsDto;
+import org.openecomp.sdcrests.vsp.rest.mapping.MapVspDescriptionDtoToVspDetails;
+import org.openecomp.sdcrests.vsp.rest.mapping.MspVspDetailsToVspCreationDto;
+import org.openecomp.sdcrests.wrappers.GenericCollectionWrapper;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Service;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.List;
+import javax.inject.Named;
+import javax.ws.rs.core.Response;
+
+@Named
+@Service("vendorSoftwareProducts")
+@Scope(value = "prototype")
+public class VendorSoftwareProductsImpl implements VendorSoftwareProducts {
+
+ @Autowired
+ private VendorSoftwareProductManager vendorSoftwareProductManager;
+
+ @Override
+ public Response createNewVsp(VspDescriptionDto vspDescriptionDto, String user) {
+ VspDetails vspDetails =
+ new MapVspDescriptionDtoToVspDetails().applyMapping(vspDescriptionDto, VspDetails.class);
+
+ vspDetails = vendorSoftwareProductManager.createNewVsp(vspDetails, user);
+
+ MspVspDetailsToVspCreationDto mapping = new MspVspDetailsToVspCreationDto();
+ VspCreationDto vspCreationDto = mapping.applyMapping(vspDetails, VspCreationDto.class);
+
+ return Response.ok(vspCreationDto).build();
+ }
+
+ @Override
+ public Response getVspList(String versionFilter, String user) {
+ List<VersionedVendorSoftwareProductInfo> vspList =
+ vendorSoftwareProductManager.getVspList(versionFilter, user);
+
+ GenericCollectionWrapper<VspDetailsDto> results = new GenericCollectionWrapper<>();
+ if (!vspList.isEmpty()) {
+ MapVersionedVendorSoftwareProductInfoToVspDetailsDto mapper =
+ new MapVersionedVendorSoftwareProductInfoToVspDetailsDto();
+ for (VersionedVendorSoftwareProductInfo versionedVsp : vspList) {
+ results.add(mapper.applyMapping(versionedVsp, VspDetailsDto.class));
+ }
+ }
+
+ return Response.ok(results).build();
+ }
+
+ @Override
+ public Response getVspDetails(String vspId, String version, String user) {
+ VersionedVendorSoftwareProductInfo vspDetails =
+ vendorSoftwareProductManager.getVspDetails(vspId, Version.valueOf(version), user);
+
+ VspDetailsDto vspDetailsDto = vspDetails == null ? null
+ : new MapVersionedVendorSoftwareProductInfoToVspDetailsDto()
+ .applyMapping(vspDetails, VspDetailsDto.class);
+
+ return Response.ok(vspDetailsDto).build();
+ }
+
+ @Override
+ public Response updateVsp(String vspId, VspDescriptionDto vspDescriptionDto, String user) {
+ VspDetails vspDetails =
+ new MapVspDescriptionDtoToVspDetails().applyMapping(vspDescriptionDto, VspDetails.class);
+ vspDetails.setId(vspId);
+
+ vendorSoftwareProductManager.updateVsp(vspDetails, user);
+
+ return Response.ok().build();
+ }
+
+ @Override
+ public Response deleteVsp(String vspId, String user) {
+ vendorSoftwareProductManager.deleteVsp(vspId, user);
+
+ return Response.ok().build();
+ }
+
+ @Override
+ public Response actOnVendorSoftwareProduct(String vspId,
+ VersionSoftwareProductActionRequestDto request,
+ String user) throws IOException {
+ switch (request.getAction()) {
+ case Checkout:
+ vendorSoftwareProductManager.checkout(vspId, user);
+ break;
+ case Undo_Checkout:
+ vendorSoftwareProductManager.undoCheckout(vspId, user);
+ break;
+ case Checkin:
+ vendorSoftwareProductManager.checkin(vspId, user);
+ break;
+ case Submit:
+ ValidationResponse validationResponse = vendorSoftwareProductManager.submit(vspId, user);
+ if (!validationResponse.isValid()) {
+ return Response.status(Response.Status.EXPECTATION_FAILED).entity(
+ new MapValidationResponseToDto()
+ .applyMapping(validationResponse, ValidationResponseDto.class)).build();
+ }
+ break;
+ case Create_Package:
+ PackageInfo packageInfo = vendorSoftwareProductManager.createPackage(vspId, user);
+ return Response.ok(packageInfo == null ? null
+ : new MapPackageInfoToPackageInfoDto().applyMapping(packageInfo, PackageInfoDto.class))
+ .build();
+ default:
+ }
+
+ return Response.ok().build();
+ }
+
+ @Override
+ public Response uploadFile(String uploadVspId, InputStream heatFileToUpload, String user) {
+ UploadFileResponse uploadFileResponse =
+ vendorSoftwareProductManager.uploadFile(uploadVspId, heatFileToUpload, user);
+
+ UploadFileResponseDto uploadFileResponseDto = new MapUploadFileResponseToUploadFileResponseDto()
+ .applyMapping(uploadFileResponse, UploadFileResponseDto.class);
+
+ return Response.ok(uploadFileResponseDto).build();
+ }
+
+ @Override
+ public Response getLatestHeatPackage(String vspId, String user) {
+ File zipFile = vendorSoftwareProductManager.getLatestHeatPackage(vspId, user);
+
+ if (zipFile == null) {
+ return Response.status(Response.Status.NOT_FOUND).build();
+ }
+ Response.ResponseBuilder response = Response.ok(zipFile);
+ response.header("Content-Disposition", "attachment; filename=" + zipFile.getName());
+ return response.build();
+ }
+
+ @Override
+ public Response listPackages(String category, String subCategory, String user) {
+ List<PackageInfo> packageInfoList =
+ vendorSoftwareProductManager.listPackages(category, subCategory);
+
+ GenericCollectionWrapper<PackageInfoDto> results = new GenericCollectionWrapper<>();
+ MapPackageInfoToPackageInfoDto mapper = new MapPackageInfoToPackageInfoDto();
+
+ if (packageInfoList != null) {
+ for (PackageInfo packageInfo : packageInfoList) {
+ results.add(mapper.applyMapping(packageInfo, PackageInfoDto.class));
+ }
+ }
+ return Response.ok(results).build();
+ }
+
+ @Override
+ public Response getTranslatedFile(String vspId, String version, String user) {
+ File zipFile =
+ vendorSoftwareProductManager.getTranslatedFile(vspId, Version.valueOf(version), user);
+
+ Response.ResponseBuilder response = Response.ok(zipFile);
+ if (zipFile == null) {
+ return Response.status(Response.Status.NOT_FOUND).build();
+ }
+ response.header("Content-Disposition", "attachment; filename=" + zipFile.getName());
+ return response.build();
+ }
+
+ @Override
+ public Response getQuestionnaire(String vspId, String version, String user) {
+ QuestionnaireResponse questionnaireResponse =
+ vendorSoftwareProductManager.getVspQuestionnaire(vspId, Version.valueOf(version), user);
+
+ QuestionnaireResponseDto result = new MapQuestionnaireResponseToQuestionnaireResponseDto()
+ .applyMapping(questionnaireResponse, QuestionnaireResponseDto.class);
+ return Response.ok(result).build();
+ }
+
+ @Override
+ public Response updateQuestionnaire(String questionnaireData, String vspId, String user) {
+ vendorSoftwareProductManager.updateVspQuestionnaire(vspId, questionnaireData, user);
+ return Response.ok().build();
+ }
+}