6e6fade369e87687e8a8a9f1f6dbe5d7f98664cc
[sdc.git] /
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.conflict.rest;
22
23 import io.swagger.v3.oas.annotations.OpenAPIDefinition;
24 import io.swagger.v3.oas.annotations.Operation;
25 import io.swagger.v3.oas.annotations.Parameter;
26 import io.swagger.v3.oas.annotations.info.Info;
27 import io.swagger.v3.oas.annotations.media.Content;
28 import io.swagger.v3.oas.annotations.media.Schema;
29 import io.swagger.v3.oas.annotations.responses.ApiResponse;
30 import org.openecomp.sdcrests.common.RestConstants;
31 import org.openecomp.sdcrests.conflict.types.ConflictDto;
32 import org.openecomp.sdcrests.conflict.types.ConflictResolutionDto;
33 import org.openecomp.sdcrests.conflict.types.ItemVersionConflictDto;
34 import org.springframework.validation.annotation.Validated;
35
36 import javax.validation.constraints.NotNull;
37 import javax.ws.rs.*;
38 import javax.ws.rs.core.MediaType;
39 import javax.ws.rs.core.Response;
40
41 @Path("/v1.0/items/{itemId}/versions/{versionId}/conflicts")
42 @Produces(MediaType.APPLICATION_JSON)
43 @Consumes(MediaType.APPLICATION_JSON)
44 @OpenAPIDefinition(info = @Info(title = "Item Version Conflicts"))
45 @Validated
46 public interface Conflicts {
47
48   @GET
49   @Path("/")
50   @Operation(description = "item version conflicts",
51       summary = "Item version private copy conflicts against its public copy",
52           responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ItemVersionConflictDto.class))))
53   Response getConflict(@Parameter(description = "Item Id") @PathParam("itemId") String itemId,
54                        @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
55                        @NotNull(message = RestConstants.USER_MISSING_ERROR_MSG)
56                         @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);
57
58   @GET
59   @Path("/{conflictId}")
60   @Operation(description = "Gets item version conflict",
61       summary = "Gets an item version private copy conflict against its public copy",
62           responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ConflictDto.class))))
63   Response getConflict(@Parameter(description = "Item Id") @PathParam("itemId") String itemId,
64                        @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
65                        @Parameter(description = "Version Id") @PathParam("conflictId") String conflictId,
66                        @NotNull(message = RestConstants.USER_MISSING_ERROR_MSG)
67                        @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);
68
69   @PUT
70   @Path("/{conflictId}")
71   @Operation(description = "Resolves item version conflict",
72       summary = "Resolves an item version private copy conflict against its public copy")
73   Response resolveConflict(ConflictResolutionDto conflictResolution,
74                            @Parameter(description = "Item Id") @PathParam("itemId") String itemId,
75                            @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
76                            @Parameter(description = "Version Id") @PathParam("conflictId") String conflictId,
77                            @NotNull(message = RestConstants.USER_MISSING_ERROR_MSG)
78                            @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);
79 }