diff options
author | Avi Ziv <avi.ziv@amdocs.com> | 2017-07-18 19:45:38 +0300 |
---|---|---|
committer | Avi Ziv <avi.ziv@amdocs.com> | 2017-07-18 19:45:38 +0300 |
commit | b8e2faf476202b6ffe61bc3a9a37df1304881d40 (patch) | |
tree | f78b8c0517d8e16c5ae610bf8b49f68ea8a312a1 /openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest | |
parent | 75aacbbe1acf78fa53378f07f0a8c7769449a17e (diff) |
[SDC] Onboarding 1710 rebase.
Change-Id: If3b6b81d221fde13908f1e8160db6f7d9433c535
Signed-off-by: Avi Ziv <avi.ziv@amdocs.com>
Diffstat (limited to 'openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest')
21 files changed, 1106 insertions, 14 deletions
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/pom.xml.versionsBackup b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/pom.xml.versionsBackup new file mode 100644 index 0000000000..ae9c3063bc --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/pom.xml.versionsBackup @@ -0,0 +1,23 @@ +<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> + + <groupId>org.openecomp.sdc.onboarding</groupId> + <artifactId>vendor-license-rest</artifactId> + <name>vendor-license-rest</name> + <version>1.0-SNAPSHOT</version> + <packaging>pom</packaging> + + <parent> + <groupId>org.openecomp.sdc</groupId> + <artifactId>openecomp-sdc-rest-webapp</artifactId> + <version>1.0-SNAPSHOT</version> + <relativePath>../</relativePath> + </parent> + + <modules> + <module>/vendor-license-rest-services</module> + <module>/vendor-license-rest-types</module> + </modules> + +</project>
\ No newline at end of file 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/EntitlementPoolLimits.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/EntitlementPoolLimits.java new file mode 100644 index 0000000000..3e7adc845d --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/EntitlementPoolLimits.java @@ -0,0 +1,103 @@ +package org.openecomp.sdcrests.vendorlicense.rest; + +import static org.openecomp.sdcrests.common.RestConstants.USER_ID_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.sdcrests.vendorlicense.types.LimitEntityDto; +import org.openecomp.sdcrests.vendorlicense.types.LimitRequestDto; +import org.springframework.validation.annotation.Validated; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.POST; +import javax.ws.rs.GET; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + +@Path("/v1.0/vendor-license-models/{vlmId}/versions/{versionId}/entitlement-pools" + + "/{entitlementPoolId}/limits") +@Produces(MediaType.APPLICATION_JSON) +@Consumes(MediaType.APPLICATION_JSON) +@Api(value = "Vendor License Model - Entitlement Pool Limits") +@Validated +public interface EntitlementPoolLimits { + + @POST + @Path("/") + @ApiOperation(value = "Create vendor entitlement pool limits") + Response createLimit(@Valid LimitRequestDto request, + @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") + String vlmId, + @ApiParam(value = "Vendor license model version Id") @PathParam + ("versionId") + String versionId, + @ApiParam(value = "Vendor license model Entitlement Pool Id") + @PathParam("entitlementPoolId") + String entitlementPoolId , + @NotNull(message = USER_MISSING_ERROR_MSG) + @HeaderParam(USER_ID_HEADER_PARAM) String user); + + + @GET + @Path("/") + @ApiOperation(value = "List vendor entitlement pool limits", + response = LimitRequestDto.class, + responseContainer = "List") + Response listLimits( + @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId, + @ApiParam(value = "Vendor license model version Id") @PathParam("versionId") String versionId, + @ApiParam(value = "Vendor license model Entitlement Pool Id") @PathParam("entitlementPoolId") + String entitlementPoolId, + @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user); + + @PUT + @Path("/{limitId}") + @ApiOperation(value = "Update vendor entitlement pool limit") + Response updateLimit(@Valid LimitRequestDto request, + @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") + String vlmId, + @ApiParam(value = "Vendor license model version Id") @PathParam + ("versionId") + String versionId, + @ApiParam(value = "Vendor license model Entitlement Pool Id") + @PathParam("entitlementPoolId") + String entitlementPoolId , + @NotNull(message = USER_MISSING_ERROR_MSG) + @PathParam("limitId") String limitId, + @HeaderParam(USER_ID_HEADER_PARAM) String user); + + @GET + @Path("/{limitId}") + @ApiOperation(value = "Get vendor entitlement pool limit", + response = LimitEntityDto.class) + Response getLimit( + @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId, + @ApiParam(value = "Vendor license model version Id") @PathParam("versionId") String versionId, + @ApiParam(value = "Vendor license model Entitlement Pool Id") @PathParam + ("entitlementPoolId") String entitlementPoolId, + @ApiParam(value = "Vendor license model Entitlement Pool Limit Id") @PathParam("limitId") + String limitId, + @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user); + + @DELETE + @Path("/{limitId}") + @ApiOperation(value = "Delete vendor entitlement pool limit") + Response deleteLimit( + @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId, + @ApiParam(value = "Vendor license model version Id") @PathParam("versionId") String versionId, + @ApiParam(value = "Vendor license model Entitlement pool Id") @PathParam("entitlementPoolId") String entitlementPoolId, + @PathParam("limitId") String limitId, + @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/LicenseKeyGroupLimits.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/LicenseKeyGroupLimits.java new file mode 100644 index 0000000000..bfb2d51af0 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/LicenseKeyGroupLimits.java @@ -0,0 +1,101 @@ +package org.openecomp.sdcrests.vendorlicense.rest; + +import static org.openecomp.sdcrests.common.RestConstants.USER_ID_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.sdcrests.vendorlicense.types.EntitlementPoolEntityDto; +import org.openecomp.sdcrests.vendorlicense.types.LimitEntityDto; +import org.openecomp.sdcrests.vendorlicense.types.LimitRequestDto; +import org.springframework.validation.annotation.Validated; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +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.core.MediaType; +import javax.ws.rs.core.Response; + +@Path("/v1.0/vendor-license-models/{vlmId}/versions/{versionId}/license-key-groups" + + "/{licenseKeyGroupId}/limits") +@Produces(MediaType.APPLICATION_JSON) +@Consumes(MediaType.APPLICATION_JSON) +@Api(value = "Vendor License Model - License Key Group Limits") +@Validated +public interface LicenseKeyGroupLimits { + + @POST + @Path("/") + @ApiOperation(value = "Create vendor license key group limit") + Response createLimit(@Valid LimitRequestDto request, + @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") + String vlmId, + @ApiParam(value = "Vendor license model version Id") @PathParam + ("versionId") + String versionId, + @ApiParam(value = "Vendor license model License Key Group Id") + @PathParam("licenseKeyGroupId") + String licenseKeyGroupId , + @NotNull(message = USER_MISSING_ERROR_MSG) + @HeaderParam(USER_ID_HEADER_PARAM) String user); + + @GET + @Path("/") + @ApiOperation(value = "List vendor license key group limits", + response = LimitEntityDto.class, + responseContainer = "List") + Response listLimits( + @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId, + @ApiParam(value = "Vendor license model version Id") @PathParam("versionId") String versionId, + @ApiParam(value = "Vendor license model License Key Group Id") @PathParam("licenseKeyGroupId") + String licenseKeyGroupId, + @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user); + + @PUT + @Path("/{limitId}") + @ApiOperation(value = "Update vendor license key group limit") + Response updateLimit(@Valid LimitRequestDto request, + @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") + String vlmId, + @ApiParam(value = "Vendor license model version Id") @PathParam + ("versionId") + String versionId, + @ApiParam(value = "Vendor license model License Key Group Id") + @PathParam("licenseKeyGroupId") + String licenseKeyGroupId , + @NotNull(message = USER_MISSING_ERROR_MSG) + @PathParam("limitId") String limitId, + @HeaderParam(USER_ID_HEADER_PARAM) String user); + + @GET + @Path("/{limitId}") + @ApiOperation(value = "Get vendor entitlement pool limit", + response = LimitEntityDto.class) + Response getLimit( + @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId, + @ApiParam(value = "Vendor license model version Id") @PathParam("versionId") String versionId, + @ApiParam(value = "Vendor license model License Key Group") @PathParam + ("licenseKeyGroupId") String entitlementPoolId, + @ApiParam(value = "Vendor license model License Key Group Limit Id") @PathParam("limitId") + String limitId, + @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user); + + @DELETE + @Path("/{limitId}") + @ApiOperation(value = "Delete vendor license key group limit") + Response deleteLimit( + @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId, + @ApiParam(value = "Vendor license model version Id") @PathParam("versionId") String versionId, + @ApiParam(value = "Vendor license model license key group Id") @PathParam("licenseKeyGroupId") String licenseKeyGroupId, + @PathParam("limitId") String limitId, + @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/mapping/LimitCreationDto.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/LimitCreationDto.java new file mode 100644 index 0000000000..da7852da2c --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/LimitCreationDto.java @@ -0,0 +1,13 @@ +package org.openecomp.sdcrests.vendorlicense.rest.mapping; + +public class LimitCreationDto { + private String limitId; + + public String getLimitId() { + return limitId; + } + + public void setLimitId(String limitId) { + this.limitId = limitId; + } +} 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/MapEntitlementPoolEntityToEntitlementPoolEntityDto.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/MapEntitlementPoolEntityToEntitlementPoolEntityDto.java index c9f4ab894b..d35c06c30d 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/MapEntitlementPoolEntityToEntitlementPoolEntityDto.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/MapEntitlementPoolEntityToEntitlementPoolEntityDto.java @@ -47,7 +47,9 @@ public class MapEntitlementPoolEntityToEntitlementPoolEntityDto .applyMapping(source.getOperationalScope(), MultiChoiceOrOtherDto.class)); target.setTime(choiceOrOtherMapper.applyMapping(source.getTime(), ChoiceOrOtherDto.class)); target.setManufacturerReferenceNumber(source.getManufacturerReferenceNumber()); - target.setReferencingFeatureGroups(source.getReferencingFeatureGroups()); + + target.setStartDate(source.getStartDate()); + target.setExpiryDate(source.getExpiryDate()); } } 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/MapEntitlementPoolRequestDtoToEntitlementPoolEntity.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/MapEntitlementPoolRequestDtoToEntitlementPoolEntity.java index fe626e374c..5442e1af61 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/MapEntitlementPoolRequestDtoToEntitlementPoolEntity.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/MapEntitlementPoolRequestDtoToEntitlementPoolEntity.java @@ -45,7 +45,8 @@ public class MapEntitlementPoolRequestDtoToEntitlementPoolEntity target.setOperationalScope(new MapMultiChoiceOrOtherDtoToMultiChoiceOrOther() .applyMapping(source.getOperationalScope(), MultiChoiceOrOther.class)); target.setTime(choiceOrOtherMapper.applyMapping(source.getTime(), ChoiceOrOther.class)); - target.setManufacturerReferenceNumber(source.getManufacturerReferenceNumber()); + target.setStartDate(source.getStartDate()); + target.setExpiryDate(source.getExpiryDate()); } } 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 9875a332bd..dedc2a01f0 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 @@ -31,5 +31,6 @@ public class MapFeatureGroupDescriptorDtoToFeatureGroupEntity target.setName(source.getName()); target.setDescription(source.getDescription()); target.setPartNumber(source.getPartNumber()); + target.setManufacturerReferenceNumber(source.getManufacturerReferenceNumber()); } -} +}
\ 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/mapping/MapFeatureGroupEntityToFeatureGroupDescriptorDto.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/MapFeatureGroupEntityToFeatureGroupDescriptorDto.java index 70f5666bcb..ce69384f41 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/MapFeatureGroupEntityToFeatureGroupDescriptorDto.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/MapFeatureGroupEntityToFeatureGroupDescriptorDto.java @@ -31,5 +31,6 @@ public class MapFeatureGroupEntityToFeatureGroupDescriptorDto target.setName(source.getName()); target.setDescription(source.getDescription()); target.setPartNumber(source.getPartNumber()); + target.setManufacturerReferenceNumber(source.getManufacturerReferenceNumber()); } } 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/MapLimitEntityToLimitCreationDto.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/MapLimitEntityToLimitCreationDto.java new file mode 100644 index 0000000000..6883f3e48c --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLimitEntityToLimitCreationDto.java @@ -0,0 +1,12 @@ +package org.openecomp.sdcrests.vendorlicense.rest.mapping; + +import org.openecomp.sdc.vendorlicense.dao.types.LimitEntity; +import org.openecomp.sdcrests.mapping.MappingBase; + +public class MapLimitEntityToLimitCreationDto extends + MappingBase<LimitEntity, LimitCreationDto> { + @Override + public void doMapping(LimitEntity source, LimitCreationDto target) { + target.setLimitId(source.getId()); + } +} 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/MapLimitEntityToLimitDto.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/MapLimitEntityToLimitDto.java new file mode 100644 index 0000000000..9678f927b0 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLimitEntityToLimitDto.java @@ -0,0 +1,23 @@ +package org.openecomp.sdcrests.vendorlicense.rest.mapping; + +import org.openecomp.sdc.vendorlicense.dao.types.LimitEntity; +import org.openecomp.sdcrests.mapping.MappingBase; +import org.openecomp.sdcrests.vendorlicense.types.LimitEntityDto; +import org.openecomp.sdcrests.vendorlicense.types.LimitRequestDto; + +public class MapLimitEntityToLimitDto extends MappingBase<LimitEntity, LimitEntityDto> { + + @Override + public void doMapping(LimitEntity source, LimitEntityDto target) { + target.setId(source.getId()); + target.setName(source.getName()); + target.setDescription(source.getDescription()); + target.setMetric(source.getMetric() != null ? source.getMetric().name() : null); + target.setAggregationFunction(source.getAggregationFunction() != null ? source + .getAggregationFunction().name() : null); + target.setTime(source.getTime() != null ? source.getTime().name() : null); + target.setType(source.getType() != null ? source.getType().name() : null); + target.setUnit(source.getUnit()); + target.setValue(source.getValue()); + } +} 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/MapLimitRequestDtoToLimitEntity.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/MapLimitRequestDtoToLimitEntity.java new file mode 100644 index 0000000000..7f48ece1cf --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLimitRequestDtoToLimitEntity.java @@ -0,0 +1,75 @@ +package org.openecomp.sdcrests.vendorlicense.rest.mapping; + +import org.openecomp.sdc.common.errors.CoreException; +import org.openecomp.sdc.common.errors.ErrorCode; +import org.openecomp.sdc.datatypes.error.ErrorLevel; +import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage; +import org.openecomp.sdc.logging.types.LoggerConstants; +import org.openecomp.sdc.logging.types.LoggerServiceName; +import org.openecomp.sdc.logging.types.LoggerTragetServiceName; +import org.openecomp.sdc.vendorlicense.dao.types.AggregationFunction; +import org.openecomp.sdc.vendorlicense.dao.types.EntitlementMetric; +import org.openecomp.sdc.vendorlicense.dao.types.EntitlementTime; +import org.openecomp.sdc.vendorlicense.dao.types.LimitEntity; +import org.openecomp.sdc.vendorlicense.errors.LimitErrorBuilder; +import org.openecomp.sdc.vendorlicense.errors.VendorLicenseErrorCodes; +import org.openecomp.sdc.vendorsoftwareproduct.errors.ImageErrorBuilder; +import org.openecomp.sdcrests.mapping.MappingBase; +import org.openecomp.sdcrests.vendorlicense.types.LimitRequestDto; +import org.openecomp.sdc.vendorlicense.dao.types.LimitType; + + +public class MapLimitRequestDtoToLimitEntity extends MappingBase<LimitRequestDto, LimitEntity> { + @Override + public void doMapping(LimitRequestDto source, LimitEntity target) { + target.setName(source.getName()); + target.setDescription(source.getDescription()); + try { + LimitType type = LimitType.valueOf(source.getType()); + target.setType(type); + } + catch (IllegalArgumentException exception) { + throwInvalidValueError("type", VendorLicenseErrorCodes.LIMIT_INVALID_TYPE); + } + + try { + EntitlementMetric metric = EntitlementMetric.valueOf(source.getMetric()); + target.setMetric(metric); + } + catch (IllegalArgumentException exception) { + throwInvalidValueError("metric", VendorLicenseErrorCodes.LIMIT_INVALID_METRIC); + } + + try { + AggregationFunction function = source.getAggregationFunction() != null ? + AggregationFunction.valueOf(source.getAggregationFunction()) : null; + target.setAggregationFunction(function); + } + catch (IllegalArgumentException exception) { + throwInvalidValueError("aggregationFunction", + VendorLicenseErrorCodes.LIMIT_INVALID_AGGREGATIONFUNCTION); + } + + try { + EntitlementTime time = source.getTime() != null ? + EntitlementTime.valueOf(source.getTime()) : null; + target.setTime(time); + } + catch (IllegalArgumentException exception) { + throwInvalidValueError("time", VendorLicenseErrorCodes.LIMIT_INVALID_TIME); + } + + target.setValue(source.getValue()); + target.setUnit(source.getUnit()); + + } + + private void throwInvalidValueError(String attribute, String vendorLicenseErrorCode) { + ErrorCode errorCode = LimitErrorBuilder.getInvalidValueErrorBuilder(attribute, + vendorLicenseErrorCode); + MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, + LoggerServiceName.Create_LIMIT.toString(), ErrorLevel.ERROR.name(), + errorCode.id(), errorCode.message() ); + throw new CoreException(errorCode); + } +} 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/EntitlementPoolLimitsImpl.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/EntitlementPoolLimitsImpl.java new file mode 100644 index 0000000000..3a08822048 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/EntitlementPoolLimitsImpl.java @@ -0,0 +1,178 @@ +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.vendorlicense.dao.types.LimitEntity; +import org.openecomp.sdc.versioning.dao.types.Version; +import org.openecomp.sdcrests.vendorlicense.rest.EntitlementPoolLimits; +import org.openecomp.sdcrests.vendorlicense.rest.mapping.LimitCreationDto; +import org.openecomp.sdcrests.vendorlicense.rest.mapping.MapLimitEntityToLimitCreationDto; +import org.openecomp.sdcrests.vendorlicense.rest.mapping.MapLimitEntityToLimitDto; +import org.openecomp.sdcrests.vendorlicense.rest.mapping.MapLimitRequestDtoToLimitEntity; +import org.openecomp.sdcrests.vendorlicense.types.LimitEntityDto; +import org.openecomp.sdcrests.vendorlicense.types.LimitRequestDto; +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; + +@Named +@Service("entitlementPoolLimits") +@Scope(value = "prototype") +public class EntitlementPoolLimitsImpl implements EntitlementPoolLimits { + private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); + @Autowired + private VendorLicenseManager vendorLicenseManager; + + @Override + public Response createLimit(LimitRequestDto request, + String vlmId, + String versionId, + String entitlementPoolId, + String user) { + mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId, "EP id", entitlementPoolId); + + MdcUtil.initMdc(LoggerServiceName.Create_LIMIT.toString()); + vendorLicenseManager.getEntitlementPool(new EntitlementPoolEntity(vlmId, Version.valueOf + (versionId), entitlementPoolId), user); + + LimitEntity limitEntity = + new MapLimitRequestDtoToLimitEntity() + .applyMapping(request, LimitEntity.class); + limitEntity.setEpLkgId(entitlementPoolId); + limitEntity.setVendorLicenseModelId(vlmId); + + LimitEntity createdLimit = vendorLicenseManager.createLimit(limitEntity, user); + MapLimitEntityToLimitCreationDto mapper = new MapLimitEntityToLimitCreationDto(); + LimitCreationDto createdLimitDto = mapper.applyMapping(createdLimit, LimitCreationDto + .class); + + /*StringWrapperResponse result = + createdLimit != null ? new StringWrapperResponse(createdLimit.getId()) + : null;*/ + + mdcDataDebugMessage.debugExitMessage("VLM id", vlmId, "EP id", entitlementPoolId); + + //return Response.ok(result).build(); + return Response.ok(createdLimitDto != null ? createdLimitDto : null) + .build(); + } + + @Override + public Response listLimits(String vlmId, String versionId, String entitlementPoolId, String + user) { + mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId, "EP id", entitlementPoolId); + + MdcUtil.initMdc(LoggerServiceName.List_EP.toString()); + vendorLicenseManager.getEntitlementPool(new EntitlementPoolEntity(vlmId, Version.valueOf + (versionId), entitlementPoolId), user); + + Collection<LimitEntity> limits = + vendorLicenseManager.listLimits(vlmId, Version.valueOf(versionId), entitlementPoolId, user); + + GenericCollectionWrapper<LimitEntityDto> result = new GenericCollectionWrapper<>(); + MapLimitEntityToLimitDto outputMapper = + new MapLimitEntityToLimitDto(); + for (LimitEntity limit : limits) { + result.add(outputMapper.applyMapping(limit, LimitEntityDto.class)); + } + + mdcDataDebugMessage.debugExitMessage("VLM id", vlmId, "EP id", entitlementPoolId); + + return Response.ok(result).build(); + } + + @Override + public Response getLimit( String vlmId, String versionId, String entitlementPoolId, + String limitId, String user) { + mdcDataDebugMessage.debugEntryMessage("VLM id, EP id, Limit Id", vlmId, entitlementPoolId, + limitId); + + MdcUtil.initMdc(LoggerServiceName.Get_LIMIT.toString()); + + vendorLicenseManager.getEntitlementPool(new EntitlementPoolEntity(vlmId, Version.valueOf + (versionId), entitlementPoolId), user); + LimitEntity epInput = new LimitEntity(); + epInput.setVendorLicenseModelId(vlmId); + epInput.setVersion(Version.valueOf(versionId)); + epInput.setEpLkgId(entitlementPoolId); + epInput.setId(limitId); + LimitEntity limit = vendorLicenseManager.getLimit(epInput, user); + + LimitEntityDto entitlementPoolEntityDto = limit == null ? null : + new MapLimitEntityToLimitDto() + .applyMapping(limit, LimitEntityDto.class); + + mdcDataDebugMessage.debugExitMessage("VLM id, EP id, Limit Id", vlmId, entitlementPoolId, + limitId); + + return Response.ok(entitlementPoolEntityDto).build(); + } + + @Override + public Response updateLimit(LimitRequestDto request, + String vlmId, + String versionId, + String entitlementPoolId, + String limitId, + String user) { + mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId, "EP id", entitlementPoolId, "limit Id", + limitId); + + MdcUtil.initMdc(LoggerServiceName.Update_LIMIT.toString()); + + vendorLicenseManager.getEntitlementPool(new EntitlementPoolEntity(vlmId, Version.valueOf + (versionId), entitlementPoolId), user); + + LimitEntity limitEntity = + new MapLimitRequestDtoToLimitEntity() + .applyMapping(request, LimitEntity.class); + limitEntity.setEpLkgId(entitlementPoolId); + limitEntity.setVendorLicenseModelId(vlmId); + limitEntity.setId(limitId); + + vendorLicenseManager.updateLimit(limitEntity, user); + + mdcDataDebugMessage.debugExitMessage("VLM id", vlmId, "EP id", entitlementPoolId, "limit Id", + limitId); + + return Response.ok().build(); + } + + /** + * Delete entitlement pool. + * + * @param vlmId the vlm id + * @param entitlementPoolId the entitlement pool id + * @param limitId the limitId + * @param user the user + * @return the response + */ + public Response deleteLimit(String vlmId, String versionId, String entitlementPoolId, + String limitId, String user) { + mdcDataDebugMessage.debugEntryMessage("VLM id, Verison Id, EP id, Limit Id", vlmId, versionId, entitlementPoolId, limitId); + + MdcUtil.initMdc(LoggerServiceName.Delete_LIMIT.toString()); + vendorLicenseManager.getEntitlementPool(new EntitlementPoolEntity(vlmId, Version.valueOf + (versionId), entitlementPoolId), user); + + LimitEntity limitInput = new LimitEntity(); + limitInput.setVendorLicenseModelId(vlmId); + limitInput.setEpLkgId(entitlementPoolId); + limitInput.setId(limitId); + vendorLicenseManager.deleteLimit(limitInput, user); + + mdcDataDebugMessage.debugExitMessage("VLM id, Verison Id, EP id, Limit Id", vlmId, versionId, entitlementPoolId, limitId); + + 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/LicenseKeyGroupLimitsImpl.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/LicenseKeyGroupLimitsImpl.java new file mode 100644 index 0000000000..aabba71a5c --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseKeyGroupLimitsImpl.java @@ -0,0 +1,179 @@ +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.vendorlicense.dao.types.LimitEntity; +import org.openecomp.sdc.versioning.dao.types.Version; +import org.openecomp.sdcrests.vendorlicense.rest.LicenseKeyGroupLimits; +import org.openecomp.sdcrests.vendorlicense.rest.mapping.LimitCreationDto; +import org.openecomp.sdcrests.vendorlicense.rest.mapping.MapLimitEntityToLimitCreationDto; +import org.openecomp.sdcrests.vendorlicense.rest.mapping.MapLimitEntityToLimitDto; +import org.openecomp.sdcrests.vendorlicense.rest.mapping.MapLimitRequestDtoToLimitEntity; +import org.openecomp.sdcrests.vendorlicense.types.LimitEntityDto; +import org.openecomp.sdcrests.vendorlicense.types.LimitRequestDto; +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; + +@Named +@Service("licenseKeyGroupLimits") +@Scope(value = "prototype") +public class LicenseKeyGroupLimitsImpl implements LicenseKeyGroupLimits { + + private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); + @Autowired + private VendorLicenseManager vendorLicenseManager; + + @Override + public Response createLimit(LimitRequestDto request, + String vlmId, + String versionId, + String licenseKeyGroupId, + String user) { + + mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId, "LKG id", licenseKeyGroupId); + + MdcUtil.initMdc(LoggerServiceName.Create_LIMIT.toString()); + vendorLicenseManager.getLicenseKeyGroup(new LicenseKeyGroupEntity(vlmId, Version.valueOf + (versionId), licenseKeyGroupId), user); + + LimitEntity limitEntity = + new MapLimitRequestDtoToLimitEntity() + .applyMapping(request, LimitEntity.class); + limitEntity.setEpLkgId(licenseKeyGroupId); + limitEntity.setVendorLicenseModelId(vlmId); + + LimitEntity createdLimit = vendorLicenseManager.createLimit(limitEntity, user); + MapLimitEntityToLimitCreationDto mapper = new MapLimitEntityToLimitCreationDto(); + LimitCreationDto createdLimitDto = mapper.applyMapping(createdLimit, LimitCreationDto + .class); + /*StringWrapperResponse result = + createdLimit != null ? new StringWrapperResponse(createdLimit.getId()) + : null;*/ + + mdcDataDebugMessage.debugExitMessage("VLM id", vlmId, "LKG id", licenseKeyGroupId); + + //return Response.ok(result).build(); + return Response.ok(createdLimitDto != null ? createdLimitDto : null) + .build(); + } + + @Override + public Response listLimits(String vlmId, String versionId, String licenseKeyGroupId, String + user) { + mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId, "LKG id", licenseKeyGroupId); + + MdcUtil.initMdc(LoggerServiceName.List_EP.toString()); + vendorLicenseManager.getLicenseKeyGroup(new LicenseKeyGroupEntity(vlmId, Version.valueOf + (versionId), licenseKeyGroupId), user); + + Collection<LimitEntity> limits = + vendorLicenseManager.listLimits(vlmId, Version.valueOf(versionId), licenseKeyGroupId, user); + + GenericCollectionWrapper<LimitEntityDto> result = new GenericCollectionWrapper<>(); + MapLimitEntityToLimitDto outputMapper = + new MapLimitEntityToLimitDto(); + for (LimitEntity limit : limits) { + result.add(outputMapper.applyMapping(limit, LimitEntityDto.class)); + } + + mdcDataDebugMessage.debugExitMessage("VLM id", vlmId, "LKG id", licenseKeyGroupId); + + return Response.ok(result).build(); + } + + @Override + public Response updateLimit(LimitRequestDto request, + String vlmId, + String versionId, + String licenseKeyGroupId, + String limitId, + String user) { + mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId, "LKG id", licenseKeyGroupId, "limit Id", + limitId); + + MdcUtil.initMdc(LoggerServiceName.Update_LIMIT.toString()); + + vendorLicenseManager.getLicenseKeyGroup(new LicenseKeyGroupEntity(vlmId, Version.valueOf + (versionId), licenseKeyGroupId), user); + + LimitEntity limitEntity = + new MapLimitRequestDtoToLimitEntity() + .applyMapping(request, LimitEntity.class); + limitEntity.setEpLkgId(licenseKeyGroupId); + limitEntity.setVendorLicenseModelId(vlmId); + limitEntity.setId(limitId); + + vendorLicenseManager.updateLimit(limitEntity, user); + + mdcDataDebugMessage.debugExitMessage("VLM id", vlmId, "LKG id", licenseKeyGroupId, "limit Id", + limitId); + + return Response.ok().build(); + } + + /** + * Delete License Key Group. + * + * @param vlmId the vlm id + * @param licenseKeyGroupId the license Key Group id + * @param limitId the limitId + * @param user the user + * @return the response + */ + public Response deleteLimit(String vlmId, String versionId, String licenseKeyGroupId, + String limitId, String user) { + mdcDataDebugMessage.debugEntryMessage("VLM id, Verison Id, LKG id, Limit Id", vlmId, versionId, + licenseKeyGroupId, limitId); + + MdcUtil.initMdc(LoggerServiceName.Delete_LIMIT.toString()); + vendorLicenseManager.getLicenseKeyGroup(new LicenseKeyGroupEntity(vlmId, Version.valueOf + (versionId), licenseKeyGroupId), user); + + LimitEntity limitInput = new LimitEntity(); + limitInput.setVendorLicenseModelId(vlmId); + limitInput.setEpLkgId(licenseKeyGroupId); + limitInput.setId(limitId); + vendorLicenseManager.deleteLimit(limitInput, user); + + mdcDataDebugMessage.debugExitMessage("VLM id, Verison Id, LKG id, Limit Id", vlmId, versionId, + licenseKeyGroupId, limitId); + + return Response.ok().build(); + } + + @Override + public Response getLimit( String vlmId, String versionId, String licenseKeyGroupId, + String limitId, String user) { + mdcDataDebugMessage.debugEntryMessage("VLM id, LKG id, Limit Id", vlmId, licenseKeyGroupId, + limitId); + + MdcUtil.initMdc(LoggerServiceName.Get_LIMIT.toString()); + vendorLicenseManager.getLicenseKeyGroup(new LicenseKeyGroupEntity(vlmId, Version.valueOf + (versionId), licenseKeyGroupId), user); + LimitEntity epInput = new LimitEntity(); + epInput.setVendorLicenseModelId(vlmId); + epInput.setVersion(Version.valueOf(versionId)); + epInput.setEpLkgId(licenseKeyGroupId); + epInput.setId(limitId); + LimitEntity limit = vendorLicenseManager.getLimit(epInput, user); + + LimitEntityDto entitlementPoolEntityDto = limit == null ? null : + new MapLimitEntityToLimitDto() + .applyMapping(limit, LimitEntityDto.class); + + mdcDataDebugMessage.debugExitMessage("VLM id, LKG id, Limit Id", vlmId, licenseKeyGroupId, + limitId); + + return Response.ok(entitlementPoolEntityDto).build(); + } +} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/pom.xml.versionsBackup b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/pom.xml.versionsBackup new file mode 100644 index 0000000000..d24c315f39 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/pom.xml.versionsBackup @@ -0,0 +1,29 @@ +<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-types</artifactId> + <name>vendor-license-rest-types</name> + <version>1.0-SNAPSHOT</version> + + <parent> + <groupId>org.openecomp.sdc.onboarding</groupId> + <artifactId>vendor-license-rest</artifactId> + <version>1.0-SNAPSHOT</version> + <relativePath>../</relativePath> + </parent> + + <dependencies> + <dependency> + <groupId>org.openecomp.sdc</groupId> + <artifactId>openecomp-sdc-common-rest</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.openecomp.sdc</groupId> + <artifactId>openecomp-sdc-vendor-license-manager</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> + +</project>
\ No newline at end of file diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/EntitlementPoolRequestDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/EntitlementPoolRequestDto.java index b70504e20e..b49a138a09 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/EntitlementPoolRequestDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/EntitlementPoolRequestDto.java @@ -21,6 +21,7 @@ package org.openecomp.sdcrests.vendorlicense.types; import io.swagger.annotations.ApiModel; +import org.codehaus.jackson.annotate.JsonIgnoreProperties; import org.openecomp.sdc.vendorlicense.dao.types.AggregationFunction; import org.openecomp.sdc.vendorlicense.dao.types.EntitlementMetric; import org.openecomp.sdc.vendorlicense.dao.types.EntitlementTime; @@ -32,17 +33,18 @@ import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; @ApiModel(value = "EntitlementPoolRequest") +//@JsonIgnoreProperties(value = {"manufacturerReferenceNumber"}) public class EntitlementPoolRequestDto { @NotNull @Size(max = 120) private String name; - @NotNull + @Size(max = 1000) private String description; - @NotNull - private int thresholdValue; - @NotNull + + private Integer thresholdValue; + private ThresholdUnit thresholdUnits; @NotNull @Valid @@ -52,7 +54,7 @@ public class EntitlementPoolRequestDto { @NotNull @Valid private ChoiceOrOtherDto<AggregationFunction> aggregationFunction; - @NotNull + @Valid private MultiChoiceOrOtherDto<OperationalScope> operationalScope; @NotNull @@ -62,6 +64,9 @@ public class EntitlementPoolRequestDto { @Size(max = 100) private String manufacturerReferenceNumber; + private String startDate; + private String expiryDate; + public String getName() { return name; } @@ -78,11 +83,11 @@ public class EntitlementPoolRequestDto { this.description = description; } - public int getThresholdValue() { + public Integer getThresholdValue() { return thresholdValue; } - public void setThresholdValue(int thresholdValue) { + public void setThresholdValue(Integer thresholdValue) { this.thresholdValue = thresholdValue; } @@ -141,4 +146,20 @@ public class EntitlementPoolRequestDto { public void setManufacturerReferenceNumber(String manufacturerReferenceNumber) { this.manufacturerReferenceNumber = manufacturerReferenceNumber; } + + public String getStartDate() { + return startDate; + } + + public void setStartDate(String startDate) { + this.startDate = startDate; + } + + public String getExpiryDate() { + return expiryDate; + } + + public void setExpiryDate(String expiryDate) { + this.expiryDate = expiryDate; + } } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/FeatureGroupDescriptorDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/FeatureGroupDescriptorDto.java index 5c1f8f2cfc..f2d0d651ef 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/FeatureGroupDescriptorDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/FeatureGroupDescriptorDto.java @@ -20,6 +20,8 @@ package org.openecomp.sdcrests.vendorlicense.types; +import org.hibernate.validator.constraints.NotBlank; + import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; @@ -27,12 +29,16 @@ public class FeatureGroupDescriptorDto { @NotNull @Size(max = 120) private String name; - @NotNull + @Size(max = 1000) private String description; @NotNull private String partNumber; + //@NotBlank(message = "is mandatory and should not be empty") + @Size(max = 100) + private String manufacturerReferenceNumber; + public String getName() { return name; } @@ -56,4 +62,12 @@ public class FeatureGroupDescriptorDto { public void setPartNumber(String partNumber) { this.partNumber = partNumber; } + + public String getManufacturerReferenceNumber() { + return manufacturerReferenceNumber; + } + + public void setManufacturerReferenceNumber(String manufacturerReferenceNumber) { + this.manufacturerReferenceNumber = manufacturerReferenceNumber; + } } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseAgreementDescriptorDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseAgreementDescriptorDto.java index acfc130ed1..4239488124 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseAgreementDescriptorDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseAgreementDescriptorDto.java @@ -31,7 +31,7 @@ public class LicenseAgreementDescriptorDto { @NotNull @Size(max = 120) private String name; - @NotNull + @Size(max = 1000) private String description; @NotNull diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseKeyGroupRequestDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseKeyGroupRequestDto.java index 0df2e3251f..a9072f5e94 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseKeyGroupRequestDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseKeyGroupRequestDto.java @@ -31,12 +31,11 @@ public class LicenseKeyGroupRequestDto { @NotNull @Size(max = 120) private String name; - @NotNull @Size(max = 1000) private String description; @NotNull private LicenseKeyType type; - @NotNull + @Valid private MultiChoiceOrOtherDto<OperationalScope> operationalScope; diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LimitEntityDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LimitEntityDto.java new file mode 100644 index 0000000000..0cc18949d8 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LimitEntityDto.java @@ -0,0 +1,86 @@ +package org.openecomp.sdcrests.vendorlicense.types; + +public class LimitEntityDto { + + private String id; + private String name; + private String type; + private String description; + private String metric; + private Integer value; + private Integer unit; + private String aggregationFunction; + private String time; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getMetric() { + return metric; + } + + public void setMetric(String metric) { + this.metric = metric; + } + + public Integer getUnit() { + return unit; + } + + public void setUnit(Integer unit) { + this.unit = unit; + } + + public String getAggregationFunction() { + return aggregationFunction; + } + + public void setAggregationFunction(String aggregationFunction) { + this.aggregationFunction = aggregationFunction; + } + + public String getTime() { + return time; + } + + public void setTime(String time) { + this.time = time; + } + + public Integer getValue() { + return value; + } + + public void setValue(Integer value) { + this.value = value; + } +} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LimitRequestDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LimitRequestDto.java new file mode 100644 index 0000000000..61f30916f8 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LimitRequestDto.java @@ -0,0 +1,96 @@ +package org.openecomp.sdcrests.vendorlicense.types; + +import io.swagger.annotations.ApiModel; +import org.hibernate.validator.constraints.NotBlank; +import org.openecomp.sdc.vendorlicense.dao.types.LimitType; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + +@ApiModel(value = "LimitRequest") +public class LimitRequestDto { + + @NotBlank(message = "is mandatory and should not be empty") + @Size(max = 120, message = "length should not exceed 120 characters.") + private String name; + @NotBlank(message = "is mandatory and should not be empty") + private String type; + @Size(max = 1000, message = "length should not exceed 1000 characters.") + private String description; + @NotBlank(message = "is mandatory and should not be empty") + private String metric; + @NotNull(message = "is mandatory and should not be empty") + @Min(value = 1, message = "should be integer and > 0") + private Integer value; + @Min(value = 1, message = "should be integer and > 0") + private Integer unit; + private String aggregationFunction; + private String time; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getMetric() { + return metric; + } + + public void setMetric(String metric) { + this.metric = metric; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getAggregationFunction() { + return aggregationFunction; + } + + public void setAggregationFunction( + String aggregationFunction) { + this.aggregationFunction = aggregationFunction; + } + + public String getTime() { + return time; + } + + public void setTime(String time) { + this.time = time; + } + + public Integer getUnit() { + return unit; + } + + public void setUnit(Integer unit) { + this.unit = unit; + } + + public Integer getValue() { + return value; + } + + public void setValue(Integer value) { + this.value = value; + } + +} |