[SDC-29] Amdocs OnBoard 1707 initial commit.
[sdc.git] / openecomp-be / api / openecomp-sdc-rest-webapp / vendor-license-rest / vendor-license-rest-services / src / main / java / org / openecomp / sdcrests / vendorlicense / rest / LicenseAgreements.java
index 28d9f5a..4eabec9 100644 (file)
 
 package org.openecomp.sdcrests.vendorlicense.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.vendorlicense.types.LicenseAgreementEntityDto;
 import org.openecomp.sdcrests.vendorlicense.types.LicenseAgreementModelDto;
 import org.openecomp.sdcrests.vendorlicense.types.LicenseAgreementRequestDto;
@@ -35,7 +31,6 @@ 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;
@@ -45,11 +40,14 @@ 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-license-models/{vlmId}/license-agreements")
+import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
+import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
+
+
+@Path("/v1.0/vendor-license-models/{vlmId}/versions/{versionId}/license-agreements")
 @Produces(MediaType.APPLICATION_JSON)
 @Consumes(MediaType.APPLICATION_JSON)
 @Api(value = "Vendor License Model - License Agreements")
@@ -64,9 +62,8 @@ public interface LicenseAgreements {
       responseContainer = "List")
   Response listLicenseAgreements(
       @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId,
-      @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);
+      @ApiParam(value = "Vendor license model version Id") @PathParam("versionId") String versionId,
+      @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
 
   @POST
   @Path("/")
@@ -74,8 +71,10 @@ public interface LicenseAgreements {
   Response createLicenseAgreement(@Valid LicenseAgreementRequestDto request,
                                   @ApiParam(value = "Vendor license model Id") @PathParam("vlmId")
                                       String vlmId,
+                                  @ApiParam(value = "Vendor license model version Id")
+                                  @PathParam("versionId") String versionId,
                                   @NotNull(message = USER_MISSING_ERROR_MSG)
-                                  @HeaderParam(USER_HEADER_PARAM) String user);
+                                  @HeaderParam(USER_ID_HEADER_PARAM) String user);
 
   @PUT
   @Path("/{licenseAgreementId}")
@@ -83,9 +82,11 @@ public interface LicenseAgreements {
   Response updateLicenseAgreement(@Valid LicenseAgreementUpdateRequestDto request,
                                   @ApiParam(value = "Vendor license model Id") @PathParam("vlmId")
                                       String vlmId,
+                                  @ApiParam(value = "Vendor license model version Id")
+                                  @PathParam("versionId") String versionId,
                                   @PathParam("licenseAgreementId") String licenseAgreementId,
                                   @NotNull(message = USER_MISSING_ERROR_MSG)
-                                  @HeaderParam(USER_HEADER_PARAM) String user);
+                                  @HeaderParam(USER_ID_HEADER_PARAM) String user);
 
   @GET
   @Path("/{licenseAgreementId}")
@@ -93,17 +94,17 @@ public interface LicenseAgreements {
       response = LicenseAgreementModelDto.class)
   Response getLicenseAgreement(
       @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId,
-      @Pattern(regexp = Version.VERSION_REGEX, message = Version.VERSION_STRING_VIOLATION_MSG)
-      @QueryParam("version") String version,
+      @ApiParam(value = "Vendor license model version Id") @PathParam("versionId") String versionId,
       @PathParam("licenseAgreementId") String licenseAgreementId,
-      @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM) String user);
+      @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
 
   @DELETE
   @Path("/{licenseAgreementId}")
   @ApiOperation(value = "Delete vendor license agreement")
   Response deleteLicenseAgreement(
       @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId,
+      @ApiParam(value = "Vendor license model version Id") @PathParam("versionId") String versionId,
       @PathParam("licenseAgreementId") String licenseAgreementId,
-      @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM) String user);
+      @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
 
 }