Added oparent to sdc main
[sdc.git] / openecomp-be / api / openecomp-sdc-rest-webapp / conflict-rest / conflict-rest-services / src / main / java / org / openecomp / sdcrests / conflict / rest / Conflicts.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.conflict.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.common.RestConstants;
27 import org.openecomp.sdcrests.conflict.types.ConflictDto;
28 import org.openecomp.sdcrests.conflict.types.ConflictResolutionDto;
29 import org.openecomp.sdcrests.conflict.types.ItemVersionConflictDto;
30 import org.springframework.validation.annotation.Validated;
31
32 import javax.validation.constraints.NotNull;
33 import javax.ws.rs.*;
34 import javax.ws.rs.core.MediaType;
35 import javax.ws.rs.core.Response;
36
37 @Path("/v1.0/items/{itemId}/versions/{versionId}/conflicts")
38 @Produces(MediaType.APPLICATION_JSON)
39 @Consumes(MediaType.APPLICATION_JSON)
40 @Api(value = "Item Version Conflicts")
41 @Validated
42 public interface Conflicts {
43
44   @GET
45   @Path("/")
46   @ApiOperation(value = "item version conflicts",
47       notes = "Item version private copy conflicts against its public copy",
48       response = ItemVersionConflictDto.class)
49   Response getConflict(@ApiParam("Item Id") @PathParam("itemId") String itemId,
50                        @ApiParam("Version Id") @PathParam("versionId") String versionId,
51                        @NotNull(message = RestConstants.USER_MISSING_ERROR_MSG)
52                         @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);
53
54   @GET
55   @Path("/{conflictId}")
56   @ApiOperation(value = "Gets item version conflict",
57       notes = "Gets an item version private copy conflict against its public copy",
58       response = ConflictDto.class)
59   Response getConflict(@ApiParam("Item Id") @PathParam("itemId") String itemId,
60                        @ApiParam("Version Id") @PathParam("versionId") String versionId,
61                        @ApiParam("Version Id") @PathParam("conflictId") String conflictId,
62                        @NotNull(message = RestConstants.USER_MISSING_ERROR_MSG)
63                        @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);
64
65   @PUT
66   @Path("/{conflictId}")
67   @ApiOperation(value = "Resolves item version conflict",
68       notes = "Resolves an item version private copy conflict against its public copy")
69   Response resolveConflict(ConflictResolutionDto conflictResolution,
70                            @ApiParam("Item Id") @PathParam("itemId") String itemId,
71                            @ApiParam("Version Id") @PathParam("versionId") String versionId,
72                            @ApiParam("Version Id") @PathParam("conflictId") String conflictId,
73                            @NotNull(message = RestConstants.USER_MISSING_ERROR_MSG)
74                            @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);
75 }