diff options
author | vasraz <vasyl.razinkov@est.tech> | 2021-03-22 15:33:06 +0000 |
---|---|---|
committer | Christophe Closset <christophe.closset@intl.att.com> | 2021-03-24 06:59:47 +0000 |
commit | d378c37fbd1ecec7b43394926f1ca32a695e07de (patch) | |
tree | 5c8a085f8732f980d871d966ac49361644efa698 /openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest | |
parent | a6ae7294ecd336d7e88f915710b08e2658eaee00 (diff) |
Reformat openecomp-be
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech>
Issue-ID: SDC-3449
Change-Id: I13e02322f8e00820cc5a1d85752caaeda9bf10d1
Diffstat (limited to 'openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest')
57 files changed, 1807 insertions, 2213 deletions
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 7caa639bac..7225a36f55 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 @@ -7,9 +7,9 @@ * 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. @@ -17,102 +17,83 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - 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.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.info.Info; import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tags; -import org.openecomp.sdcrests.vendorlicense.types.LimitEntityDto; -import org.openecomp.sdcrests.vendorlicense.types.LimitRequestDto; -import org.springframework.validation.annotation.Validated; - import javax.validation.Valid; import javax.validation.constraints.NotNull; -import javax.ws.rs.*; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; +import org.openecomp.sdcrests.vendorlicense.types.LimitEntityDto; +import org.openecomp.sdcrests.vendorlicense.types.LimitRequestDto; +import org.springframework.validation.annotation.Validated; -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") +@Path("/v1.0/vendor-license-models/{vlmId}/versions/{versionId}/entitlement-pools/{entitlementPoolId}/limits") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @Tags({@Tag(name = "SDCE-1 APIs"), @Tag(name = "Vendor License Model - Entitlement Pool Limits")}) @Validated public interface EntitlementPoolLimits { - @POST - @Path("/") - @Operation(description = "Create vendor entitlement pool limits") - Response createLimit(@Valid LimitRequestDto request, - @Parameter(description = "Vendor license model Id") @PathParam("vlmId") - String vlmId, - @Parameter(description = "Vendor license model version Id") @PathParam - ("versionId") - String versionId, - @Parameter(description = "Vendor license model Entitlement Pool Id") - @PathParam("entitlementPoolId") - String entitlementPoolId, - @NotNull(message = USER_MISSING_ERROR_MSG) - @HeaderParam(USER_ID_HEADER_PARAM) String user); - - - @GET - @Path("/") - @Operation(description = "List vendor entitlement pool limits", responses = @ApiResponse(content = @Content(array = @ArraySchema( schema = @Schema(implementation = LimitRequestDto.class))))) - Response listLimits( - @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, - @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId, - @Parameter(description = "Vendor license model Entitlement Pool Id") @PathParam("entitlementPoolId") - String entitlementPoolId, - @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user); + @POST + @Path("/") + @Operation(description = "Create vendor entitlement pool limits") + Response createLimit(@Valid LimitRequestDto request, @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, + @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId, + @Parameter(description = "Vendor license model Entitlement Pool Id") @PathParam("entitlementPoolId") String entitlementPoolId, + @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user); - @PUT - @Path("/{limitId}") - @Operation(description = "Update vendor entitlement pool limit") - Response updateLimit(@Valid LimitRequestDto request, - @Parameter(description = "Vendor license model Id") @PathParam("vlmId") - String vlmId, - @Parameter(description = "Vendor license model version Id") @PathParam - ("versionId") - String versionId, - @Parameter(description = "Vendor license model Entitlement Pool Id") - @PathParam("entitlementPoolId") - String entitlementPoolId, - @NotNull(message = USER_MISSING_ERROR_MSG) - @PathParam("limitId") String limitId, - @HeaderParam(USER_ID_HEADER_PARAM) String user); + @GET + @Path("/") + @Operation(description = "List vendor entitlement pool limits", responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = LimitRequestDto.class))))) + Response listLimits(@Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, + @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId, + @Parameter(description = "Vendor license model Entitlement Pool Id") @PathParam("entitlementPoolId") String entitlementPoolId, + @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user); - @GET - @Path("/{limitId}") - @Operation(description = "Get vendor entitlement pool limit", responses = @ApiResponse(content = @Content(schema = @Schema(implementation = LimitEntityDto.class)))) - Response getLimit( - @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, - @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId, - @Parameter(description = "Vendor license model Entitlement Pool Id") @PathParam - ("entitlementPoolId") String entitlementPoolId, - @Parameter(description = "Vendor license model Entitlement Pool Limit Id") @PathParam("limitId") - String limitId, - @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user); + @PUT + @Path("/{limitId}") + @Operation(description = "Update vendor entitlement pool limit") + Response updateLimit(@Valid LimitRequestDto request, @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, + @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId, + @Parameter(description = "Vendor license model Entitlement Pool Id") @PathParam("entitlementPoolId") String entitlementPoolId, + @NotNull(message = USER_MISSING_ERROR_MSG) @PathParam("limitId") String limitId, + @HeaderParam(USER_ID_HEADER_PARAM) String user); - @DELETE - @Path("/{limitId}") - @Operation(description = "Delete vendor entitlement pool limit") - Response deleteLimit( - @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, - @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId, - @Parameter(description = "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); + @GET + @Path("/{limitId}") + @Operation(description = "Get vendor entitlement pool limit", responses = @ApiResponse(content = @Content(schema = @Schema(implementation = LimitEntityDto.class)))) + Response getLimit(@Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, + @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId, + @Parameter(description = "Vendor license model Entitlement Pool Id") @PathParam("entitlementPoolId") String entitlementPoolId, + @Parameter(description = "Vendor license model Entitlement Pool Limit Id") @PathParam("limitId") String limitId, + @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user); + @DELETE + @Path("/{limitId}") + @Operation(description = "Delete vendor entitlement pool limit") + Response deleteLimit(@Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, + @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId, + @Parameter(description = "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/EntitlementPools.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/EntitlementPools.java index 89b632f2e5..b2d320023e 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/EntitlementPools.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/EntitlementPools.java @@ -17,30 +17,35 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - 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.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.info.Info; import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tags; -import org.openecomp.sdcrests.vendorlicense.types.EntitlementPoolEntityDto; -import org.openecomp.sdcrests.vendorlicense.types.EntitlementPoolRequestDto; -import org.springframework.validation.annotation.Validated; - import javax.validation.Valid; import javax.validation.constraints.NotNull; -import javax.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.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; +import org.openecomp.sdcrests.vendorlicense.types.EntitlementPoolEntityDto; +import org.openecomp.sdcrests.vendorlicense.types.EntitlementPoolRequestDto; +import org.springframework.validation.annotation.Validated; @Path("/v1.0/vendor-license-models/{vlmId}/versions/{versionId}/entitlement-pools") @Produces(MediaType.APPLICATION_JSON) @@ -48,52 +53,44 @@ import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG @Tags({@Tag(name = "SDCE-1 APIs"), @Tag(name = "Vendor License Model - Entitlement Pools")}) @Validated public interface EntitlementPools { + @GET @Path("/") - @Operation(description = "List vendor entitlement pools", responses = @ApiResponse(content = @Content(array = @ArraySchema( schema = @Schema(implementation = EntitlementPoolEntityDto.class))))) - Response listEntitlementPools( - @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, - @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId, - - @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user); + @Operation(description = "List vendor entitlement pools", responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = EntitlementPoolEntityDto.class))))) + Response listEntitlementPools(@Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, + @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId, + @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user); @POST @Path("/") @Operation(description = "Create vendor entitlement pool") Response createEntitlementPool(@Valid EntitlementPoolRequestDto request, @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, - @Parameter(description = "Vendor license model version Id") @PathParam ("versionId") String versionId, - @NotNull(message = USER_MISSING_ERROR_MSG) - @HeaderParam(USER_ID_HEADER_PARAM) String user); + @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId, + @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user); @PUT @Path("/{entitlementPoolId}") @Operation(description = "Update vendor entitlement pool") Response updateEntitlementPool(@Valid EntitlementPoolRequestDto request, - @Parameter(description = "Vendor license model Id") @PathParam("vlmId") - String vlmId, - @Parameter(description = "Vendor license model version Id") - @PathParam("versionId") String versionId, - @NotNull(message = USER_MISSING_ERROR_MSG) - @PathParam("entitlementPoolId") String entitlementPoolId, + @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, + @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId, + @NotNull(message = USER_MISSING_ERROR_MSG) @PathParam("entitlementPoolId") String entitlementPoolId, @HeaderParam(USER_ID_HEADER_PARAM) String user); @GET @Path("/{entitlementPoolId}") @Operation(description = "Get vendor entitlement pool", responses = @ApiResponse(content = @Content(schema = @Schema(implementation = EntitlementPoolEntityDto.class)))) - Response getEntitlementPool( - @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, - @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId, - @PathParam("entitlementPoolId") String entitlementPoolId, - @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user); + Response getEntitlementPool(@Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, + @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId, + @PathParam("entitlementPoolId") String entitlementPoolId, + @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user); @DELETE @Path("/{entitlementPoolId}") @Operation(description = "Delete vendor entitlement pool") - Response deleteEntitlementPool( - @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, - @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId, - @PathParam("entitlementPoolId") String entitlementPoolId, - @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user); - + Response deleteEntitlementPool(@Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, + @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId, + @PathParam("entitlementPoolId") String entitlementPoolId, + @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 80403f59e1..efb6479b0f 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 @@ -7,9 +7,9 @@ * 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. @@ -17,34 +17,38 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - 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.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.info.Info; import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tags; +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; import org.openecomp.sdcrests.vendorlicense.types.FeatureGroupEntityDto; import org.openecomp.sdcrests.vendorlicense.types.FeatureGroupModelDto; import org.openecomp.sdcrests.vendorlicense.types.FeatureGroupRequestDto; import org.openecomp.sdcrests.vendorlicense.types.FeatureGroupUpdateRequestDto; import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import javax.ws.rs.*; -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) @Consumes(MediaType.APPLICATION_JSON) @@ -52,51 +56,43 @@ import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG @Validated public interface FeatureGroups { - @GET - @Path("/") - @Operation(description = "List vendor feature groups",responses = @ApiResponse(content = @Content(array = @ArraySchema( schema = @Schema(implementation =FeatureGroupEntityDto.class))))) - Response listFeatureGroups( - @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, - @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId, - @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user); - - @POST - @Path("/") - @Operation(description = "Create vendor feature group") - Response createFeatureGroup(@Valid FeatureGroupRequestDto request, - @Parameter(description = "Vendor license model Id") @PathParam("vlmId") - String vlmId, - @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId, - @NotNull(message = USER_MISSING_ERROR_MSG) - @HeaderParam(USER_ID_HEADER_PARAM) String user); + @GET + @Path("/") + @Operation(description = "List vendor feature groups", responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = FeatureGroupEntityDto.class))))) + Response listFeatureGroups(@Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, + @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId, + @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user); - @PUT - @Path("/{featureGroupId}") - @Operation(description = "Update vendor feature group") - Response updateFeatureGroup(@Valid FeatureGroupUpdateRequestDto request, - @Parameter(description = "Vendor license model Id") @PathParam("vlmId") - String vlmId, - @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId, - @PathParam("featureGroupId") String featureGroupId, - @NotNull(message = USER_MISSING_ERROR_MSG) - @HeaderParam(USER_ID_HEADER_PARAM) String user); + @POST + @Path("/") + @Operation(description = "Create vendor feature group") + Response createFeatureGroup(@Valid FeatureGroupRequestDto request, + @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, + @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId, + @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user); - @GET - @Path("/{featureGroupId}") - @Operation(description = "Get vendor feature group", responses = @ApiResponse(content = @Content(schema = @Schema(implementation =FeatureGroupModelDto.class)))) - Response getFeatureGroup( - @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, - @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId, - @PathParam("featureGroupId") String featureGroupId, - @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user); + @PUT + @Path("/{featureGroupId}") + @Operation(description = "Update vendor feature group") + Response updateFeatureGroup(@Valid FeatureGroupUpdateRequestDto request, + @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, + @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId, + @PathParam("featureGroupId") String featureGroupId, + @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user); - @DELETE - @Path("/{featureGroupId}") - @Operation(description = "Delete vendor feature group") - Response deleteFeatureGroup( - @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, - @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId, - @PathParam("featureGroupId") String featureGroupId, - @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user); + @GET + @Path("/{featureGroupId}") + @Operation(description = "Get vendor feature group", responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FeatureGroupModelDto.class)))) + Response getFeatureGroup(@Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, + @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId, + @PathParam("featureGroupId") String featureGroupId, + @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user); + @DELETE + @Path("/{featureGroupId}") + @Operation(description = "Delete vendor feature group") + Response deleteFeatureGroup(@Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, + @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId, + @PathParam("featureGroupId") String featureGroupId, + @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user); } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/LicenseAgreements.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/LicenseAgreements.java index 0d384ed7bb..d74ddaa8fe 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/LicenseAgreements.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/LicenseAgreements.java @@ -7,9 +7,9 @@ * 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. @@ -17,89 +17,82 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - 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.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.info.Info; import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tags; +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; import org.openecomp.sdcrests.vendorlicense.types.LicenseAgreementEntityDto; import org.openecomp.sdcrests.vendorlicense.types.LicenseAgreementModelDto; import org.openecomp.sdcrests.vendorlicense.types.LicenseAgreementRequestDto; import org.openecomp.sdcrests.vendorlicense.types.LicenseAgreementUpdateRequestDto; import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import javax.ws.rs.*; -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}/license-agreements") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @Tags({@Tag(name = "SDCE-1 APIs"), @Tag(name = "Vendor License Model - License Agreements")}) @Validated - public interface LicenseAgreements { - @GET - @Path("/") - @Operation(description = "List vendor license agreements", responses = @ApiResponse(content = @Content(array = @ArraySchema( schema = @Schema(implementation =LicenseAgreementEntityDto.class))))) - Response listLicenseAgreements( - @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, - @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId, - @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user); - - @POST - @Path("/") - @Operation(description = "Create vendor license agreement") - Response createLicenseAgreement(@Valid LicenseAgreementRequestDto request, - @Parameter(description = "Vendor license model Id") @PathParam("vlmId") - String vlmId, - @Parameter(description = "Vendor license model version Id") - @PathParam("versionId") String versionId, - @NotNull(message = USER_MISSING_ERROR_MSG) - @HeaderParam(USER_ID_HEADER_PARAM) String user); + @GET + @Path("/") + @Operation(description = "List vendor license agreements", responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = LicenseAgreementEntityDto.class))))) + Response listLicenseAgreements(@Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, + @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId, + @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user); - @PUT - @Path("/{licenseAgreementId}") - @Operation(description = "Update vendor license agreement") - Response updateLicenseAgreement(@Valid LicenseAgreementUpdateRequestDto request, - @Parameter(description = "Vendor license model Id") @PathParam("vlmId") - String vlmId, - @Parameter(description = "Vendor license model version Id") - @PathParam("versionId") String versionId, - @PathParam("licenseAgreementId") String licenseAgreementId, - @NotNull(message = USER_MISSING_ERROR_MSG) - @HeaderParam(USER_ID_HEADER_PARAM) String user); + @POST + @Path("/") + @Operation(description = "Create vendor license agreement") + Response createLicenseAgreement(@Valid LicenseAgreementRequestDto request, + @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, + @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId, + @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user); - @GET - @Path("/{licenseAgreementId}") - @Operation(description = "Get vendor license agreement", responses = @ApiResponse(content = @Content(schema = @Schema(implementation = LicenseAgreementModelDto.class)))) - Response getLicenseAgreement( - @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, - @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId, - @PathParam("licenseAgreementId") String licenseAgreementId, - @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user); + @PUT + @Path("/{licenseAgreementId}") + @Operation(description = "Update vendor license agreement") + Response updateLicenseAgreement(@Valid LicenseAgreementUpdateRequestDto request, + @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, + @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId, + @PathParam("licenseAgreementId") String licenseAgreementId, + @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user); - @DELETE - @Path("/{licenseAgreementId}") - @Operation(description = "Delete vendor license agreement") - Response deleteLicenseAgreement( - @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, - @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId, - @PathParam("licenseAgreementId") String licenseAgreementId, - @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user); + @GET + @Path("/{licenseAgreementId}") + @Operation(description = "Get vendor license agreement", responses = @ApiResponse(content = @Content(schema = @Schema(implementation = LicenseAgreementModelDto.class)))) + Response getLicenseAgreement(@Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, + @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId, + @PathParam("licenseAgreementId") String licenseAgreementId, + @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user); + @DELETE + @Path("/{licenseAgreementId}") + @Operation(description = "Delete vendor license agreement") + Response deleteLicenseAgreement(@Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, + @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId, + @PathParam("licenseAgreementId") String licenseAgreementId, + @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user); } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/LicenseKeyGroupLimits.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/LicenseKeyGroupLimits.java index afa9663b10..898f084d5f 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 @@ -7,9 +7,9 @@ * 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. @@ -17,100 +17,83 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - 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.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.info.Info; import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tags; -import org.openecomp.sdcrests.vendorlicense.types.LimitEntityDto; -import org.openecomp.sdcrests.vendorlicense.types.LimitRequestDto; -import org.springframework.validation.annotation.Validated; - import javax.validation.Valid; import javax.validation.constraints.NotNull; -import javax.ws.rs.*; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; +import org.openecomp.sdcrests.vendorlicense.types.LimitEntityDto; +import org.openecomp.sdcrests.vendorlicense.types.LimitRequestDto; +import org.springframework.validation.annotation.Validated; -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") +@Path("/v1.0/vendor-license-models/{vlmId}/versions/{versionId}/license-key-groups/{licenseKeyGroupId}/limits") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @Tags({@Tag(name = "SDCE-1 APIs"), @Tag(name = "Vendor License Model - License Key Group Limits")}) @Validated public interface LicenseKeyGroupLimits { - @POST - @Path("/") - @Operation(description = "Create vendor license key group limit") - Response createLimit(@Valid LimitRequestDto request, - @Parameter(description = "Vendor license model Id") @PathParam("vlmId") - String vlmId, - @Parameter(description = "Vendor license model version Id") @PathParam - ("versionId") - String versionId, - @Parameter(description = "Vendor license model License Key Group Id") - @PathParam("licenseKeyGroupId") - String licenseKeyGroupId, - @NotNull(message = USER_MISSING_ERROR_MSG) - @HeaderParam(USER_ID_HEADER_PARAM) String user); + @POST + @Path("/") + @Operation(description = "Create vendor license key group limit") + Response createLimit(@Valid LimitRequestDto request, @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, + @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId, + @Parameter(description = "Vendor license model License Key Group Id") @PathParam("licenseKeyGroupId") String licenseKeyGroupId, + @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user); - @GET - @Path("/") - @Operation(description = "List vendor license key group limits", responses = @ApiResponse(content = @Content(array = @ArraySchema( schema = @Schema(implementation = LimitEntityDto.class))))) - Response listLimits( - @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, - @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId, - @Parameter(description = "Vendor license model License Key Group Id") @PathParam("licenseKeyGroupId") - String licenseKeyGroupId, - @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user); + @GET + @Path("/") + @Operation(description = "List vendor license key group limits", responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = LimitEntityDto.class))))) + Response listLimits(@Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, + @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId, + @Parameter(description = "Vendor license model License Key Group Id") @PathParam("licenseKeyGroupId") String licenseKeyGroupId, + @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user); - @PUT - @Path("/{limitId}") - @Operation(description = "Update vendor license key group limit") - Response updateLimit(@Valid LimitRequestDto request, - @Parameter(description = "Vendor license model Id") @PathParam("vlmId") - String vlmId, - @Parameter(description = "Vendor license model version Id") @PathParam - ("versionId") - String versionId, - @Parameter(description = "Vendor license model License Key Group Id") - @PathParam("licenseKeyGroupId") - String licenseKeyGroupId, - @NotNull(message = USER_MISSING_ERROR_MSG) - @PathParam("limitId") String limitId, - @HeaderParam(USER_ID_HEADER_PARAM) String user); + @PUT + @Path("/{limitId}") + @Operation(description = "Update vendor license key group limit") + Response updateLimit(@Valid LimitRequestDto request, @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, + @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId, + @Parameter(description = "Vendor license model License Key Group Id") @PathParam("licenseKeyGroupId") String licenseKeyGroupId, + @NotNull(message = USER_MISSING_ERROR_MSG) @PathParam("limitId") String limitId, + @HeaderParam(USER_ID_HEADER_PARAM) String user); - @GET - @Path("/{limitId}") - @Operation(description = "Get vendor entitlement pool limit", responses = @ApiResponse(content = @Content(schema = @Schema(implementation = LimitEntityDto.class)))) - Response getLimit( - @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, - @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId, - @Parameter(description = "Vendor license model License Key Group") @PathParam - ("licenseKeyGroupId") String entitlementPoolId, - @Parameter(description = "Vendor license model License Key Group Limit Id") @PathParam("limitId") - String limitId, - @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user); + @GET + @Path("/{limitId}") + @Operation(description = "Get vendor entitlement pool limit", responses = @ApiResponse(content = @Content(schema = @Schema(implementation = LimitEntityDto.class)))) + Response getLimit(@Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, + @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId, + @Parameter(description = "Vendor license model License Key Group") @PathParam("licenseKeyGroupId") String entitlementPoolId, + @Parameter(description = "Vendor license model License Key Group Limit Id") @PathParam("limitId") String limitId, + @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user); - @DELETE - @Path("/{limitId}") - @Operation(description = "Delete vendor license key group limit") - Response deleteLimit( - @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, - @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId, - @Parameter(description = "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}") + @Operation(description = "Delete vendor license key group limit") + Response deleteLimit(@Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, + @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId, + @Parameter(description = "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/LicenseKeyGroups.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/LicenseKeyGroups.java index 50dc3c82a1..2bb565b124 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/LicenseKeyGroups.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/LicenseKeyGroups.java @@ -7,9 +7,9 @@ * 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. @@ -17,31 +17,35 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - 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.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.info.Info; import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tags; -import org.openecomp.sdcrests.vendorlicense.types.LicenseKeyGroupEntityDto; -import org.openecomp.sdcrests.vendorlicense.types.LicenseKeyGroupRequestDto; -import org.springframework.validation.annotation.Validated; - import javax.validation.Valid; import javax.validation.constraints.NotNull; -import javax.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.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; - +import org.openecomp.sdcrests.vendorlicense.types.LicenseKeyGroupEntityDto; +import org.openecomp.sdcrests.vendorlicense.types.LicenseKeyGroupRequestDto; +import org.springframework.validation.annotation.Validated; @Path("/v1.0/vendor-license-models/{vlmId}/versions/{versionId}/license-key-groups") @Produces(MediaType.APPLICATION_JSON) @@ -49,52 +53,44 @@ import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG @Tags({@Tag(name = "SDCE-1 APIs"), @Tag(name = "Vendor License Model - License Key Groups")}) @Validated public interface LicenseKeyGroups { - @GET - @Path("/") - @Operation(description = "List vendor license key groups", responses = @ApiResponse(content = @Content(array = @ArraySchema( schema = @Schema(implementation =LicenseKeyGroupEntityDto.class))))) - Response listLicenseKeyGroups( - @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, - @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId, - @HeaderParam(USER_ID_HEADER_PARAM) String user); - @POST - @Path("/") - @Operation(description = "Create vendor license key group") - Response createLicenseKeyGroup(@Valid LicenseKeyGroupRequestDto request, - @Parameter(description = "Vendor license model Id") @PathParam("vlmId") - String vlmId, - @Parameter(description = "Vendor license model version Id") - @PathParam("versionId") String versionId, - @NotNull(message = USER_MISSING_ERROR_MSG) - @HeaderParam(USER_ID_HEADER_PARAM) String user); + @GET + @Path("/") + @Operation(description = "List vendor license key groups", responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = LicenseKeyGroupEntityDto.class))))) + Response listLicenseKeyGroups(@Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, + @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId, + @HeaderParam(USER_ID_HEADER_PARAM) String user); + + @POST + @Path("/") + @Operation(description = "Create vendor license key group") + Response createLicenseKeyGroup(@Valid LicenseKeyGroupRequestDto request, + @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, + @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId, + @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user); - @PUT - @Path("/{licenseKeyGroupId}") - @Operation(description = "Update vendor license key group") - Response updateLicenseKeyGroup(@Valid LicenseKeyGroupRequestDto request, - @Parameter(description = "Vendor license model Id") @PathParam("vlmId") - String vlmId, - @Parameter(description = "Vendor license model version Id") - @PathParam("versionId") String versionId, - @PathParam("licenseKeyGroupId") String licenseKeyGroupId, - @NotNull(message = USER_MISSING_ERROR_MSG) - @HeaderParam(USER_ID_HEADER_PARAM) String user); + @PUT + @Path("/{licenseKeyGroupId}") + @Operation(description = "Update vendor license key group") + Response updateLicenseKeyGroup(@Valid LicenseKeyGroupRequestDto request, + @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, + @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId, + @PathParam("licenseKeyGroupId") String licenseKeyGroupId, + @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user); - @GET - @Path("/{licenseKeyGroupId}") - @Operation(description = "Get vendor license key group",responses = @ApiResponse(content = @Content(schema = @Schema(implementation = LicenseKeyGroupEntityDto.class)))) - Response getLicenseKeyGroup( - @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, - @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId, - @PathParam("licenseKeyGroupId") String licenseKeyGroupId, - @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user); + @GET + @Path("/{licenseKeyGroupId}") + @Operation(description = "Get vendor license key group", responses = @ApiResponse(content = @Content(schema = @Schema(implementation = LicenseKeyGroupEntityDto.class)))) + Response getLicenseKeyGroup(@Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, + @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId, + @PathParam("licenseKeyGroupId") String licenseKeyGroupId, + @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user); - @DELETE - @Path("/{licenseKeyGroupId}") - @Operation(description = "Delete vendor license key group") - Response deleteLicenseKeyGroup( - @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, - @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId, - @PathParam("licenseKeyGroupId") String licenseKeyGroupId, - @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user); + @DELETE + @Path("/{licenseKeyGroupId}") + @Operation(description = "Delete vendor license key group") + Response deleteLicenseKeyGroup(@Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, + @Parameter(description = "Vendor license model version Id") @PathParam("versionId") String versionId, + @PathParam("licenseKeyGroupId") String licenseKeyGroupId, + @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 3778129f7f..0636b6e599 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 @@ -13,19 +13,32 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - - package org.openecomp.sdcrests.vendorlicense.rest; +import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG; + import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.info.Info; import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tags; +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; import org.openecomp.sdcrests.common.RestConstants; import org.openecomp.sdcrests.item.types.ItemDto; import org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelActionRequestDto; @@ -33,15 +46,6 @@ import org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelEntityDto; import org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelRequestDto; import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import javax.ws.rs.*; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - -import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG; - - @Path("/v1.0/vendor-license-models") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @@ -49,64 +53,48 @@ import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG @Validated public interface VendorLicenseModels { - @GET - @Path("/") - @Operation(description = "List vendor license models", responses = @ApiResponse(content = @Content(array = @ArraySchema( schema = @Schema(implementation=ItemDto.class))))) - Response listLicenseModels(@Parameter(description = "Filter to return only Vendor License Models with at" + - " least one version at this status. Currently supported values: 'Certified' , 'Draft'") - @QueryParam("versionFilter") String versionStatus, - @Parameter(description = "Filter to only return Vendor License Models at this status." + - "Currently supported values: 'ACTIVE' , 'ARCHIVED'." + - "Default value = 'ACTIVE'.") - @QueryParam("Status") String itemStatus, - @NotNull(message = USER_MISSING_ERROR_MSG) - @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user); - - @POST - @Path("/") - @Operation(description = "Create vendor license model") - Response createLicenseModel(@Valid VendorLicenseModelRequestDto request, - @NotNull(message = USER_MISSING_ERROR_MSG) - @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user); + @GET + @Path("/") + @Operation(description = "List vendor license models", responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = ItemDto.class))))) + Response listLicenseModels(@Parameter(description = "Filter to return only Vendor License Models with at" + + " least one version at this status. Currently supported values: 'Certified' , 'Draft'") @QueryParam("versionFilter") String versionStatus, + @Parameter(description = "Filter to only return Vendor License Models at this status." + + "Currently supported values: 'ACTIVE' , 'ARCHIVED'." + + "Default value = 'ACTIVE'.") @QueryParam("Status") String itemStatus, + @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user); - @DELETE - @Path("/{vlmId}") - @Operation(description = "Delete vendor license model") - Response deleteLicenseModel( - @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, - @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) - String user); + @POST + @Path("/") + @Operation(description = "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}") - @Operation(description = "Update vendor license model") - Response updateLicenseModel(@Valid VendorLicenseModelRequestDto request, - @Parameter(description = "Vendor license model Id") - @PathParam("vlmId") String vlmId, - @Parameter(description = "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}") + @Operation(description = "Delete vendor license model") + Response deleteLicenseModel(@Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, + @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user); - @GET - @Path("/{vlmId}/versions/{versionId}") - @Operation(description = "Get vendor license model", responses = @ApiResponse(content = @Content(schema = @Schema(implementation=VendorLicenseModelEntityDto.class)))) - Response getLicenseModel( - @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, - @Parameter(description = "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}") + @Operation(description = "Update vendor license model") + Response updateLicenseModel(@Valid VendorLicenseModelRequestDto request, + @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, + @Parameter(description = "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}") + @Operation(description = "Get vendor license model", responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VendorLicenseModelEntityDto.class)))) + Response getLicenseModel(@Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, + @Parameter(description = "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") - @Operation(description = "Update vendor license model") - Response actOnLicenseModel(@Valid VendorLicenseModelActionRequestDto request, - @Parameter(description = "Vendor license model Id") @PathParam("vlmId") - String vlmId, - @Parameter(description = "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") + @Operation(description = "Update vendor license model") + Response actOnLicenseModel(@Valid VendorLicenseModelActionRequestDto request, + @Parameter(description = "Vendor license model Id") @PathParam("vlmId") String vlmId, + @Parameter(description = "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/LimitCreationDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/LimitCreationDto.java index 35833e9621..05d2d1ac77 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/LimitCreationDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/LimitCreationDto.java @@ -7,9 +7,9 @@ * 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. @@ -17,17 +17,17 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdcrests.vendorlicense.rest.mapping; public class LimitCreationDto { - private String limitId; - public String getLimitId() { - return limitId; - } + private String limitId; + + public String getLimitId() { + return limitId; + } - public void setLimitId(String limitId) { - this.limitId = limitId; - } + public void setLimitId(String limitId) { + this.limitId = limitId; + } } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapChoiceOrOtherDtoToChoiceOrOther.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/MapChoiceOrOtherDtoToChoiceOrOther.java index 28eeb29018..f4b6119056 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapChoiceOrOtherDtoToChoiceOrOther.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/MapChoiceOrOtherDtoToChoiceOrOther.java @@ -7,9 +7,9 @@ * 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. @@ -17,20 +17,18 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdcrests.vendorlicense.rest.mapping; import org.openecomp.sdc.vendorlicense.dao.types.ChoiceOrOther; import org.openecomp.sdcrests.mapping.MappingBase; import org.openecomp.sdcrests.vendorlicense.types.ChoiceOrOtherDto; -public class MapChoiceOrOtherDtoToChoiceOrOther - extends MappingBase<ChoiceOrOtherDto, ChoiceOrOther> { +public class MapChoiceOrOtherDtoToChoiceOrOther extends MappingBase<ChoiceOrOtherDto, ChoiceOrOther> { - @Override - public void doMapping(ChoiceOrOtherDto source, ChoiceOrOther target) { - target.setChoice(source.getChoice()); - target.setOther(source.getOther()); - target.setResult(null); - } + @Override + public void doMapping(ChoiceOrOtherDto source, ChoiceOrOther target) { + target.setChoice(source.getChoice()); + target.setOther(source.getOther()); + target.setResult(null); + } } 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/MapChoiceOrOtherToChoiceOrOtherDto.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/MapChoiceOrOtherToChoiceOrOtherDto.java index 2d686110d5..aad72491ac 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapChoiceOrOtherToChoiceOrOtherDto.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/MapChoiceOrOtherToChoiceOrOtherDto.java @@ -7,9 +7,9 @@ * 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. @@ -17,19 +17,17 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdcrests.vendorlicense.rest.mapping; import org.openecomp.sdc.vendorlicense.dao.types.ChoiceOrOther; import org.openecomp.sdcrests.mapping.MappingBase; import org.openecomp.sdcrests.vendorlicense.types.ChoiceOrOtherDto; -public class MapChoiceOrOtherToChoiceOrOtherDto - extends MappingBase<ChoiceOrOther, ChoiceOrOtherDto> { +public class MapChoiceOrOtherToChoiceOrOtherDto extends MappingBase<ChoiceOrOther, ChoiceOrOtherDto> { - @Override - public void doMapping(ChoiceOrOther source, ChoiceOrOtherDto target) { - target.setChoice(source.getChoice()); - target.setOther(source.getOther()); - } + @Override + public void doMapping(ChoiceOrOther source, ChoiceOrOtherDto target) { + target.setChoice(source.getChoice()); + target.setOther(source.getOther()); + } } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolEntityToEntitlementPoolEntityDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolEntityToEntitlementPoolEntityDto.java index 2510bd0634..6dc6e6af92 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolEntityToEntitlementPoolEntityDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolEntityToEntitlementPoolEntityDto.java @@ -7,9 +7,9 @@ * 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. @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdcrests.vendorlicense.rest.mapping; import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity; @@ -25,26 +24,23 @@ import org.openecomp.sdcrests.mapping.MappingBase; import org.openecomp.sdcrests.vendorlicense.types.EntitlementPoolEntityDto; import org.openecomp.sdcrests.vendorlicense.types.MultiChoiceOrOtherDto; -public class MapEntitlementPoolEntityToEntitlementPoolEntityDto - extends MappingBase<EntitlementPoolEntity, EntitlementPoolEntityDto> { - @Override - public void doMapping(EntitlementPoolEntity source, EntitlementPoolEntityDto target) { - target.setId(source.getId()); - target.setName(source.getName()); - target.setDescription(source.getDescription()); - target.setType(source.getType()); - target.setThresholdValue(source.getThresholdValue()); - target.setThresholdUnits(source.getThresholdUnit()); - target.setIncrements(source.getIncrements()); - - target.setOperationalScope(new MapMultiChoiceOrOtherToMultiChoiceOrOtherDto() - .applyMapping(source.getOperationalScope(), MultiChoiceOrOtherDto.class)); - - target.setReferencingFeatureGroups(source.getReferencingFeatureGroups()); +public class MapEntitlementPoolEntityToEntitlementPoolEntityDto extends MappingBase<EntitlementPoolEntity, EntitlementPoolEntityDto> { - target.setStartDate(source.getStartDate()); - target.setExpiryDate(source.getExpiryDate()); - target.setVersionUUID(source.getVersionUuId()); - target.setManufacturerReferenceNumber(source.getManufacturerReferenceNumber()); - } + @Override + public void doMapping(EntitlementPoolEntity source, EntitlementPoolEntityDto target) { + target.setId(source.getId()); + target.setName(source.getName()); + target.setDescription(source.getDescription()); + target.setType(source.getType()); + target.setThresholdValue(source.getThresholdValue()); + target.setThresholdUnits(source.getThresholdUnit()); + target.setIncrements(source.getIncrements()); + target.setOperationalScope( + new MapMultiChoiceOrOtherToMultiChoiceOrOtherDto().applyMapping(source.getOperationalScope(), MultiChoiceOrOtherDto.class)); + target.setReferencingFeatureGroups(source.getReferencingFeatureGroups()); + target.setStartDate(source.getStartDate()); + target.setExpiryDate(source.getExpiryDate()); + target.setVersionUUID(source.getVersionUuId()); + target.setManufacturerReferenceNumber(source.getManufacturerReferenceNumber()); + } } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolRequestDtoToEntitlementPoolEntity.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolRequestDtoToEntitlementPoolEntity.java index 5c45ed652a..1058a869aa 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolRequestDtoToEntitlementPoolEntity.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolRequestDtoToEntitlementPoolEntity.java @@ -7,9 +7,9 @@ * 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. @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdcrests.vendorlicense.rest.mapping; import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity; @@ -25,21 +24,20 @@ import org.openecomp.sdc.vendorlicense.dao.types.MultiChoiceOrOther; import org.openecomp.sdcrests.mapping.MappingBase; import org.openecomp.sdcrests.vendorlicense.types.EntitlementPoolRequestDto; -public class MapEntitlementPoolRequestDtoToEntitlementPoolEntity - extends MappingBase<EntitlementPoolRequestDto, EntitlementPoolEntity> { - @Override - public void doMapping(EntitlementPoolRequestDto source, EntitlementPoolEntity target) { - target.setName(source.getName()); - target.setManufacturerReferenceNumber(source.getManufacturerReferenceNumber()); - target.setDescription(source.getDescription()); - target.setType(source.getType()); - target.setThresholdValue(source.getThresholdValue()); - target.setThresholdUnit(source.getThresholdUnits()); - target.setIncrements(source.getIncrements()); - target.setOperationalScope(new MapMultiChoiceOrOtherDtoToMultiChoiceOrOther() - .applyMapping(source.getOperationalScope(), MultiChoiceOrOther.class)); +public class MapEntitlementPoolRequestDtoToEntitlementPoolEntity extends MappingBase<EntitlementPoolRequestDto, EntitlementPoolEntity> { - target.setStartDate(source.getStartDate()); - target.setExpiryDate(source.getExpiryDate()); - } + @Override + public void doMapping(EntitlementPoolRequestDto source, EntitlementPoolEntity target) { + target.setName(source.getName()); + target.setManufacturerReferenceNumber(source.getManufacturerReferenceNumber()); + target.setDescription(source.getDescription()); + target.setType(source.getType()); + target.setThresholdValue(source.getThresholdValue()); + target.setThresholdUnit(source.getThresholdUnits()); + target.setIncrements(source.getIncrements()); + target.setOperationalScope( + new MapMultiChoiceOrOtherDtoToMultiChoiceOrOther().applyMapping(source.getOperationalScope(), MultiChoiceOrOther.class)); + target.setStartDate(source.getStartDate()); + target.setExpiryDate(source.getExpiryDate()); + } } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapFeatureGroupDescriptorDtoToFeatureGroupEntity.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapFeatureGroupDescriptorDtoToFeatureGroupEntity.java index 5dbf087e45..e362c92196 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapFeatureGroupDescriptorDtoToFeatureGroupEntity.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapFeatureGroupDescriptorDtoToFeatureGroupEntity.java @@ -7,9 +7,9 @@ * 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. @@ -17,19 +17,18 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdcrests.vendorlicense.rest.mapping; import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity; import org.openecomp.sdcrests.mapping.MappingBase; import org.openecomp.sdcrests.vendorlicense.types.FeatureGroupDescriptorDto; -public class MapFeatureGroupDescriptorDtoToFeatureGroupEntity - extends MappingBase<FeatureGroupDescriptorDto, FeatureGroupEntity> { - @Override - public void doMapping(FeatureGroupDescriptorDto source, FeatureGroupEntity target) { - target.setName(source.getName()); - target.setDescription(source.getDescription()); - target.setPartNumber(source.getPartNumber()); - } -}
\ No newline at end of file +public class MapFeatureGroupDescriptorDtoToFeatureGroupEntity extends MappingBase<FeatureGroupDescriptorDto, FeatureGroupEntity> { + + @Override + public void doMapping(FeatureGroupDescriptorDto source, FeatureGroupEntity target) { + target.setName(source.getName()); + target.setDescription(source.getDescription()); + target.setPartNumber(source.getPartNumber()); + } +} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapFeatureGroupEntityToFeatureGroupDescriptorDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapFeatureGroupEntityToFeatureGroupDescriptorDto.java index 70f5666bcb..ee8626abaa 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapFeatureGroupEntityToFeatureGroupDescriptorDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapFeatureGroupEntityToFeatureGroupDescriptorDto.java @@ -7,9 +7,9 @@ * 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. @@ -17,19 +17,18 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdcrests.vendorlicense.rest.mapping; import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity; import org.openecomp.sdcrests.mapping.MappingBase; import org.openecomp.sdcrests.vendorlicense.types.FeatureGroupDescriptorDto; -public class MapFeatureGroupEntityToFeatureGroupDescriptorDto - extends MappingBase<FeatureGroupEntity, FeatureGroupDescriptorDto> { - @Override - public void doMapping(FeatureGroupEntity source, FeatureGroupDescriptorDto target) { - target.setName(source.getName()); - target.setDescription(source.getDescription()); - target.setPartNumber(source.getPartNumber()); - } +public class MapFeatureGroupEntityToFeatureGroupDescriptorDto extends MappingBase<FeatureGroupEntity, FeatureGroupDescriptorDto> { + + @Override + public void doMapping(FeatureGroupEntity source, FeatureGroupDescriptorDto target) { + target.setName(source.getName()); + target.setDescription(source.getDescription()); + target.setPartNumber(source.getPartNumber()); + } } 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/MapLicenseAgreementDescriptorDtoToLicenseAgreementEntity.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/MapLicenseAgreementDescriptorDtoToLicenseAgreementEntity.java index f5ea8414d5..98d703299b 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseAgreementDescriptorDtoToLicenseAgreementEntity.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/MapLicenseAgreementDescriptorDtoToLicenseAgreementEntity.java @@ -7,9 +7,9 @@ * 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. @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdcrests.vendorlicense.rest.mapping; import org.openecomp.sdc.vendorlicense.dao.types.ChoiceOrOther; @@ -25,14 +24,13 @@ import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementEntity; import org.openecomp.sdcrests.mapping.MappingBase; import org.openecomp.sdcrests.vendorlicense.types.LicenseAgreementDescriptorDto; -public class MapLicenseAgreementDescriptorDtoToLicenseAgreementEntity - extends MappingBase<LicenseAgreementDescriptorDto, LicenseAgreementEntity> { - @Override - public void doMapping(LicenseAgreementDescriptorDto source, LicenseAgreementEntity target) { - target.setName(source.getName()); - target.setDescription(source.getDescription()); - target.setLicenseTerm(new MapChoiceOrOtherDtoToChoiceOrOther() - .applyMapping(source.getLicenseTerm(), ChoiceOrOther.class)); - target.setRequirementsAndConstrains(source.getRequirementsAndConstrains()); - } +public class MapLicenseAgreementDescriptorDtoToLicenseAgreementEntity extends MappingBase<LicenseAgreementDescriptorDto, LicenseAgreementEntity> { + + @Override + public void doMapping(LicenseAgreementDescriptorDto source, LicenseAgreementEntity target) { + target.setName(source.getName()); + target.setDescription(source.getDescription()); + target.setLicenseTerm(new MapChoiceOrOtherDtoToChoiceOrOther().applyMapping(source.getLicenseTerm(), ChoiceOrOther.class)); + target.setRequirementsAndConstrains(source.getRequirementsAndConstrains()); + } } 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/MapLicenseAgreementEntityToLicenseAgreementDescriptorDto.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/MapLicenseAgreementEntityToLicenseAgreementDescriptorDto.java index 2fd4f669cf..46de11f021 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseAgreementEntityToLicenseAgreementDescriptorDto.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/MapLicenseAgreementEntityToLicenseAgreementDescriptorDto.java @@ -7,9 +7,9 @@ * 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. @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdcrests.vendorlicense.rest.mapping; import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementEntity; @@ -25,14 +24,13 @@ import org.openecomp.sdcrests.mapping.MappingBase; import org.openecomp.sdcrests.vendorlicense.types.ChoiceOrOtherDto; import org.openecomp.sdcrests.vendorlicense.types.LicenseAgreementDescriptorDto; -public class MapLicenseAgreementEntityToLicenseAgreementDescriptorDto - extends MappingBase<LicenseAgreementEntity, LicenseAgreementDescriptorDto> { - @Override - public void doMapping(LicenseAgreementEntity source, LicenseAgreementDescriptorDto target) { - target.setName(source.getName()); - target.setDescription(source.getDescription()); - target.setLicenseTerm(new MapChoiceOrOtherToChoiceOrOtherDto() - .applyMapping(source.getLicenseTerm(), ChoiceOrOtherDto.class)); - target.setRequirementsAndConstrains(source.getRequirementsAndConstrains()); - } +public class MapLicenseAgreementEntityToLicenseAgreementDescriptorDto extends MappingBase<LicenseAgreementEntity, LicenseAgreementDescriptorDto> { + + @Override + public void doMapping(LicenseAgreementEntity source, LicenseAgreementDescriptorDto target) { + target.setName(source.getName()); + target.setDescription(source.getDescription()); + target.setLicenseTerm(new MapChoiceOrOtherToChoiceOrOtherDto().applyMapping(source.getLicenseTerm(), ChoiceOrOtherDto.class)); + target.setRequirementsAndConstrains(source.getRequirementsAndConstrains()); + } } 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/MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto.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/MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto.java index c543cf402e..3690a7c5d3 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto.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/MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto.java @@ -7,9 +7,9 @@ * 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. @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdcrests.vendorlicense.rest.mapping; import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity; @@ -25,23 +24,23 @@ import org.openecomp.sdcrests.mapping.MappingBase; import org.openecomp.sdcrests.vendorlicense.types.LicenseKeyGroupEntityDto; import org.openecomp.sdcrests.vendorlicense.types.MultiChoiceOrOtherDto; -public class MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto - extends MappingBase<LicenseKeyGroupEntity, LicenseKeyGroupEntityDto> { - @Override - public void doMapping(LicenseKeyGroupEntity source, LicenseKeyGroupEntityDto target) { - target.setId(source.getId()); - target.setName(source.getName()); - target.setDescription(source.getDescription()); - target.setType(source.getType()); - target.setOperationalScope(new MapMultiChoiceOrOtherToMultiChoiceOrOtherDto() - .applyMapping(source.getOperationalScope(), MultiChoiceOrOtherDto.class)); - target.setReferencingFeatureGroups(source.getReferencingFeatureGroups()); - target.setStartDate(source.getStartDate()); - target.setExpiryDate(source.getExpiryDate()); - target.setThresholdUnits(source.getThresholdUnits()); - target.setThresholdValue(source.getThresholdValue()); - target.setIncrements(source.getIncrements()); - target.setVersionUUID(source.getVersionUuId()); - target.setManufacturerReferenceNumber(source.getManufacturerReferenceNumber()); - } +public class MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto extends MappingBase<LicenseKeyGroupEntity, LicenseKeyGroupEntityDto> { + + @Override + public void doMapping(LicenseKeyGroupEntity source, LicenseKeyGroupEntityDto target) { + target.setId(source.getId()); + target.setName(source.getName()); + target.setDescription(source.getDescription()); + target.setType(source.getType()); + target.setOperationalScope( + new MapMultiChoiceOrOtherToMultiChoiceOrOtherDto().applyMapping(source.getOperationalScope(), MultiChoiceOrOtherDto.class)); + target.setReferencingFeatureGroups(source.getReferencingFeatureGroups()); + target.setStartDate(source.getStartDate()); + target.setExpiryDate(source.getExpiryDate()); + target.setThresholdUnits(source.getThresholdUnits()); + target.setThresholdValue(source.getThresholdValue()); + target.setIncrements(source.getIncrements()); + target.setVersionUUID(source.getVersionUuId()); + target.setManufacturerReferenceNumber(source.getManufacturerReferenceNumber()); + } } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity.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/MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity.java index 87eea4ba1e..ed0e79d0a5 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity.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/MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity.java @@ -7,9 +7,9 @@ * 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. @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdcrests.vendorlicense.rest.mapping; import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity; @@ -25,20 +24,20 @@ import org.openecomp.sdc.vendorlicense.dao.types.MultiChoiceOrOther; import org.openecomp.sdcrests.mapping.MappingBase; import org.openecomp.sdcrests.vendorlicense.types.LicenseKeyGroupRequestDto; -public class MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity - extends MappingBase<LicenseKeyGroupRequestDto, LicenseKeyGroupEntity> { - @Override - public void doMapping(LicenseKeyGroupRequestDto source, LicenseKeyGroupEntity target) { - target.setName(source.getName()); - target.setManufacturerReferenceNumber(source.getManufacturerReferenceNumber()); - target.setDescription(source.getDescription()); - target.setType(source.getType()); - target.setOperationalScope(new MapMultiChoiceOrOtherDtoToMultiChoiceOrOther() - .applyMapping(source.getOperationalScope(), MultiChoiceOrOther.class)); - target.setStartDate(source.getStartDate()); - target.setExpiryDate(source.getExpiryDate()); - target.setThresholdUnits(source.getThresholdUnits()); - target.setThresholdValue(source.getThresholdValue()); - target.setIncrements(source.getIncrements()); - } +public class MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity extends MappingBase<LicenseKeyGroupRequestDto, LicenseKeyGroupEntity> { + + @Override + public void doMapping(LicenseKeyGroupRequestDto source, LicenseKeyGroupEntity target) { + target.setName(source.getName()); + target.setManufacturerReferenceNumber(source.getManufacturerReferenceNumber()); + target.setDescription(source.getDescription()); + target.setType(source.getType()); + target.setOperationalScope( + new MapMultiChoiceOrOtherDtoToMultiChoiceOrOther().applyMapping(source.getOperationalScope(), MultiChoiceOrOther.class)); + target.setStartDate(source.getStartDate()); + target.setExpiryDate(source.getExpiryDate()); + target.setThresholdUnits(source.getThresholdUnits()); + target.setThresholdValue(source.getThresholdValue()); + target.setIncrements(source.getIncrements()); + } } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLimitEntityToLimitCreationDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLimitEntityToLimitCreationDto.java index ef4ae1ccdc..eb1a8a2def 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLimitEntityToLimitCreationDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLimitEntityToLimitCreationDto.java @@ -7,9 +7,9 @@ * 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. @@ -17,16 +17,15 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdcrests.vendorlicense.rest.mapping; import org.openecomp.sdc.vendorlicense.dao.types.LimitEntity; import org.openecomp.sdcrests.mapping.MappingBase; -public class MapLimitEntityToLimitCreationDto extends - MappingBase<LimitEntity, LimitCreationDto> { - @Override - public void doMapping(LimitEntity source, LimitCreationDto target) { - target.setLimitId(source.getId()); - } +public class MapLimitEntityToLimitCreationDto extends MappingBase<LimitEntity, LimitCreationDto> { + + @Override + public void doMapping(LimitEntity source, LimitCreationDto target) { + target.setLimitId(source.getId()); + } } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLimitEntityToLimitDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLimitEntityToLimitDto.java index b17a0e08d4..030fcc1c91 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLimitEntityToLimitDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLimitEntityToLimitDto.java @@ -7,9 +7,9 @@ * 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. @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdcrests.vendorlicense.rest.mapping; import org.openecomp.sdc.vendorlicense.dao.types.LimitEntity; @@ -26,17 +25,16 @@ import org.openecomp.sdcrests.vendorlicense.types.LimitEntityDto; public class MapLimitEntityToLimitDto extends MappingBase<LimitEntity, LimitEntityDto> { - @Override - public void doMapping(LimitEntity source, LimitEntityDto target) { - target.setId(source.getId()); - target.setName(source.getName()); - target.setDescription(source.getDescription()); - target.setMetric(source.getMetric()); - target.setAggregationFunction(source.getAggregationFunction() != null ? source - .getAggregationFunction().name() : null); - target.setTime(source.getTime()); - target.setType(source.getType() != null ? source.getType().name() : null); - target.setUnit(source.getUnit()); - target.setValue(source.getValue()); - } + @Override + public void doMapping(LimitEntity source, LimitEntityDto target) { + target.setId(source.getId()); + target.setName(source.getName()); + target.setDescription(source.getDescription()); + target.setMetric(source.getMetric()); + target.setAggregationFunction(source.getAggregationFunction() != null ? source.getAggregationFunction().name() : null); + target.setTime(source.getTime()); + target.setType(source.getType() != null ? source.getType().name() : null); + target.setUnit(source.getUnit()); + target.setValue(source.getValue()); + } } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLimitRequestDtoToLimitEntity.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLimitRequestDtoToLimitEntity.java index 99f45bfc18..2de29c6e0c 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLimitRequestDtoToLimitEntity.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLimitRequestDtoToLimitEntity.java @@ -7,9 +7,9 @@ * 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. @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdcrests.vendorlicense.rest.mapping; import org.openecomp.sdc.common.errors.CoreException; @@ -32,11 +31,9 @@ import org.openecomp.sdc.vendorlicense.errors.VendorLicenseErrorCodes; import org.openecomp.sdcrests.mapping.MappingBase; import org.openecomp.sdcrests.vendorlicense.types.LimitRequestDto; - public class MapLimitRequestDtoToLimitEntity extends MappingBase<LimitRequestDto, LimitEntity> { - private static final Logger logger = - LoggerFactory.getLogger(MapLimitRequestDtoToLimitEntity.class); + private static final Logger logger = LoggerFactory.getLogger(MapLimitRequestDtoToLimitEntity.class); @Override public void doMapping(LimitRequestDto source, LimitEntity target) { @@ -49,27 +46,22 @@ public class MapLimitRequestDtoToLimitEntity extends MappingBase<LimitRequestDto logger.error(exception.getMessage(), exception); throwInvalidValueError("type", VendorLicenseErrorCodes.LIMIT_INVALID_TYPE); } - try { - AggregationFunction function = source.getAggregationFunction() != null ? - AggregationFunction.valueOf(source.getAggregationFunction()) : null; + AggregationFunction function = + source.getAggregationFunction() != null ? AggregationFunction.valueOf(source.getAggregationFunction()) : null; target.setAggregationFunction(function); } catch (IllegalArgumentException exception) { logger.error(exception.getMessage(), exception); - throwInvalidValueError("aggregationFunction", - VendorLicenseErrorCodes.LIMIT_INVALID_AGGREGATIONFUNCTION); + throwInvalidValueError("aggregationFunction", VendorLicenseErrorCodes.LIMIT_INVALID_AGGREGATIONFUNCTION); } - target.setTime(source.getTime()); target.setMetric(source.getMetric()); target.setValue(source.getValue()); target.setUnit(source.getUnit()); - } private void throwInvalidValueError(String attribute, String vendorLicenseErrorCode) { - ErrorCode errorCode = LimitErrorBuilder.getInvalidValueErrorBuilder(attribute, - vendorLicenseErrorCode); + ErrorCode errorCode = LimitErrorBuilder.getInvalidValueErrorBuilder(attribute, vendorLicenseErrorCode); throw new CoreException(errorCode); } } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapMultiChoiceOrOtherDtoToMultiChoiceOrOther.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/MapMultiChoiceOrOtherDtoToMultiChoiceOrOther.java index 320bf67bdf..ad0aab26d1 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapMultiChoiceOrOtherDtoToMultiChoiceOrOther.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/MapMultiChoiceOrOtherDtoToMultiChoiceOrOther.java @@ -7,9 +7,9 @@ * 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. @@ -17,20 +17,18 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdcrests.vendorlicense.rest.mapping; import org.openecomp.sdc.vendorlicense.dao.types.MultiChoiceOrOther; import org.openecomp.sdcrests.mapping.MappingBase; import org.openecomp.sdcrests.vendorlicense.types.MultiChoiceOrOtherDto; -public class MapMultiChoiceOrOtherDtoToMultiChoiceOrOther - extends MappingBase<MultiChoiceOrOtherDto, MultiChoiceOrOther> { +public class MapMultiChoiceOrOtherDtoToMultiChoiceOrOther extends MappingBase<MultiChoiceOrOtherDto, MultiChoiceOrOther> { - @Override - public void doMapping(MultiChoiceOrOtherDto source, MultiChoiceOrOther target) { - target.setChoices(source.getChoices()); - target.setOther(source.getOther()); - target.setResults(null); - } + @Override + public void doMapping(MultiChoiceOrOtherDto source, MultiChoiceOrOther target) { + target.setChoices(source.getChoices()); + target.setOther(source.getOther()); + target.setResults(null); + } } 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/MapMultiChoiceOrOtherToMultiChoiceOrOtherDto.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/MapMultiChoiceOrOtherToMultiChoiceOrOtherDto.java index 9649053fb4..93a2007897 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapMultiChoiceOrOtherToMultiChoiceOrOtherDto.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/MapMultiChoiceOrOtherToMultiChoiceOrOtherDto.java @@ -7,9 +7,9 @@ * 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. @@ -17,19 +17,17 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdcrests.vendorlicense.rest.mapping; import org.openecomp.sdc.vendorlicense.dao.types.MultiChoiceOrOther; import org.openecomp.sdcrests.mapping.MappingBase; import org.openecomp.sdcrests.vendorlicense.types.MultiChoiceOrOtherDto; -public class MapMultiChoiceOrOtherToMultiChoiceOrOtherDto - extends MappingBase<MultiChoiceOrOther, MultiChoiceOrOtherDto> { +public class MapMultiChoiceOrOtherToMultiChoiceOrOtherDto extends MappingBase<MultiChoiceOrOther, MultiChoiceOrOtherDto> { - @Override - public void doMapping(MultiChoiceOrOther source, MultiChoiceOrOtherDto target) { - target.setChoices(source.getChoices()); - target.setOther(source.getOther()); - } + @Override + public void doMapping(MultiChoiceOrOther source, MultiChoiceOrOtherDto target) { + target.setChoices(source.getChoices()); + target.setOther(source.getOther()); + } } 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 index 7bdde1d592..5b0bfb7d73 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/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 @@ -17,20 +17,19 @@ * 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()); - } +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/MapVendorLicenseModelRequestDtoToVendorLicenseModelEntity.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapVendorLicenseModelRequestDtoToVendorLicenseModelEntity.java index 593a4a37b0..2cbc81980a 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapVendorLicenseModelRequestDtoToVendorLicenseModelEntity.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapVendorLicenseModelRequestDtoToVendorLicenseModelEntity.java @@ -7,9 +7,9 @@ * 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. @@ -17,19 +17,18 @@ * 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.VendorLicenseModelRequestDto; -public class MapVendorLicenseModelRequestDtoToVendorLicenseModelEntity - extends MappingBase<VendorLicenseModelRequestDto, VendorLicenseModelEntity> { - @Override - public void doMapping(VendorLicenseModelRequestDto source, VendorLicenseModelEntity target) { - target.setVendorName(source.getVendorName()); - target.setDescription(source.getDescription()); - target.setIconRef(source.getIconRef()); - } +public class MapVendorLicenseModelRequestDtoToVendorLicenseModelEntity extends MappingBase<VendorLicenseModelRequestDto, VendorLicenseModelEntity> { + + @Override + public void doMapping(VendorLicenseModelRequestDto source, VendorLicenseModelEntity target) { + 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/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 544c1d7331..38e0a78154 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 @@ -7,9 +7,9 @@ * 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. @@ -17,10 +17,11 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdcrests.vendorlicense.rest.services; - +import java.util.Collection; +import javax.inject.Named; +import javax.ws.rs.core.Response; import org.openecomp.sdc.vendorlicense.VendorLicenseManager; import org.openecomp.sdc.vendorlicense.VendorLicenseManagerFactory; import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity; @@ -37,126 +38,89 @@ import org.openecomp.sdcrests.wrappers.GenericCollectionWrapper; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Service; -import javax.inject.Named; -import javax.ws.rs.core.Response; -import java.util.Collection; - @Named @Service("entitlementPoolLimits") @Scope(value = "prototype") public class EntitlementPoolLimitsImpl implements EntitlementPoolLimits { - private VendorLicenseManager vendorLicenseManager = - VendorLicenseManagerFactory.getInstance().createInterface(); - - private static final String PARENT = "EntitlementPool"; - - @Override - public Response createLimit(LimitRequestDto request, - String vlmId, - String versionId, - String entitlementPoolId, - String user) { - Version version = new Version(versionId); - vendorLicenseManager - .getEntitlementPool(new EntitlementPoolEntity(vlmId, version, entitlementPoolId)); - - LimitEntity limitEntity = - new MapLimitRequestDtoToLimitEntity().applyMapping(request, LimitEntity.class); - limitEntity.setVendorLicenseModelId(vlmId); - limitEntity.setVersion(version); - limitEntity.setEpLkgId(entitlementPoolId); - limitEntity.setParent(PARENT); - LimitEntity createdLimit = vendorLicenseManager.createLimit(limitEntity); - MapLimitEntityToLimitCreationDto mapper = new MapLimitEntityToLimitCreationDto(); - LimitCreationDto createdLimitDto = mapper.applyMapping(createdLimit, LimitCreationDto.class); - - return Response.ok(createdLimitDto != null ? createdLimitDto : null).build(); - } - - @Override - public Response listLimits(String vlmId, String versionId, String entitlementPoolId, String - user) { - Version version = new Version(versionId); - vendorLicenseManager - .getEntitlementPool(new EntitlementPoolEntity(vlmId, version, entitlementPoolId)); - - Collection<LimitEntity> limits = - vendorLicenseManager.listLimits(vlmId, version, entitlementPoolId); - - GenericCollectionWrapper<LimitEntityDto> result = new GenericCollectionWrapper<>(); - MapLimitEntityToLimitDto outputMapper = - new MapLimitEntityToLimitDto(); - for (LimitEntity limit : limits) { - result.add(outputMapper.applyMapping(limit, LimitEntityDto.class)); + private static final String PARENT = "EntitlementPool"; + private VendorLicenseManager vendorLicenseManager = VendorLicenseManagerFactory.getInstance().createInterface(); + + @Override + public Response createLimit(LimitRequestDto request, String vlmId, String versionId, String entitlementPoolId, String user) { + Version version = new Version(versionId); + vendorLicenseManager.getEntitlementPool(new EntitlementPoolEntity(vlmId, version, entitlementPoolId)); + LimitEntity limitEntity = new MapLimitRequestDtoToLimitEntity().applyMapping(request, LimitEntity.class); + limitEntity.setVendorLicenseModelId(vlmId); + limitEntity.setVersion(version); + limitEntity.setEpLkgId(entitlementPoolId); + limitEntity.setParent(PARENT); + LimitEntity createdLimit = vendorLicenseManager.createLimit(limitEntity); + MapLimitEntityToLimitCreationDto mapper = new MapLimitEntityToLimitCreationDto(); + LimitCreationDto createdLimitDto = mapper.applyMapping(createdLimit, LimitCreationDto.class); + return Response.ok(createdLimitDto != null ? createdLimitDto : null).build(); } - return Response.ok(result).build(); - } - - @Override - public Response getLimit(String vlmId, String versionId, String entitlementPoolId, - String limitId, String 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); - return Response.ok(entitlementPoolEntityDto).build(); - } - @Override - public Response updateLimit(LimitRequestDto request, - String vlmId, - String versionId, - String entitlementPoolId, - String limitId, - String user) { - Version version = new Version(versionId); - vendorLicenseManager - .getEntitlementPool(new EntitlementPoolEntity(vlmId, version, entitlementPoolId)); - - LimitEntity limitEntity = - new MapLimitRequestDtoToLimitEntity().applyMapping(request, LimitEntity.class); - limitEntity.setVendorLicenseModelId(vlmId); - limitEntity.setVersion(version); - limitEntity.setEpLkgId(entitlementPoolId); - limitEntity.setId(limitId); - limitEntity.setParent(PARENT); - - vendorLicenseManager.updateLimit(limitEntity); - return Response.ok().build(); - } + @Override + public Response listLimits(String vlmId, String versionId, String entitlementPoolId, String user) { + Version version = new Version(versionId); + vendorLicenseManager.getEntitlementPool(new EntitlementPoolEntity(vlmId, version, entitlementPoolId)); + Collection<LimitEntity> limits = vendorLicenseManager.listLimits(vlmId, version, entitlementPoolId); + GenericCollectionWrapper<LimitEntityDto> result = new GenericCollectionWrapper<>(); + MapLimitEntityToLimitDto outputMapper = new MapLimitEntityToLimitDto(); + for (LimitEntity limit : limits) { + result.add(outputMapper.applyMapping(limit, LimitEntityDto.class)); + } + return Response.ok(result).build(); + } - /** - * Delete entitlement pool. - * - * @param vlmId the vlm id - * @param entitlementPoolId the entitlement pool id - * @param limitId the limitId - * @param user the user - * @return the response - */ - public Response deleteLimit(String vlmId, String versionId, String entitlementPoolId, - String limitId, String user) { - Version version = new Version(versionId); - vendorLicenseManager.getEntitlementPool( - new EntitlementPoolEntity(vlmId, version, entitlementPoolId)); + @Override + public Response getLimit(String vlmId, String versionId, String entitlementPoolId, String limitId, String 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); + return Response.ok(entitlementPoolEntityDto).build(); + } - LimitEntity limitInput = new LimitEntity(); - limitInput.setVendorLicenseModelId(vlmId); - limitInput.setVersion(version); - limitInput.setEpLkgId(entitlementPoolId); - limitInput.setId(limitId); - limitInput.setParent(PARENT); + @Override + public Response updateLimit(LimitRequestDto request, String vlmId, String versionId, String entitlementPoolId, String limitId, String user) { + Version version = new Version(versionId); + vendorLicenseManager.getEntitlementPool(new EntitlementPoolEntity(vlmId, version, entitlementPoolId)); + LimitEntity limitEntity = new MapLimitRequestDtoToLimitEntity().applyMapping(request, LimitEntity.class); + limitEntity.setVendorLicenseModelId(vlmId); + limitEntity.setVersion(version); + limitEntity.setEpLkgId(entitlementPoolId); + limitEntity.setId(limitId); + limitEntity.setParent(PARENT); + vendorLicenseManager.updateLimit(limitEntity); + return Response.ok().build(); + } - vendorLicenseManager.deleteLimit(limitInput); - return Response.ok().build(); - } + /** + * Delete entitlement pool. + * + * @param vlmId the vlm id + * @param entitlementPoolId the entitlement pool id + * @param limitId the limitId + * @param user the user + * @return the response + */ + public Response deleteLimit(String vlmId, String versionId, String entitlementPoolId, String limitId, String user) { + 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); + 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 83519198b7..bff8c7a449 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 @@ -7,9 +7,9 @@ * 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. @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdcrests.vendorlicense.rest.services; import java.util.Comparator; @@ -42,115 +41,97 @@ import org.springframework.stereotype.Service; @Service("entitlementPools") @Scope(value = "prototype") public class EntitlementPoolsImpl implements EntitlementPools { - private VendorLicenseManager vendorLicenseManager = - VendorLicenseManagerFactory.getInstance().createInterface(); - - /** - * List entitlement pools response. - * - * @param vlmId the vlm id - * @param versionId the version - * @param user the user - * @return the response - */ - public Response listEntitlementPools(String vlmId, String versionId, String user) { - MapEntitlementPoolEntityToEntitlementPoolEntityDto outputMapper = - new MapEntitlementPoolEntityToEntitlementPoolEntityDto(); + private VendorLicenseManager vendorLicenseManager = VendorLicenseManagerFactory.getInstance().createInterface(); + /** + * List entitlement pools response. + * + * @param vlmId the vlm id + * @param versionId the version + * @param user the user + * @return the response + */ + public Response listEntitlementPools(String vlmId, String versionId, String user) { + MapEntitlementPoolEntityToEntitlementPoolEntityDto outputMapper = new MapEntitlementPoolEntityToEntitlementPoolEntityDto(); GenericCollectionWrapper<EntitlementPoolEntityDto> result = new GenericCollectionWrapper<>( - vendorLicenseManager.listEntitlementPools(vlmId, new Version(versionId)).stream() - .sorted(Comparator.comparing(EntitlementPoolEntity::getName)) - .map(item -> outputMapper.applyMapping(item, EntitlementPoolEntityDto.class)) - .collect(Collectors.toList())); - + vendorLicenseManager.listEntitlementPools(vlmId, new Version(versionId)).stream() + .sorted(Comparator.comparing(EntitlementPoolEntity::getName)) + .map(item -> outputMapper.applyMapping(item, EntitlementPoolEntityDto.class)).collect(Collectors.toList())); return Response.ok(result).build(); } - /** - * Create entitlement pool response. - * - * @param request the request - * @param vlmId the vlm id - * @param user the user - * @return the response - */ - public Response createEntitlementPool(EntitlementPoolRequestDto request, String vlmId, - String versionId, String user) { - EntitlementPoolEntity entitlementPoolEntity = - new MapEntitlementPoolRequestDtoToEntitlementPoolEntity() + /** + * Create entitlement pool response. + * + * @param request the request + * @param vlmId the vlm id + * @param user the user + * @return the response + */ + public Response createEntitlementPool(EntitlementPoolRequestDto request, String vlmId, String versionId, String user) { + EntitlementPoolEntity entitlementPoolEntity = new MapEntitlementPoolRequestDtoToEntitlementPoolEntity() .applyMapping(request, EntitlementPoolEntity.class); - entitlementPoolEntity.setVendorLicenseModelId(vlmId); - entitlementPoolEntity.setVersion(new Version(versionId)); - - EntitlementPoolEntity createdEntitlementPool = - vendorLicenseManager.createEntitlementPool(entitlementPoolEntity); - StringWrapperResponse result = - createdEntitlementPool != null ? new StringWrapperResponse(createdEntitlementPool.getId()) - : null; - return Response.ok(result).build(); - } + entitlementPoolEntity.setVendorLicenseModelId(vlmId); + entitlementPoolEntity.setVersion(new Version(versionId)); + EntitlementPoolEntity createdEntitlementPool = vendorLicenseManager.createEntitlementPool(entitlementPoolEntity); + StringWrapperResponse result = createdEntitlementPool != null ? new StringWrapperResponse(createdEntitlementPool.getId()) : null; + return Response.ok(result).build(); + } - /** - * Update entitlement pool response. - * - * @param request the request - * @param vlmId the vlm id - * @param entitlementPoolId the entitlement pool id - * @param user the user - * @return the response - */ - public Response updateEntitlementPool(EntitlementPoolRequestDto request, String vlmId, - String versionId, String entitlementPoolId, String user) { - EntitlementPoolEntity entitlementPoolEntity = - new MapEntitlementPoolRequestDtoToEntitlementPoolEntity() + /** + * Update entitlement pool response. + * + * @param request the request + * @param vlmId the vlm id + * @param entitlementPoolId the entitlement pool id + * @param user the user + * @return the response + */ + public Response updateEntitlementPool(EntitlementPoolRequestDto request, String vlmId, String versionId, String entitlementPoolId, String user) { + EntitlementPoolEntity entitlementPoolEntity = new MapEntitlementPoolRequestDtoToEntitlementPoolEntity() .applyMapping(request, EntitlementPoolEntity.class); - entitlementPoolEntity.setVendorLicenseModelId(vlmId); - entitlementPoolEntity.setVersion(new Version(versionId)); - entitlementPoolEntity.setId(entitlementPoolId); - - vendorLicenseManager.updateEntitlementPool(entitlementPoolEntity); - return Response.ok().build(); - } - - /** - * Gets entitlement pool. - * - * @param vlmId the vlm id - * @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 versionId, String entitlementPoolId, - String user) { - EntitlementPoolEntity epInput = new EntitlementPoolEntity(); - epInput.setVendorLicenseModelId(vlmId); - epInput.setVersion(new Version(versionId)); - epInput.setId(entitlementPoolId); - EntitlementPoolEntity entitlementPool = vendorLicenseManager.getEntitlementPool(epInput); + entitlementPoolEntity.setVendorLicenseModelId(vlmId); + entitlementPoolEntity.setVersion(new Version(versionId)); + entitlementPoolEntity.setId(entitlementPoolId); + vendorLicenseManager.updateEntitlementPool(entitlementPoolEntity); + return Response.ok().build(); + } - EntitlementPoolEntityDto entitlementPoolEntityDto = entitlementPool == null ? null : - new MapEntitlementPoolEntityToEntitlementPoolEntityDto() - .applyMapping(entitlementPool, EntitlementPoolEntityDto.class); - return Response.ok(entitlementPoolEntityDto).build(); - } + /** + * Gets entitlement pool. + * + * @param vlmId the vlm id + * @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 versionId, String entitlementPoolId, String user) { + EntitlementPoolEntity epInput = new EntitlementPoolEntity(); + epInput.setVendorLicenseModelId(vlmId); + epInput.setVersion(new Version(versionId)); + epInput.setId(entitlementPoolId); + EntitlementPoolEntity entitlementPool = vendorLicenseManager.getEntitlementPool(epInput); + EntitlementPoolEntityDto entitlementPoolEntityDto = entitlementPool == null ? null + : new MapEntitlementPoolEntityToEntitlementPoolEntityDto().applyMapping(entitlementPool, EntitlementPoolEntityDto.class); + return Response.ok(entitlementPoolEntityDto).build(); + } - /** - * Delete entitlement pool response. - * - * @param vlmId the vlm id - * @param entitlementPoolId the entitlement pool id - * @param user the user - * @return the response - */ - public Response deleteEntitlementPool(String vlmId, String versionId, String entitlementPoolId, - String user) { - EntitlementPoolEntity epInput = new EntitlementPoolEntity(); - epInput.setVendorLicenseModelId(vlmId); - epInput.setId(entitlementPoolId); - epInput.setVersion(new Version(versionId)); - vendorLicenseManager.deleteEntitlementPool(epInput); - return Response.ok().build(); - } + /** + * Delete entitlement pool response. + * + * @param vlmId the vlm id + * @param entitlementPoolId the entitlement pool id + * @param user the user + * @return the response + */ + public Response deleteEntitlementPool(String vlmId, String versionId, String entitlementPoolId, String user) { + EntitlementPoolEntity epInput = new EntitlementPoolEntity(); + epInput.setVendorLicenseModelId(vlmId); + epInput.setId(entitlementPoolId); + epInput.setVersion(new Version(versionId)); + vendorLicenseManager.deleteEntitlementPool(epInput); + return Response.ok().build(); + } } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/FeatureGroupsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/FeatureGroupsImpl.java index 4ea35d321d..a945784213 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 @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdcrests.vendorlicense.rest.services; import java.util.Comparator; @@ -54,104 +53,75 @@ import org.springframework.stereotype.Service; @Scope(value = "prototype") public class FeatureGroupsImpl implements FeatureGroups { - private VendorLicenseManager vendorLicenseManager = - VendorLicenseManagerFactory.getInstance().createInterface(); + private VendorLicenseManager vendorLicenseManager = VendorLicenseManagerFactory.getInstance().createInterface(); @Override public Response listFeatureGroups(String vlmId, String versionId, String user) { - - MapFeatureGroupEntityToFeatureGroupDescriptorDto outputMapper = - new MapFeatureGroupEntityToFeatureGroupDescriptorDto(); - + MapFeatureGroupEntityToFeatureGroupDescriptorDto outputMapper = new MapFeatureGroupEntityToFeatureGroupDescriptorDto(); GenericCollectionWrapper<FeatureGroupEntityDto> results = new GenericCollectionWrapper<>( - vendorLicenseManager.listFeatureGroups(vlmId, new Version(versionId)).stream() - .sorted(Comparator.comparing(FeatureGroupEntity::getName)) - .map(fg -> getFeatureGroupEntityDto(outputMapper,fg)).collect(Collectors.toList())); - + vendorLicenseManager.listFeatureGroups(vlmId, new Version(versionId)).stream().sorted(Comparator.comparing(FeatureGroupEntity::getName)) + .map(fg -> getFeatureGroupEntityDto(outputMapper, fg)).collect(Collectors.toList())); return Response.ok(results).build(); } @Override - public Response createFeatureGroup(FeatureGroupRequestDto request, String vlmId, String versionId, - String user) { + public Response createFeatureGroup(FeatureGroupRequestDto request, String vlmId, String versionId, String user) { FeatureGroupEntity featureGroupEntity = new MapFeatureGroupDescriptorDtoToFeatureGroupEntity() - .applyMapping(request, FeatureGroupEntity.class); + .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); - - StringWrapperResponse result = - createdFeatureGroup != null ? new StringWrapperResponse(createdFeatureGroup.getId()) : null; + FeatureGroupEntity createdFeatureGroup = vendorLicenseManager.createFeatureGroup(featureGroupEntity); + StringWrapperResponse result = createdFeatureGroup != null ? new StringWrapperResponse(createdFeatureGroup.getId()) : null; return Response.ok(result).build(); } @Override - public Response updateFeatureGroup(FeatureGroupUpdateRequestDto request, String vlmId, - String versionId, String featureGroupId, String user) { + public Response updateFeatureGroup(FeatureGroupUpdateRequestDto request, String vlmId, String versionId, String featureGroupId, String user) { FeatureGroupEntity featureGroupEntity = new MapFeatureGroupDescriptorDtoToFeatureGroupEntity() - .applyMapping(request, FeatureGroupEntity.class); + .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()); + vendorLicenseManager.updateFeatureGroup(featureGroupEntity, request.getAddedLicenseKeyGroupsIds(), request.getRemovedLicenseKeyGroupsIds(), + request.getAddedEntitlementPoolsIds(), request.getRemovedEntitlementPoolsIds()); return Response.ok().build(); } @Override - public Response getFeatureGroup(String vlmId, String versionId, String featureGroupId, - String user) { + public Response getFeatureGroup(String vlmId, String versionId, String featureGroupId, String user) { FeatureGroupEntity fgInput = new FeatureGroupEntity(); fgInput.setVendorLicenseModelId(vlmId); fgInput.setVersion(new Version(versionId)); fgInput.setId(featureGroupId); FeatureGroupModel featureGroupModel = vendorLicenseManager.getFeatureGroupModel(fgInput); - if (featureGroupModel == null) { return Response.ok().build(); } - FeatureGroupModelDto fgmDto = new FeatureGroupModelDto(); fgmDto.setId(featureGroupModel.getFeatureGroup().getId()); - fgmDto.setReferencingLicenseAgreements( - featureGroupModel.getFeatureGroup().getReferencingLicenseAgreements()); - new MapFeatureGroupEntityToFeatureGroupDescriptorDto() - .doMapping(featureGroupModel.getFeatureGroup(), fgmDto); - + fgmDto.setReferencingLicenseAgreements(featureGroupModel.getFeatureGroup().getReferencingLicenseAgreements()); + new MapFeatureGroupEntityToFeatureGroupDescriptorDto().doMapping(featureGroupModel.getFeatureGroup(), fgmDto); if (!CollectionUtils.isEmpty(featureGroupModel.getLicenseKeyGroups())) { fgmDto.setLicenseKeyGroups(new HashSet<>()); - - MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto lkgMapper = - new MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto(); + MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto lkgMapper = new MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto(); for (LicenseKeyGroupEntity lkg : featureGroupModel.getLicenseKeyGroups()) { - fgmDto.getLicenseKeyGroups() - .add(lkgMapper.applyMapping(lkg, LicenseKeyGroupEntityDto.class)); + fgmDto.getLicenseKeyGroups().add(lkgMapper.applyMapping(lkg, LicenseKeyGroupEntityDto.class)); } } - if (!CollectionUtils.isEmpty(featureGroupModel.getEntitlementPools())) { fgmDto.setEntitlementPools(new HashSet<>()); - - MapEntitlementPoolEntityToEntitlementPoolEntityDto epMapper = - new MapEntitlementPoolEntityToEntitlementPoolEntityDto(); + MapEntitlementPoolEntityToEntitlementPoolEntityDto epMapper = new MapEntitlementPoolEntityToEntitlementPoolEntityDto(); for (EntitlementPoolEntity ep : featureGroupModel.getEntitlementPools()) { fgmDto.getEntitlementPools().add(epMapper.applyMapping(ep, EntitlementPoolEntityDto.class)); - } } return Response.ok(fgmDto).build(); } @Override - public Response deleteFeatureGroup(String vlmId, String versionId, String featureGroupId, - String user) { + public Response deleteFeatureGroup(String vlmId, String versionId, String featureGroupId, String user) { FeatureGroupEntity fgInput = new FeatureGroupEntity(); fgInput.setVendorLicenseModelId(vlmId); fgInput.setVersion(new Version(versionId)); @@ -160,7 +130,7 @@ public class FeatureGroupsImpl implements FeatureGroups { return Response.ok().build(); } - private FeatureGroupEntityDto getFeatureGroupEntityDto(MapFeatureGroupEntityToFeatureGroupDescriptorDto mapper,FeatureGroupEntity fg) { + private FeatureGroupEntityDto getFeatureGroupEntityDto(MapFeatureGroupEntityToFeatureGroupDescriptorDto mapper, FeatureGroupEntity fg) { FeatureGroupEntityDto fgDto = new FeatureGroupEntityDto(); fgDto.setId(fg.getId()); fgDto.setLicenseKeyGroupsIds(fg.getLicenseKeyGroupIds()); @@ -169,5 +139,4 @@ public class FeatureGroupsImpl implements FeatureGroups { mapper.doMapping(fg, fgDto); return fgDto; } - } 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 7c0539931b..fb67b237f0 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 @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdcrests.vendorlicense.rest.services; import java.util.Comparator; @@ -51,8 +50,7 @@ import org.springframework.stereotype.Service; @Scope(value = "prototype") public class LicenseAgreementsImpl implements LicenseAgreements { - private VendorLicenseManager vendorLicenseManager = - VendorLicenseManagerFactory.getInstance().createInterface(); + private VendorLicenseManager vendorLicenseManager = VendorLicenseManagerFactory.getInstance().createInterface(); /** * List license agreements response. @@ -63,20 +61,14 @@ public class LicenseAgreementsImpl implements LicenseAgreements { * @return the response */ public Response listLicenseAgreements(String vlmId, String versionId, String user) { - - MapLicenseAgreementEntityToLicenseAgreementDescriptorDto outputMapper = - new MapLicenseAgreementEntityToLicenseAgreementDescriptorDto(); - + MapLicenseAgreementEntityToLicenseAgreementDescriptorDto outputMapper = new MapLicenseAgreementEntityToLicenseAgreementDescriptorDto(); GenericCollectionWrapper<LicenseAgreementEntityDto> results = new GenericCollectionWrapper<>( - vendorLicenseManager.listLicenseAgreements(vlmId, new Version(versionId)).stream() - .sorted(Comparator.comparing(LicenseAgreementEntity::getName)) - .map(lae -> getLicenseAgreementEntityDto(outputMapper, lae)) - .collect(Collectors.toList())); - + vendorLicenseManager.listLicenseAgreements(vlmId, new Version(versionId)).stream() + .sorted(Comparator.comparing(LicenseAgreementEntity::getName)).map(lae -> getLicenseAgreementEntityDto(outputMapper, lae)) + .collect(Collectors.toList())); return Response.ok(results).build(); } - /** * Create license agreement response. * @@ -85,20 +77,14 @@ public class LicenseAgreementsImpl implements LicenseAgreements { * @param user the user * @return the response */ - public Response createLicenseAgreement(LicenseAgreementRequestDto request, String vlmId, - String versionId, String user) { - LicenseAgreementEntity licenseAgreementEntity = - new MapLicenseAgreementDescriptorDtoToLicenseAgreementEntity() - .applyMapping(request, LicenseAgreementEntity.class); + public Response createLicenseAgreement(LicenseAgreementRequestDto request, String vlmId, String versionId, String user) { + LicenseAgreementEntity licenseAgreementEntity = new MapLicenseAgreementDescriptorDtoToLicenseAgreementEntity() + .applyMapping(request, LicenseAgreementEntity.class); licenseAgreementEntity.setVendorLicenseModelId(vlmId); licenseAgreementEntity.setVersion(new Version(versionId)); licenseAgreementEntity.setFeatureGroupIds(request.getAddedFeatureGroupsIds()); - - LicenseAgreementEntity createdLicenseAgreement = - vendorLicenseManager.createLicenseAgreement(licenseAgreementEntity); - StringWrapperResponse result = - createdLicenseAgreement != null ? new StringWrapperResponse(createdLicenseAgreement.getId()) - : null; + LicenseAgreementEntity createdLicenseAgreement = vendorLicenseManager.createLicenseAgreement(licenseAgreementEntity); + StringWrapperResponse result = createdLicenseAgreement != null ? new StringWrapperResponse(createdLicenseAgreement.getId()) : null; return Response.ok(result).build(); } @@ -111,18 +97,14 @@ public class LicenseAgreementsImpl implements LicenseAgreements { * @param user the user * @return the response */ - public Response updateLicenseAgreement(LicenseAgreementUpdateRequestDto request, String vlmId, - String versionId, String licenseAgreementId, String user) { - LicenseAgreementEntity licenseAgreementEntity = - new MapLicenseAgreementDescriptorDtoToLicenseAgreementEntity() - .applyMapping(request, LicenseAgreementEntity.class); + public Response updateLicenseAgreement(LicenseAgreementUpdateRequestDto request, String vlmId, String versionId, String licenseAgreementId, + String user) { + LicenseAgreementEntity licenseAgreementEntity = new MapLicenseAgreementDescriptorDtoToLicenseAgreementEntity() + .applyMapping(request, LicenseAgreementEntity.class); licenseAgreementEntity.setVendorLicenseModelId(vlmId); licenseAgreementEntity.setVersion(new Version(versionId)); licenseAgreementEntity.setId(licenseAgreementId); - - vendorLicenseManager - .updateLicenseAgreement(licenseAgreementEntity, request.getAddedFeatureGroupsIds(), - request.getRemovedFeatureGroupsIds()); + vendorLicenseManager.updateLicenseAgreement(licenseAgreementEntity, request.getAddedFeatureGroupsIds(), request.getRemovedFeatureGroupsIds()); return Response.ok().build(); } @@ -135,32 +117,24 @@ public class LicenseAgreementsImpl implements LicenseAgreements { * @param user the user * @return the license agreement */ - public Response getLicenseAgreement(String vlmId, String versionId, String licenseAgreementId, - String user) { + public Response getLicenseAgreement(String vlmId, String versionId, String licenseAgreementId, String user) { LicenseAgreementModel licenseAgreementModel = vendorLicenseManager - .getLicenseAgreementModel(vlmId, new Version(versionId), licenseAgreementId); - + .getLicenseAgreementModel(vlmId, new Version(versionId), licenseAgreementId); if (licenseAgreementModel == null) { return Response.ok().build(); } - LicenseAgreementModelDto lamDto = new LicenseAgreementModelDto(); lamDto.setId(licenseAgreementModel.getLicenseAgreement().getId()); - new MapLicenseAgreementEntityToLicenseAgreementDescriptorDto() - .doMapping(licenseAgreementModel.getLicenseAgreement(), lamDto); - + new MapLicenseAgreementEntityToLicenseAgreementDescriptorDto().doMapping(licenseAgreementModel.getLicenseAgreement(), lamDto); if (!CollectionUtils.isEmpty(licenseAgreementModel.getFeatureGroups())) { lamDto.setFeatureGroups(new HashSet<>()); - - MapFeatureGroupEntityToFeatureGroupDescriptorDto fgMapper = - new MapFeatureGroupEntityToFeatureGroupDescriptorDto(); + MapFeatureGroupEntityToFeatureGroupDescriptorDto fgMapper = new MapFeatureGroupEntityToFeatureGroupDescriptorDto(); for (FeatureGroupEntity fg : licenseAgreementModel.getFeatureGroups()) { FeatureGroupEntityDto fgeDto = new FeatureGroupEntityDto(); fgeDto.setId(fg.getId()); fgeDto.setEntitlementPoolsIds(fg.getEntitlementPoolIds()); fgeDto.setLicenseKeyGroupsIds(fg.getLicenseKeyGroupIds()); fgMapper.doMapping(fg, fgeDto); - lamDto.getFeatureGroups().add(fgeDto); } } @@ -176,14 +150,13 @@ public class LicenseAgreementsImpl implements LicenseAgreements { * @param user the user * @return the response */ - public Response deleteLicenseAgreement(String vlmId, String versionId, String licenseAgreementId, - String user) { + public Response deleteLicenseAgreement(String vlmId, String versionId, String licenseAgreementId, String user) { vendorLicenseManager.deleteLicenseAgreement(vlmId, new Version(versionId), licenseAgreementId); return Response.ok().build(); } - private LicenseAgreementEntityDto getLicenseAgreementEntityDto( - MapLicenseAgreementEntityToLicenseAgreementDescriptorDto mapper, LicenseAgreementEntity lae) { + private LicenseAgreementEntityDto getLicenseAgreementEntityDto(MapLicenseAgreementEntityToLicenseAgreementDescriptorDto mapper, + LicenseAgreementEntity lae) { LicenseAgreementEntityDto laeDto = new LicenseAgreementEntityDto(); laeDto.setId(lae.getId()); laeDto.setFeatureGroupsIds(lae.getFeatureGroupIds()); 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 14491b0e6a..7d4f1f7679 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 @@ -7,9 +7,9 @@ * 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. @@ -17,9 +17,11 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdcrests.vendorlicense.rest.services; +import java.util.Collection; +import javax.inject.Named; +import javax.ws.rs.core.Response; import org.openecomp.sdc.vendorlicense.VendorLicenseManager; import org.openecomp.sdc.vendorlicense.VendorLicenseManagerFactory; import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity; @@ -36,126 +38,89 @@ import org.openecomp.sdcrests.wrappers.GenericCollectionWrapper; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Service; -import javax.inject.Named; -import javax.ws.rs.core.Response; -import java.util.Collection; - @Named @Service("licenseKeyGroupLimits") @Scope(value = "prototype") public class LicenseKeyGroupLimitsImpl implements LicenseKeyGroupLimits { - private VendorLicenseManager vendorLicenseManager = - VendorLicenseManagerFactory.getInstance().createInterface(); - - private static final String PARENT = "LicenseKeyGroup"; - - - @Override - public Response createLimit(LimitRequestDto request, - String vlmId, - String versionId, - String licenseKeyGroupId, - String user) { - Version version = new Version(versionId); - vendorLicenseManager.getLicenseKeyGroup( - new LicenseKeyGroupEntity(vlmId, version, licenseKeyGroupId)); - - LimitEntity limitEntity = - new MapLimitRequestDtoToLimitEntity().applyMapping(request, LimitEntity.class); - limitEntity.setVendorLicenseModelId(vlmId); - limitEntity.setVersion(version); - limitEntity.setEpLkgId(licenseKeyGroupId); - limitEntity.setParent(PARENT); - LimitEntity createdLimit = vendorLicenseManager.createLimit(limitEntity); - MapLimitEntityToLimitCreationDto mapper = new MapLimitEntityToLimitCreationDto(); - LimitCreationDto createdLimitDto = mapper.applyMapping(createdLimit, LimitCreationDto.class); - return Response.ok(createdLimitDto != null ? createdLimitDto : null).build(); - } - - @Override - public Response listLimits(String vlmId, String versionId, String licenseKeyGroupId, - String user) { - Version version = new Version(versionId); - vendorLicenseManager - .getLicenseKeyGroup(new LicenseKeyGroupEntity(vlmId, version, licenseKeyGroupId)); - - Collection<LimitEntity> limits = - vendorLicenseManager.listLimits(vlmId, version, licenseKeyGroupId); - - GenericCollectionWrapper<LimitEntityDto> result = new GenericCollectionWrapper<>(); - MapLimitEntityToLimitDto outputMapper = - new MapLimitEntityToLimitDto(); - for (LimitEntity limit : limits) { - result.add(outputMapper.applyMapping(limit, LimitEntityDto.class)); + private static final String PARENT = "LicenseKeyGroup"; + private VendorLicenseManager vendorLicenseManager = VendorLicenseManagerFactory.getInstance().createInterface(); + + @Override + public Response createLimit(LimitRequestDto request, String vlmId, String versionId, String licenseKeyGroupId, String user) { + Version version = new Version(versionId); + vendorLicenseManager.getLicenseKeyGroup(new LicenseKeyGroupEntity(vlmId, version, licenseKeyGroupId)); + LimitEntity limitEntity = new MapLimitRequestDtoToLimitEntity().applyMapping(request, LimitEntity.class); + limitEntity.setVendorLicenseModelId(vlmId); + limitEntity.setVersion(version); + limitEntity.setEpLkgId(licenseKeyGroupId); + limitEntity.setParent(PARENT); + LimitEntity createdLimit = vendorLicenseManager.createLimit(limitEntity); + MapLimitEntityToLimitCreationDto mapper = new MapLimitEntityToLimitCreationDto(); + LimitCreationDto createdLimitDto = mapper.applyMapping(createdLimit, LimitCreationDto.class); + return Response.ok(createdLimitDto != null ? createdLimitDto : null).build(); } - return Response.ok(result).build(); - } - - @Override - public Response updateLimit(LimitRequestDto request, - String vlmId, - String versionId, - String licenseKeyGroupId, - String limitId, - String user) { - Version version = new Version(versionId); - vendorLicenseManager - .getLicenseKeyGroup(new LicenseKeyGroupEntity(vlmId, version, licenseKeyGroupId)); - - LimitEntity limitEntity = - new MapLimitRequestDtoToLimitEntity().applyMapping(request, LimitEntity.class); - limitEntity.setVendorLicenseModelId(vlmId); - limitEntity.setVersion(version); - limitEntity.setEpLkgId(licenseKeyGroupId); - limitEntity.setId(limitId); - limitEntity.setParent(PARENT); - - vendorLicenseManager.updateLimit(limitEntity); - return Response.ok().build(); - } - /** - * Delete License Key Group. - * - * @param vlmId the vlm id - * @param licenseKeyGroupId the license Key Group id - * @param limitId the limitId - * @param user the user - * @return the response - */ - public Response deleteLimit(String vlmId, String versionId, String licenseKeyGroupId, - String limitId, String user) { - 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); + @Override + public Response listLimits(String vlmId, String versionId, String licenseKeyGroupId, String user) { + Version version = new Version(versionId); + vendorLicenseManager.getLicenseKeyGroup(new LicenseKeyGroupEntity(vlmId, version, licenseKeyGroupId)); + Collection<LimitEntity> limits = vendorLicenseManager.listLimits(vlmId, version, licenseKeyGroupId); + GenericCollectionWrapper<LimitEntityDto> result = new GenericCollectionWrapper<>(); + MapLimitEntityToLimitDto outputMapper = new MapLimitEntityToLimitDto(); + for (LimitEntity limit : limits) { + result.add(outputMapper.applyMapping(limit, LimitEntityDto.class)); + } + return Response.ok(result).build(); + } - vendorLicenseManager.deleteLimit(limitInput); - return Response.ok().build(); - } + @Override + public Response updateLimit(LimitRequestDto request, String vlmId, String versionId, String licenseKeyGroupId, String limitId, String user) { + Version version = new Version(versionId); + vendorLicenseManager.getLicenseKeyGroup(new LicenseKeyGroupEntity(vlmId, version, licenseKeyGroupId)); + LimitEntity limitEntity = new MapLimitRequestDtoToLimitEntity().applyMapping(request, LimitEntity.class); + limitEntity.setVendorLicenseModelId(vlmId); + limitEntity.setVersion(version); + limitEntity.setEpLkgId(licenseKeyGroupId); + limitEntity.setId(limitId); + limitEntity.setParent(PARENT); + vendorLicenseManager.updateLimit(limitEntity); + return Response.ok().build(); + } - @Override - public Response getLimit(String vlmId, String versionId, String licenseKeyGroupId, - String limitId, String 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); - LimitEntity limit = vendorLicenseManager.getLimit(limitInput); + /** + * Delete License Key Group. + * + * @param vlmId the vlm id + * @param licenseKeyGroupId the license Key Group id + * @param limitId the limitId + * @param user the user + * @return the response + */ + public Response deleteLimit(String vlmId, String versionId, String licenseKeyGroupId, String limitId, String user) { + 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); + return Response.ok().build(); + } - LimitEntityDto entitlementPoolEntityDto = limit == null ? null - : new MapLimitEntityToLimitDto().applyMapping(limit, LimitEntityDto.class); - return Response.ok(entitlementPoolEntityDto).build(); - } + @Override + public Response getLimit(String vlmId, String versionId, String licenseKeyGroupId, String limitId, String 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); + LimitEntity limit = vendorLicenseManager.getLimit(limitInput); + LimitEntityDto entitlementPoolEntityDto = limit == null ? null : new MapLimitEntityToLimitDto().applyMapping(limit, LimitEntityDto.class); + 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 3edee02080..f7ddc25eba 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 @@ -7,9 +7,9 @@ * 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. @@ -17,12 +17,10 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdcrests.vendorlicense.rest.services; import java.util.Comparator; import java.util.stream.Collectors; -import java.util.stream.Stream; import javax.inject.Named; import javax.ws.rs.core.Response; import org.openecomp.sdc.vendorlicense.VendorLicenseManager; @@ -45,116 +43,97 @@ import org.springframework.validation.annotation.Validated; @Scope(value = "prototype") @Validated public class LicenseKeyGroupsImpl implements LicenseKeyGroups { - private VendorLicenseManager vendorLicenseManager = - VendorLicenseManagerFactory.getInstance().createInterface(); - - /** - * List license key groups response. - * - * @param vlmId the vlm id - * @param versionId the version - * @param user the user - * @return the response - */ - public Response listLicenseKeyGroups(String vlmId, String versionId, String user) { - MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto outputMapper = - new MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto(); + private VendorLicenseManager vendorLicenseManager = VendorLicenseManagerFactory.getInstance().createInterface(); - GenericCollectionWrapper<LicenseKeyGroupEntityDto> result = new GenericCollectionWrapper<>( + /** + * List license key groups response. + * + * @param vlmId the vlm id + * @param versionId the version + * @param user the user + * @return the response + */ + public Response listLicenseKeyGroups(String vlmId, String versionId, String user) { + MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto outputMapper = new MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto(); + GenericCollectionWrapper<LicenseKeyGroupEntityDto> result = new GenericCollectionWrapper<>( vendorLicenseManager.listLicenseKeyGroups(vlmId, new Version(versionId)).stream() - .sorted(Comparator.comparing(LicenseKeyGroupEntity::getName)) - .map(item -> outputMapper.applyMapping(item, LicenseKeyGroupEntityDto.class)) - .collect(Collectors.toList())); - - return Response.ok(result).build(); - } + .sorted(Comparator.comparing(LicenseKeyGroupEntity::getName)) + .map(item -> outputMapper.applyMapping(item, LicenseKeyGroupEntityDto.class)).collect(Collectors.toList())); + return Response.ok(result).build(); + } - /** - * Create license key group response. - * - * @param request the request - * @param vlmId the vlm id - * @param user the user - * @return the response - */ - public Response createLicenseKeyGroup(LicenseKeyGroupRequestDto request, String vlmId, - String versionId, String user) { - LicenseKeyGroupEntity licenseKeyGroupEntity = - new MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity() + /** + * Create license key group response. + * + * @param request the request + * @param vlmId the vlm id + * @param user the user + * @return the response + */ + public Response createLicenseKeyGroup(LicenseKeyGroupRequestDto request, String vlmId, String versionId, String user) { + LicenseKeyGroupEntity licenseKeyGroupEntity = new MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity() .applyMapping(request, LicenseKeyGroupEntity.class); - licenseKeyGroupEntity.setVendorLicenseModelId(vlmId); - licenseKeyGroupEntity.setVersion(new Version(versionId)); + licenseKeyGroupEntity.setVendorLicenseModelId(vlmId); + licenseKeyGroupEntity.setVersion(new Version(versionId)); + LicenseKeyGroupEntity createdLicenseKeyGroup = vendorLicenseManager.createLicenseKeyGroup(licenseKeyGroupEntity); + StringWrapperResponse result = createdLicenseKeyGroup != null ? new StringWrapperResponse(createdLicenseKeyGroup.getId()) : null; + return Response.ok(result).build(); + } - LicenseKeyGroupEntity createdLicenseKeyGroup = - vendorLicenseManager.createLicenseKeyGroup(licenseKeyGroupEntity); - StringWrapperResponse result = - createdLicenseKeyGroup != null ? new StringWrapperResponse(createdLicenseKeyGroup.getId()) - : null; - return Response.ok(result).build(); - } - - /** - * Update license key group response. - * - * @param request the request - * @param vlmId the vlm id - * @param licenseKeyGroupId the license key group id - * @param user the user - * @return the response - */ - public Response updateLicenseKeyGroup(LicenseKeyGroupRequestDto request, String vlmId, - String versionId, - String licenseKeyGroupId, String user) { - LicenseKeyGroupEntity licenseKeyGroupEntity = - new MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity() + /** + * Update license key group response. + * + * @param request the request + * @param vlmId the vlm id + * @param licenseKeyGroupId the license key group id + * @param user the user + * @return the response + */ + public Response updateLicenseKeyGroup(LicenseKeyGroupRequestDto request, String vlmId, String versionId, String licenseKeyGroupId, String user) { + LicenseKeyGroupEntity licenseKeyGroupEntity = new MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity() .applyMapping(request, LicenseKeyGroupEntity.class); - licenseKeyGroupEntity.setVendorLicenseModelId(vlmId); - licenseKeyGroupEntity.setVersion(new Version(versionId)); - licenseKeyGroupEntity.setId(licenseKeyGroupId); - - vendorLicenseManager.updateLicenseKeyGroup(licenseKeyGroupEntity); - return Response.ok().build(); - } - - /** - * Gets license key group. - * - * @param vlmId the vlm id - * @param versionId the version - * @param licenseKeyGroupId the license key group id - * @param user the user - * @return the license key group - */ - public Response getLicenseKeyGroup(String vlmId, String versionId, String licenseKeyGroupId, - String user) { - LicenseKeyGroupEntity lkgInput = new LicenseKeyGroupEntity(); - lkgInput.setVendorLicenseModelId(vlmId); - lkgInput.setVersion(new Version(versionId)); - lkgInput.setId(licenseKeyGroupId); - LicenseKeyGroupEntity licenseKeyGroup = vendorLicenseManager.getLicenseKeyGroup(lkgInput); + licenseKeyGroupEntity.setVendorLicenseModelId(vlmId); + licenseKeyGroupEntity.setVersion(new Version(versionId)); + licenseKeyGroupEntity.setId(licenseKeyGroupId); + vendorLicenseManager.updateLicenseKeyGroup(licenseKeyGroupEntity); + return Response.ok().build(); + } - LicenseKeyGroupEntityDto licenseKeyGroupEntityDto = licenseKeyGroup == null ? null : - new MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto() - .applyMapping(licenseKeyGroup, LicenseKeyGroupEntityDto.class); - return Response.ok(licenseKeyGroupEntityDto).build(); - } + /** + * Gets license key group. + * + * @param vlmId the vlm id + * @param versionId the version + * @param licenseKeyGroupId the license key group id + * @param user the user + * @return the license key group + */ + public Response getLicenseKeyGroup(String vlmId, String versionId, String licenseKeyGroupId, String user) { + LicenseKeyGroupEntity lkgInput = new LicenseKeyGroupEntity(); + lkgInput.setVendorLicenseModelId(vlmId); + lkgInput.setVersion(new Version(versionId)); + lkgInput.setId(licenseKeyGroupId); + LicenseKeyGroupEntity licenseKeyGroup = vendorLicenseManager.getLicenseKeyGroup(lkgInput); + LicenseKeyGroupEntityDto licenseKeyGroupEntityDto = licenseKeyGroup == null ? null + : new MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto().applyMapping(licenseKeyGroup, LicenseKeyGroupEntityDto.class); + return Response.ok(licenseKeyGroupEntityDto).build(); + } - /** - * Delete license key group response. - * - * @param vlmId the vlm id - * @param licenseKeyGroupId the license key group id - * @param user the user - * @return the response - */ - public Response deleteLicenseKeyGroup(String vlmId, String versionId, String licenseKeyGroupId, - String user) { - LicenseKeyGroupEntity lkgInput = new LicenseKeyGroupEntity(); - lkgInput.setVendorLicenseModelId(vlmId); - lkgInput.setVersion(new Version(versionId)); - lkgInput.setId(licenseKeyGroupId); - vendorLicenseManager.deleteLicenseKeyGroup(lkgInput); - return Response.ok().build(); - } + /** + * Delete license key group response. + * + * @param vlmId the vlm id + * @param licenseKeyGroupId the license key group id + * @param user the user + * @return the response + */ + public Response deleteLicenseKeyGroup(String vlmId, String versionId, String licenseKeyGroupId, String user) { + LicenseKeyGroupEntity lkgInput = new LicenseKeyGroupEntity(); + lkgInput.setVendorLicenseModelId(vlmId); + lkgInput.setVersion(new Version(versionId)); + lkgInput.setId(licenseKeyGroupId); + vendorLicenseManager.deleteLicenseKeyGroup(lkgInput); + return Response.ok().build(); + } } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/VendorLicenseModelsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/VendorLicenseModelsImpl.java index df6363c883..0255b14753 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 @@ -13,10 +13,22 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - - package org.openecomp.sdcrests.vendorlicense.rest.services; +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; +import static org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelActionRequestDto.VendorLicenseModelAction.Submit; + +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.function.Predicate; +import javax.inject.Named; +import javax.ws.rs.core.Response; import org.openecomp.core.dao.UniqueValueDaoFactory; import org.openecomp.core.util.UniqueValueUtil; import org.openecomp.sdc.activitylog.ActivityLogManager; @@ -65,17 +77,6 @@ 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.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.function.Predicate; - -import static org.openecomp.sdc.itempermissions.notifications.NotificationConstants.PERMISSION_USER; -import static org.openecomp.sdc.versioning.VersioningNotificationConstansts.*; -import static org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelActionRequestDto.VendorLicenseModelAction.Submit; - @Named @Service("vendorLicenseModels") @Scope(value = "prototype") @@ -83,75 +84,57 @@ import static org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelActio public class VendorLicenseModelsImpl implements VendorLicenseModels { private static final String SUBMIT_ITEM_ACTION = "Submit_Item"; - private static final String SUBMIT_HEALED_VERSION_ERROR = - "VLM Id %s: Error while submitting version %s created based on Certified version %s for healing purpose."; + private static final String SUBMIT_HEALED_VERSION_ERROR = "VLM Id %s: Error while submitting version %s created based on Certified version %s for healing purpose."; private static final Logger LOGGER = LoggerFactory.getLogger(VendorLicenseModelsImpl.class); private PermissionsManager permissionsManager = PermissionsManagerFactory.getInstance().createInterface(); - private NotificationPropagationManager notifier = - NotificationPropagationManagerFactory.getInstance().createInterface(); - + private NotificationPropagationManager notifier = NotificationPropagationManagerFactory.getInstance().createInterface(); private AsdcItemManager asdcItemManager = AsdcItemManagerFactory.getInstance().createInterface(); private VersioningManager versioningManager = VersioningManagerFactory.getInstance().createInterface(); private VendorLicenseManager vendorLicenseManager = VendorLicenseManagerFactory.getInstance().createInterface(); private ActivityLogManager activityLogManager = ActivityLogManagerFactory.getInstance().createInterface(); - private UniqueValueUtil uniqueValueUtil = - new UniqueValueUtil(UniqueValueDaoFactory.getInstance().createInterface()); + private UniqueValueUtil uniqueValueUtil = new UniqueValueUtil(UniqueValueDaoFactory.getInstance().createInterface()); @Override public Response listLicenseModels(String versionStatus, String itemStatus, String user) { Predicate<Item> itemPredicate = createItemPredicate(versionStatus, itemStatus, user); - GenericCollectionWrapper<ItemDto> results = new GenericCollectionWrapper<>(); MapItemToDto mapper = new MapItemToDto(); - asdcItemManager.list(itemPredicate).stream() - .sorted((o1, o2) -> o2.getModificationTime().compareTo(o1.getModificationTime())) - .forEach(item -> results.add(mapper.applyMapping(item, ItemDto.class))); - + asdcItemManager.list(itemPredicate).stream().sorted((o1, o2) -> o2.getModificationTime().compareTo(o1.getModificationTime())) + .forEach(item -> results.add(mapper.applyMapping(item, ItemDto.class))); return Response.ok(results).build(); } @Override public Response createLicenseModel(VendorLicenseModelRequestDto request, String user) { - Item item = new Item(); item.setType(ItemType.vlm.name()); item.setOwner(user); item.setStatus(ItemStatus.ACTIVE); item.setName(request.getVendorName()); item.setDescription(request.getDescription()); - uniqueValueUtil.validateUniqueValue(VendorLicenseConstants.UniqueValues.VENDOR_NAME, item.getName()); item = asdcItemManager.create(item); uniqueValueUtil.createUniqueValue(VendorLicenseConstants.UniqueValues.VENDOR_NAME, item.getName()); - Version version = versioningManager.create(item.getId(), new Version(), null); - VendorLicenseModelEntity vlm = new MapVendorLicenseModelRequestDtoToVendorLicenseModelEntity() - .applyMapping(request, VendorLicenseModelEntity.class); + .applyMapping(request, VendorLicenseModelEntity.class); vlm.setId(item.getId()); vlm.setVersion(version); - 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, "", "")); - + activityLogManager.logActivity(new ActivityLogEntity(vlm.getId(), version, ActivityType.Create, user, true, "", "")); return Response.ok(itemCreationDto).build(); } @Override - public Response updateLicenseModel(VendorLicenseModelRequestDto request, String vlmId, String versionId, - String user) { + public Response updateLicenseModel(VendorLicenseModelRequestDto request, String vlmId, String versionId, String user) { VendorLicenseModelEntity vlm = new MapVendorLicenseModelRequestDtoToVendorLicenseModelEntity() - .applyMapping(request, VendorLicenseModelEntity.class); + .applyMapping(request, VendorLicenseModelEntity.class); vlm.setId(vlmId); vlm.setVersion(new Version(versionId)); - vendorLicenseManager.updateVendorLicenseModel(vlm); return Response.ok().build(); } @@ -160,74 +143,56 @@ public class VendorLicenseModelsImpl implements VendorLicenseModels { public Response getLicenseModel(String vlmId, String versionId, String user) { Version version = versioningManager.get(vlmId, new Version(versionId)); VendorLicenseModelEntity vlm = vendorLicenseManager.getVendorLicenseModel(vlmId, version); - try { - HealingManagerFactory.getInstance().createInterface() - .healItemVersion(vlmId, version, ItemType.vlm, false) - .ifPresent(healedVersion -> { - vlm.setVersion(healedVersion); - if (version.getStatus() == VersionStatus.Certified) { - submitHealedVersion(vlmId, healedVersion, versionId, user); - } - }); + HealingManagerFactory.getInstance().createInterface().healItemVersion(vlmId, version, ItemType.vlm, false).ifPresent(healedVersion -> { + vlm.setVersion(healedVersion); + if (version.getStatus() == VersionStatus.Certified) { + submitHealedVersion(vlmId, healedVersion, versionId, user); + } + }); } catch (Exception e) { LOGGER.error(String.format("Error while auto healing VLM with Id %s and version %s", vlmId, versionId), e); } - - VendorLicenseModelEntityDto vlmDto = - new MapVendorLicenseModelEntityToDto().applyMapping(vlm, VendorLicenseModelEntityDto.class); + VendorLicenseModelEntityDto vlmDto = new MapVendorLicenseModelEntityToDto().applyMapping(vlm, VendorLicenseModelEntityDto.class); return Response.ok(vlmDto).build(); } @Override public Response deleteLicenseModel(String vlmId, String user) { Item vlm = asdcItemManager.get(vlmId); - if (!vlm.getType().equals(ItemType.vlm.name())) { - throw new CoreException((new ErrorCode.ErrorCodeBuilder() - .withMessage(String.format("Vlm with id %s does not exist.", vlmId)) - .build())); + throw new CoreException((new ErrorCode.ErrorCodeBuilder().withMessage(String.format("Vlm with id %s does not exist.", vlmId)).build())); } - Integer certifiedVersionsCounter = vlm.getVersionStatusCounters().get(VersionStatus.Certified); if (Objects.isNull(certifiedVersionsCounter) || certifiedVersionsCounter == 0) { asdcItemManager.delete(vlm); permissionsManager.deleteItemPermissions(vlmId); uniqueValueUtil.deleteUniqueValue(VendorLicenseConstants.UniqueValues.VENDOR_NAME, vlm.getName()); notifyUsers(vlmId, vlm.getName(), null, null, user, NotificationEventTypes.DELETE); - return Response.ok().build(); } else { - return Response.status(Response.Status.FORBIDDEN) - .entity(new Exception(Messages.DELETE_VLM_ERROR.getErrorMessage())).build(); + return Response.status(Response.Status.FORBIDDEN).entity(new Exception(Messages.DELETE_VLM_ERROR.getErrorMessage())).build(); } } @Override - public Response actOnLicenseModel(VendorLicenseModelActionRequestDto request, String vlmId, String versionId, - String user) { + public Response actOnLicenseModel(VendorLicenseModelActionRequestDto request, String vlmId, String versionId, String user) { Version version = new Version(versionId); - if (request.getAction() == Submit) { if (!permissionsManager.isAllowed(vlmId, user, SUBMIT_ITEM_ACTION)) { - return Response.status(Response.Status.FORBIDDEN) - .entity(new Exception(Messages.PERMISSIONS_ERROR.getErrorMessage())).build(); + return Response.status(Response.Status.FORBIDDEN).entity(new Exception(Messages.PERMISSIONS_ERROR.getErrorMessage())).build(); } String message = request.getSubmitRequest() == null ? "Submit" : request.getSubmitRequest().getMessage(); submit(vlmId, version, message, user); - notifyUsers(vlmId, null, version, message, user, NotificationEventTypes.SUBMIT); - } return Response.ok().build(); } private void submit(String vlmId, Version version, String message, String user) { - vendorLicenseManager.validate(vlmId, version); versioningManager.submit(vlmId, version, message); - activityLogManager - .logActivity(new ActivityLogEntity(vlmId, version, ActivityType.Submit, user, true, "", message)); + activityLogManager.logActivity(new ActivityLogEntity(vlmId, version, ActivityType.Submit, user, true, "", message)); } private void submitHealedVersion(String vlmId, Version healedVersion, String baseVersionId, String user) { @@ -238,21 +203,16 @@ public class VendorLicenseModelsImpl implements VendorLicenseModels { } } - private void notifyUsers(String itemId, String itemName, Version version, String message, String userName, - NotificationEventTypes eventType) { + private void notifyUsers(String itemId, String itemName, Version version, String message, String userName, NotificationEventTypes eventType) { Map<String, Object> eventProperties = new HashMap<>(); eventProperties.put(ITEM_NAME, itemName == null ? asdcItemManager.get(itemId).getName() : itemName); eventProperties.put(ITEM_ID, itemId); - if (version != null) { - eventProperties.put(VERSION_NAME, - version.getName() == null ? versioningManager.get(itemId, version).getName() : version.getName()); + eventProperties.put(VERSION_NAME, version.getName() == null ? versioningManager.get(itemId, version).getName() : version.getName()); eventProperties.put(VERSION_ID, version.getId()); } - eventProperties.put(SUBMIT_DESCRIPTION, message); eventProperties.put(PERMISSION_USER, userName); - Event syncEvent = new SyncEvent(eventType.getEventName(), itemId, eventProperties, itemId); try { notifier.notifySubscribers(syncEvent, userName); @@ -261,6 +221,27 @@ public class VendorLicenseModelsImpl implements VendorLicenseModels { } } + private boolean userHasPermission(String itemId, String userId) { + return permissionsManager.getUserItemPermission(itemId, userId) + .map(permission -> permission.matches(PermissionTypes.Contributor.name() + "|" + PermissionTypes.Owner.name())).orElse(false); + } + + private Predicate<Item> createItemPredicate(String versionStatus, String itemStatus, String user) { + Predicate<Item> itemPredicate = item -> ItemType.vlm.name().equals(item.getType()); + if (ItemStatus.ARCHIVED.name().equals(itemStatus)) { + itemPredicate = itemPredicate.and(item -> ItemStatus.ARCHIVED.equals(item.getStatus())); + } else { + itemPredicate = itemPredicate.and(item -> ItemStatus.ACTIVE.equals(item.getStatus())); + if (VersionStatus.Certified.name().equals(versionStatus)) { + itemPredicate = itemPredicate.and(item -> item.getVersionStatusCounters().containsKey(VersionStatus.Certified)); + } else if (VersionStatus.Draft.name().equals(versionStatus)) { + itemPredicate = itemPredicate + .and(item -> item.getVersionStatusCounters().containsKey(VersionStatus.Draft) && userHasPermission(item.getId(), user)); + } + } + return itemPredicate; + } + private class SyncEvent implements Event { private String eventType; @@ -295,33 +276,4 @@ public class VendorLicenseModelsImpl implements VendorLicenseModels { return entityId; } } - - private boolean userHasPermission(String itemId, String userId) { - return permissionsManager.getUserItemPermission(itemId, userId) - .map(permission -> permission - .matches(PermissionTypes.Contributor.name() + "|" + PermissionTypes.Owner.name())) - .orElse(false); - } - - private Predicate<Item> createItemPredicate(String versionStatus, String itemStatus, String user) { - Predicate<Item> itemPredicate = item -> ItemType.vlm.name().equals(item.getType()); - - if (ItemStatus.ARCHIVED.name().equals(itemStatus)) { - itemPredicate = itemPredicate.and(item -> ItemStatus.ARCHIVED.equals(item.getStatus())); - } else { - itemPredicate = itemPredicate.and(item -> ItemStatus.ACTIVE.equals(item.getStatus())); - - if (VersionStatus.Certified.name().equals(versionStatus)) { - itemPredicate = - itemPredicate.and(item -> item.getVersionStatusCounters().containsKey(VersionStatus.Certified)); - - } else if (VersionStatus.Draft.name().equals(versionStatus)) { - itemPredicate = itemPredicate - .and(item -> item.getVersionStatusCounters().containsKey(VersionStatus.Draft) - && userHasPermission(item.getId(), user)); - } - } - return itemPredicate; - } - } 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/VlmUniqueTypeProvider.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/VlmUniqueTypeProvider.java index 5beeec242f..91e1ac5593 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/VlmUniqueTypeProvider.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/VlmUniqueTypeProvider.java @@ -15,20 +15,18 @@ */ package org.openecomp.sdcrests.vendorlicense.rest.services; -import org.openecomp.sdcrests.uniquevalue.types.UniqueTypesProvider; +import static org.openecomp.sdc.vendorlicense.VendorLicenseConstants.UniqueValues.VENDOR_NAME; import java.util.Collections; import java.util.Map; - -import static org.openecomp.sdc.vendorlicense.VendorLicenseConstants.UniqueValues.VENDOR_NAME; +import org.openecomp.sdcrests.uniquevalue.types.UniqueTypesProvider; public class VlmUniqueTypeProvider implements UniqueTypesProvider { - private static final Map<String, String> uniqueTypes = - Collections.singletonMap("VlmName", VENDOR_NAME); + private static final Map<String, String> uniqueTypes = Collections.singletonMap("VlmName", VENDOR_NAME); - @Override - public Map<String, String> listUniqueTypes() { - return uniqueTypes; - } + @Override + public Map<String, String> listUniqueTypes() { + return uniqueTypes; + } } 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/ChoiceOrOtherDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/ChoiceOrOtherDto.java index ba8f57f79f..fc3a41903b 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/ChoiceOrOtherDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/ChoiceOrOtherDto.java @@ -7,9 +7,9 @@ * 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. @@ -17,59 +17,53 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdcrests.vendorlicense.types; +import javax.validation.constraints.NotNull; import org.hibernate.validator.group.GroupSequenceProvider; import org.openecomp.sdcrests.vendorlicense.types.validation.ChoiceOrOtherSequenceProvider; import org.openecomp.sdcrests.vendorlicense.types.validation.OtherChoiceValidation; -import javax.validation.constraints.NotNull; - @GroupSequenceProvider(value = ChoiceOrOtherSequenceProvider.class) public class ChoiceOrOtherDto<E extends Enum<E>> { - @NotNull - private E choice; - @NotNull(message = "may not be null when choice is set to 'Other'.", - groups = OtherChoiceValidation.class) - private String other; - - public E getChoice() { - return choice; - } - - public void setChoice(E choice) { - this.choice = choice; - } - public String getOther() { - return other; - } + @NotNull + private E choice; + @NotNull(message = "may not be null when choice is set to 'Other'.", groups = OtherChoiceValidation.class) + private String other; - public void setOther(String other) { - this.other = other; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; + public E getChoice() { + return choice; } - if (obj == null || getClass() != obj.getClass()) { - return false; + + public void setChoice(E choice) { + this.choice = choice; } - ChoiceOrOtherDto<?> that = (ChoiceOrOtherDto<?>) obj; + public String getOther() { + return other; + } - return choice != null ? choice.equals(that.choice) - : that.choice == null && (other != null ? other.equals(that.other) : that.other == null); + public void setOther(String other) { + this.other = other; + } - } + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null || getClass() != obj.getClass()) { + return false; + } + ChoiceOrOtherDto<?> that = (ChoiceOrOtherDto<?>) obj; + return choice != null ? choice.equals(that.choice) : that.choice == null && (other != null ? other.equals(that.other) : that.other == null); + } - @Override - public int hashCode() { - int result = choice != null ? choice.hashCode() : 0; - result = 31 * result + (other != null ? other.hashCode() : 0); - return result; - } + @Override + public int hashCode() { + int result = choice != null ? choice.hashCode() : 0; + result = 31 * result + (other != null ? other.hashCode() : 0); + return result; + } } 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/EntitlementPoolEntityDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/EntitlementPoolEntityDto.java index 88d08d6aa1..835d6fcbfe 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/EntitlementPoolEntityDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/EntitlementPoolEntityDto.java @@ -7,9 +7,9 @@ * 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. @@ -17,41 +17,39 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdcrests.vendorlicense.types; - import io.swagger.v3.oas.annotations.media.Schema; - import java.util.Set; @Schema(description = "EntitlementPoolEntity") public class EntitlementPoolEntityDto extends EntitlementPoolRequestDto { - private String id; - private Set<String> referencingFeatureGroups; - private String versionUUID; - public String getId() { - return id; - } + private String id; + private Set<String> referencingFeatureGroups; + private String versionUUID; + + public String getId() { + return id; + } - public void setId(String id) { - this.id = id; - } + public void setId(String id) { + this.id = id; + } - public Set<String> getReferencingFeatureGroups() { - return referencingFeatureGroups; - } + public Set<String> getReferencingFeatureGroups() { + return referencingFeatureGroups; + } - public void setReferencingFeatureGroups(Set<String> referencingFeatureGroups) { - this.referencingFeatureGroups = referencingFeatureGroups; - } + public void setReferencingFeatureGroups(Set<String> referencingFeatureGroups) { + this.referencingFeatureGroups = referencingFeatureGroups; + } - public String getversionUUID() { - return versionUUID; - } + public String getversionUUID() { + return versionUUID; + } - public void setVersionUUID(String versionUUID) { - this.versionUUID = versionUUID; - } + public void setVersionUUID(String versionUUID) { + this.versionUUID = versionUUID; + } } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/EntitlementPoolRequestDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/EntitlementPoolRequestDto.java index 642156fa30..35e6f31e28 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/EntitlementPoolRequestDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/EntitlementPoolRequestDto.java @@ -7,9 +7,9 @@ * 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. @@ -17,17 +17,14 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdcrests.vendorlicense.types; - import io.swagger.v3.oas.annotations.media.Schema; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import org.hibernate.validator.constraints.NotBlank; import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolType; import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope; import org.openecomp.sdc.vendorlicense.dao.types.ThresholdUnit; - import javax.validation.Valid; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; @@ -36,109 +33,102 @@ import javax.validation.constraints.Size; @JsonIgnoreProperties({"time", "aggregationFunction", "entitlementMetric"}) public class EntitlementPoolRequestDto { - @NotNull - @Size(max = 120) - private String name; - - @NotBlank(message = "is mandatory and should not be empty") - @Size(max = 100) - private String manufacturerReferenceNumber; - - @Size(max = 1000) - private String description; - - @NotNull - private EntitlementPoolType type; - - private Integer thresholdValue; - - private ThresholdUnit thresholdUnits; - @Size(max = 120) - private String increments; - - @Valid - private MultiChoiceOrOtherDto<OperationalScope> operationalScope; - - private String startDate; - private String expiryDate; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getManufacturerReferenceNumber() { - return manufacturerReferenceNumber; - } - - public void setManufacturerReferenceNumber(String manufacturerReferenceNumber) { - this.manufacturerReferenceNumber = manufacturerReferenceNumber; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public EntitlementPoolType getType() { - return type; - } - - public void setType(EntitlementPoolType type) { - this.type = type; - } - - public Integer getThresholdValue() { - return thresholdValue; - } - - public void setThresholdValue(Integer thresholdValue) { - this.thresholdValue = thresholdValue; - } - - public ThresholdUnit getThresholdUnits() { - return thresholdUnits; - } - - public void setThresholdUnits(ThresholdUnit thresholdUnits) { - this.thresholdUnits = thresholdUnits; - } - - public String getIncrements() { - return increments; - } - - public void setIncrements(String increments) { - this.increments = increments; - } - - public MultiChoiceOrOtherDto<OperationalScope> getOperationalScope() { - return operationalScope; - } - - public void setOperationalScope(MultiChoiceOrOtherDto<OperationalScope> operationalScope) { - this.operationalScope = operationalScope; - } - - public String getStartDate() { - return startDate; - } - - public void setStartDate(String startDate) { - this.startDate = startDate; - } - - public String getExpiryDate() { - return expiryDate; - } - - public void setExpiryDate(String expiryDate) { - this.expiryDate = expiryDate; - } + @NotNull + @Size(max = 120) + private String name; + @NotBlank(message = "is mandatory and should not be empty") + @Size(max = 100) + private String manufacturerReferenceNumber; + @Size(max = 1000) + private String description; + @NotNull + private EntitlementPoolType type; + private Integer thresholdValue; + private ThresholdUnit thresholdUnits; + @Size(max = 120) + private String increments; + @Valid + private MultiChoiceOrOtherDto<OperationalScope> operationalScope; + private String startDate; + private String expiryDate; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getManufacturerReferenceNumber() { + return manufacturerReferenceNumber; + } + + public void setManufacturerReferenceNumber(String manufacturerReferenceNumber) { + this.manufacturerReferenceNumber = manufacturerReferenceNumber; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public EntitlementPoolType getType() { + return type; + } + + public void setType(EntitlementPoolType type) { + this.type = type; + } + + public Integer getThresholdValue() { + return thresholdValue; + } + + public void setThresholdValue(Integer thresholdValue) { + this.thresholdValue = thresholdValue; + } + + public ThresholdUnit getThresholdUnits() { + return thresholdUnits; + } + + public void setThresholdUnits(ThresholdUnit thresholdUnits) { + this.thresholdUnits = thresholdUnits; + } + + public String getIncrements() { + return increments; + } + + public void setIncrements(String increments) { + this.increments = increments; + } + + public MultiChoiceOrOtherDto<OperationalScope> getOperationalScope() { + return operationalScope; + } + + public void setOperationalScope(MultiChoiceOrOtherDto<OperationalScope> operationalScope) { + this.operationalScope = operationalScope; + } + + public String getStartDate() { + return startDate; + } + + public void setStartDate(String startDate) { + this.startDate = startDate; + } + + public String getExpiryDate() { + return expiryDate; + } + + public void setExpiryDate(String expiryDate) { + this.expiryDate = expiryDate; + } } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/FeatureGroupDescriptorDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/FeatureGroupDescriptorDto.java index 919fdb21c2..03bf2de328 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/FeatureGroupDescriptorDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/FeatureGroupDescriptorDto.java @@ -7,9 +7,9 @@ * 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. @@ -17,45 +17,42 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdcrests.vendorlicense.types; - import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; public class FeatureGroupDescriptorDto { - @NotNull - @Size(max = 120) - private String name; - - @Size(max = 1000) - private String description; - @NotNull - private String partNumber; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getPartNumber() { - return partNumber; - } - - public void setPartNumber(String partNumber) { - this.partNumber = partNumber; - } + @NotNull + @Size(max = 120) + private String name; + @Size(max = 1000) + private String description; + @NotNull + private String partNumber; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getPartNumber() { + return partNumber; + } + + public void setPartNumber(String partNumber) { + this.partNumber = partNumber; + } } 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 eac6ed38fe..679dfbbeca 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 @@ -7,9 +7,9 @@ * 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. @@ -17,52 +17,50 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdcrests.vendorlicense.types; - import io.swagger.v3.oas.annotations.media.Schema; - -import javax.validation.constraints.Size; import java.util.Set; +import javax.validation.constraints.Size; @Schema(description = "FeatureGroupEntity") public class FeatureGroupEntityDto extends FeatureGroupDescriptorDto { - private String id; - private Set<String> licenseKeyGroupsIds; - @Size(min = 1) - private Set<String> entitlementPoolsIds; - private Set<String> referencingLicenseAgreements; - public String getId() { - return id; - } + private String id; + private Set<String> licenseKeyGroupsIds; + @Size(min = 1) + private Set<String> entitlementPoolsIds; + private Set<String> referencingLicenseAgreements; + + public String getId() { + return id; + } - public void setId(String id) { - this.id = id; - } + public void setId(String id) { + this.id = id; + } - public Set<String> getLicenseKeyGroupsIds() { - return licenseKeyGroupsIds; - } + public Set<String> getLicenseKeyGroupsIds() { + return licenseKeyGroupsIds; + } - public void setLicenseKeyGroupsIds(Set<String> licenseKeyGroupsIds) { - this.licenseKeyGroupsIds = licenseKeyGroupsIds; - } + public void setLicenseKeyGroupsIds(Set<String> licenseKeyGroupsIds) { + this.licenseKeyGroupsIds = licenseKeyGroupsIds; + } - public Set<String> getEntitlementPoolsIds() { - return entitlementPoolsIds; - } + public Set<String> getEntitlementPoolsIds() { + return entitlementPoolsIds; + } - public void setEntitlementPoolsIds(Set<String> entitlementPoolsIds) { - this.entitlementPoolsIds = entitlementPoolsIds; - } + public void setEntitlementPoolsIds(Set<String> entitlementPoolsIds) { + this.entitlementPoolsIds = entitlementPoolsIds; + } - public Set<String> getReferencingLicenseAgreements() { - return referencingLicenseAgreements; - } + public Set<String> getReferencingLicenseAgreements() { + return referencingLicenseAgreements; + } - public void setReferencingLicenseAgreements(Set<String> referencingLicenseAgreements) { - this.referencingLicenseAgreements = referencingLicenseAgreements; - } + public void setReferencingLicenseAgreements(Set<String> referencingLicenseAgreements) { + this.referencingLicenseAgreements = referencingLicenseAgreements; + } } 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/FeatureGroupModelDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/FeatureGroupModelDto.java index 44404c3b1f..485e362288 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/FeatureGroupModelDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/FeatureGroupModelDto.java @@ -7,9 +7,9 @@ * 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. @@ -17,52 +17,49 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdcrests.vendorlicense.types; - - import io.swagger.v3.oas.annotations.media.Schema; - import java.util.Collection; import java.util.Set; @Schema(description = "FeatureGroupModel") public class FeatureGroupModelDto extends FeatureGroupDescriptorDto { - private String id; - private Set<String> referencingLicenseAgreements; - private Collection<LicenseKeyGroupEntityDto> licenseKeyGroups; - private Collection<EntitlementPoolEntityDto> entitlementPools; - public String getId() { - return id; - } + private String id; + private Set<String> referencingLicenseAgreements; + private Collection<LicenseKeyGroupEntityDto> licenseKeyGroups; + private Collection<EntitlementPoolEntityDto> entitlementPools; + + public String getId() { + return id; + } - public void setId(String id) { - this.id = id; - } + public void setId(String id) { + this.id = id; + } - public Set<String> getReferencingLicenseAgreements() { - return referencingLicenseAgreements; - } + public Set<String> getReferencingLicenseAgreements() { + return referencingLicenseAgreements; + } - public void setReferencingLicenseAgreements(Set<String> referencingLicenseAgreements) { - this.referencingLicenseAgreements = referencingLicenseAgreements; - } + public void setReferencingLicenseAgreements(Set<String> referencingLicenseAgreements) { + this.referencingLicenseAgreements = referencingLicenseAgreements; + } - public Collection<LicenseKeyGroupEntityDto> getLicenseKeyGroups() { - return licenseKeyGroups; - } + public Collection<LicenseKeyGroupEntityDto> getLicenseKeyGroups() { + return licenseKeyGroups; + } - public void setLicenseKeyGroups(Collection<LicenseKeyGroupEntityDto> licenseKeyGroups) { - this.licenseKeyGroups = licenseKeyGroups; - } + public void setLicenseKeyGroups(Collection<LicenseKeyGroupEntityDto> licenseKeyGroups) { + this.licenseKeyGroups = licenseKeyGroups; + } - public Collection<EntitlementPoolEntityDto> getEntitlementPools() { - return entitlementPools; - } + public Collection<EntitlementPoolEntityDto> getEntitlementPools() { + return entitlementPools; + } - public void setEntitlementPools(Collection<EntitlementPoolEntityDto> entitlementPools) { - this.entitlementPools = entitlementPools; - } + public void setEntitlementPools(Collection<EntitlementPoolEntityDto> entitlementPools) { + this.entitlementPools = entitlementPools; + } } 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/FeatureGroupRequestDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/FeatureGroupRequestDto.java index 3aefaa1d45..27fb954957 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/FeatureGroupRequestDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/FeatureGroupRequestDto.java @@ -7,9 +7,9 @@ * 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. @@ -17,33 +17,30 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdcrests.vendorlicense.types; - import io.swagger.v3.oas.annotations.media.Schema; - import java.util.Set; @Schema(description = "FeatureGroupRequest") public class FeatureGroupRequestDto extends FeatureGroupDescriptorDto { - private Set<String> addedLicenseKeyGroupsIds; - private Set<String> addedEntitlementPoolsIds; + private Set<String> addedLicenseKeyGroupsIds; + private Set<String> addedEntitlementPoolsIds; - public Set<String> getAddedLicenseKeyGroupsIds() { - return addedLicenseKeyGroupsIds; - } + public Set<String> getAddedLicenseKeyGroupsIds() { + return addedLicenseKeyGroupsIds; + } - public void setAddedLicenseKeyGroupsIds(Set<String> addedLicenseKeyGroupsIds) { - this.addedLicenseKeyGroupsIds = addedLicenseKeyGroupsIds; - } + public void setAddedLicenseKeyGroupsIds(Set<String> addedLicenseKeyGroupsIds) { + this.addedLicenseKeyGroupsIds = addedLicenseKeyGroupsIds; + } - public Set<String> getAddedEntitlementPoolsIds() { - return addedEntitlementPoolsIds; - } + public Set<String> getAddedEntitlementPoolsIds() { + return addedEntitlementPoolsIds; + } - public void setAddedEntitlementPoolsIds(Set<String> addedEntitlementPoolsIds) { - this.addedEntitlementPoolsIds = addedEntitlementPoolsIds; - } + public void setAddedEntitlementPoolsIds(Set<String> addedEntitlementPoolsIds) { + this.addedEntitlementPoolsIds = addedEntitlementPoolsIds; + } } 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/FeatureGroupUpdateRequestDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/FeatureGroupUpdateRequestDto.java index 9e3fab59ee..016735fced 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/FeatureGroupUpdateRequestDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/FeatureGroupUpdateRequestDto.java @@ -7,9 +7,9 @@ * 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. @@ -17,33 +17,30 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdcrests.vendorlicense.types; - import io.swagger.v3.oas.annotations.media.Schema; - import java.util.Set; @Schema(description = "FeatureGroupUpdateRequest") public class FeatureGroupUpdateRequestDto extends FeatureGroupRequestDto { - private Set<String> removedLicenseKeyGroupsIds; - private Set<String> removedEntitlementPoolsIds; + private Set<String> removedLicenseKeyGroupsIds; + private Set<String> removedEntitlementPoolsIds; - public Set<String> getRemovedLicenseKeyGroupsIds() { - return removedLicenseKeyGroupsIds; - } + public Set<String> getRemovedLicenseKeyGroupsIds() { + return removedLicenseKeyGroupsIds; + } - public void setRemovedLicenseKeyGroupsIds(Set<String> removedLicenseKeyGroupsIds) { - this.removedLicenseKeyGroupsIds = removedLicenseKeyGroupsIds; - } + public void setRemovedLicenseKeyGroupsIds(Set<String> removedLicenseKeyGroupsIds) { + this.removedLicenseKeyGroupsIds = removedLicenseKeyGroupsIds; + } - public Set<String> getRemovedEntitlementPoolsIds() { - return removedEntitlementPoolsIds; - } + public Set<String> getRemovedEntitlementPoolsIds() { + return removedEntitlementPoolsIds; + } - public void setRemovedEntitlementPoolsIds(Set<String> removedEntitlementPoolsIds) { - this.removedEntitlementPoolsIds = removedEntitlementPoolsIds; - } + public void setRemovedEntitlementPoolsIds(Set<String> removedEntitlementPoolsIds) { + this.removedEntitlementPoolsIds = removedEntitlementPoolsIds; + } } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseAgreementDescriptorDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseAgreementDescriptorDto.java index 4239488124..cd72d151dc 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseAgreementDescriptorDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseAgreementDescriptorDto.java @@ -7,9 +7,9 @@ * 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. @@ -17,58 +17,55 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdcrests.vendorlicense.types; -import org.openecomp.sdc.vendorlicense.dao.types.LicenseTerm; - import javax.validation.Valid; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; +import org.openecomp.sdc.vendorlicense.dao.types.LicenseTerm; public class LicenseAgreementDescriptorDto { - @NotNull - @Size(max = 120) - private String name; - - @Size(max = 1000) - private String description; - @NotNull - @Valid - private ChoiceOrOtherDto<LicenseTerm> licenseTerm; - @Size(max = 1000) - private String requirementsAndConstrains; + @NotNull + @Size(max = 120) + private String name; + @Size(max = 1000) + private String description; + @NotNull + @Valid + private ChoiceOrOtherDto<LicenseTerm> licenseTerm; + @Size(max = 1000) + private String requirementsAndConstrains; - public String getName() { - return name; - } + public String getName() { + return name; + } - public void setName(String name) { - this.name = name; - } + public void setName(String name) { + this.name = name; + } - public String getDescription() { - return description; - } + public String getDescription() { + return description; + } - public void setDescription(String description) { - this.description = description; - } + public void setDescription(String description) { + this.description = description; + } - public ChoiceOrOtherDto<LicenseTerm> getLicenseTerm() { - return licenseTerm; - } + public ChoiceOrOtherDto<LicenseTerm> getLicenseTerm() { + return licenseTerm; + } - public void setLicenseTerm(ChoiceOrOtherDto<LicenseTerm> licenseTerm) { - this.licenseTerm = licenseTerm; - } + public void setLicenseTerm(ChoiceOrOtherDto<LicenseTerm> licenseTerm) { + this.licenseTerm = licenseTerm; + } - public String getRequirementsAndConstrains() { - return requirementsAndConstrains; - } + public String getRequirementsAndConstrains() { + return requirementsAndConstrains; + } - public void setRequirementsAndConstrains(String requirementsAndConstrains) { - this.requirementsAndConstrains = requirementsAndConstrains; - } + public void setRequirementsAndConstrains(String requirementsAndConstrains) { + this.requirementsAndConstrains = requirementsAndConstrains; + } } 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 e3b6207eaa..423edcfe59 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 @@ -7,9 +7,9 @@ * 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. @@ -17,35 +17,32 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdcrests.vendorlicense.types; - - import io.swagger.v3.oas.annotations.media.Schema; - -import javax.validation.constraints.Size; import java.util.Set; +import javax.validation.constraints.Size; @Schema(description = "LicenseAgreementEntity") public class LicenseAgreementEntityDto extends LicenseAgreementDescriptorDto { - private String id; - @Size(min = 1) - private Set<String> featureGroupsIds; - public String getId() { - return id; - } + private String id; + @Size(min = 1) + private Set<String> featureGroupsIds; + + public String getId() { + return id; + } - public void setId(String id) { - this.id = id; - } + public void setId(String id) { + this.id = id; + } - public Set<String> getFeatureGroupsIds() { - return featureGroupsIds; - } + public Set<String> getFeatureGroupsIds() { + return featureGroupsIds; + } - public void setFeatureGroupsIds(Set<String> featureGroupsIds) { - this.featureGroupsIds = featureGroupsIds; - } + public void setFeatureGroupsIds(Set<String> featureGroupsIds) { + this.featureGroupsIds = featureGroupsIds; + } } 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/LicenseAgreementModelDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseAgreementModelDto.java index 3c97756c3c..8365476e8d 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseAgreementModelDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseAgreementModelDto.java @@ -7,9 +7,9 @@ * 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. @@ -17,33 +17,30 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdcrests.vendorlicense.types; - - import io.swagger.v3.oas.annotations.media.Schema; - import java.util.Set; @Schema(description = "LicenseAgreementModel") public class LicenseAgreementModelDto extends LicenseAgreementDescriptorDto { - private String id; - private Set<FeatureGroupEntityDto> featureGroups; - public String getId() { - return id; - } + private String id; + private Set<FeatureGroupEntityDto> featureGroups; + + public String getId() { + return id; + } - public void setId(String id) { - this.id = id; - } + public void setId(String id) { + this.id = id; + } - public Set<FeatureGroupEntityDto> getFeatureGroups() { - return featureGroups; - } + public Set<FeatureGroupEntityDto> getFeatureGroups() { + return featureGroups; + } - public void setFeatureGroups(Set<FeatureGroupEntityDto> featureGroups) { - this.featureGroups = featureGroups; - } + public void setFeatureGroups(Set<FeatureGroupEntityDto> featureGroups) { + this.featureGroups = featureGroups; + } } 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/LicenseAgreementRequestDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseAgreementRequestDto.java index 358dcef8e2..ee90e989e2 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseAgreementRequestDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseAgreementRequestDto.java @@ -7,9 +7,9 @@ * 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. @@ -17,24 +17,21 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdcrests.vendorlicense.types; - import io.swagger.v3.oas.annotations.media.Schema; - import java.util.Set; @Schema(description = "LicenseAgreementRequest") public class LicenseAgreementRequestDto extends LicenseAgreementDescriptorDto { - private Set<String> addedFeatureGroupsIds; + private Set<String> addedFeatureGroupsIds; - public Set<String> getAddedFeatureGroupsIds() { - return addedFeatureGroupsIds; - } + public Set<String> getAddedFeatureGroupsIds() { + return addedFeatureGroupsIds; + } - public void setAddedFeatureGroupsIds(Set<String> addedFeatureGroupsIds) { - this.addedFeatureGroupsIds = addedFeatureGroupsIds; - } + public void setAddedFeatureGroupsIds(Set<String> addedFeatureGroupsIds) { + this.addedFeatureGroupsIds = addedFeatureGroupsIds; + } } 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/LicenseAgreementUpdateRequestDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseAgreementUpdateRequestDto.java index 6baba8acb3..3fbba212dd 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseAgreementUpdateRequestDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseAgreementUpdateRequestDto.java @@ -7,9 +7,9 @@ * 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. @@ -17,23 +17,21 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdcrests.vendorlicense.types; - import io.swagger.v3.oas.annotations.media.Schema; - import java.util.Set; @Schema(description = "LicenseAgreementUpdateRequest") public class LicenseAgreementUpdateRequestDto extends LicenseAgreementRequestDto { - private Set<String> removedFeatureGroupsIds; - public Set<String> getRemovedFeatureGroupsIds() { - return removedFeatureGroupsIds; - } + private Set<String> removedFeatureGroupsIds; + + public Set<String> getRemovedFeatureGroupsIds() { + return removedFeatureGroupsIds; + } - public void setRemovedFeatureGroupsIds(Set<String> removedFeatureGroupsIds) { - this.removedFeatureGroupsIds = removedFeatureGroupsIds; - } + public void setRemovedFeatureGroupsIds(Set<String> removedFeatureGroupsIds) { + this.removedFeatureGroupsIds = removedFeatureGroupsIds; + } } 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/LicenseKeyGroupEntityDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseKeyGroupEntityDto.java index 6186398d29..6ee80bd801 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseKeyGroupEntityDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseKeyGroupEntityDto.java @@ -7,9 +7,9 @@ * 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. @@ -17,38 +17,37 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdcrests.vendorlicense.types; - import java.util.Set; public class LicenseKeyGroupEntityDto extends LicenseKeyGroupRequestDto { - private String id; - private Set<String> referencingFeatureGroups; - private String versionUUID; - public String getId() { - return id; - } + private String id; + private Set<String> referencingFeatureGroups; + private String versionUUID; + + public String getId() { + return id; + } - public void setId(String id) { - this.id = id; - } + public void setId(String id) { + this.id = id; + } - public Set<String> getReferencingFeatureGroups() { - return referencingFeatureGroups; - } + public Set<String> getReferencingFeatureGroups() { + return referencingFeatureGroups; + } - public void setReferencingFeatureGroups(Set<String> referencingFeatureGroups) { - this.referencingFeatureGroups = referencingFeatureGroups; - } + public void setReferencingFeatureGroups(Set<String> referencingFeatureGroups) { + this.referencingFeatureGroups = referencingFeatureGroups; + } - public String getVersionUUID() { - return versionUUID; - } + public String getVersionUUID() { + return versionUUID; + } - public void setVersionUUID(String versionUUID) { - this.versionUUID = versionUUID; - } + public void setVersionUUID(String versionUUID) { + this.versionUUID = versionUUID; + } } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseKeyGroupRequestDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseKeyGroupRequestDto.java index c1e2ef05bf..2eabb0aa4a 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseKeyGroupRequestDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseKeyGroupRequestDto.java @@ -7,9 +7,9 @@ * 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. @@ -17,121 +17,112 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdcrests.vendorlicense.types; -import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyType; -import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope; -import org.openecomp.sdc.vendorlicense.dao.types.ThresholdUnit; - import javax.validation.Valid; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; +import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyType; +import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope; +import org.openecomp.sdc.vendorlicense.dao.types.ThresholdUnit; public class LicenseKeyGroupRequestDto { - @NotNull - @Size(max = 120) - private String name; - - @Size(max = 100) - private String manufacturerReferenceNumber; - - @Size(max = 1000) - private String description; - - @NotNull - private LicenseKeyType type; - - @Valid - private MultiChoiceOrOtherDto<OperationalScope> operationalScope; - - private String startDate; - private String expiryDate; - - private Integer thresholdValue; - - private ThresholdUnit thresholdUnits; - - @Size(max = 120) - private String increments; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getManufacturerReferenceNumber() { - return manufacturerReferenceNumber; - } - - public void setManufacturerReferenceNumber(String manufacturerReferenceNumber) { - this.manufacturerReferenceNumber = manufacturerReferenceNumber; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public LicenseKeyType getType() { - return type; - } - - public void setType(LicenseKeyType type) { - this.type = type; - } - - public MultiChoiceOrOtherDto<OperationalScope> getOperationalScope() { - return operationalScope; - } - - public void setOperationalScope(MultiChoiceOrOtherDto<OperationalScope> operationalScope) { - this.operationalScope = operationalScope; - } - - public String getStartDate() { - return startDate; - } - - public void setStartDate(String startDate) { - this.startDate = startDate; - } - - public String getExpiryDate() { - return expiryDate; - } - - public void setExpiryDate(String expiryDate) { - this.expiryDate = expiryDate; - } - - public Integer getThresholdValue() { - return thresholdValue; - } - - public void setThresholdValue(Integer thresholdValue) { - this.thresholdValue = thresholdValue; - } - - public ThresholdUnit getThresholdUnits() { - return thresholdUnits; - } - - public void setThresholdUnits(ThresholdUnit thresholdUnits) { - this.thresholdUnits = thresholdUnits; - } - - public String getIncrements() { - return increments; - } - public void setIncrements(String increments) { - this.increments = increments; - } + @NotNull + @Size(max = 120) + private String name; + @Size(max = 100) + private String manufacturerReferenceNumber; + @Size(max = 1000) + private String description; + @NotNull + private LicenseKeyType type; + @Valid + private MultiChoiceOrOtherDto<OperationalScope> operationalScope; + private String startDate; + private String expiryDate; + private Integer thresholdValue; + private ThresholdUnit thresholdUnits; + @Size(max = 120) + private String increments; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getManufacturerReferenceNumber() { + return manufacturerReferenceNumber; + } + + public void setManufacturerReferenceNumber(String manufacturerReferenceNumber) { + this.manufacturerReferenceNumber = manufacturerReferenceNumber; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public LicenseKeyType getType() { + return type; + } + + public void setType(LicenseKeyType type) { + this.type = type; + } + + public MultiChoiceOrOtherDto<OperationalScope> getOperationalScope() { + return operationalScope; + } + + public void setOperationalScope(MultiChoiceOrOtherDto<OperationalScope> operationalScope) { + this.operationalScope = operationalScope; + } + + public String getStartDate() { + return startDate; + } + + public void setStartDate(String startDate) { + this.startDate = startDate; + } + + public String getExpiryDate() { + return expiryDate; + } + + public void setExpiryDate(String expiryDate) { + this.expiryDate = expiryDate; + } + + public Integer getThresholdValue() { + return thresholdValue; + } + + public void setThresholdValue(Integer thresholdValue) { + this.thresholdValue = thresholdValue; + } + + public ThresholdUnit getThresholdUnits() { + return thresholdUnits; + } + + public void setThresholdUnits(ThresholdUnit thresholdUnits) { + this.thresholdUnits = thresholdUnits; + } + + public String getIncrements() { + return increments; + } + + public void setIncrements(String increments) { + this.increments = increments; + } } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LimitEntityDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LimitEntityDto.java index e3e3584b34..a22bb0a64d 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LimitEntityDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LimitEntityDto.java @@ -7,9 +7,9 @@ * 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. @@ -17,90 +17,89 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdcrests.vendorlicense.types; public class LimitEntityDto { - private String id; - private String name; - private String type; - private String description; - private String metric; - private String value; - private String unit; - private String aggregationFunction; - private String time; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getMetric() { - return metric; - } - - public void setMetric(String metric) { - this.metric = metric; - } - - public String getUnit() { - return unit; - } - - public void setUnit(String unit) { - this.unit = unit; - } - - public String getAggregationFunction() { - return aggregationFunction; - } - - public void setAggregationFunction(String aggregationFunction) { - this.aggregationFunction = aggregationFunction; - } - - public String getTime() { - return time; - } - - public void setTime(String time) { - this.time = time; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } + private String id; + private String name; + private String type; + private String description; + private String metric; + private String value; + private String unit; + private String aggregationFunction; + private String time; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getMetric() { + return metric; + } + + public void setMetric(String metric) { + this.metric = metric; + } + + public String getUnit() { + return unit; + } + + public void setUnit(String unit) { + this.unit = unit; + } + + public String getAggregationFunction() { + return aggregationFunction; + } + + public void setAggregationFunction(String aggregationFunction) { + this.aggregationFunction = aggregationFunction; + } + + public String getTime() { + return time; + } + + public void setTime(String time) { + this.time = time; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LimitRequestDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LimitRequestDto.java index 116be31a40..fff840c402 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LimitRequestDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LimitRequestDto.java @@ -7,9 +7,9 @@ * 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. @@ -17,95 +17,91 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdcrests.vendorlicense.types; import io.swagger.v3.oas.annotations.media.Schema; -import org.hibernate.validator.constraints.NotBlank; - import javax.validation.constraints.Size; +import org.hibernate.validator.constraints.NotBlank; @Schema(description = "LimitRequest") public class LimitRequestDto { - @NotBlank(message = "is mandatory and should not be empty") - @Size(max = 120, message = "length should not exceed 120 characters.") - private String name; - @NotBlank(message = "is mandatory and should not be empty") - private String type; - @Size(max = 1000, message = "length should not exceed 1000 characters.") - private String description; - @NotBlank(message = "is mandatory and should not be empty") - private String metric; - @NotBlank(message = "is mandatory and should not be empty") - private String value; - private String unit; - private String aggregationFunction; - private String time; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getMetric() { - return metric; - } - - public void setMetric(String metric) { - this.metric = metric; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getAggregationFunction() { - return aggregationFunction; - } - - public void setAggregationFunction( - String aggregationFunction) { - this.aggregationFunction = aggregationFunction; - } - - public String getTime() { - return time; - } - - public void setTime(String time) { - this.time = time; - } - - public String getUnit() { - return unit; - } - - public void setUnit(String unit) { - this.unit = unit; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - + @NotBlank(message = "is mandatory and should not be empty") + @Size(max = 120, message = "length should not exceed 120 characters.") + private String name; + @NotBlank(message = "is mandatory and should not be empty") + private String type; + @Size(max = 1000, message = "length should not exceed 1000 characters.") + private String description; + @NotBlank(message = "is mandatory and should not be empty") + private String metric; + @NotBlank(message = "is mandatory and should not be empty") + private String value; + private String unit; + private String aggregationFunction; + private String time; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getMetric() { + return metric; + } + + public void setMetric(String metric) { + this.metric = metric; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getAggregationFunction() { + return aggregationFunction; + } + + public void setAggregationFunction(String aggregationFunction) { + this.aggregationFunction = aggregationFunction; + } + + public String getTime() { + return time; + } + + public void setTime(String time) { + this.time = time; + } + + public String getUnit() { + return unit; + } + + public void setUnit(String unit) { + this.unit = unit; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/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 1dc8ff2bdd..7a3266da96 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 @@ -7,9 +7,9 @@ * 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. @@ -17,62 +17,57 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdcrests.vendorlicense.types; +import java.util.Set; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; import org.hibernate.validator.group.GroupSequenceProvider; import org.openecomp.sdcrests.vendorlicense.types.validation.MultiChoiceOrOtherSequenceProvider; import org.openecomp.sdcrests.vendorlicense.types.validation.OtherChoiceValidation; -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>> { - @NotNull - @Size(min = 1, message = "must contain at least 1 choice.") - private Set<E> choices; - @NotNull(message = "may not be null when choices is set to 'Other'.", - groups = OtherChoiceValidation.class) - private String other; - public Set<E> getChoices() { - return choices; - } + @NotNull + @Size(min = 1, message = "must contain at least 1 choice.") + private Set<E> choices; + @NotNull(message = "may not be null when choices is set to 'Other'.", groups = OtherChoiceValidation.class) + private String other; - public void setChoices(Set<E> choices) { - this.choices = choices; - } - - public String getOther() { - return other; - } - - public void setOther(String other) { - this.other = other; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; + public Set<E> getChoices() { + return choices; } - if (obj == null || getClass() != obj.getClass()) { - return false; + + public void setChoices(Set<E> choices) { + this.choices = choices; } - MultiChoiceOrOtherDto<?> that = (MultiChoiceOrOtherDto<?>) obj; + public String getOther() { + return other; + } - return choices != null ? choices.equals(that.choices) - : that.choices == null && (other != null ? other.equals(that.other) : that.other == null); + public void setOther(String other) { + this.other = other; + } - } + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null || getClass() != obj.getClass()) { + return false; + } + MultiChoiceOrOtherDto<?> that = (MultiChoiceOrOtherDto<?>) obj; + return choices != null ? choices.equals(that.choices) + : that.choices == null && (other != null ? other.equals(that.other) : that.other == null); + } - @Override - public int hashCode() { - int result = choices != null ? choices.hashCode() : 0; - result = 31 * result + (other != null ? other.hashCode() : 0); - return result; - } + @Override + public int hashCode() { + int result = choices != null ? choices.hashCode() : 0; + result = 31 * result + (other != null ? other.hashCode() : 0); + return result; + } } 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 68e0fd8552..53be21f0bc 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 @@ -7,9 +7,9 @@ * 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. @@ -17,33 +17,30 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdcrests.vendorlicense.types; import org.openecomp.sdcrests.item.types.SubmitRequestDto; public class VendorLicenseModelActionRequestDto { - private VendorLicenseModelAction action; - private SubmitRequestDto submitRequest; + private VendorLicenseModelAction action; + private SubmitRequestDto submitRequest; - public VendorLicenseModelAction getAction() { - return action; - } + public VendorLicenseModelAction getAction() { + return action; + } - public void setAction(VendorLicenseModelAction action) { - this.action = action; - } + public void setAction(VendorLicenseModelAction action) { + this.action = action; + } - public SubmitRequestDto getSubmitRequest() { - return submitRequest; - } + public SubmitRequestDto getSubmitRequest() { + return submitRequest; + } - public void setSubmitRequest(SubmitRequestDto submitRequest) { - this.submitRequest = submitRequest; - } + public void setSubmitRequest(SubmitRequestDto submitRequest) { + this.submitRequest = submitRequest; + } - public enum VendorLicenseModelAction { - Submit - } + 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 2162006c16..2c647647d8 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 @@ -7,9 +7,9 @@ * 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. @@ -17,21 +17,20 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdcrests.vendorlicense.types; - import io.swagger.v3.oas.annotations.media.Schema; @Schema(description = "VendorLicenseModelEntity") public class VendorLicenseModelEntityDto extends VendorLicenseModelRequestDto { - private String id; - public String getId() { - return id; - } + private String id; + + public String getId() { + return id; + } - public void setId(String id) { - this.id = id; - } + public void setId(String id) { + this.id = id; + } } 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/VendorLicenseModelRequestDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/VendorLicenseModelRequestDto.java index da2a3e742d..625cc721a9 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/VendorLicenseModelRequestDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/VendorLicenseModelRequestDto.java @@ -7,9 +7,9 @@ * 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. @@ -17,48 +17,45 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdcrests.vendorlicense.types; - - import io.swagger.v3.oas.annotations.media.Schema; - import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; @Schema(description = "VendorLicenseModelRequest") public class VendorLicenseModelRequestDto { - @NotNull - @Size(max = 25) - private String vendorName; - @NotNull - @Size(max = 1000) - private String description; - @NotNull - private String iconRef; - - public String getVendorName() { - return vendorName; - } - - public void setVendorName(String vendorName) { - this.vendorName = vendorName; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getIconRef() { - return iconRef; - } - public void setIconRef(String iconRef) { - this.iconRef = iconRef; - } + @NotNull + @Size(max = 25) + private String vendorName; + @NotNull + @Size(max = 1000) + private String description; + @NotNull + private String iconRef; + + public String getVendorName() { + return vendorName; + } + + public void setVendorName(String vendorName) { + this.vendorName = vendorName; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getIconRef() { + return iconRef; + } + + public void setIconRef(String iconRef) { + this.iconRef = iconRef; + } } 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/validation/ChoiceOrOtherSequenceProvider.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/validation/ChoiceOrOtherSequenceProvider.java index 8be0ba3231..d2cc51c769 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/validation/ChoiceOrOtherSequenceProvider.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/validation/ChoiceOrOtherSequenceProvider.java @@ -7,9 +7,9 @@ * 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. @@ -17,29 +17,23 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdcrests.vendorlicense.types.validation; +import java.util.ArrayList; +import java.util.List; import org.hibernate.validator.spi.group.DefaultGroupSequenceProvider; import org.openecomp.sdc.vendorlicense.dao.types.ChoiceOrOther; import org.openecomp.sdcrests.vendorlicense.types.ChoiceOrOtherDto; -import java.util.ArrayList; -import java.util.List; - -public class ChoiceOrOtherSequenceProvider - implements DefaultGroupSequenceProvider<ChoiceOrOtherDto> { +public class ChoiceOrOtherSequenceProvider implements DefaultGroupSequenceProvider<ChoiceOrOtherDto> { - @Override - public List<Class<?>> getValidationGroups(ChoiceOrOtherDto choiceOrOther) { - List<Class<?>> sequence = new ArrayList<>(); - sequence.add(ChoiceOrOtherDto.class); - - if (choiceOrOther != null && choiceOrOther.getChoice() != null - && ChoiceOrOther.OTHER_ENUM_VALUE.equals(choiceOrOther.getChoice().name())) { - sequence.add(OtherChoiceValidation.class); + @Override + public List<Class<?>> getValidationGroups(ChoiceOrOtherDto choiceOrOther) { + List<Class<?>> sequence = new ArrayList<>(); + sequence.add(ChoiceOrOtherDto.class); + if (choiceOrOther != null && choiceOrOther.getChoice() != null && ChoiceOrOther.OTHER_ENUM_VALUE.equals(choiceOrOther.getChoice().name())) { + sequence.add(OtherChoiceValidation.class); + } + return sequence; } - - return sequence; - } } 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/validation/MultiChoiceOrOtherSequenceProvider.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/validation/MultiChoiceOrOtherSequenceProvider.java index 7cc9bbd2a2..446a7c2ec7 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/validation/MultiChoiceOrOtherSequenceProvider.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/validation/MultiChoiceOrOtherSequenceProvider.java @@ -7,9 +7,9 @@ * 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. @@ -17,31 +17,24 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdcrests.vendorlicense.types.validation; +import java.util.ArrayList; +import java.util.List; import org.hibernate.validator.spi.group.DefaultGroupSequenceProvider; import org.openecomp.sdc.vendorlicense.dao.types.MultiChoiceOrOther; import org.openecomp.sdcrests.vendorlicense.types.MultiChoiceOrOtherDto; -import java.util.ArrayList; -import java.util.List; - -public class MultiChoiceOrOtherSequenceProvider - implements DefaultGroupSequenceProvider<MultiChoiceOrOtherDto> { +public class MultiChoiceOrOtherSequenceProvider implements DefaultGroupSequenceProvider<MultiChoiceOrOtherDto> { - @Override - public List<Class<?>> getValidationGroups(MultiChoiceOrOtherDto multiChoiceOrOther) { - List<Class<?>> sequence = new ArrayList<>(); - sequence.add(MultiChoiceOrOtherDto.class); - - if (multiChoiceOrOther != null && multiChoiceOrOther.getChoices() != null - && multiChoiceOrOther.getChoices().size() == 1 - && MultiChoiceOrOther.OTHER_ENUM_VALUE - .equals((((Enum) (multiChoiceOrOther.getChoices().iterator().next())).name()))) { - sequence.add(OtherChoiceValidation.class); + @Override + public List<Class<?>> getValidationGroups(MultiChoiceOrOtherDto multiChoiceOrOther) { + List<Class<?>> sequence = new ArrayList<>(); + sequence.add(MultiChoiceOrOtherDto.class); + if (multiChoiceOrOther != null && multiChoiceOrOther.getChoices() != null && multiChoiceOrOther.getChoices().size() == 1 + && MultiChoiceOrOther.OTHER_ENUM_VALUE.equals((((Enum) (multiChoiceOrOther.getChoices().iterator().next())).name()))) { + sequence.add(OtherChoiceValidation.class); + } + return sequence; } - - return sequence; - } } 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/validation/OtherChoiceValidation.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/validation/OtherChoiceValidation.java index ff682dd8b5..7bffee5749 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/validation/OtherChoiceValidation.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/validation/OtherChoiceValidation.java @@ -7,9 +7,9 @@ * 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. @@ -17,8 +17,8 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdcrests.vendorlicense.types.validation; public interface OtherChoiceValidation { + } |