Add collaboration feature
[sdc.git] / 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
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.openecomp.sdcrests.vsp.rest;
22
23 import io.swagger.annotations.Api;
24 import io.swagger.annotations.ApiOperation;
25 import io.swagger.annotations.ApiParam;
26 import org.apache.cxf.jaxrs.ext.multipart.Attachment;
27 import org.apache.cxf.jaxrs.ext.multipart.Multipart;
28 import org.openecomp.sdcrests.vendorsoftwareproducts.types.ProcessEntityDto;
29 import org.openecomp.sdcrests.vendorsoftwareproducts.types.ProcessRequestDto;
30 import org.springframework.validation.annotation.Validated;
31
32 import javax.validation.Valid;
33 import javax.validation.constraints.NotNull;
34 import javax.ws.rs.Consumes;
35 import javax.ws.rs.DELETE;
36 import javax.ws.rs.GET;
37 import javax.ws.rs.HeaderParam;
38 import javax.ws.rs.POST;
39 import javax.ws.rs.PUT;
40 import javax.ws.rs.Path;
41 import javax.ws.rs.PathParam;
42 import javax.ws.rs.Produces;
43 import javax.ws.rs.core.MediaType;
44 import javax.ws.rs.core.Response;
45
46 import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
47 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
48
49 @Path("/v1.0/vendor-software-products/{vspId}/versions/{versionId}/components/{componentId}/processes")
50 @Produces(MediaType.APPLICATION_JSON)
51 @Consumes(MediaType.APPLICATION_JSON)
52 @Api(value = "Vendor Software Product Component Processes")
53 @Validated
54 public interface ComponentProcesses extends VspEntities {
55   @GET
56   @Path("/")
57   @ApiOperation(value = "List vendor software product component processes",
58       response = ProcessEntityDto.class,
59       responseContainer = "List")
60   Response list(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
61                 @ApiParam(value = "Vendor software product version Id") @PathParam("versionId") String versionId,
62                 @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
63                     String componentId,
64                 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
65                     String user);
66
67   @DELETE
68   @Path("/")
69   @ApiOperation(value = "Delete vendor software product processes",
70       responseContainer = "List")
71   Response deleteList(
72       @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
73       @ApiParam(value = "Vendor software product version Id") @PathParam("versionId") String versionId,
74       @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
75           String componentId,
76       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
77
78   @POST
79   @Path("/")
80   @ApiOperation(value = "Create a vendor software product process")
81   Response create(@Valid ProcessRequestDto request,
82                   @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
83                   @ApiParam(value = "Vendor software product version Id") @PathParam("versionId") String versionId,
84                   @ApiParam(value = "Vendor software product component Id")
85                   @PathParam("componentId") String componentId,
86                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
87                       String user);
88
89   @GET
90   @Path("/{processId}")
91   @ApiOperation(value = "Get vendor software product process",
92       response = ProcessEntityDto.class)
93   Response get(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
94                @ApiParam(value = "Vendor software product version Id") @PathParam("versionId") String versionId,
95                @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
96                    String componentId,
97                @ApiParam(value = "Vendor software product process Id") @PathParam("processId")
98                    String processId,
99                @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
100                    String user);
101
102   @DELETE
103   @Path("/{processId}")
104   @ApiOperation(value = "Delete vendor software product process")
105   Response delete(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
106                   @ApiParam(value = "Vendor software product version Id") @PathParam("versionId") String versionId,
107                   @ApiParam(value = "Vendor software product component Id")
108                   @PathParam("componentId") String componentId,
109                   @ApiParam(value = "Vendor software product process Id") @PathParam("processId")
110                       String processId,
111                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
112                       String user);
113
114   @PUT
115   @Path("/{processId}")
116   @ApiOperation(value = "Update vendor software product process")
117   Response update(@Valid ProcessRequestDto request,
118                   @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
119                   @ApiParam(value = "Vendor software product version Id") @PathParam("versionId") String versionId,
120                   @ApiParam(value = "Vendor software product component Id")
121                   @PathParam("componentId") String componentId,
122                   @ApiParam(value = "Vendor software product process Id") @PathParam("processId")
123                       String processId,
124                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
125                       String user);
126
127   @GET
128   @Path("/{processId}/upload")
129   @Produces(MediaType.APPLICATION_OCTET_STREAM)
130   @ApiOperation(value = "Get vendor software product process uploaded file")
131   Response getUploadedFile(
132       @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
133       @ApiParam(value = "Vendor software product version Id") @PathParam("versionId") String versionId,
134       @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
135           String componentId,
136       @ApiParam(value = "Vendor software product process Id") @PathParam("processId")
137           String processId,
138       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
139
140   @DELETE
141   @Path("/{processId}/upload")
142   @ApiOperation(value = "Delete vendor software product process uploaded file")
143   Response deleteUploadedFile(
144       @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
145       @ApiParam(value = "Vendor software product version Id") @PathParam("versionId") String versionId,
146       @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
147           String componentId,
148       @ApiParam(value = "Vendor software product process Id") @PathParam("processId")
149           String processId,
150       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
151
152   @POST
153   @Path("/{processId}/upload")
154   @Consumes(MediaType.MULTIPART_FORM_DATA)
155   @ApiOperation(value = "Update vendor software product process upload")
156   Response uploadFile(@Multipart("upload") Attachment attachment,
157                       @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
158                       @ApiParam(value = "Vendor software product version Id") @PathParam("versionId") String versionId,
159                       @ApiParam(value = "Vendor software product component Id")
160                       @PathParam("componentId") String componentId,
161                       @ApiParam(value = "Vendor software product process Id")
162                       @PathParam("processId") String processId,
163                       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
164                           String user);
165 }