diff options
author | talig <talig@amdocs.com> | 2017-12-20 14:30:43 +0200 |
---|---|---|
committer | Vitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com> | 2017-12-21 11:12:33 +0000 |
commit | 8e9c0653dd6c6862123c9609ae34e1206d86456e (patch) | |
tree | 5eeef00ec0677133baa439ca8d7ffd7aca4804b6 /openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest | |
parent | 785ebcc95de3e064e843bec04ba7a209d854fc7c (diff) |
Add collaboration feature
Issue-ID: SDC-767
Change-Id: I14fb4c1f54086ed03a56a7ff7fab9ecd40381795
Signed-off-by: talig <talig@amdocs.com>
Diffstat (limited to 'openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest')
20 files changed, 595 insertions, 495 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 643addc0aa..cec09f0e8f 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 @@ -30,13 +30,13 @@ </dependency> <dependency> <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-vendor-license-manager</artifactId> + <artifactId>openecomp-sdc-item-permissions-manager</artifactId> <version>${project.version}</version> </dependency> <!-- Spring --> - <dependency> +<!-- <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>${spring.framework.version}</version> @@ -60,7 +60,7 @@ <groupId>org.springframework</groupId> <artifactId>spring-beans</artifactId> <version>${spring.framework.version}</version> - </dependency> + </dependency>--> <!-- CXF --> <dependency> @@ -79,11 +79,11 @@ <version>${http.client.version}</version> </dependency> - <dependency> +<!-- <dependency> <groupId>javax.ws.rs</groupId> <artifactId>javax.ws.rs-api</artifactId> <version>${ws.rs.version}</version> - </dependency> + </dependency>--> <!-- Other Stuff--> <!--dependency> @@ -105,8 +105,13 @@ <artifactId>openecomp-sdc-vendor-software-product-manager</artifactId> <version>${project.version}</version> </dependency> + <dependency> + <groupId>org.openecomp.sdc</groupId> + <artifactId>item-rest-services</artifactId> + <version>${project.version}</version> + </dependency> - </dependencies> + </dependencies> <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/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 index 3e7adc845d..fb71b0a001 100644 --- 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 @@ -1,12 +1,8 @@ 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; @@ -15,9 +11,9 @@ 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.POST; import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; @@ -25,8 +21,11 @@ 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") +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/{entitlementPoolId}/limits") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @Api(value = "Vendor License Model - Entitlement Pool Limits") @@ -37,16 +36,16 @@ public interface EntitlementPoolLimits { @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); + @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 @@ -72,7 +71,7 @@ public interface EntitlementPoolLimits { String versionId, @ApiParam(value = "Vendor license model Entitlement Pool Id") @PathParam("entitlementPoolId") - String entitlementPoolId , + String entitlementPoolId, @NotNull(message = USER_MISSING_ERROR_MSG) @PathParam("limitId") String limitId, @HeaderParam(USER_ID_HEADER_PARAM) String user); @@ -94,10 +93,11 @@ public interface EntitlementPoolLimits { @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); + @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/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 a3a4e4d0d8..7344459077 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_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; @@ -46,6 +43,9 @@ import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; +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) 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 index bd31dc5607..0033304e5a 100644 --- 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 @@ -1,8 +1,5 @@ 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; @@ -24,8 +21,11 @@ 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") +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/{licenseKeyGroupId}/limits") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @Api(value = "Vendor License Model - License Key Group Limits") @@ -43,7 +43,7 @@ public interface LicenseKeyGroupLimits { String versionId, @ApiParam(value = "Vendor license model License Key Group Id") @PathParam("licenseKeyGroupId") - String licenseKeyGroupId , + String licenseKeyGroupId, @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user); @@ -70,7 +70,7 @@ public interface LicenseKeyGroupLimits { String versionId, @ApiParam(value = "Vendor license model License Key Group Id") @PathParam("licenseKeyGroupId") - String licenseKeyGroupId , + String licenseKeyGroupId, @NotNull(message = USER_MISSING_ERROR_MSG) @PathParam("limitId") String limitId, @HeaderParam(USER_ID_HEADER_PARAM) String user); @@ -88,13 +88,14 @@ public interface LicenseKeyGroupLimits { 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); + @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/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 23a0960a3a..9b1c09603c 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 @@ -24,6 +24,7 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import org.openecomp.sdcrests.common.RestConstants; +import org.openecomp.sdcrests.item.types.ItemDto; import org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelActionRequestDto; import org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelEntityDto; import org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelRequestDto; @@ -31,7 +32,16 @@ import org.springframework.validation.annotation.Validated; import javax.validation.Valid; import javax.validation.constraints.NotNull; -import javax.ws.rs.*; +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.core.MediaType; import javax.ws.rs.core.Response; @@ -45,65 +55,65 @@ import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG @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_ID_HEADER_PARAM) String user); + @GET + @Path("/") + @ApiOperation(value = "List vendor license models", + response = ItemDto.class, + responseContainer = "List") + Response listLicenseModels(@ApiParam(value = + "Currently supported value: 'Certified' - only vendor License models with final versions " + + "will be return - with their latest final version") + @QueryParam("versionFilter") String versionStatus, + @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_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_ID_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); + @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}/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); + @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}/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); + @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}/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); + @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/MapVendorLicenseModelEntityToDto.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/MapVendorLicenseModelEntityToDto.java new file mode 100644 index 0000000000..7bdde1d592 --- /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/MapVendorLicenseModelEntityToDto.java @@ -0,0 +1,36 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdcrests.vendorlicense.rest.mapping; + +import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity; +import org.openecomp.sdcrests.mapping.MappingBase; +import org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelEntityDto; + +public class MapVendorLicenseModelEntityToDto + extends MappingBase<VendorLicenseModelEntity, VendorLicenseModelEntityDto> { + @Override + public void doMapping(VendorLicenseModelEntity source, VendorLicenseModelEntityDto target) { + target.setId(source.getId()); + target.setVendorName(source.getVendorName()); + target.setDescription(source.getDescription()); + target.setIconRef(source.getIconRef()); + } +} 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 deleted file mode 100644 index 7c2db85d2e..0000000000 --- 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 +++ /dev/null @@ -1,64 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.sdcrests.vendorlicense.rest.mapping; - -import org.openecomp.core.utilities.CommonMethods; -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; - -import java.util.stream.Collectors; - -public class MapVersionedVendorLicenseModelToVendorLicenseModelEntityDto - extends MappingBase<VersionedVendorLicenseModel, VendorLicenseModelEntityDto> { - @Override - public void doMapping(VersionedVendorLicenseModel source, VendorLicenseModelEntityDto target) { - VendorLicenseModelEntity sourceVlm = source.getVendorLicenseModel(); - target.setId(sourceVlm.getId()); - target.setVendorName(sourceVlm.getVendorName()); - target.setDescription(sourceVlm.getDescription()); - target.setIconRef(sourceVlm.getIconRef()); - - VersionInfo versionInfo = source.getVersionInfo(); - if (versionInfo != null) { - 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->new - VersionDto(version.toString(),version.toString())) - .collect(Collectors.toList())); - } - - if (!CommonMethods.isEmpty(versionInfo.getFinalVersions())) { - 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/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 index 4365ace85d..a866278cf3 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/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 @@ -17,14 +17,12 @@ import org.openecomp.sdcrests.vendorlicense.rest.mapping.MapLimitRequestDtoToLim 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; +import java.util.Collection; @Named @Service("entitlementPoolLimits") @@ -32,7 +30,7 @@ import javax.ws.rs.core.Response; public class EntitlementPoolLimitsImpl implements EntitlementPoolLimits { private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); private VendorLicenseManager vendorLicenseManager = - VendorLicenseManagerFactory.getInstance().createInterface(); + VendorLicenseManagerFactory.getInstance().createInterface(); public static final String parent = "EntitlementPool"; @@ -45,20 +43,20 @@ public class EntitlementPoolLimitsImpl implements EntitlementPoolLimits { mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId, "EP id", entitlementPoolId); MdcUtil.initMdc(LoggerServiceName.Create_LIMIT.toString()); - vendorLicenseManager.getEntitlementPool(new EntitlementPoolEntity(vlmId, Version.valueOf - (versionId), entitlementPoolId), user); + Version version = new Version(versionId); + vendorLicenseManager + .getEntitlementPool(new EntitlementPoolEntity(vlmId, version, entitlementPoolId)); LimitEntity limitEntity = - new MapLimitRequestDtoToLimitEntity() - .applyMapping(request, LimitEntity.class); - limitEntity.setEpLkgId(entitlementPoolId); + new MapLimitRequestDtoToLimitEntity().applyMapping(request, LimitEntity.class); limitEntity.setVendorLicenseModelId(vlmId); + limitEntity.setVersion(version); + limitEntity.setEpLkgId(entitlementPoolId); limitEntity.setParent(parent); - LimitEntity createdLimit = vendorLicenseManager.createLimit(limitEntity, user); + LimitEntity createdLimit = vendorLicenseManager.createLimit(limitEntity); MapLimitEntityToLimitCreationDto mapper = new MapLimitEntityToLimitCreationDto(); - LimitCreationDto createdLimitDto = mapper.applyMapping(createdLimit, LimitCreationDto - .class); + LimitCreationDto createdLimitDto = mapper.applyMapping(createdLimit, LimitCreationDto.class); /*StringWrapperResponse result = createdLimit != null ? new StringWrapperResponse(createdLimit.getId()) @@ -67,25 +65,25 @@ public class EntitlementPoolLimitsImpl implements EntitlementPoolLimits { mdcDataDebugMessage.debugExitMessage("VLM id", vlmId, "EP id", entitlementPoolId); //return Response.ok(result).build(); - return Response.ok(createdLimitDto != null ? createdLimitDto : null) - .build(); + return Response.ok(createdLimitDto != null ? createdLimitDto : null).build(); } @Override public Response listLimits(String vlmId, String versionId, String entitlementPoolId, String - user) { + 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); + Version version = new Version(versionId); + vendorLicenseManager + .getEntitlementPool(new EntitlementPoolEntity(vlmId, version, entitlementPoolId)); Collection<LimitEntity> limits = - vendorLicenseManager.listLimits(vlmId, Version.valueOf(versionId), entitlementPoolId, user); + vendorLicenseManager.listLimits(vlmId, version, entitlementPoolId); GenericCollectionWrapper<LimitEntityDto> result = new GenericCollectionWrapper<>(); MapLimitEntityToLimitDto outputMapper = - new MapLimitEntityToLimitDto(); + new MapLimitEntityToLimitDto(); for (LimitEntity limit : limits) { result.add(outputMapper.applyMapping(limit, LimitEntityDto.class)); } @@ -96,28 +94,28 @@ public class EntitlementPoolLimitsImpl implements EntitlementPoolLimits { } @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); + 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); + Version version = new Version(versionId); + vendorLicenseManager + .getEntitlementPool(new EntitlementPoolEntity(vlmId, version, entitlementPoolId)); + LimitEntity limitInput = new LimitEntity(); + limitInput.setVendorLicenseModelId(vlmId); + limitInput.setVersion(version); + limitInput.setEpLkgId(entitlementPoolId); + limitInput.setId(limitId); + LimitEntity limit = vendorLicenseManager.getLimit(limitInput); LimitEntityDto entitlementPoolEntityDto = limit == null ? null : - new MapLimitEntityToLimitDto() - .applyMapping(limit, LimitEntityDto.class); + new MapLimitEntityToLimitDto().applyMapping(limit, LimitEntityDto.class); - mdcDataDebugMessage.debugExitMessage("VLM id, EP id, Limit Id", vlmId, entitlementPoolId, - limitId); + mdcDataDebugMessage + .debugExitMessage("VLM id, EP id, Limit Id", vlmId, entitlementPoolId, limitId); return Response.ok(entitlementPoolEntityDto).build(); } @@ -129,26 +127,27 @@ public class EntitlementPoolLimitsImpl implements EntitlementPoolLimits { String entitlementPoolId, String limitId, String user) { - mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId, "EP id", entitlementPoolId, "limit Id", - limitId); + 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); + Version version = new Version(versionId); + vendorLicenseManager + .getEntitlementPool(new EntitlementPoolEntity(vlmId, version, entitlementPoolId)); LimitEntity limitEntity = - new MapLimitRequestDtoToLimitEntity() - .applyMapping(request, LimitEntity.class); - limitEntity.setEpLkgId(entitlementPoolId); + new MapLimitRequestDtoToLimitEntity().applyMapping(request, LimitEntity.class); limitEntity.setVendorLicenseModelId(vlmId); + limitEntity.setVersion(version); + limitEntity.setEpLkgId(entitlementPoolId); limitEntity.setId(limitId); limitEntity.setParent(parent); - vendorLicenseManager.updateLimit(limitEntity, user); + vendorLicenseManager.updateLimit(limitEntity); - mdcDataDebugMessage.debugExitMessage("VLM id", vlmId, "EP id", entitlementPoolId, "limit Id", - limitId); + mdcDataDebugMessage + .debugExitMessage("VLM id", vlmId, "EP id", entitlementPoolId, "limit Id", limitId); return Response.ok().build(); } @@ -156,29 +155,33 @@ public class EntitlementPoolLimitsImpl implements EntitlementPoolLimits { /** * Delete entitlement pool. * - * @param vlmId the vlm id - * @param entitlementPoolId the entitlement pool id - * @param limitId the limitId - * @param user the user + * @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); - + 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); + + Version version = new Version(versionId); + vendorLicenseManager.getEntitlementPool( + new EntitlementPoolEntity(vlmId, version, entitlementPoolId)); LimitEntity limitInput = new LimitEntity(); limitInput.setVendorLicenseModelId(vlmId); + limitInput.setVersion(version); limitInput.setEpLkgId(entitlementPoolId); limitInput.setId(limitId); limitInput.setParent(parent); - vendorLicenseManager.deleteLimit(limitInput, user); + vendorLicenseManager.deleteLimit(limitInput); - mdcDataDebugMessage.debugExitMessage("VLM id, Verison Id, EP id, Limit Id", vlmId, versionId, entitlementPoolId, limitId); + 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/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 120bb3d6a0..8c31303b3b 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 @@ -34,7 +34,6 @@ 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; @@ -64,7 +63,7 @@ public class EntitlementPoolsImpl implements EntitlementPools { MdcUtil.initMdc(LoggerServiceName.List_EP.toString()); Collection<EntitlementPoolEntity> entitlementPools = - vendorLicenseManager.listEntitlementPools(vlmId, Version.valueOf(versionId), user); + vendorLicenseManager.listEntitlementPools(vlmId, new Version(versionId)); GenericCollectionWrapper<EntitlementPoolEntityDto> result = new GenericCollectionWrapper<>(); MapEntitlementPoolEntityToEntitlementPoolEntityDto outputMapper = @@ -96,9 +95,10 @@ public class EntitlementPoolsImpl implements EntitlementPools { new MapEntitlementPoolRequestDtoToEntitlementPoolEntity() .applyMapping(request, EntitlementPoolEntity.class); entitlementPoolEntity.setVendorLicenseModelId(vlmId); + entitlementPoolEntity.setVersion(new Version(versionId)); EntitlementPoolEntity createdEntitlementPool = - vendorLicenseManager.createEntitlementPool(entitlementPoolEntity, user); + vendorLicenseManager.createEntitlementPool(entitlementPoolEntity); StringWrapperResponse result = createdEntitlementPool != null ? new StringWrapperResponse(createdEntitlementPool.getId()) : null; @@ -127,9 +127,10 @@ public class EntitlementPoolsImpl implements EntitlementPools { new MapEntitlementPoolRequestDtoToEntitlementPoolEntity() .applyMapping(request, EntitlementPoolEntity.class); entitlementPoolEntity.setVendorLicenseModelId(vlmId); + entitlementPoolEntity.setVersion(new Version(versionId)); entitlementPoolEntity.setId(entitlementPoolId); - vendorLicenseManager.updateEntitlementPool(entitlementPoolEntity, user); + vendorLicenseManager.updateEntitlementPool(entitlementPoolEntity); mdcDataDebugMessage.debugExitMessage("VLM id, EP id", vlmId, entitlementPoolId); @@ -140,12 +141,12 @@ public class EntitlementPoolsImpl implements EntitlementPools { * Gets entitlement pool. * * @param vlmId the vlm id - * @param version the version + * @param versionId the version id * @param entitlementPoolId the entitlement pool id * @param user the user * @return the entitlement pool */ - public Response getEntitlementPool(String vlmId, String version, String entitlementPoolId, + public Response getEntitlementPool(String vlmId, String versionId, String entitlementPoolId, String user) { mdcDataDebugMessage.debugEntryMessage("VLM id, EP id", vlmId, entitlementPoolId); @@ -153,9 +154,9 @@ public class EntitlementPoolsImpl implements EntitlementPools { MdcUtil.initMdc(LoggerServiceName.Get_EP.toString()); EntitlementPoolEntity epInput = new EntitlementPoolEntity(); epInput.setVendorLicenseModelId(vlmId); - epInput.setVersion(Version.valueOf(version)); + epInput.setVersion(new Version(versionId)); epInput.setId(entitlementPoolId); - EntitlementPoolEntity entitlementPool = vendorLicenseManager.getEntitlementPool(epInput, user); + EntitlementPoolEntity entitlementPool = vendorLicenseManager.getEntitlementPool(epInput); EntitlementPoolEntityDto entitlementPoolEntityDto = entitlementPool == null ? null : new MapEntitlementPoolEntityToEntitlementPoolEntityDto() @@ -183,7 +184,8 @@ public class EntitlementPoolsImpl implements EntitlementPools { EntitlementPoolEntity epInput = new EntitlementPoolEntity(); epInput.setVendorLicenseModelId(vlmId); epInput.setId(entitlementPoolId); - vendorLicenseManager.deleteEntitlementPool(epInput, user); + epInput.setVersion(new Version(versionId)); + vendorLicenseManager.deleteEntitlementPool(epInput); mdcDataDebugMessage.debugExitMessage("VLM id, EP id", vlmId, entitlementPoolId); 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 593ed1939f..9f87f98bb5 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 @@ -44,7 +44,6 @@ 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; @@ -69,7 +68,7 @@ public class FeatureGroupsImpl implements FeatureGroups { MdcUtil.initMdc(LoggerServiceName.List_FG.toString()); Collection<FeatureGroupEntity> featureGroupEntities = - vendorLicenseManager.listFeatureGroups(vlmId, Version.valueOf(versionId), user); + vendorLicenseManager.listFeatureGroups(vlmId, new Version(versionId)); MapFeatureGroupEntityToFeatureGroupDescriptorDto outputMapper = new MapFeatureGroupEntityToFeatureGroupDescriptorDto(); @@ -101,11 +100,12 @@ public class FeatureGroupsImpl implements FeatureGroups { FeatureGroupEntity featureGroupEntity = new MapFeatureGroupDescriptorDtoToFeatureGroupEntity() .applyMapping(request, FeatureGroupEntity.class); featureGroupEntity.setVendorLicenseModelId(vlmId); + featureGroupEntity.setVersion(new Version(versionId)); featureGroupEntity.setLicenseKeyGroupIds(request.getAddedLicenseKeyGroupsIds()); featureGroupEntity.setEntitlementPoolIds(request.getAddedEntitlementPoolsIds()); FeatureGroupEntity createdFeatureGroup = - vendorLicenseManager.createFeatureGroup(featureGroupEntity, user); + vendorLicenseManager.createFeatureGroup(featureGroupEntity); StringWrapperResponse result = createdFeatureGroup != null ? new StringWrapperResponse(createdFeatureGroup.getId()) : null; @@ -125,12 +125,13 @@ public class FeatureGroupsImpl implements FeatureGroups { FeatureGroupEntity featureGroupEntity = new MapFeatureGroupDescriptorDtoToFeatureGroupEntity() .applyMapping(request, FeatureGroupEntity.class); featureGroupEntity.setVendorLicenseModelId(vlmId); + featureGroupEntity.setVersion(new Version(versionId)); featureGroupEntity.setId(featureGroupId); vendorLicenseManager .updateFeatureGroup(featureGroupEntity, request.getAddedLicenseKeyGroupsIds(), request.getRemovedLicenseKeyGroupsIds(), request.getAddedEntitlementPoolsIds(), - request.getRemovedEntitlementPoolsIds(), user); + request.getRemovedEntitlementPoolsIds()); mdcDataDebugMessage.debugExitMessage("VLM id, FG id", vlmId, featureGroupId); @@ -146,9 +147,9 @@ public class FeatureGroupsImpl implements FeatureGroups { MdcUtil.initMdc(LoggerServiceName.Get_FG.toString()); FeatureGroupEntity fgInput = new FeatureGroupEntity(); fgInput.setVendorLicenseModelId(vlmId); - fgInput.setVersion(Version.valueOf(versionId)); + fgInput.setVersion(new Version(versionId)); fgInput.setId(featureGroupId); - FeatureGroupModel featureGroupModel = vendorLicenseManager.getFeatureGroupModel(fgInput, user); + FeatureGroupModel featureGroupModel = vendorLicenseManager.getFeatureGroupModel(fgInput); if (featureGroupModel == null) { return Response.ok().build(); @@ -197,8 +198,9 @@ public class FeatureGroupsImpl implements FeatureGroups { MdcUtil.initMdc(LoggerServiceName.Delete_FG.toString()); FeatureGroupEntity fgInput = new FeatureGroupEntity(); fgInput.setVendorLicenseModelId(vlmId); + fgInput.setVersion(new Version(versionId)); fgInput.setId(featureGroupId); - vendorLicenseManager.deleteFeatureGroup(fgInput, user); + vendorLicenseManager.deleteFeatureGroup(fgInput); mdcDataDebugMessage.debugExitMessage("VLM id, FG id", vlmId, featureGroupId); 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 60a2d684d2..210aadce42 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 @@ -41,14 +41,13 @@ 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; -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("licenseAgreements") @@ -62,9 +61,9 @@ public class LicenseAgreementsImpl implements LicenseAgreements { /** * List license agreements response. * - * @param vlmId the vlm id + * @param vlmId the vlm id * @param versionId the version - * @param user the user + * @param user the user * @return the response */ public Response listLicenseAgreements(String vlmId, String versionId, String user) { @@ -73,7 +72,7 @@ public class LicenseAgreementsImpl implements LicenseAgreements { MdcUtil.initMdc(LoggerServiceName.List_LA.toString()); Collection<LicenseAgreementEntity> licenseAgreements = - vendorLicenseManager.listLicenseAgreements(vlmId, Version.valueOf(versionId), user); + vendorLicenseManager.listLicenseAgreements(vlmId, new Version(versionId)); GenericCollectionWrapper<LicenseAgreementEntityDto> results = new GenericCollectionWrapper<>(); MapLicenseAgreementEntityToLicenseAgreementDescriptorDto outputMapper = @@ -100,7 +99,7 @@ public class LicenseAgreementsImpl implements LicenseAgreements { * @return the response */ public Response createLicenseAgreement(LicenseAgreementRequestDto request, String vlmId, - String versionId,String user) { + String versionId, String user) { mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId); @@ -109,11 +108,11 @@ public class LicenseAgreementsImpl implements LicenseAgreements { new MapLicenseAgreementDescriptorDtoToLicenseAgreementEntity() .applyMapping(request, LicenseAgreementEntity.class); licenseAgreementEntity.setVendorLicenseModelId(vlmId); - licenseAgreementEntity.setVersion(Version.valueOf(versionId)); + licenseAgreementEntity.setVersion(new Version(versionId)); licenseAgreementEntity.setFeatureGroupIds(request.getAddedFeatureGroupsIds()); LicenseAgreementEntity createdLicenseAgreement = - vendorLicenseManager.createLicenseAgreement(licenseAgreementEntity, user); + vendorLicenseManager.createLicenseAgreement(licenseAgreementEntity); StringWrapperResponse result = createdLicenseAgreement != null ? new StringWrapperResponse(createdLicenseAgreement.getId()) : null; @@ -133,7 +132,7 @@ public class LicenseAgreementsImpl implements LicenseAgreements { * @return the response */ public Response updateLicenseAgreement(LicenseAgreementUpdateRequestDto request, String vlmId, - String versionId,String licenseAgreementId, String user) { + String versionId, String licenseAgreementId, String user) { mdcDataDebugMessage.debugEntryMessage("VLM id, LA id", vlmId, licenseAgreementId); @@ -142,12 +141,12 @@ public class LicenseAgreementsImpl implements LicenseAgreements { new MapLicenseAgreementDescriptorDtoToLicenseAgreementEntity() .applyMapping(request, LicenseAgreementEntity.class); licenseAgreementEntity.setVendorLicenseModelId(vlmId); - licenseAgreementEntity.setVersion(Version.valueOf(versionId)); + licenseAgreementEntity.setVersion(new Version(versionId)); licenseAgreementEntity.setId(licenseAgreementId); vendorLicenseManager .updateLicenseAgreement(licenseAgreementEntity, request.getAddedFeatureGroupsIds(), - request.getRemovedFeatureGroupsIds(), user); + request.getRemovedFeatureGroupsIds()); mdcDataDebugMessage.debugExitMessage("VLM id, LA id", vlmId, licenseAgreementId); @@ -158,7 +157,7 @@ public class LicenseAgreementsImpl implements LicenseAgreements { * Gets license agreement. * * @param vlmId the vlm id - * @param versionId the version + * @param versionId the version * @param licenseAgreementId the license agreement id * @param user the user * @return the license agreement @@ -170,7 +169,7 @@ public class LicenseAgreementsImpl implements LicenseAgreements { MdcUtil.initMdc(LoggerServiceName.Get_LA.toString()); LicenseAgreementModel licenseAgreementModel = vendorLicenseManager - .getLicenseAgreementModel(vlmId, Version.valueOf(versionId), licenseAgreementId, user); + .getLicenseAgreementModel(vlmId, new Version(versionId), licenseAgreementId); if (licenseAgreementModel == null) { return Response.ok().build(); @@ -206,18 +205,18 @@ public class LicenseAgreementsImpl implements LicenseAgreements { * Delete license agreement response. * * @param vlmId the vlm id - * @param versionId the version 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 versionId, String licenseAgreementId, + 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); + vendorLicenseManager.deleteLicenseAgreement(vlmId, new Version(versionId), licenseAgreementId); mdcDataDebugMessage.debugExitMessage("VLM id, LA id", vlmId, licenseAgreementId); 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 index bedbc928ed..3aef837bd3 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/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 @@ -16,14 +16,12 @@ import org.openecomp.sdcrests.vendorlicense.rest.mapping.MapLimitRequestDtoToLim 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; +import java.util.Collection; @Named @Service("licenseKeyGroupLimits") @@ -32,10 +30,11 @@ public class LicenseKeyGroupLimitsImpl implements LicenseKeyGroupLimits { private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); private VendorLicenseManager vendorLicenseManager = - VendorLicenseManagerFactory.getInstance().createInterface(); + VendorLicenseManagerFactory.getInstance().createInterface(); public static final String parent = "LicenseKeyGroup"; + @Override public Response createLimit(LimitRequestDto request, String vlmId, @@ -46,20 +45,20 @@ public class LicenseKeyGroupLimitsImpl implements LicenseKeyGroupLimits { mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId, "LKG id", licenseKeyGroupId); MdcUtil.initMdc(LoggerServiceName.Create_LIMIT.toString()); - vendorLicenseManager.getLicenseKeyGroup(new LicenseKeyGroupEntity(vlmId, Version.valueOf - (versionId), licenseKeyGroupId), user); + Version version = new Version(versionId); + vendorLicenseManager.getLicenseKeyGroup( + new LicenseKeyGroupEntity(vlmId, version, licenseKeyGroupId)); LimitEntity limitEntity = - new MapLimitRequestDtoToLimitEntity() - .applyMapping(request, LimitEntity.class); - limitEntity.setEpLkgId(licenseKeyGroupId); + new MapLimitRequestDtoToLimitEntity().applyMapping(request, LimitEntity.class); limitEntity.setVendorLicenseModelId(vlmId); + limitEntity.setVersion(version); + limitEntity.setEpLkgId(licenseKeyGroupId); limitEntity.setParent(parent); - LimitEntity createdLimit = vendorLicenseManager.createLimit(limitEntity, user); + LimitEntity createdLimit = vendorLicenseManager.createLimit(limitEntity); MapLimitEntityToLimitCreationDto mapper = new MapLimitEntityToLimitCreationDto(); - LimitCreationDto createdLimitDto = mapper.applyMapping(createdLimit, LimitCreationDto - .class); + LimitCreationDto createdLimitDto = mapper.applyMapping(createdLimit, LimitCreationDto.class); /*StringWrapperResponse result = createdLimit != null ? new StringWrapperResponse(createdLimit.getId()) : null;*/ @@ -67,25 +66,25 @@ public class LicenseKeyGroupLimitsImpl implements LicenseKeyGroupLimits { mdcDataDebugMessage.debugExitMessage("VLM id", vlmId, "LKG id", licenseKeyGroupId); //return Response.ok(result).build(); - return Response.ok(createdLimitDto != null ? createdLimitDto : null) - .build(); + return Response.ok(createdLimitDto != null ? createdLimitDto : null).build(); } @Override - public Response listLimits(String vlmId, String versionId, String licenseKeyGroupId, String - user) { + 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); + Version version = new Version(versionId); + vendorLicenseManager + .getLicenseKeyGroup(new LicenseKeyGroupEntity(vlmId, version, licenseKeyGroupId)); Collection<LimitEntity> limits = - vendorLicenseManager.listLimits(vlmId, Version.valueOf(versionId), licenseKeyGroupId, user); + vendorLicenseManager.listLimits(vlmId, version, licenseKeyGroupId); GenericCollectionWrapper<LimitEntityDto> result = new GenericCollectionWrapper<>(); MapLimitEntityToLimitDto outputMapper = - new MapLimitEntityToLimitDto(); + new MapLimitEntityToLimitDto(); for (LimitEntity limit : limits) { result.add(outputMapper.applyMapping(limit, LimitEntityDto.class)); } @@ -103,25 +102,26 @@ public class LicenseKeyGroupLimitsImpl implements LicenseKeyGroupLimits { String limitId, String user) { mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId, "LKG id", licenseKeyGroupId, "limit Id", - limitId); + limitId); MdcUtil.initMdc(LoggerServiceName.Update_LIMIT.toString()); - vendorLicenseManager.getLicenseKeyGroup(new LicenseKeyGroupEntity(vlmId, Version.valueOf - (versionId), licenseKeyGroupId), user); + Version version = new Version(versionId); + vendorLicenseManager + .getLicenseKeyGroup(new LicenseKeyGroupEntity(vlmId, version, licenseKeyGroupId)); LimitEntity limitEntity = - new MapLimitRequestDtoToLimitEntity() - .applyMapping(request, LimitEntity.class); - limitEntity.setEpLkgId(licenseKeyGroupId); + new MapLimitRequestDtoToLimitEntity().applyMapping(request, LimitEntity.class); limitEntity.setVendorLicenseModelId(vlmId); + limitEntity.setVersion(version); + limitEntity.setEpLkgId(licenseKeyGroupId); limitEntity.setId(limitId); limitEntity.setParent(parent); - vendorLicenseManager.updateLimit(limitEntity, user); + vendorLicenseManager.updateLimit(limitEntity); - mdcDataDebugMessage.debugExitMessage("VLM id", vlmId, "LKG id", licenseKeyGroupId, "limit Id", - limitId); + mdcDataDebugMessage + .debugExitMessage("VLM id", vlmId, "LKG id", licenseKeyGroupId, "limit Id", limitId); return Response.ok().build(); } @@ -129,57 +129,59 @@ public class LicenseKeyGroupLimitsImpl implements LicenseKeyGroupLimits { /** * Delete License Key Group. * - * @param vlmId the vlm id - * @param licenseKeyGroupId the license Key Group id - * @param limitId the limitId - * @param user the user + * @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); - + licenseKeyGroupId, limitId); MdcUtil.initMdc(LoggerServiceName.Delete_LIMIT.toString()); - vendorLicenseManager.getLicenseKeyGroup(new LicenseKeyGroupEntity(vlmId, Version.valueOf - (versionId), licenseKeyGroupId), user); + + Version version = new Version(versionId); + vendorLicenseManager + .getLicenseKeyGroup(new LicenseKeyGroupEntity(vlmId, version, licenseKeyGroupId)); LimitEntity limitInput = new LimitEntity(); limitInput.setVendorLicenseModelId(vlmId); + limitInput.setVersion(version); limitInput.setEpLkgId(licenseKeyGroupId); limitInput.setId(limitId); limitInput.setParent(parent); - vendorLicenseManager.deleteLimit(limitInput, user); + vendorLicenseManager.deleteLimit(limitInput); mdcDataDebugMessage.debugExitMessage("VLM id, Verison Id, LKG id, Limit Id", vlmId, versionId, - licenseKeyGroupId, limitId); + licenseKeyGroupId, limitId); return Response.ok().build(); } @Override - public Response getLimit( String vlmId, String versionId, String licenseKeyGroupId, - String limitId, String user) { + public Response getLimit(String vlmId, String versionId, String licenseKeyGroupId, + String limitId, String user) { mdcDataDebugMessage.debugEntryMessage("VLM id, LKG id, Limit Id", vlmId, licenseKeyGroupId, - limitId); + 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); + Version version = new Version(versionId); + vendorLicenseManager + .getLicenseKeyGroup(new LicenseKeyGroupEntity(vlmId, version, licenseKeyGroupId)); + LimitEntity limitInput = new LimitEntity(); + limitInput.setVendorLicenseModelId(vlmId); + limitInput.setVersion(version); + limitInput.setEpLkgId(licenseKeyGroupId); + limitInput.setId(limitId); + LimitEntity limit = vendorLicenseManager.getLimit(limitInput); + + 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-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 4c4bf134fd..6fe33d77ae 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 @@ -34,7 +34,6 @@ 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; @@ -67,7 +66,7 @@ public class LicenseKeyGroupsImpl implements LicenseKeyGroups { MdcUtil.initMdc(LoggerServiceName.List_LKG.toString()); Collection<LicenseKeyGroupEntity> licenseKeyGroups = - vendorLicenseManager.listLicenseKeyGroups(vlmId, Version.valueOf(versionId), user); + vendorLicenseManager.listLicenseKeyGroups(vlmId, new Version(versionId)); GenericCollectionWrapper<LicenseKeyGroupEntityDto> result = new GenericCollectionWrapper<>(); MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto outputMapper = @@ -99,9 +98,10 @@ public class LicenseKeyGroupsImpl implements LicenseKeyGroups { new MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity() .applyMapping(request, LicenseKeyGroupEntity.class); licenseKeyGroupEntity.setVendorLicenseModelId(vlmId); + licenseKeyGroupEntity.setVersion(new Version(versionId)); LicenseKeyGroupEntity createdLicenseKeyGroup = - vendorLicenseManager.createLicenseKeyGroup(licenseKeyGroupEntity, user); + vendorLicenseManager.createLicenseKeyGroup(licenseKeyGroupEntity); StringWrapperResponse result = createdLicenseKeyGroup != null ? new StringWrapperResponse(createdLicenseKeyGroup.getId()) : null; @@ -131,9 +131,10 @@ public class LicenseKeyGroupsImpl implements LicenseKeyGroups { new MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity() .applyMapping(request, LicenseKeyGroupEntity.class); licenseKeyGroupEntity.setVendorLicenseModelId(vlmId); + licenseKeyGroupEntity.setVersion(new Version(versionId)); licenseKeyGroupEntity.setId(licenseKeyGroupId); - vendorLicenseManager.updateLicenseKeyGroup(licenseKeyGroupEntity, user); + vendorLicenseManager.updateLicenseKeyGroup(licenseKeyGroupEntity); mdcDataDebugMessage.debugExitMessage("VLM id, LKG id", vlmId, licenseKeyGroupId); @@ -157,9 +158,9 @@ public class LicenseKeyGroupsImpl implements LicenseKeyGroups { MdcUtil.initMdc(LoggerServiceName.Get_LKG.toString()); LicenseKeyGroupEntity lkgInput = new LicenseKeyGroupEntity(); lkgInput.setVendorLicenseModelId(vlmId); - lkgInput.setVersion(Version.valueOf(versionId)); + lkgInput.setVersion(new Version(versionId)); lkgInput.setId(licenseKeyGroupId); - LicenseKeyGroupEntity licenseKeyGroup = vendorLicenseManager.getLicenseKeyGroup(lkgInput, user); + LicenseKeyGroupEntity licenseKeyGroup = vendorLicenseManager.getLicenseKeyGroup(lkgInput); LicenseKeyGroupEntityDto licenseKeyGroupEntityDto = licenseKeyGroup == null ? null : new MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto() @@ -186,8 +187,9 @@ public class LicenseKeyGroupsImpl implements LicenseKeyGroups { MdcUtil.initMdc(LoggerServiceName.Delete_LKG.toString()); LicenseKeyGroupEntity lkgInput = new LicenseKeyGroupEntity(); lkgInput.setVendorLicenseModelId(vlmId); + lkgInput.setVersion(new Version(versionId)); lkgInput.setId(licenseKeyGroupId); - vendorLicenseManager.deleteLicenseKeyGroup(lkgInput, user); + vendorLicenseManager.deleteLicenseKeyGroup(lkgInput); mdcDataDebugMessage.debugExitMessage("VLM id, LKG id", vlmId, licenseKeyGroupId); 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 6d88e4cacb..2b8e5a343e 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,37 +20,67 @@ package org.openecomp.sdcrests.vendorlicense.rest.services; +import org.openecomp.core.util.UniqueValueUtil; +import org.openecomp.sdc.activitylog.ActivityLogManager; +import org.openecomp.sdc.activitylog.ActivityLogManagerFactory; +import org.openecomp.sdc.activitylog.dao.type.ActivityLogEntity; +import org.openecomp.sdc.activitylog.dao.type.ActivityType; +import org.openecomp.sdc.common.errors.Messages; +import org.openecomp.sdc.datatypes.model.ItemType; +import org.openecomp.sdc.healing.factory.HealingManagerFactory; +import org.openecomp.sdc.itempermissions.ItemPermissionsManager; +import org.openecomp.sdc.itempermissions.ItemPermissionsManagerFactory; +import org.openecomp.sdc.itempermissions.impl.types.PermissionTypes; 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.notification.dtos.Event; +import org.openecomp.sdc.notification.factories.NotificationPropagationManagerFactory; +import org.openecomp.sdc.notification.services.NotificationPropagationManager; +import org.openecomp.sdc.vendorlicense.VendorLicenseConstants; import org.openecomp.sdc.vendorlicense.VendorLicenseManager; import org.openecomp.sdc.vendorlicense.VendorLicenseManagerFactory; import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity; -import org.openecomp.sdc.vendorlicense.types.VersionedVendorLicenseModel; -import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductManager; -import org.openecomp.sdc.vendorsoftwareproduct.VspManagerFactory; +import org.openecomp.sdc.versioning.ItemManager; +import org.openecomp.sdc.versioning.ItemManagerFactory; +import org.openecomp.sdc.versioning.VersioningManager; +import org.openecomp.sdc.versioning.VersioningManagerFactory; import org.openecomp.sdc.versioning.dao.types.Version; +import org.openecomp.sdc.versioning.dao.types.VersionStatus; +import org.openecomp.sdc.versioning.types.Item; +import org.openecomp.sdc.versioning.types.NotificationEventTypes; +import org.openecomp.sdcrests.item.rest.mapping.MapItemToDto; +import org.openecomp.sdcrests.item.rest.mapping.MapVersionToDto; +import org.openecomp.sdcrests.item.types.ItemCreationDto; +import org.openecomp.sdcrests.item.types.ItemDto; +import org.openecomp.sdcrests.item.types.VersionDto; import org.openecomp.sdcrests.vendorlicense.rest.VendorLicenseModels; +import org.openecomp.sdcrests.vendorlicense.rest.mapping.MapVendorLicenseModelEntityToDto; import org.openecomp.sdcrests.vendorlicense.rest.mapping.MapVendorLicenseModelRequestDtoToVendorLicenseModelEntity; -import org.openecomp.sdcrests.vendorlicense.rest.mapping.MapVersionedVendorLicenseModelToVendorLicenseModelEntityDto; import org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelActionRequestDto; 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 javax.inject.Named; import javax.ws.rs.core.Response; -import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; +import java.util.function.Predicate; + +import static org.openecomp.sdc.itempermissions.notifications.NotificationConstants.PERMISSION_USER; +import static org.openecomp.sdc.versioning.VersioningNotificationConstansts.ITEM_ID; +import static org.openecomp.sdc.versioning.VersioningNotificationConstansts.ITEM_NAME; +import static org.openecomp.sdc.versioning.VersioningNotificationConstansts.SUBMIT_DESCRIPTION; +import static org.openecomp.sdc.versioning.VersioningNotificationConstansts.VERSION_ID; +import static org.openecomp.sdc.versioning.VersioningNotificationConstansts.VERSION_NAME; @Named @Service("vendorLicenseModels") @@ -59,140 +89,248 @@ import java.util.Collection; public class VendorLicenseModelsImpl implements VendorLicenseModels { private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); + private static final Logger logger = LoggerFactory.getLogger(VendorLicenseModelsImpl.class); + public static final String SUBMIT_ITEM = "Submit_Item"; + private ItemPermissionsManager permissionsManager = ItemPermissionsManagerFactory.getInstance() + .createInterface(); + private NotificationPropagationManager notifier = + NotificationPropagationManagerFactory.getInstance().createInterface(); + + private ItemManager itemManager = ItemManagerFactory.getInstance().createInterface(); + private VersioningManager versioningManager = + VersioningManagerFactory.getInstance().createInterface(); private VendorLicenseManager vendorLicenseManager = VendorLicenseManagerFactory.getInstance().createInterface(); + private ActivityLogManager activityLogManager = + ActivityLogManagerFactory.getInstance().createInterface(); + + @Override + public Response listLicenseModels(String versionStatus, String user) { + mdcDataDebugMessage.debugEntryMessage(null); + MdcUtil.initMdc(LoggerServiceName.List_VLM.toString()); + + Predicate<Item> itemPredicate; + if (VersionStatus.Certified.name().equals(versionStatus)) { + itemPredicate = item -> ItemType.vlm.name().equals(item.getType()) && + item.getVersionStatusCounters().containsKey(VersionStatus.Certified); + + } else if (VersionStatus.Draft.name().equals(versionStatus)) { + itemPredicate = item -> ItemType.vlm.name().equals(item.getType()) && + item.getVersionStatusCounters().containsKey(VersionStatus.Draft) && + userHasPermission(item.getId(), user); + + } else { + itemPredicate = item -> ItemType.vlm.name().equals(item.getType()); + } - private static final Logger logger = - LoggerFactory.getLogger(VendorLicenseModelsImpl.class); + GenericCollectionWrapper<ItemDto> results = new GenericCollectionWrapper<>(); + MapItemToDto mapper = new MapItemToDto(); + itemManager.list(itemPredicate).stream() + .sorted((o1, o2) -> o2.getModificationTime().compareTo(o1.getModificationTime())) + .forEach(vspItem -> results.add(mapper.applyMapping(vspItem, ItemDto.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); + return Response.ok(results).build(); + } - mdcDataDebugMessage.debugExitMessage(null, null); + @Override + public Response createLicenseModel(VendorLicenseModelRequestDto request, String user) { + mdcDataDebugMessage.debugEntryMessage(null); + logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.CREATE_VLM + request.getVendorName()); + MdcUtil.initMdc(LoggerServiceName.Create_VLM.toString()); - return Response.ok(results).build(); - } + Item item = new Item(); + item.setType(ItemType.vlm.name()); + item.setName(request.getVendorName()); + item.setDescription(request.getDescription()); - @Override - public Response createLicenseModel(VendorLicenseModelRequestDto request, String user) { + UniqueValueUtil + .validateUniqueValue(VendorLicenseConstants.UniqueValues.VENDOR_NAME, item.getName()); + item = itemManager.create(item); + UniqueValueUtil + .createUniqueValue(VendorLicenseConstants.UniqueValues.VENDOR_NAME, item.getName()); - mdcDataDebugMessage.debugEntryMessage(null, null); + Version version = versioningManager.create(item.getId(), new Version(), null); - logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.CREATE_VLM - + request.getVendorName()); + VendorLicenseModelEntity vlm = new MapVendorLicenseModelRequestDtoToVendorLicenseModelEntity() + .applyMapping(request, VendorLicenseModelEntity.class); + vlm.setId(item.getId()); + vlm.setVersion(version); - MdcUtil.initMdc(LoggerServiceName.Create_VLM.toString()); - VendorLicenseModelEntity vendorLicenseModelEntity = + vendorLicenseManager.createVendorLicenseModel(vlm); + versioningManager.publish(item.getId(), version, "Initial vlm:" + vlm.getVendorName()); + + ItemCreationDto itemCreationDto = new ItemCreationDto(); + itemCreationDto.setItemId(item.getId()); + itemCreationDto.setVersion(new MapVersionToDto().applyMapping(version, VersionDto.class)); + + activityLogManager.logActivity(new ActivityLogEntity(vlm.getId(), version, + ActivityType.Create, user, true, "", "")); + + mdcDataDebugMessage.debugExitMessage(null); + return Response.ok(itemCreationDto).build(); + } + + @Override + public Response updateLicenseModel(VendorLicenseModelRequestDto request, String vlmId, + String versionId, String user) { + mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId); + MdcUtil.initMdc(LoggerServiceName.Update_VLM.toString()); + + VendorLicenseModelEntity vlm = new MapVendorLicenseModelRequestDtoToVendorLicenseModelEntity() .applyMapping(request, VendorLicenseModelEntity.class); - VendorLicenseModelEntity createdVendorLicenseModel = - vendorLicenseManager.createVendorLicenseModel(vendorLicenseModelEntity, user); - StringWrapperResponse result = createdVendorLicenseModel != null ? new StringWrapperResponse( - createdVendorLicenseModel.getId()) : null; + vlm.setId(vlmId); + vlm.setVersion(new Version(versionId)); + + vendorLicenseManager.updateVendorLicenseModel(vlm); + + 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()); + + Version version = versioningManager.get(vlmId, new Version(versionId)); + VendorLicenseModelEntity vlm = vendorLicenseManager.getVendorLicenseModel(vlmId, version); + vlm.setWritetimeMicroSeconds(version.getModificationTime().getTime()); + + try { + Optional<Version> healedVersion = HealingManagerFactory.getInstance().createInterface() + .healItemVersion(vlmId, version, ItemType.vlm, false); + healedVersion.ifPresent(vlm::setVersion); + + if (healedVersion.isPresent() && version.getStatus() == VersionStatus.Certified) { + try { + submit(vlmId, healedVersion.get(), "Submit after heal", user); + } catch (Exception ex) { + logger.error("VLM Id {}: Error while submitting version {} " + + "created based on Certified version {} for healing purpose.", + vlmId, healedVersion.get().getId(), versionId, ex.getMessage()); + } + } + } catch (Exception e) { + logger.error(String.format("Error while auto healing VLM with Id %s and version %s: %s", + vlmId, versionId, e.getMessage())); + } - mdcDataDebugMessage.debugExitMessage(null, null); + VendorLicenseModelEntityDto vlmDto = + new MapVendorLicenseModelEntityToDto().applyMapping(vlm, VendorLicenseModelEntityDto.class); - return Response.ok(result).build(); - } + mdcDataDebugMessage.debugExitMessage("VLM id", vlmId); + return Response.ok(vlmDto).build(); + } - @Override - public Response updateLicenseModel(VendorLicenseModelRequestDto request, String vlmId, - String versionId, String user) { + @Override + public Response deleteLicenseModel(String vlmId, String versionId, String user) { + mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId); + + MdcUtil.initMdc(LoggerServiceName.Delete_VLM.toString()); + vendorLicenseManager.deleteVendorLicenseModel(vlmId, new Version(versionId)); - mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId); + mdcDataDebugMessage.debugExitMessage("VLM id", vlmId); - MdcUtil.initMdc(LoggerServiceName.Update_VLM.toString()); - VendorLicenseModelEntity vendorLicenseModelEntity = - new MapVendorLicenseModelRequestDtoToVendorLicenseModelEntity() - .applyMapping(request, VendorLicenseModelEntity.class); - vendorLicenseModelEntity.setId(vlmId); + return Response.ok().build(); + } - vendorLicenseManager.updateVendorLicenseModel(vendorLicenseModelEntity, user); + @Override + public Response actOnLicenseModel(VendorLicenseModelActionRequestDto request, String vlmId, + String versionId, String user) { + Version version = new Version(versionId); - mdcDataDebugMessage.debugExitMessage("VLM id", vlmId); + switch (request.getAction()) { + case Submit: + if (!permissionsManager.isAllowed(vlmId, user, SUBMIT_ITEM)) { + return Response.status(Response.Status.FORBIDDEN).entity + (new Exception(Messages.PERMISSIONS_ERROR.getErrorMessage())).build(); + } + String message = + request.getSubmitRequest() == null ? "" : request.getSubmitRequest().getMessage(); + submit(vlmId, version, message, user); - return Response.ok().build(); + notifyUsers(vlmId, version, message, user, NotificationEventTypes.SUBMIT); + break; + default: } - @Override - public Response getLicenseModel(String vlmId, String versionId, String user) { + return Response.ok().build(); + } - mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId); + private void submit(String vlmId, Version version, String message, String user) { + MdcUtil.initMdc(LoggerServiceName.Submit_VLM.toString()); + logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.SUBMIT_VLM + vlmId); - MdcUtil.initMdc(LoggerServiceName.Get_VLM.toString()); - VersionedVendorLicenseModel versionedVlm = - vendorLicenseManager.getVendorLicenseModel(vlmId, Version.valueOf(versionId), user); + vendorLicenseManager.validate(vlmId, version); + versioningManager.submit(vlmId, version, message); - VendorLicenseModelEntityDto vlmDto = versionedVlm == null ? null : - new MapVersionedVendorLicenseModelToVendorLicenseModelEntityDto() - .applyMapping(versionedVlm, VendorLicenseModelEntityDto.class); + activityLogManager.logActivity( + new ActivityLogEntity(vlmId, version, ActivityType.Submit, user, true, "", message)); + } - mdcDataDebugMessage.debugExitMessage("VLM id", vlmId); + private void notifyUsers(String itemId, Version version, String message, + String userName, NotificationEventTypes eventType) { + Map<String, Object> eventProperties = new HashMap<>(); + eventProperties.put(ITEM_NAME, itemManager.get(itemId).getName()); + eventProperties.put(ITEM_ID, itemId); - return Response.ok(vlmDto).build(); - } + Version ver = versioningManager.get(itemId, version); + eventProperties.put(VERSION_NAME, ver.getName()); + eventProperties.put(VERSION_ID, ver.getId()); - @Override - public Response deleteLicenseModel(String vlmId, String versionId, String user) { + eventProperties.put(SUBMIT_DESCRIPTION, message); + eventProperties.put(PERMISSION_USER, userName); - mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId); + Event syncEvent = new SyncEvent(eventType.getEventName(), itemId, eventProperties, itemId); + try { + notifier.notifySubscribers(syncEvent, userName); + } catch (Exception e) { + logger.error("Failed to send sync notification to users subscribed o item '" + itemId); + } + } - MdcUtil.initMdc(LoggerServiceName.Delete_VLM.toString()); - vendorLicenseManager.deleteVendorLicenseModel(vlmId, user); + private class SyncEvent implements Event { - mdcDataDebugMessage.debugExitMessage("VLM id", vlmId); + private String eventType; + private String originatorId; + private Map<String, Object> attributes; + private String entityId; - return Response.ok().build(); + public SyncEvent(String eventType, String originatorId, + Map<String, Object> attributes, String entityId) { + this.eventType = eventType; + this.originatorId = originatorId; + this.attributes = attributes; + this.entityId = entityId; } @Override - public Response actOnLicenseModel(VendorLicenseModelActionRequestDto request, String vlmId, - String versionId, String user) { + public String getEventType() { + return eventType; + } - 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: + @Override + public String getOriginatorId() { + return originatorId; } - return Response.ok().build(); + @Override + public Map<String, Object> getAttributes() { + return attributes; } + + @Override + public String getEntityId() { + return entityId; + } + } + + private boolean userHasPermission(String itemId, String userId) { + String permission = permissionsManager.getUserItemPermiission(itemId, userId); + return (permission != null && permission + .matches(PermissionTypes.Contributor.name() + "|" + PermissionTypes.Owner.name())); + } } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/pom.xml index 6b30f9567f..daeb720c37 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/pom.xml +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/pom.xml @@ -12,17 +12,17 @@ <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> + <dependencies> + <dependency> + <groupId>org.openecomp.sdc</groupId> + <artifactId>openecomp-sdc-vendor-license-manager</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.openecomp.sdc</groupId> + <artifactId>item-rest-types</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> </project> 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/FeatureGroupEntityDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/FeatureGroupEntityDto.java index aebb171b8e..3edf283707 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/FeatureGroupEntityDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/FeatureGroupEntityDto.java @@ -22,8 +22,8 @@ package org.openecomp.sdcrests.vendorlicense.types; import io.swagger.annotations.ApiModel; -import java.util.Set; import javax.validation.constraints.Size; +import java.util.Set; @ApiModel(value = "FeatureGroupEntity") public class FeatureGroupEntityDto extends FeatureGroupDescriptorDto { 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/LicenseAgreementEntityDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseAgreementEntityDto.java index 7c9f03dc91..23d1218b74 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseAgreementEntityDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseAgreementEntityDto.java @@ -23,8 +23,8 @@ package org.openecomp.sdcrests.vendorlicense.types; import io.swagger.annotations.ApiModel; -import java.util.Set; import javax.validation.constraints.Size; +import java.util.Set; @ApiModel(value = "LicenseAgreementEntity") public class LicenseAgreementEntityDto extends LicenseAgreementDescriptorDto { 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/MultiChoiceOrOtherDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/MultiChoiceOrOtherDto.java index 6039a810ba..1dc8ff2bdd 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/MultiChoiceOrOtherDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/MultiChoiceOrOtherDto.java @@ -24,9 +24,9 @@ import org.hibernate.validator.group.GroupSequenceProvider; import org.openecomp.sdcrests.vendorlicense.types.validation.MultiChoiceOrOtherSequenceProvider; import org.openecomp.sdcrests.vendorlicense.types.validation.OtherChoiceValidation; -import java.util.Set; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; +import java.util.Set; @GroupSequenceProvider(value = MultiChoiceOrOtherSequenceProvider.class) public class MultiChoiceOrOtherDto<E extends Enum<E>> { 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/VendorLicenseModelActionRequestDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/VendorLicenseModelActionRequestDto.java index cfae94ce35..68e0fd8552 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/VendorLicenseModelActionRequestDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/VendorLicenseModelActionRequestDto.java @@ -20,17 +20,30 @@ package org.openecomp.sdcrests.vendorlicense.types; -import org.openecomp.sdcrests.versioning.types.VersioningAction; +import org.openecomp.sdcrests.item.types.SubmitRequestDto; public class VendorLicenseModelActionRequestDto { - private VersioningAction action; + private VendorLicenseModelAction action; + private SubmitRequestDto submitRequest; - public VersioningAction getAction() { + public VendorLicenseModelAction getAction() { return action; } - public void setAction(VersioningAction action) { + public void setAction(VendorLicenseModelAction action) { this.action = action; } + + public SubmitRequestDto getSubmitRequest() { + return submitRequest; + } + + public void setSubmitRequest(SubmitRequestDto submitRequest) { + this.submitRequest = submitRequest; + } + + public enum VendorLicenseModelAction { + Submit + } } 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/VendorLicenseModelEntityDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/VendorLicenseModelEntityDto.java index e8a900a82b..f88926c300 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/VendorLicenseModelEntityDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/VendorLicenseModelEntityDto.java @@ -21,19 +21,10 @@ package org.openecomp.sdcrests.vendorlicense.types; import io.swagger.annotations.ApiModel; -import org.openecomp.sdc.versioning.dao.types.VersionStatus; -import org.openecomp.sdcrests.common.types.VersionDto; - -import java.util.List; @ApiModel(value = "VendorLicenseModelEntity") public class VendorLicenseModelEntityDto extends VendorLicenseModelRequestDto { private String id; - private VersionDto version; - private VersionStatus status; - private String lockingUser; - private List<VersionDto> viewableVersions; - private List<VersionDto> finalVersions; public String getId() { return id; @@ -42,44 +33,4 @@ public class VendorLicenseModelEntityDto extends VendorLicenseModelRequestDto { public void setId(String id) { this.id = id; } - - public VersionDto getVersion() { - return version; - } - - public void setVersion(VersionDto version) { - this.version = version; - } - - public VersionStatus getStatus() { - return status; - } - - public void setStatus(VersionStatus status) { - this.status = status; - } - - public String getLockingUser() { - return lockingUser; - } - - public void setLockingUser(String lockingUser) { - this.lockingUser = lockingUser; - } - - public List<VersionDto> getViewableVersions() { - return viewableVersions; - } - - public void setViewableVersions(List<VersionDto> viewableVersions) { - this.viewableVersions = viewableVersions; - } - - public List<VersionDto> getFinalVersions() { - return finalVersions; - } - - public void setFinalVersions(List<VersionDto> finalVersions) { - this.finalVersions = finalVersions; - } } |