Added oparent to sdc main
[sdc.git] / openecomp-be / api / openecomp-sdc-rest-webapp / item-rest / item-rest-services / src / main / java / org / openecomp / sdcrests / item / rest / Versions.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2019 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.item.rest;
22
23 import io.swagger.annotations.Api;
24 import io.swagger.annotations.ApiOperation;
25 import io.swagger.annotations.ApiParam;
26 import org.openecomp.sdcrests.item.types.*;
27 import org.springframework.validation.annotation.Validated;
28
29 import javax.validation.constraints.NotNull;
30 import javax.ws.rs.*;
31 import javax.ws.rs.core.MediaType;
32 import javax.ws.rs.core.Response;
33
34 import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
35 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
36
37 @Path("/v1.0/items/{itemId}/versions")
38 @Produces(MediaType.APPLICATION_JSON)
39 @Consumes(MediaType.APPLICATION_JSON)
40 @Api(value = "Item Versions")
41 @Validated
42 public interface Versions {
43
44   @GET
45   @Path("/")
46   @ApiOperation(value = "Lists item versions",
47       response = VersionDto.class,
48       responseContainer = "List")
49   Response list(@PathParam("itemId") String itemId,
50                 @NotNull(message = USER_MISSING_ERROR_MSG)
51                 @HeaderParam(USER_ID_HEADER_PARAM) String user);
52
53   @POST
54   @Path("/{versionId}")
55   @ApiOperation(value = "Creates a new item version")
56   Response create(VersionRequestDto request,
57                   @PathParam("itemId") String itemId,
58                   @PathParam("versionId") String versionId,
59                   @NotNull(message = USER_MISSING_ERROR_MSG)
60                   @HeaderParam(USER_ID_HEADER_PARAM) String user);
61
62   @GET
63   @Path("/{versionId}")
64   @ApiOperation(value = "Gets item version", response = VersionDto.class)
65   Response get(@PathParam("itemId") String itemId,
66                @PathParam("versionId") String versionId,
67                @NotNull(message = USER_MISSING_ERROR_MSG)
68                @HeaderParam(USER_ID_HEADER_PARAM) String user);
69
70   @GET
71   @Path("/{versionId}/activity-logs")
72   @ApiOperation(value = "Gets item version activity log",
73       response = ActivityLogDto.class,
74       responseContainer = "List")
75   Response getActivityLog(@ApiParam("Item Id") @PathParam("itemId") String itemId,
76                           @ApiParam("Version Id") @PathParam("versionId") String versionId,
77                           @NotNull(message = USER_MISSING_ERROR_MSG)
78                           @HeaderParam(USER_ID_HEADER_PARAM) String user);
79
80   @GET
81   @Path("/{versionId}/revisions")
82   @ApiOperation(value = "Gets item version revisions", response = RevisionDto.class,
83       responseContainer = "List")
84   Response listRevisions(@PathParam("itemId") String itemId,
85                          @PathParam("versionId") String versionId,
86                          @NotNull(message = USER_MISSING_ERROR_MSG)
87                @HeaderParam(USER_ID_HEADER_PARAM) String user);
88
89   @PUT
90   @Path("/{versionId}/actions")
91   @ApiOperation(value = "Acts on item version")
92   Response actOn(VersionActionRequestDto request,
93                  @PathParam("itemId") String itemId,
94                  @PathParam("versionId") String versionId,
95                  @NotNull(message = USER_MISSING_ERROR_MSG)
96                  @HeaderParam(USER_ID_HEADER_PARAM) String user);
97 }