diff options
author | AviZi <avi.ziv@amdocs.com> | 2017-06-09 02:39:56 +0300 |
---|---|---|
committer | AviZi <avi.ziv@amdocs.com> | 2017-06-09 02:39:56 +0300 |
commit | 280f8015d06af1f41a3ef12e8300801c7a5e0d54 (patch) | |
tree | 9c1d3978c04cd28068f02073038c936bb49ca9e0 /openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services | |
parent | fd3821dad11780d33c5373d74c957c442489945e (diff) |
[SDC-29] Amdocs OnBoard 1707 initial commit.
Change-Id: Ie4d12a3f574008b792899b368a0902a8b46b5370
Signed-off-by: AviZi <avi.ziv@amdocs.com>
Diffstat (limited to 'openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services')
15 files changed, 582 insertions, 235 deletions
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/pom.xml index 2002129cd6..513c9f5c7d 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/pom.xml +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/pom.xml @@ -2,6 +2,9 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> + <artifactId>vendor-license-rest-services</artifactId> + <name>vendor-license-rest-services</name> + <parent> <groupId>org.openecomp.sdc.onboarding</groupId> <artifactId>vendor-license-rest</artifactId> @@ -9,11 +12,6 @@ <relativePath>../</relativePath> </parent> - <artifactId>vendor-license-rest-services</artifactId> - <name>vendor-license-rest-services</name> - - - <properties> <errorcode.dir>${project.build.directory}/generated-sources/error-codes</errorcode.dir> @@ -70,7 +68,6 @@ <artifactId>cxf-rt-frontend-jaxrs</artifactId> <version>${cxf.version}</version> </dependency> - <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> @@ -89,12 +86,12 @@ </dependency> <!-- Other Stuff--> - <dependency> + <!--dependency> <groupId>cglib</groupId> <artifactId>cglib-nodep</artifactId> <version>${cglib.nodep.version}</version> <scope>runtime</scope> - </dependency> + </dependency--> <!-- Java Stuff --> <dependency> @@ -124,10 +121,15 @@ <skipTests>true</skipTests> </configuration> </plugin> + <!-- Error codes generator plugin --> + <!--plugin> + <groupId>org.openecomp.nfv.tools</groupId> + <artifactId>error-codes-maven-plugin</artifactId> + </plugin--> </plugins> </build> -</project>
\ No newline at end of file +</project> diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/pom.xml.versionsBackup b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/pom.xml.versionsBackup new file mode 100644 index 0000000000..187135e1f4 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/pom.xml.versionsBackup @@ -0,0 +1,135 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <artifactId>vendor-license-rest-services</artifactId> + <name>vendor-license-rest-services</name> + + <parent> + <groupId>org.openecomp.sdc.onboarding</groupId> + <artifactId>vendor-license-rest</artifactId> + <version>1.0-SNAPSHOT</version> + <relativePath>../</relativePath> + </parent> + + + <properties> + <errorcode.dir>${project.build.directory}/generated-sources/error-codes</errorcode.dir> + </properties> + + <dependencies> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>vendor-license-rest-types</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.openecomp.sdc</groupId> + <artifactId>openecomp-sdc-vendor-license-api</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.openecomp.sdc</groupId> + <artifactId>openecomp-sdc-vendor-license-manager</artifactId> + <version>${project.version}</version> + </dependency> + + + <!-- Spring --> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-core</artifactId> + <version>${spring.framework.version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-context</artifactId> + <version>${spring.framework.version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-context-support</artifactId> + <version>${spring.framework.version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-web</artifactId> + <version>${spring.framework.version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-beans</artifactId> + <version>${spring.framework.version}</version> + </dependency> + + <!-- CXF --> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-frontend-jaxrs</artifactId> + <version>${cxf.version}</version> + </dependency> + <dependency> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpclient</artifactId> + <version>${http.client.version}</version> + </dependency> + <dependency> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpcore</artifactId> + <version>${http.client.version}</version> + </dependency> + + <dependency> + <groupId>javax.ws.rs</groupId> + <artifactId>javax.ws.rs-api</artifactId> + <version>${ws.rs.version}</version> + </dependency> + + <!-- Other Stuff--> + <!--dependency> + <groupId>cglib</groupId> + <artifactId>cglib-nodep</artifactId> + <version>${cglib.nodep.version}</version> + <scope>runtime</scope> + </dependency--> + + <!-- Java Stuff --> + <dependency> + <groupId>javax.inject</groupId> + <artifactId>javax.inject</artifactId> + <version>${javax.inject.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.openecomp.sdc</groupId> + <artifactId>openecomp-sdc-vendor-software-product-manager</artifactId> + <version>1.0-SNAPSHOT</version> + </dependency> + + </dependencies> + + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <includes> + <include>test/core/unittest/offline/**</include> + </includes> + <skipTests>true</skipTests> + </configuration> + </plugin> + <!-- Error codes generator plugin --> + <!--plugin> + <groupId>org.openecomp.nfv.tools</groupId> + <artifactId>error-codes-maven-plugin</artifactId> + </plugin--> + </plugins> + </build> + + + + +</project>
\ No newline at end of file diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/EntitlementPools.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/EntitlementPools.java index 9dea767f7d..1f88e4c475 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/EntitlementPools.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/EntitlementPools.java @@ -20,20 +20,15 @@ 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.EntitlementPoolEntityDto; import org.openecomp.sdcrests.vendorlicense.types.EntitlementPoolRequestDto; 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; @@ -43,11 +38,13 @@ 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}/entitlement-pools") +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}/entitlement-pools") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @Api(value = "Vendor License Model - Entitlement Pools") @@ -60,9 +57,9 @@ public interface EntitlementPools { responseContainer = "List") Response listEntitlementPools( @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("/") @@ -70,8 +67,11 @@ public interface EntitlementPools { Response createEntitlementPool(@Valid EntitlementPoolRequestDto 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("/{entitlementPoolId}") @@ -79,9 +79,11 @@ public interface EntitlementPools { Response updateEntitlementPool(@Valid EntitlementPoolRequestDto 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) @PathParam("entitlementPoolId") String entitlementPoolId, - @HeaderParam(USER_HEADER_PARAM) String user); + @HeaderParam(USER_ID_HEADER_PARAM) String user); @GET @Path("/{entitlementPoolId}") @@ -89,17 +91,17 @@ public interface EntitlementPools { response = EntitlementPoolEntityDto.class) Response getEntitlementPool( @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("entitlementPoolId") String entitlementPoolId, - @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("/{entitlementPoolId}") @ApiOperation(value = "Delete vendor entitlement pool") Response deleteEntitlementPool( @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId, + @ApiParam(value = "Vendor license model version Id") @PathParam("versionId") String versionId, @PathParam("entitlementPoolId") String entitlementPoolId, - @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); } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/FeatureGroups.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/FeatureGroups.java index f5ad973cb0..9a72a59070 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/FeatureGroups.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/FeatureGroups.java @@ -20,9 +20,6 @@ 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; @@ -49,7 +46,11 @@ import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -@Path("/v1.0/vendor-license-models/{vlmId}/feature-groups") +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}/feature-groups") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @Api(value = "Vendor License Model - Feature Groups") @@ -63,9 +64,8 @@ public interface FeatureGroups { responseContainer = "List") Response listFeatureGroups( @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("/") @@ -73,8 +73,9 @@ public interface FeatureGroups { Response createFeatureGroup(@Valid FeatureGroupRequestDto 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("/{featureGroupId}") @@ -82,9 +83,10 @@ public interface FeatureGroups { Response updateFeatureGroup(@Valid FeatureGroupUpdateRequestDto request, @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId, + @ApiParam(value = "Vendor license model version Id") @PathParam("versionId") String versionId, @PathParam("featureGroupId") String featureGroupId, @NotNull(message = USER_MISSING_ERROR_MSG) - @HeaderParam(USER_HEADER_PARAM) String user); + @HeaderParam(USER_ID_HEADER_PARAM) String user); @GET @Path("/{featureGroupId}") @@ -92,17 +94,17 @@ public interface FeatureGroups { response = FeatureGroupModelDto.class) Response getFeatureGroup( @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("featureGroupId") String featureGroupId, - @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("/{featureGroupId}") @ApiOperation(value = "Delete vendor feature group") Response deleteFeatureGroup( @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId, + @ApiParam(value = "Vendor license model version Id") @PathParam("versionId") String versionId, @PathParam("featureGroupId") String featureGroupId, - @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); } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/LicenseAgreements.java b/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 28d9f5a32f..4eabec91a6 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/LicenseAgreements.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/LicenseAgreements.java @@ -20,13 +20,9 @@ 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); } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/LicenseKeyGroups.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/LicenseKeyGroups.java index d66945d63c..973e3c22d4 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/LicenseKeyGroups.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/LicenseKeyGroups.java @@ -20,20 +20,15 @@ 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.LicenseKeyGroupEntityDto; import org.openecomp.sdcrests.vendorlicense.types.LicenseKeyGroupRequestDto; 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; @@ -43,11 +38,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-key-groups") +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-key-groups") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @Api(value = "Vendor License Model - License Key Groups") @@ -60,9 +58,8 @@ public interface LicenseKeyGroups { responseContainer = "List") Response listLicenseKeyGroups( @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, - @HeaderParam(USER_HEADER_PARAM) String user); + @ApiParam(value = "Vendor license model version Id") @PathParam("versionId") String versionId, + @HeaderParam(USER_ID_HEADER_PARAM) String user); @POST @Path("/") @@ -70,8 +67,10 @@ public interface LicenseKeyGroups { Response createLicenseKeyGroup(@Valid LicenseKeyGroupRequestDto 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("/{licenseKeyGroupId}") @@ -79,9 +78,11 @@ public interface LicenseKeyGroups { Response updateLicenseKeyGroup(@Valid LicenseKeyGroupRequestDto request, @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId, + @ApiParam(value = "Vendor license model version Id") + @PathParam("versionId") String versionId, @PathParam("licenseKeyGroupId") String licenseKeyGroupId, @NotNull(message = USER_MISSING_ERROR_MSG) - @HeaderParam(USER_HEADER_PARAM) String user); + @HeaderParam(USER_ID_HEADER_PARAM) String user); @GET @Path("/{licenseKeyGroupId}") @@ -89,16 +90,16 @@ public interface LicenseKeyGroups { response = LicenseKeyGroupEntityDto.class) Response getLicenseKeyGroup( @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("licenseKeyGroupId") String licenseKeyGroupId, - @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("/{licenseKeyGroupId}") @ApiOperation(value = "Delete vendor license key group") Response deleteLicenseKeyGroup( @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId, + @ApiParam(value = "Vendor license model version Id") @PathParam("versionId") String versionId, @PathParam("licenseKeyGroupId") String licenseKeyGroupId, - @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); } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/VendorLicenseModels.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/VendorLicenseModels.java index 15fc9bf0d9..23a0960a3a 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/VendorLicenseModels.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/VendorLicenseModels.java @@ -20,12 +20,9 @@ package org.openecomp.sdcrests.vendorlicense.rest; -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.common.RestConstants; import org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelActionRequestDto; import org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelEntityDto; @@ -34,20 +31,13 @@ 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; -import javax.ws.rs.HeaderParam; -import javax.ws.rs.POST; -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.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; +import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG; + + @Path("/v1.0/vendor-license-models") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @@ -55,57 +45,65 @@ import javax.ws.rs.core.Response; @Validated public interface VendorLicenseModels { - @GET - @Path("/") - @ApiOperation(value = "List vendor license models", - response = VendorLicenseModelEntityDto.class, - responseContainer = "List") - Response listLicenseModels(@ApiParam( - value = "Currently supported value: 'Final' - only vendor License models with final versions " - + "will be return - with their latest final version") - @QueryParam("versionFilter") String versionFilter, - @NotNull(message = USER_MISSING_ERROR_MSG) - @HeaderParam(RestConstants.USER_HEADER_PARAM) String user); + @GET + @Path("/") + @ApiOperation(value = "List vendor license models", + response = VendorLicenseModelEntityDto.class, + responseContainer = "List") + Response listLicenseModels(@ApiParam( + value = "Currently supported value: 'Final' - only vendor License models with final versions " + + "will be return - with their latest final version") + @QueryParam("versionFilter") String versionFilter, + @NotNull(message = USER_MISSING_ERROR_MSG) + @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user); - @POST - @Path("/") - @ApiOperation(value = "Create vendor license model") - Response createLicenseModel(@Valid VendorLicenseModelRequestDto request, - @NotNull(message = USER_MISSING_ERROR_MSG) - @HeaderParam(RestConstants.USER_HEADER_PARAM) String user); + @POST + @Path("/") + @ApiOperation(value = "Create vendor license model") + Response createLicenseModel(@Valid VendorLicenseModelRequestDto request, + @NotNull(message = USER_MISSING_ERROR_MSG) + @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user); - @PUT - @Path("/{vlmId}") - @ApiOperation(value = "Update vendor license model") - Response updateLicenseModel(@Valid VendorLicenseModelRequestDto request, - @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") - String vlmId, @NotNull(message = USER_MISSING_ERROR_MSG) - @HeaderParam(RestConstants.USER_HEADER_PARAM) String user); + @PUT + @Path("/{vlmId}/versions/{versionId}") + @ApiOperation(value = "Update vendor license model") + Response updateLicenseModel(@Valid VendorLicenseModelRequestDto 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(RestConstants.USER_ID_HEADER_PARAM) String user); - @GET - @Path("/{vlmId}") - @ApiOperation(value = "Get vendor license model", - response = VendorLicenseModelEntityDto.class) - Response getLicenseModel( - @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(RestConstants.USER_HEADER_PARAM) - String user); + @GET + @Path("/{vlmId}/versions/{versionId}") + @ApiOperation(value = "Get vendor license model", + response = VendorLicenseModelEntityDto.class) + Response getLicenseModel( + @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(RestConstants.USER_ID_HEADER_PARAM) + String user); - @DELETE - @Path("/{vlmId}") - @ApiOperation(value = "Delete vendor license model") - Response deleteLicenseModel( - @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId, - @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(RestConstants.USER_HEADER_PARAM) - String user); + @DELETE + @Path("/{vlmId}/versions/{versionId}") + @ApiOperation(value = "Delete vendor license model") + Response deleteLicenseModel( + @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(RestConstants.USER_ID_HEADER_PARAM) + String user); - @PUT - @Path("/{vlmId}/actions") - @ApiOperation(value = "Update vendor license model") - Response actOnLicenseModel(@Valid VendorLicenseModelActionRequestDto request, - @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") - String vlmId, @NotNull(message = USER_MISSING_ERROR_MSG) - @HeaderParam(RestConstants.USER_HEADER_PARAM) String user); + @PUT + @Path("/{vlmId}/versions/{versionId}/actions") + @ApiOperation(value = "Update vendor license model") + Response actOnLicenseModel(@Valid VendorLicenseModelActionRequestDto 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(RestConstants.USER_ID_HEADER_PARAM) String user); } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapFeatureGroupDescriptorDtoToFeatureGroupEntity.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapFeatureGroupDescriptorDtoToFeatureGroupEntity.java index 91239e2655..9875a332bd 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapFeatureGroupDescriptorDtoToFeatureGroupEntity.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapFeatureGroupDescriptorDtoToFeatureGroupEntity.java @@ -24,7 +24,6 @@ import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity; import org.openecomp.sdcrests.mapping.MappingBase; import org.openecomp.sdcrests.vendorlicense.types.FeatureGroupDescriptorDto; - public class MapFeatureGroupDescriptorDtoToFeatureGroupEntity extends MappingBase<FeatureGroupDescriptorDto, FeatureGroupEntity> { @Override diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapVendorLicenseModelRequestDtoToVendorLicenseModelEntity.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapVendorLicenseModelRequestDtoToVendorLicenseModelEntity.java index 1117a2db9f..593a4a37b0 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapVendorLicenseModelRequestDtoToVendorLicenseModelEntity.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapVendorLicenseModelRequestDtoToVendorLicenseModelEntity.java @@ -24,7 +24,6 @@ import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity; import org.openecomp.sdcrests.mapping.MappingBase; import org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelRequestDto; - public class MapVendorLicenseModelRequestDtoToVendorLicenseModelEntity extends MappingBase<VendorLicenseModelRequestDto, VendorLicenseModelEntity> { @Override diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapVersionedVendorLicenseModelToVendorLicenseModelEntityDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapVersionedVendorLicenseModelToVendorLicenseModelEntityDto.java index a53d5c9e36..7c2db85d2e 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapVersionedVendorLicenseModelToVendorLicenseModelEntityDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapVersionedVendorLicenseModelToVendorLicenseModelEntityDto.java @@ -25,6 +25,7 @@ import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity; import org.openecomp.sdc.vendorlicense.types.VersionedVendorLicenseModel; import org.openecomp.sdc.versioning.dao.types.Version; import org.openecomp.sdc.versioning.types.VersionInfo; +import org.openecomp.sdcrests.common.types.VersionDto; import org.openecomp.sdcrests.mapping.MappingBase; import org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelEntityDto; @@ -42,17 +43,20 @@ public class MapVersionedVendorLicenseModelToVendorLicenseModelEntityDto VersionInfo versionInfo = source.getVersionInfo(); if (versionInfo != null) { - target.setVersion(versionInfo.getActiveVersion().toString()); + target.setVersion(new VersionDto(versionInfo.getActiveVersion().toString(),versionInfo + .getActiveVersion().toString())); target.setStatus(versionInfo.getStatus()); target.setLockingUser(versionInfo.getLockingUser()); if (!CommonMethods.isEmpty(versionInfo.getViewableVersions())) { - target.setViewableVersions(versionInfo.getViewableVersions().stream().map(Version::toString) + target.setViewableVersions(versionInfo.getViewableVersions().stream().map(version->new + VersionDto(version.toString(),version.toString())) .collect(Collectors.toList())); } if (!CommonMethods.isEmpty(versionInfo.getFinalVersions())) { - target.setFinalVersions(versionInfo.getFinalVersions().stream().map(Version::toString) + target.setFinalVersions(versionInfo.getFinalVersions().stream().map(version->new + VersionDto(version.toString(),version.toString())) .collect(Collectors.toList())); } } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/EntitlementPoolsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/EntitlementPoolsImpl.java index ab9800e612..63576c95bd 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/EntitlementPoolsImpl.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/EntitlementPoolsImpl.java @@ -20,10 +20,12 @@ package org.openecomp.sdcrests.vendorlicense.rest.services; +import org.openecomp.sdc.logging.context.MdcUtil; +import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage; +import org.openecomp.sdc.logging.types.LoggerServiceName; import org.openecomp.sdc.vendorlicense.VendorLicenseManager; import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity; import org.openecomp.sdc.versioning.dao.types.Version; - import org.openecomp.sdcrests.vendorlicense.rest.EntitlementPools; import org.openecomp.sdcrests.vendorlicense.rest.mapping.MapEntitlementPoolEntityToEntitlementPoolEntityDto; import org.openecomp.sdcrests.vendorlicense.rest.mapping.MapEntitlementPoolRequestDtoToEntitlementPoolEntity; @@ -31,34 +33,37 @@ import org.openecomp.sdcrests.vendorlicense.types.EntitlementPoolEntityDto; import org.openecomp.sdcrests.vendorlicense.types.EntitlementPoolRequestDto; import org.openecomp.sdcrests.wrappers.GenericCollectionWrapper; import org.openecomp.sdcrests.wrappers.StringWrapperResponse; - import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Service; -import java.util.Collection; import javax.inject.Named; import javax.ws.rs.core.Response; +import java.util.Collection; @Named @Service("entitlementPools") @Scope(value = "prototype") public class EntitlementPoolsImpl implements EntitlementPools { + private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); @Autowired private VendorLicenseManager vendorLicenseManager; /** * List entitlement pools response. * - * @param vlmId the vlm id - * @param version the version - * @param user the user + * @param vlmId the vlm id + * @param versionId the version + * @param user the user * @return the response */ - public Response listEntitlementPools(String vlmId, String version, String user) { + public Response listEntitlementPools(String vlmId, String versionId, String user) { + mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId); + + MdcUtil.initMdc(LoggerServiceName.List_EP.toString()); Collection<EntitlementPoolEntity> entitlementPools = - vendorLicenseManager.listEntitlementPools(vlmId, Version.valueOf(version), user); + vendorLicenseManager.listEntitlementPools(vlmId, Version.valueOf(versionId), user); GenericCollectionWrapper<EntitlementPoolEntityDto> result = new GenericCollectionWrapper<>(); MapEntitlementPoolEntityToEntitlementPoolEntityDto outputMapper = @@ -67,6 +72,8 @@ public class EntitlementPoolsImpl implements EntitlementPools { result.add(outputMapper.applyMapping(ep, EntitlementPoolEntityDto.class)); } + mdcDataDebugMessage.debugExitMessage("VLM id", vlmId); + return Response.ok(result).build(); } @@ -79,7 +86,11 @@ public class EntitlementPoolsImpl implements EntitlementPools { * @return the response */ public Response createEntitlementPool(EntitlementPoolRequestDto request, String vlmId, - String user) { + String versionId, String user) { + + mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId); + + MdcUtil.initMdc(LoggerServiceName.Create_EP.toString()); EntitlementPoolEntity entitlementPoolEntity = new MapEntitlementPoolRequestDtoToEntitlementPoolEntity() .applyMapping(request, EntitlementPoolEntity.class); @@ -91,6 +102,8 @@ public class EntitlementPoolsImpl implements EntitlementPools { createdEntitlementPool != null ? new StringWrapperResponse(createdEntitlementPool.getId()) : null; + mdcDataDebugMessage.debugExitMessage("VLM id", vlmId); + return Response.ok(result).build(); } @@ -104,15 +117,21 @@ public class EntitlementPoolsImpl implements EntitlementPools { * @return the response */ public Response updateEntitlementPool(EntitlementPoolRequestDto request, String vlmId, - String entitlementPoolId, String user) { + String versionId, String entitlementPoolId, String user) { + + mdcDataDebugMessage.debugEntryMessage("VLM id, EP id", vlmId, entitlementPoolId); + + MdcUtil.initMdc(LoggerServiceName.Update_EP.toString()); EntitlementPoolEntity entitlementPoolEntity = new MapEntitlementPoolRequestDtoToEntitlementPoolEntity() .applyMapping(request, EntitlementPoolEntity.class); - entitlementPoolEntity.setVendorLicenseModelId(vlmId); entitlementPoolEntity.setId(entitlementPoolId); vendorLicenseManager.updateEntitlementPool(entitlementPoolEntity, user); + + mdcDataDebugMessage.debugExitMessage("VLM id, EP id", vlmId, entitlementPoolId); + return Response.ok().build(); } @@ -127,6 +146,10 @@ public class EntitlementPoolsImpl implements EntitlementPools { */ public Response getEntitlementPool(String vlmId, String version, String entitlementPoolId, String user) { + + mdcDataDebugMessage.debugEntryMessage("VLM id, EP id", vlmId, entitlementPoolId); + + MdcUtil.initMdc(LoggerServiceName.Get_EP.toString()); EntitlementPoolEntity epInput = new EntitlementPoolEntity(); epInput.setVendorLicenseModelId(vlmId); epInput.setVersion(Version.valueOf(version)); @@ -136,6 +159,9 @@ public class EntitlementPoolsImpl implements EntitlementPools { EntitlementPoolEntityDto entitlementPoolEntityDto = entitlementPool == null ? null : new MapEntitlementPoolEntityToEntitlementPoolEntityDto() .applyMapping(entitlementPool, EntitlementPoolEntityDto.class); + + mdcDataDebugMessage.debugExitMessage("VLM id, EP id", vlmId, entitlementPoolId); + return Response.ok(entitlementPoolEntityDto).build(); } @@ -147,11 +173,19 @@ public class EntitlementPoolsImpl implements EntitlementPools { * @param user the user * @return the response */ - public Response deleteEntitlementPool(String vlmId, String entitlementPoolId, String user) { + public Response deleteEntitlementPool(String vlmId, String versionId, String entitlementPoolId, + String user) { + + mdcDataDebugMessage.debugEntryMessage("VLM id, EP id", vlmId, entitlementPoolId); + + MdcUtil.initMdc(LoggerServiceName.Delete_EP.toString()); EntitlementPoolEntity epInput = new EntitlementPoolEntity(); epInput.setVendorLicenseModelId(vlmId); epInput.setId(entitlementPoolId); vendorLicenseManager.deleteEntitlementPool(epInput, user); + + mdcDataDebugMessage.debugExitMessage("VLM id, EP id", vlmId, entitlementPoolId); + return Response.ok().build(); } } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/FeatureGroupsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/FeatureGroupsImpl.java index daf35f9ee6..e41942d455 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/FeatureGroupsImpl.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/FeatureGroupsImpl.java @@ -21,6 +21,9 @@ package org.openecomp.sdcrests.vendorlicense.rest.services; import org.openecomp.core.utilities.CommonMethods; +import org.openecomp.sdc.logging.context.MdcUtil; +import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage; +import org.openecomp.sdc.logging.types.LoggerServiceName; import org.openecomp.sdc.vendorlicense.VendorLicenseManager; import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity; import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity; @@ -40,29 +43,32 @@ import org.openecomp.sdcrests.vendorlicense.types.FeatureGroupUpdateRequestDto; import org.openecomp.sdcrests.vendorlicense.types.LicenseKeyGroupEntityDto; import org.openecomp.sdcrests.wrappers.GenericCollectionWrapper; import org.openecomp.sdcrests.wrappers.StringWrapperResponse; - import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Service; -import java.util.Collection; -import java.util.HashSet; import javax.inject.Named; import javax.ws.rs.core.Response; - +import java.util.Collection; +import java.util.HashSet; @Named @Service("featureGroups") @Scope(value = "prototype") public class FeatureGroupsImpl implements FeatureGroups { + private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); @Autowired private VendorLicenseManager vendorLicenseManager; @Override - public Response listFeatureGroups(String vlmId, String version, String user) { + public Response listFeatureGroups(String vlmId, String versionId, String user) { + + mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId); + + MdcUtil.initMdc(LoggerServiceName.List_FG.toString()); Collection<FeatureGroupEntity> featureGroupEntities = - vendorLicenseManager.listFeatureGroups(vlmId, Version.valueOf(version), user); + vendorLicenseManager.listFeatureGroups(vlmId, Version.valueOf(versionId), user); MapFeatureGroupEntityToFeatureGroupDescriptorDto outputMapper = new MapFeatureGroupEntityToFeatureGroupDescriptorDto(); @@ -78,11 +84,18 @@ public class FeatureGroupsImpl implements FeatureGroups { results.add(fgDto); } + mdcDataDebugMessage.debugExitMessage("VLM id", vlmId); + return Response.ok(results).build(); } @Override - public Response createFeatureGroup(FeatureGroupRequestDto request, String vlmId, String user) { + public Response createFeatureGroup(FeatureGroupRequestDto request, String vlmId, String versionId, + String user) { + + mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId); + + MdcUtil.initMdc(LoggerServiceName.Create_FG.toString()); FeatureGroupEntity featureGroupEntity = new MapFeatureGroupDescriptorDtoToFeatureGroupEntity() .applyMapping(request, FeatureGroupEntity.class); featureGroupEntity.setVendorLicenseModelId(vlmId); @@ -94,12 +107,19 @@ public class FeatureGroupsImpl implements FeatureGroups { StringWrapperResponse result = createdFeatureGroup != null ? new StringWrapperResponse(createdFeatureGroup.getId()) : null; + + mdcDataDebugMessage.debugExitMessage("VLM id", vlmId); + return Response.ok(result).build(); } @Override public Response updateFeatureGroup(FeatureGroupUpdateRequestDto request, String vlmId, - String featureGroupId, String user) { + String versionId, String featureGroupId, String user) { + + mdcDataDebugMessage.debugEntryMessage("VLM id, FG id", vlmId, featureGroupId); + + MdcUtil.initMdc(LoggerServiceName.Update_FG.toString()); FeatureGroupEntity featureGroupEntity = new MapFeatureGroupDescriptorDtoToFeatureGroupEntity() .applyMapping(request, FeatureGroupEntity.class); featureGroupEntity.setVendorLicenseModelId(vlmId); @@ -109,15 +129,22 @@ public class FeatureGroupsImpl implements FeatureGroups { .updateFeatureGroup(featureGroupEntity, request.getAddedLicenseKeyGroupsIds(), request.getRemovedLicenseKeyGroupsIds(), request.getAddedEntitlementPoolsIds(), request.getRemovedEntitlementPoolsIds(), user); + + mdcDataDebugMessage.debugExitMessage("VLM id, FG id", vlmId, featureGroupId); + return Response.ok().build(); } @Override - public Response getFeatureGroup(String vlmId, String version, String featureGroupId, + public Response getFeatureGroup(String vlmId, String versionId, String featureGroupId, String user) { + + mdcDataDebugMessage.debugEntryMessage("VLM id, FG id", vlmId, featureGroupId); + + MdcUtil.initMdc(LoggerServiceName.Get_FG.toString()); FeatureGroupEntity fgInput = new FeatureGroupEntity(); fgInput.setVendorLicenseModelId(vlmId); - fgInput.setVersion(Version.valueOf(version)); + fgInput.setVersion(Version.valueOf(versionId)); fgInput.setId(featureGroupId); FeatureGroupModel featureGroupModel = vendorLicenseManager.getFeatureGroupModel(fgInput, user); @@ -154,15 +181,25 @@ public class FeatureGroupsImpl implements FeatureGroups { } } + mdcDataDebugMessage.debugExitMessage("VLM id, FG id", vlmId, featureGroupId); + return Response.ok(fgmDto).build(); } @Override - public Response deleteFeatureGroup(String vlmId, String featureGroupId, String user) { + public Response deleteFeatureGroup(String vlmId, String versionId, String featureGroupId, + String user) { + + mdcDataDebugMessage.debugEntryMessage("VLM id, FG id", vlmId, featureGroupId); + + MdcUtil.initMdc(LoggerServiceName.Delete_FG.toString()); FeatureGroupEntity fgInput = new FeatureGroupEntity(); fgInput.setVendorLicenseModelId(vlmId); fgInput.setId(featureGroupId); vendorLicenseManager.deleteFeatureGroup(fgInput, user); + + mdcDataDebugMessage.debugExitMessage("VLM id, FG id", vlmId, featureGroupId); + return Response.ok().build(); } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseAgreementsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseAgreementsImpl.java index d87be05998..ac242422e4 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseAgreementsImpl.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseAgreementsImpl.java @@ -21,6 +21,9 @@ package org.openecomp.sdcrests.vendorlicense.rest.services; import org.openecomp.core.utilities.CommonMethods; +import org.openecomp.sdc.logging.context.MdcUtil; +import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage; +import org.openecomp.sdc.logging.types.LoggerServiceName; import org.openecomp.sdc.vendorlicense.VendorLicenseManager; import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity; import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementEntity; @@ -37,7 +40,6 @@ import org.openecomp.sdcrests.vendorlicense.types.LicenseAgreementRequestDto; import org.openecomp.sdcrests.vendorlicense.types.LicenseAgreementUpdateRequestDto; import org.openecomp.sdcrests.wrappers.GenericCollectionWrapper; import org.openecomp.sdcrests.wrappers.StringWrapperResponse; - import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Service; @@ -52,6 +54,7 @@ import javax.ws.rs.core.Response; @Scope(value = "prototype") public class LicenseAgreementsImpl implements LicenseAgreements { + private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); @Autowired private VendorLicenseManager vendorLicenseManager; @@ -59,13 +62,17 @@ public class LicenseAgreementsImpl implements LicenseAgreements { * List license agreements response. * * @param vlmId the vlm id - * @param version the version + * @param versionId the version * @param user the user * @return the response */ - public Response listLicenseAgreements(String vlmId, String version, String user) { + public Response listLicenseAgreements(String vlmId, String versionId, String user) { + + mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId); + + MdcUtil.initMdc(LoggerServiceName.List_LA.toString()); Collection<LicenseAgreementEntity> licenseAgreements = - vendorLicenseManager.listLicenseAgreements(vlmId, Version.valueOf(version), user); + vendorLicenseManager.listLicenseAgreements(vlmId, Version.valueOf(versionId), user); GenericCollectionWrapper<LicenseAgreementEntityDto> results = new GenericCollectionWrapper<>(); MapLicenseAgreementEntityToLicenseAgreementDescriptorDto outputMapper = @@ -78,6 +85,8 @@ public class LicenseAgreementsImpl implements LicenseAgreements { results.add(laeDto); } + mdcDataDebugMessage.debugExitMessage("VLM id", vlmId); + return Response.ok(results).build(); } @@ -90,11 +99,16 @@ public class LicenseAgreementsImpl implements LicenseAgreements { * @return the response */ public Response createLicenseAgreement(LicenseAgreementRequestDto request, String vlmId, - String user) { + String versionId,String user) { + + mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId); + + MdcUtil.initMdc(LoggerServiceName.Create_LA.toString()); LicenseAgreementEntity licenseAgreementEntity = new MapLicenseAgreementDescriptorDtoToLicenseAgreementEntity() .applyMapping(request, LicenseAgreementEntity.class); licenseAgreementEntity.setVendorLicenseModelId(vlmId); + licenseAgreementEntity.setVersion(Version.valueOf(versionId)); licenseAgreementEntity.setFeatureGroupIds(request.getAddedFeatureGroupsIds()); LicenseAgreementEntity createdLicenseAgreement = @@ -103,6 +117,8 @@ public class LicenseAgreementsImpl implements LicenseAgreements { createdLicenseAgreement != null ? new StringWrapperResponse(createdLicenseAgreement.getId()) : null; + mdcDataDebugMessage.debugExitMessage("VLM id", vlmId); + return Response.ok(result).build(); } @@ -116,16 +132,24 @@ public class LicenseAgreementsImpl implements LicenseAgreements { * @return the response */ public Response updateLicenseAgreement(LicenseAgreementUpdateRequestDto request, String vlmId, - String licenseAgreementId, String user) { + String versionId,String licenseAgreementId, String user) { + + mdcDataDebugMessage.debugEntryMessage("VLM id, LA id", vlmId, licenseAgreementId); + + MdcUtil.initMdc(LoggerServiceName.Update_LA.toString()); LicenseAgreementEntity licenseAgreementEntity = new MapLicenseAgreementDescriptorDtoToLicenseAgreementEntity() .applyMapping(request, LicenseAgreementEntity.class); licenseAgreementEntity.setVendorLicenseModelId(vlmId); + licenseAgreementEntity.setVersion(Version.valueOf(versionId)); licenseAgreementEntity.setId(licenseAgreementId); vendorLicenseManager .updateLicenseAgreement(licenseAgreementEntity, request.getAddedFeatureGroupsIds(), request.getRemovedFeatureGroupsIds(), user); + + mdcDataDebugMessage.debugExitMessage("VLM id, LA id", vlmId, licenseAgreementId); + return Response.ok().build(); } @@ -133,15 +157,19 @@ public class LicenseAgreementsImpl implements LicenseAgreements { * Gets license agreement. * * @param vlmId the vlm id - * @param version the version + * @param versionId the version * @param licenseAgreementId the license agreement id * @param user the user * @return the license agreement */ - public Response getLicenseAgreement(String vlmId, String version, String licenseAgreementId, + public Response getLicenseAgreement(String vlmId, String versionId, String licenseAgreementId, String user) { + + mdcDataDebugMessage.debugEntryMessage("VLM id, LA id", vlmId, licenseAgreementId); + + MdcUtil.initMdc(LoggerServiceName.Get_LA.toString()); LicenseAgreementModel licenseAgreementModel = vendorLicenseManager - .getLicenseAgreementModel(vlmId, Version.valueOf(version), licenseAgreementId, user); + .getLicenseAgreementModel(vlmId, Version.valueOf(versionId), licenseAgreementId, user); if (licenseAgreementModel == null) { return Response.ok().build(); @@ -168,6 +196,8 @@ public class LicenseAgreementsImpl implements LicenseAgreements { } } + mdcDataDebugMessage.debugExitMessage("VLM id, LA id", vlmId, licenseAgreementId); + return Response.ok(lamDto).build(); } @@ -175,12 +205,21 @@ public class LicenseAgreementsImpl implements LicenseAgreements { * Delete license agreement response. * * @param vlmId the vlm id - * @param licenseAgreementId the license agreement id + * @param versionId the version id + * @param licenseAgreementId the license agreement id * @param user the user * @return the response */ - public Response deleteLicenseAgreement(String vlmId, String licenseAgreementId, String user) { - vendorLicenseManager.deleteLicenseAgreement(vlmId, licenseAgreementId, user); + public Response deleteLicenseAgreement(String vlmId,String versionId, String licenseAgreementId, + String user) { + + mdcDataDebugMessage.debugEntryMessage("VLM id, LA id", vlmId, licenseAgreementId); + + MdcUtil.initMdc(LoggerServiceName.Delete_LA.toString()); + vendorLicenseManager.deleteLicenseAgreement(vlmId, Version.valueOf(versionId), licenseAgreementId, user); + + mdcDataDebugMessage.debugExitMessage("VLM id, LA id", vlmId, licenseAgreementId); + return Response.ok().build(); } } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseKeyGroupsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseKeyGroupsImpl.java index 6ef7e194b8..2aac474123 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseKeyGroupsImpl.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseKeyGroupsImpl.java @@ -20,10 +20,12 @@ package org.openecomp.sdcrests.vendorlicense.rest.services; +import org.openecomp.sdc.logging.context.MdcUtil; +import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage; +import org.openecomp.sdc.logging.types.LoggerServiceName; import org.openecomp.sdc.vendorlicense.VendorLicenseManager; import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity; import org.openecomp.sdc.versioning.dao.types.Version; - import org.openecomp.sdcrests.vendorlicense.rest.LicenseKeyGroups; import org.openecomp.sdcrests.vendorlicense.rest.mapping.MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto; import org.openecomp.sdcrests.vendorlicense.rest.mapping.MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity; @@ -31,15 +33,14 @@ import org.openecomp.sdcrests.vendorlicense.types.LicenseKeyGroupEntityDto; import org.openecomp.sdcrests.vendorlicense.types.LicenseKeyGroupRequestDto; import org.openecomp.sdcrests.wrappers.GenericCollectionWrapper; import org.openecomp.sdcrests.wrappers.StringWrapperResponse; - import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; -import java.util.Collection; import javax.inject.Named; import javax.ws.rs.core.Response; +import java.util.Collection; @Named @Service("licenseKeyGroups") @@ -47,20 +48,25 @@ import javax.ws.rs.core.Response; @Validated public class LicenseKeyGroupsImpl implements LicenseKeyGroups { + private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); @Autowired private VendorLicenseManager vendorLicenseManager; /** * List license key groups response. * - * @param vlmId the vlm id - * @param version the version - * @param user the user + * @param vlmId the vlm id + * @param versionId the version + * @param user the user * @return the response */ - public Response listLicenseKeyGroups(String vlmId, String version, String user) { + public Response listLicenseKeyGroups(String vlmId, String versionId, String user) { + + mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId); + + MdcUtil.initMdc(LoggerServiceName.List_LKG.toString()); Collection<LicenseKeyGroupEntity> licenseKeyGroups = - vendorLicenseManager.listLicenseKeyGroups(vlmId, Version.valueOf(version), user); + vendorLicenseManager.listLicenseKeyGroups(vlmId, Version.valueOf(versionId), user); GenericCollectionWrapper<LicenseKeyGroupEntityDto> result = new GenericCollectionWrapper<>(); MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto outputMapper = @@ -69,6 +75,8 @@ public class LicenseKeyGroupsImpl implements LicenseKeyGroups { result.add(outputMapper.applyMapping(ep, LicenseKeyGroupEntityDto.class)); } + mdcDataDebugMessage.debugExitMessage("VLM id", vlmId); + return Response.ok(result).build(); } @@ -81,7 +89,11 @@ public class LicenseKeyGroupsImpl implements LicenseKeyGroups { * @return the response */ public Response createLicenseKeyGroup(LicenseKeyGroupRequestDto request, String vlmId, - String user) { + String versionId, String user) { + + mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId); + + MdcUtil.initMdc(LoggerServiceName.Create_LKG.toString()); LicenseKeyGroupEntity licenseKeyGroupEntity = new MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity() .applyMapping(request, LicenseKeyGroupEntity.class); @@ -93,6 +105,8 @@ public class LicenseKeyGroupsImpl implements LicenseKeyGroups { createdLicenseKeyGroup != null ? new StringWrapperResponse(createdLicenseKeyGroup.getId()) : null; + mdcDataDebugMessage.debugExitMessage("VLM id", vlmId); + return Response.ok(result).build(); } @@ -106,15 +120,22 @@ public class LicenseKeyGroupsImpl implements LicenseKeyGroups { * @return the response */ public Response updateLicenseKeyGroup(LicenseKeyGroupRequestDto request, String vlmId, + String versionId, String licenseKeyGroupId, String user) { + + mdcDataDebugMessage.debugEntryMessage("VLM id, LKG id", vlmId, licenseKeyGroupId); + + MdcUtil.initMdc(LoggerServiceName.Update_LKG.toString()); LicenseKeyGroupEntity licenseKeyGroupEntity = new MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity() .applyMapping(request, LicenseKeyGroupEntity.class); - licenseKeyGroupEntity.setVendorLicenseModelId(vlmId); licenseKeyGroupEntity.setId(licenseKeyGroupId); vendorLicenseManager.updateLicenseKeyGroup(licenseKeyGroupEntity, user); + + mdcDataDebugMessage.debugExitMessage("VLM id, LKG id", vlmId, licenseKeyGroupId); + return Response.ok().build(); } @@ -122,22 +143,29 @@ public class LicenseKeyGroupsImpl implements LicenseKeyGroups { * Gets license key group. * * @param vlmId the vlm id - * @param version the version + * @param versionId the version * @param licenseKeyGroupId the license key group id * @param user the user * @return the license key group */ - public Response getLicenseKeyGroup(String vlmId, String version, String licenseKeyGroupId, + public Response getLicenseKeyGroup(String vlmId, String versionId, String licenseKeyGroupId, String user) { + + mdcDataDebugMessage.debugEntryMessage("VLM id, LKG id", vlmId, licenseKeyGroupId); + + MdcUtil.initMdc(LoggerServiceName.Get_LKG.toString()); LicenseKeyGroupEntity lkgInput = new LicenseKeyGroupEntity(); lkgInput.setVendorLicenseModelId(vlmId); - lkgInput.setVersion(Version.valueOf(version)); + lkgInput.setVersion(Version.valueOf(versionId)); lkgInput.setId(licenseKeyGroupId); LicenseKeyGroupEntity licenseKeyGroup = vendorLicenseManager.getLicenseKeyGroup(lkgInput, user); LicenseKeyGroupEntityDto licenseKeyGroupEntityDto = licenseKeyGroup == null ? null : new MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto() .applyMapping(licenseKeyGroup, LicenseKeyGroupEntityDto.class); + + mdcDataDebugMessage.debugExitMessage("VLM id, LKG id", vlmId, licenseKeyGroupId); + return Response.ok(licenseKeyGroupEntityDto).build(); } @@ -149,11 +177,19 @@ public class LicenseKeyGroupsImpl implements LicenseKeyGroups { * @param user the user * @return the response */ - public Response deleteLicenseKeyGroup(String vlmId, String licenseKeyGroupId, String user) { + public Response deleteLicenseKeyGroup(String vlmId, String versionId, String licenseKeyGroupId, + String user) { + + mdcDataDebugMessage.debugEntryMessage("VLM id, LKG id", vlmId, licenseKeyGroupId); + + MdcUtil.initMdc(LoggerServiceName.Delete_LKG.toString()); LicenseKeyGroupEntity lkgInput = new LicenseKeyGroupEntity(); lkgInput.setVendorLicenseModelId(vlmId); lkgInput.setId(licenseKeyGroupId); vendorLicenseManager.deleteLicenseKeyGroup(lkgInput, user); + + mdcDataDebugMessage.debugExitMessage("VLM id, LKG id", vlmId, licenseKeyGroupId); + return Response.ok().build(); } } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/VendorLicenseModelsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/VendorLicenseModelsImpl.java index c63da86e7a..9e72170e04 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/VendorLicenseModelsImpl.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/VendorLicenseModelsImpl.java @@ -20,6 +20,13 @@ package org.openecomp.sdcrests.vendorlicense.rest.services; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; +import org.openecomp.sdc.logging.context.MdcUtil; +import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage; +import org.openecomp.sdc.logging.messages.AuditMessages; +import org.openecomp.sdc.logging.types.LoggerConstants; +import org.openecomp.sdc.logging.types.LoggerServiceName; import org.openecomp.sdc.vendorlicense.VendorLicenseManager; import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity; import org.openecomp.sdc.vendorlicense.types.VersionedVendorLicenseModel; @@ -32,16 +39,15 @@ import org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelEntityDto; import org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelRequestDto; import org.openecomp.sdcrests.wrappers.GenericCollectionWrapper; import org.openecomp.sdcrests.wrappers.StringWrapperResponse; +import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; -import java.util.Collection; import javax.inject.Named; import javax.ws.rs.core.Response; - - +import java.util.Collection; @Named @Service("vendorLicenseModels") @@ -49,27 +55,42 @@ import javax.ws.rs.core.Response; @Validated public class VendorLicenseModelsImpl implements VendorLicenseModels { + private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); @Autowired private VendorLicenseManager vendorLicenseManager; + private static final Logger logger = + LoggerFactory.getLogger(VendorLicenseModelsImpl.class); + + @Override + public Response listLicenseModels(String versionFilter, String user) { + + mdcDataDebugMessage.debugEntryMessage(null, null); + MdcUtil.initMdc(LoggerServiceName.List_VLM.toString()); + Collection<VersionedVendorLicenseModel> versionedVendorLicenseModels = + vendorLicenseManager.listVendorLicenseModels(versionFilter, user); + + GenericCollectionWrapper<VendorLicenseModelEntityDto> results = + new GenericCollectionWrapper<>(); + MapVersionedVendorLicenseModelToVendorLicenseModelEntityDto outputMapper = + new MapVersionedVendorLicenseModelToVendorLicenseModelEntityDto(); + for (VersionedVendorLicenseModel versionedVlm : versionedVendorLicenseModels) { + results.add(outputMapper.applyMapping(versionedVlm, VendorLicenseModelEntityDto.class)); + } + + mdcDataDebugMessage.debugExitMessage(null, null); - @Override - public Response listLicenseModels(String versionFilter, String user) { - Collection<VersionedVendorLicenseModel> versionedVendorLicenseModels = - vendorLicenseManager.listVendorLicenseModels(versionFilter, user); - - GenericCollectionWrapper<VendorLicenseModelEntityDto> results = - new GenericCollectionWrapper<>(); - MapVersionedVendorLicenseModelToVendorLicenseModelEntityDto outputMapper = - new MapVersionedVendorLicenseModelToVendorLicenseModelEntityDto(); - for (VersionedVendorLicenseModel versionedVlm : versionedVendorLicenseModels) { - results.add(outputMapper.applyMapping(versionedVlm, VendorLicenseModelEntityDto.class)); + return Response.ok(results).build(); } - return Response.ok(results).build(); - } + @Override + public Response createLicenseModel(VendorLicenseModelRequestDto request, String user) { - @Override - public Response createLicenseModel(VendorLicenseModelRequestDto request, String user) { + mdcDataDebugMessage.debugEntryMessage(null, null); + + logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.CREATE_VLM + + request.getVendorName()); + + MdcUtil.initMdc(LoggerServiceName.Create_VLM.toString()); VendorLicenseModelEntity vendorLicenseModelEntity = new MapVendorLicenseModelRequestDtoToVendorLicenseModelEntity() .applyMapping(request, VendorLicenseModelEntity.class); @@ -78,58 +99,95 @@ public class VendorLicenseModelsImpl implements VendorLicenseModels { StringWrapperResponse result = createdVendorLicenseModel != null ? new StringWrapperResponse( createdVendorLicenseModel.getId()) : null; - return Response.ok(result).build(); - } + mdcDataDebugMessage.debugExitMessage(null, null); - @Override - public Response updateLicenseModel(VendorLicenseModelRequestDto request, String vlmId, - String user) { - VendorLicenseModelEntity vendorLicenseModelEntity = - new MapVendorLicenseModelRequestDtoToVendorLicenseModelEntity() - .applyMapping(request, VendorLicenseModelEntity.class); - vendorLicenseModelEntity.setId(vlmId); + return Response.ok(result).build(); + } - vendorLicenseManager.updateVendorLicenseModel(vendorLicenseModelEntity, user); - return Response.ok().build(); - } + @Override + public Response updateLicenseModel(VendorLicenseModelRequestDto request, String vlmId, + String versionId, String user) { - @Override - public Response getLicenseModel(String vlmId, String version, String user) { - VersionedVendorLicenseModel versionedVlm = - vendorLicenseManager.getVendorLicenseModel(vlmId, Version.valueOf(version), user); + mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId); - VendorLicenseModelEntityDto vlmDto = versionedVlm == null ? null : - new MapVersionedVendorLicenseModelToVendorLicenseModelEntityDto() - .applyMapping(versionedVlm, VendorLicenseModelEntityDto.class); - return Response.ok(vlmDto).build(); - } + MdcUtil.initMdc(LoggerServiceName.Update_VLM.toString()); + VendorLicenseModelEntity vendorLicenseModelEntity = + new MapVendorLicenseModelRequestDtoToVendorLicenseModelEntity() + .applyMapping(request, VendorLicenseModelEntity.class); + vendorLicenseModelEntity.setId(vlmId); - @Override - public Response deleteLicenseModel(String vlmId, String user) { - vendorLicenseManager.deleteVendorLicenseModel(vlmId, user); - return Response.ok().build(); - } + vendorLicenseManager.updateVendorLicenseModel(vendorLicenseModelEntity, user); - @Override - public Response actOnLicenseModel(VendorLicenseModelActionRequestDto request, String vlmId, - String user) { + mdcDataDebugMessage.debugExitMessage("VLM id", vlmId); + + return Response.ok().build(); + } + + @Override + public Response getLicenseModel(String vlmId, String versionId, String user) { + + mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId); + + MdcUtil.initMdc(LoggerServiceName.Get_VLM.toString()); + VersionedVendorLicenseModel versionedVlm = + vendorLicenseManager.getVendorLicenseModel(vlmId, Version.valueOf(versionId), user); + + VendorLicenseModelEntityDto vlmDto = versionedVlm == null ? null : + new MapVersionedVendorLicenseModelToVendorLicenseModelEntityDto() + .applyMapping(versionedVlm, VendorLicenseModelEntityDto.class); + + mdcDataDebugMessage.debugExitMessage("VLM id", vlmId); + + return Response.ok(vlmDto).build(); + } + + @Override + public Response deleteLicenseModel(String vlmId, String versionId, String user) { + + mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId); + + MdcUtil.initMdc(LoggerServiceName.Delete_VLM.toString()); + vendorLicenseManager.deleteVendorLicenseModel(vlmId, user); + + mdcDataDebugMessage.debugExitMessage("VLM id", vlmId); + + return Response.ok().build(); + } + + @Override + public Response actOnLicenseModel(VendorLicenseModelActionRequestDto request, String vlmId, + String versionId, String user) { switch (request.getAction()) { case Checkout: + MDC.put(LoggerConstants.SERVICE_NAME, + LoggerServiceName.Checkout_VLM.toString()); + logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.CHECK_OUT_VLM + + vlmId); vendorLicenseManager.checkout(vlmId, user); break; case Undo_Checkout: + MDC.put(LoggerConstants.SERVICE_NAME, + LoggerServiceName.Undo_Checkout_VLM.toString()); vendorLicenseManager.undoCheckout(vlmId, user); break; case Checkin: + MDC.put(LoggerConstants.SERVICE_NAME, + LoggerServiceName.Checkin_VLM.toString()); + logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.CHECK_IN_VLM + + vlmId); vendorLicenseManager.checkin(vlmId, user); break; case Submit: + MDC.put(LoggerConstants.SERVICE_NAME, + LoggerServiceName.Submit_VLM.toString()); + logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.SUBMIT_VLM + + vlmId); vendorLicenseManager.submit(vlmId, user); break; default: } - return Response.ok().build(); - } + return Response.ok().build(); + } } |