aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main')
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/EntitlementPools.java105
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/FeatureGroups.java108
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/LicenseAgreements.java109
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/LicenseKeyGroups.java104
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/VendorLicenseModels.java111
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapChoiceOrOtherDtoToChoiceOrOther.java36
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapChoiceOrOtherToChoiceOrOtherDto.java35
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolEntityToEntitlementPoolEntityDto.java53
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolRequestDtoToEntitlementPoolEntity.java51
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapFeatureGroupDescriptorDtoToFeatureGroupEntity.java36
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapFeatureGroupEntityToFeatureGroupDescriptorDto.java35
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseAgreementDescriptorDtoToLicenseAgreementEntity.java38
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseAgreementEntityToLicenseAgreementDescriptorDto.java38
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto.java40
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity.java38
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapMultiChoiceOrOtherDtoToMultiChoiceOrOther.java36
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapMultiChoiceOrOtherToMultiChoiceOrOtherDto.java35
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapVendorLicenseModelRequestDtoToVendorLicenseModelEntity.java36
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapVersionedVendorLicenseModelToVendorLicenseModelEntityDto.java60
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/EntitlementPoolsImpl.java157
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/FeatureGroupsImpl.java169
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseAgreementsImpl.java186
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseKeyGroupsImpl.java159
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/VendorLicenseModelsImpl.java135
24 files changed, 1910 insertions, 0 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/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
new file mode 100644
index 0000000000..9dea767f7d
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/EntitlementPools.java
@@ -0,0 +1,105 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vendorlicense.rest;
+
+import static org.openecomp.sdcrests.common.RestConstants.USER_HEADER_PARAM;
+import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdcrests.vendorlicense.types.EntitlementPoolEntityDto;
+import org.openecomp.sdcrests.vendorlicense.types.EntitlementPoolRequestDto;
+import org.springframework.validation.annotation.Validated;
+
+import javax.validation.Valid;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Pattern;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+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;
+
+@Path("/v1.0/vendor-license-models/{vlmId}/entitlement-pools")
+@Produces(MediaType.APPLICATION_JSON)
+@Consumes(MediaType.APPLICATION_JSON)
+@Api(value = "Vendor License Model - Entitlement Pools")
+@Validated
+public interface EntitlementPools {
+ @GET
+ @Path("/")
+ @ApiOperation(value = "List vendor entitlement pools",
+ response = EntitlementPoolEntityDto.class,
+ responseContainer = "List")
+ Response listEntitlementPools(
+ @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId,
+ @Pattern(regexp = Version.VERSION_REGEX, message = Version.VERSION_STRING_VIOLATION_MSG)
+ @QueryParam("version") String version,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM) String user);
+
+ @POST
+ @Path("/")
+ @ApiOperation(value = "Create vendor entitlement pool")
+ Response createEntitlementPool(@Valid EntitlementPoolRequestDto request,
+ @ApiParam(value = "Vendor license model Id") @PathParam("vlmId")
+ String vlmId,
+ @NotNull(message = USER_MISSING_ERROR_MSG)
+ @HeaderParam(USER_HEADER_PARAM) String user);
+
+ @PUT
+ @Path("/{entitlementPoolId}")
+ @ApiOperation(value = "Update vendor entitlement pool")
+ Response updateEntitlementPool(@Valid EntitlementPoolRequestDto request,
+ @ApiParam(value = "Vendor license model Id") @PathParam("vlmId")
+ String vlmId,
+ @NotNull(message = USER_MISSING_ERROR_MSG)
+ @PathParam("entitlementPoolId") String entitlementPoolId,
+ @HeaderParam(USER_HEADER_PARAM) String user);
+
+ @GET
+ @Path("/{entitlementPoolId}")
+ @ApiOperation(value = "Get vendor entitlement pool",
+ response = EntitlementPoolEntityDto.class)
+ Response getEntitlementPool(
+ @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId,
+ @Pattern(regexp = Version.VERSION_REGEX, message = Version.VERSION_STRING_VIOLATION_MSG)
+ @QueryParam("version") String version,
+ @PathParam("entitlementPoolId") String entitlementPoolId,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM) String user);
+
+ @DELETE
+ @Path("/{entitlementPoolId}")
+ @ApiOperation(value = "Delete vendor entitlement pool")
+ Response deleteEntitlementPool(
+ @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId,
+ @PathParam("entitlementPoolId") String entitlementPoolId,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_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
new file mode 100644
index 0000000000..f5ad973cb0
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/FeatureGroups.java
@@ -0,0 +1,108 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vendorlicense.rest;
+
+import static org.openecomp.sdcrests.common.RestConstants.USER_HEADER_PARAM;
+import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdcrests.vendorlicense.types.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.validation.constraints.Pattern;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.HeaderParam;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+@Path("/v1.0/vendor-license-models/{vlmId}/feature-groups")
+@Produces(MediaType.APPLICATION_JSON)
+@Consumes(MediaType.APPLICATION_JSON)
+@Api(value = "Vendor License Model - Feature Groups")
+@Validated
+public interface FeatureGroups {
+
+ @GET
+ @Path("/")
+ @ApiOperation(value = "List vendor feature groups",
+ response = FeatureGroupEntityDto.class,
+ responseContainer = "List")
+ Response listFeatureGroups(
+ @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId,
+ @Pattern(regexp = Version.VERSION_REGEX, message = Version.VERSION_STRING_VIOLATION_MSG)
+ @QueryParam("version") String version,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM) String user);
+
+ @POST
+ @Path("/")
+ @ApiOperation(value = "Create vendor feature group")
+ Response createFeatureGroup(@Valid FeatureGroupRequestDto request,
+ @ApiParam(value = "Vendor license model Id") @PathParam("vlmId")
+ String vlmId,
+ @NotNull(message = USER_MISSING_ERROR_MSG)
+ @HeaderParam(USER_HEADER_PARAM) String user);
+
+ @PUT
+ @Path("/{featureGroupId}")
+ @ApiOperation(value = "Update vendor feature group")
+ Response updateFeatureGroup(@Valid FeatureGroupUpdateRequestDto request,
+ @ApiParam(value = "Vendor license model Id") @PathParam("vlmId")
+ String vlmId,
+ @PathParam("featureGroupId") String featureGroupId,
+ @NotNull(message = USER_MISSING_ERROR_MSG)
+ @HeaderParam(USER_HEADER_PARAM) String user);
+
+ @GET
+ @Path("/{featureGroupId}")
+ @ApiOperation(value = "Get vendor feature group",
+ response = FeatureGroupModelDto.class)
+ Response getFeatureGroup(
+ @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId,
+ @Pattern(regexp = Version.VERSION_REGEX, message = Version.VERSION_STRING_VIOLATION_MSG)
+ @QueryParam("version") String version,
+ @PathParam("featureGroupId") String featureGroupId,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM) String user);
+
+ @DELETE
+ @Path("/{featureGroupId}")
+ @ApiOperation(value = "Delete vendor feature group")
+ Response deleteFeatureGroup(
+ @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId,
+ @PathParam("featureGroupId") String featureGroupId,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_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
new file mode 100644
index 0000000000..28d9f5a32f
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/LicenseAgreements.java
@@ -0,0 +1,109 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vendorlicense.rest;
+
+import static org.openecomp.sdcrests.common.RestConstants.USER_HEADER_PARAM;
+import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdcrests.vendorlicense.types.LicenseAgreementEntityDto;
+import org.openecomp.sdcrests.vendorlicense.types.LicenseAgreementModelDto;
+import org.openecomp.sdcrests.vendorlicense.types.LicenseAgreementRequestDto;
+import org.openecomp.sdcrests.vendorlicense.types.LicenseAgreementUpdateRequestDto;
+import org.springframework.validation.annotation.Validated;
+
+import javax.validation.Valid;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Pattern;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.HeaderParam;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+@Path("/v1.0/vendor-license-models/{vlmId}/license-agreements")
+@Produces(MediaType.APPLICATION_JSON)
+@Consumes(MediaType.APPLICATION_JSON)
+@Api(value = "Vendor License Model - License Agreements")
+@Validated
+
+public interface LicenseAgreements {
+
+ @GET
+ @Path("/")
+ @ApiOperation(value = "List vendor license agreements",
+ response = LicenseAgreementEntityDto.class,
+ responseContainer = "List")
+ Response listLicenseAgreements(
+ @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId,
+ @Pattern(regexp = Version.VERSION_REGEX, message = Version.VERSION_STRING_VIOLATION_MSG)
+ @QueryParam("version") String version,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM) String user);
+
+ @POST
+ @Path("/")
+ @ApiOperation(value = "Create vendor license agreement")
+ Response createLicenseAgreement(@Valid LicenseAgreementRequestDto request,
+ @ApiParam(value = "Vendor license model Id") @PathParam("vlmId")
+ String vlmId,
+ @NotNull(message = USER_MISSING_ERROR_MSG)
+ @HeaderParam(USER_HEADER_PARAM) String user);
+
+ @PUT
+ @Path("/{licenseAgreementId}")
+ @ApiOperation(value = "Update vendor license agreement")
+ Response updateLicenseAgreement(@Valid LicenseAgreementUpdateRequestDto request,
+ @ApiParam(value = "Vendor license model Id") @PathParam("vlmId")
+ String vlmId,
+ @PathParam("licenseAgreementId") String licenseAgreementId,
+ @NotNull(message = USER_MISSING_ERROR_MSG)
+ @HeaderParam(USER_HEADER_PARAM) String user);
+
+ @GET
+ @Path("/{licenseAgreementId}")
+ @ApiOperation(value = "Get vendor license agreement",
+ response = LicenseAgreementModelDto.class)
+ Response getLicenseAgreement(
+ @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId,
+ @Pattern(regexp = Version.VERSION_REGEX, message = Version.VERSION_STRING_VIOLATION_MSG)
+ @QueryParam("version") String version,
+ @PathParam("licenseAgreementId") String licenseAgreementId,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM) String user);
+
+ @DELETE
+ @Path("/{licenseAgreementId}")
+ @ApiOperation(value = "Delete vendor license agreement")
+ Response deleteLicenseAgreement(
+ @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId,
+ @PathParam("licenseAgreementId") String licenseAgreementId,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_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
new file mode 100644
index 0000000000..d66945d63c
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/LicenseKeyGroups.java
@@ -0,0 +1,104 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vendorlicense.rest;
+
+import static org.openecomp.sdcrests.common.RestConstants.USER_HEADER_PARAM;
+import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdcrests.vendorlicense.types.LicenseKeyGroupEntityDto;
+import org.openecomp.sdcrests.vendorlicense.types.LicenseKeyGroupRequestDto;
+import org.springframework.validation.annotation.Validated;
+
+import javax.validation.Valid;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Pattern;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+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;
+
+@Path("/v1.0/vendor-license-models/{vlmId}/license-key-groups")
+@Produces(MediaType.APPLICATION_JSON)
+@Consumes(MediaType.APPLICATION_JSON)
+@Api(value = "Vendor License Model - License Key Groups")
+@Validated
+public interface LicenseKeyGroups {
+ @GET
+ @Path("/")
+ @ApiOperation(value = "List vendor license key groups",
+ response = LicenseKeyGroupEntityDto.class,
+ responseContainer = "List")
+ Response listLicenseKeyGroups(
+ @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId,
+ @Pattern(regexp = Version.VERSION_REGEX, message = Version.VERSION_STRING_VIOLATION_MSG)
+ @QueryParam("version") String version,
+ @HeaderParam(USER_HEADER_PARAM) String user);
+
+ @POST
+ @Path("/")
+ @ApiOperation(value = "Create vendor license key group")
+ Response createLicenseKeyGroup(@Valid LicenseKeyGroupRequestDto request,
+ @ApiParam(value = "Vendor license model Id") @PathParam("vlmId")
+ String vlmId,
+ @NotNull(message = USER_MISSING_ERROR_MSG)
+ @HeaderParam(USER_HEADER_PARAM) String user);
+
+ @PUT
+ @Path("/{licenseKeyGroupId}")
+ @ApiOperation(value = "Update vendor license key group")
+ Response updateLicenseKeyGroup(@Valid LicenseKeyGroupRequestDto request,
+ @ApiParam(value = "Vendor license model Id") @PathParam("vlmId")
+ String vlmId,
+ @PathParam("licenseKeyGroupId") String licenseKeyGroupId,
+ @NotNull(message = USER_MISSING_ERROR_MSG)
+ @HeaderParam(USER_HEADER_PARAM) String user);
+
+ @GET
+ @Path("/{licenseKeyGroupId}")
+ @ApiOperation(value = "Get vendor license key group",
+ response = LicenseKeyGroupEntityDto.class)
+ Response getLicenseKeyGroup(
+ @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId,
+ @Pattern(regexp = Version.VERSION_REGEX, message = Version.VERSION_STRING_VIOLATION_MSG)
+ @QueryParam("version") String version,
+ @PathParam("licenseKeyGroupId") String licenseKeyGroupId,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM) String user);
+
+ @DELETE
+ @Path("/{licenseKeyGroupId}")
+ @ApiOperation(value = "Delete vendor license key group")
+ Response deleteLicenseKeyGroup(
+ @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId,
+ @PathParam("licenseKeyGroupId") String licenseKeyGroupId,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_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
new file mode 100644
index 0000000000..15fc9bf0d9
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/VendorLicenseModels.java
@@ -0,0 +1,111 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vendorlicense.rest;
+
+import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdcrests.common.RestConstants;
+import org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelActionRequestDto;
+import org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelEntityDto;
+import org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelRequestDto;
+import org.springframework.validation.annotation.Validated;
+
+import javax.validation.Valid;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Pattern;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.HeaderParam;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+@Path("/v1.0/vendor-license-models")
+@Produces(MediaType.APPLICATION_JSON)
+@Consumes(MediaType.APPLICATION_JSON)
+@Api(value = "Vendor License Models")
+@Validated
+public interface VendorLicenseModels {
+
+ @GET
+ @Path("/")
+ @ApiOperation(value = "List vendor license models",
+ response = VendorLicenseModelEntityDto.class,
+ responseContainer = "List")
+ Response listLicenseModels(@ApiParam(
+ value = "Currently supported value: 'Final' - only vendor License models with final versions "
+ + "will be return - with their latest final version")
+ @QueryParam("versionFilter") String versionFilter,
+ @NotNull(message = USER_MISSING_ERROR_MSG)
+ @HeaderParam(RestConstants.USER_HEADER_PARAM) String user);
+
+ @POST
+ @Path("/")
+ @ApiOperation(value = "Create vendor license model")
+ Response createLicenseModel(@Valid VendorLicenseModelRequestDto request,
+ @NotNull(message = USER_MISSING_ERROR_MSG)
+ @HeaderParam(RestConstants.USER_HEADER_PARAM) String user);
+
+ @PUT
+ @Path("/{vlmId}")
+ @ApiOperation(value = "Update vendor license model")
+ Response updateLicenseModel(@Valid VendorLicenseModelRequestDto request,
+ @ApiParam(value = "Vendor license model Id") @PathParam("vlmId")
+ String vlmId, @NotNull(message = USER_MISSING_ERROR_MSG)
+ @HeaderParam(RestConstants.USER_HEADER_PARAM) String user);
+
+ @GET
+ @Path("/{vlmId}")
+ @ApiOperation(value = "Get vendor license model",
+ response = VendorLicenseModelEntityDto.class)
+ Response getLicenseModel(
+ @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId,
+ @Pattern(regexp = Version.VERSION_REGEX, message = Version.VERSION_STRING_VIOLATION_MSG)
+ @QueryParam("version") String version,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(RestConstants.USER_HEADER_PARAM)
+ String user);
+
+ @DELETE
+ @Path("/{vlmId}")
+ @ApiOperation(value = "Delete vendor license model")
+ Response deleteLicenseModel(
+ @ApiParam(value = "Vendor license model Id") @PathParam("vlmId") String vlmId,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(RestConstants.USER_HEADER_PARAM)
+ String user);
+
+ @PUT
+ @Path("/{vlmId}/actions")
+ @ApiOperation(value = "Update vendor license model")
+ Response actOnLicenseModel(@Valid VendorLicenseModelActionRequestDto request,
+ @ApiParam(value = "Vendor license model Id") @PathParam("vlmId")
+ String vlmId, @NotNull(message = USER_MISSING_ERROR_MSG)
+ @HeaderParam(RestConstants.USER_HEADER_PARAM) String user);
+}
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
new file mode 100644
index 0000000000..28eeb29018
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapChoiceOrOtherDtoToChoiceOrOther.java
@@ -0,0 +1,36 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vendorlicense.rest.mapping;
+
+import org.openecomp.sdc.vendorlicense.dao.types.ChoiceOrOther;
+import org.openecomp.sdcrests.mapping.MappingBase;
+import org.openecomp.sdcrests.vendorlicense.types.ChoiceOrOtherDto;
+
+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);
+ }
+}
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
new file mode 100644
index 0000000000..2d686110d5
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapChoiceOrOtherToChoiceOrOtherDto.java
@@ -0,0 +1,35 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vendorlicense.rest.mapping;
+
+import org.openecomp.sdc.vendorlicense.dao.types.ChoiceOrOther;
+import org.openecomp.sdcrests.mapping.MappingBase;
+import org.openecomp.sdcrests.vendorlicense.types.ChoiceOrOtherDto;
+
+public class MapChoiceOrOtherToChoiceOrOtherDto
+ extends MappingBase<ChoiceOrOther, ChoiceOrOtherDto> {
+
+ @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
new file mode 100644
index 0000000000..c9f4ab894b
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolEntityToEntitlementPoolEntityDto.java
@@ -0,0 +1,53 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vendorlicense.rest.mapping;
+
+import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity;
+import org.openecomp.sdcrests.mapping.MappingBase;
+import org.openecomp.sdcrests.vendorlicense.types.ChoiceOrOtherDto;
+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.setThresholdValue(source.getThresholdValue());
+ target.setThresholdUnits(source.getThresholdUnit());
+ target.setIncrements(source.getIncrements());
+
+ MapChoiceOrOtherToChoiceOrOtherDto choiceOrOtherMapper =
+ new MapChoiceOrOtherToChoiceOrOtherDto();
+ target.setEntitlementMetric(
+ choiceOrOtherMapper.applyMapping(source.getEntitlementMetric(), ChoiceOrOtherDto.class));
+ target.setAggregationFunction(
+ choiceOrOtherMapper.applyMapping(source.getAggregationFunction(), ChoiceOrOtherDto.class));
+ target.setOperationalScope(new MapMultiChoiceOrOtherToMultiChoiceOrOtherDto()
+ .applyMapping(source.getOperationalScope(), MultiChoiceOrOtherDto.class));
+ target.setTime(choiceOrOtherMapper.applyMapping(source.getTime(), ChoiceOrOtherDto.class));
+ target.setManufacturerReferenceNumber(source.getManufacturerReferenceNumber());
+
+ target.setReferencingFeatureGroups(source.getReferencingFeatureGroups());
+ }
+}
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
new file mode 100644
index 0000000000..fe626e374c
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolRequestDtoToEntitlementPoolEntity.java
@@ -0,0 +1,51 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vendorlicense.rest.mapping;
+
+import org.openecomp.sdc.vendorlicense.dao.types.ChoiceOrOther;
+import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity;
+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.setDescription(source.getDescription());
+ target.setThresholdValue(source.getThresholdValue());
+ target.setThresholdUnit(source.getThresholdUnits());
+ target.setIncrements(source.getIncrements());
+
+ MapChoiceOrOtherDtoToChoiceOrOther choiceOrOtherMapper =
+ new MapChoiceOrOtherDtoToChoiceOrOther();
+ target.setEntitlementMetric(
+ choiceOrOtherMapper.applyMapping(source.getEntitlementMetric(), ChoiceOrOther.class));
+ target.setAggregationFunction(
+ choiceOrOtherMapper.applyMapping(source.getAggregationFunction(), ChoiceOrOther.class));
+ target.setOperationalScope(new MapMultiChoiceOrOtherDtoToMultiChoiceOrOther()
+ .applyMapping(source.getOperationalScope(), MultiChoiceOrOther.class));
+ target.setTime(choiceOrOtherMapper.applyMapping(source.getTime(), ChoiceOrOther.class));
+
+ 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/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
new file mode 100644
index 0000000000..91239e2655
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapFeatureGroupDescriptorDtoToFeatureGroupEntity.java
@@ -0,0 +1,36 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vendorlicense.rest.mapping;
+
+import org.openecomp.sdc.vendorlicense.dao.types.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());
+ }
+}
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
new file mode 100644
index 0000000000..70f5666bcb
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapFeatureGroupEntityToFeatureGroupDescriptorDto.java
@@ -0,0 +1,35 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vendorlicense.rest.mapping;
+
+import org.openecomp.sdc.vendorlicense.dao.types.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());
+ }
+}
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
new file mode 100644
index 0000000000..f5ea8414d5
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseAgreementDescriptorDtoToLicenseAgreementEntity.java
@@ -0,0 +1,38 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vendorlicense.rest.mapping;
+
+import org.openecomp.sdc.vendorlicense.dao.types.ChoiceOrOther;
+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());
+ }
+}
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
new file mode 100644
index 0000000000..2fd4f669cf
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseAgreementEntityToLicenseAgreementDescriptorDto.java
@@ -0,0 +1,38 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vendorlicense.rest.mapping;
+
+import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementEntity;
+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());
+ }
+}
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
new file mode 100644
index 0000000000..38384711b1
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto.java
@@ -0,0 +1,40 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vendorlicense.rest.mapping;
+
+import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity;
+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());
+ }
+}
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
new file mode 100644
index 0000000000..aee27c8521
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity.java
@@ -0,0 +1,38 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vendorlicense.rest.mapping;
+
+import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity;
+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.setDescription(source.getDescription());
+ target.setType(source.getType());
+ target.setOperationalScope(new MapMultiChoiceOrOtherDtoToMultiChoiceOrOther()
+ .applyMapping(source.getOperationalScope(), MultiChoiceOrOther.class));
+ }
+}
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
new file mode 100644
index 0000000000..320bf67bdf
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapMultiChoiceOrOtherDtoToMultiChoiceOrOther.java
@@ -0,0 +1,36 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vendorlicense.rest.mapping;
+
+import org.openecomp.sdc.vendorlicense.dao.types.MultiChoiceOrOther;
+import org.openecomp.sdcrests.mapping.MappingBase;
+import org.openecomp.sdcrests.vendorlicense.types.MultiChoiceOrOtherDto;
+
+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);
+ }
+}
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
new file mode 100644
index 0000000000..9649053fb4
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapMultiChoiceOrOtherToMultiChoiceOrOtherDto.java
@@ -0,0 +1,35 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vendorlicense.rest.mapping;
+
+import org.openecomp.sdc.vendorlicense.dao.types.MultiChoiceOrOther;
+import org.openecomp.sdcrests.mapping.MappingBase;
+import org.openecomp.sdcrests.vendorlicense.types.MultiChoiceOrOtherDto;
+
+public class MapMultiChoiceOrOtherToMultiChoiceOrOtherDto
+ extends MappingBase<MultiChoiceOrOther, MultiChoiceOrOtherDto> {
+
+ @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/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
new file mode 100644
index 0000000000..1117a2db9f
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapVendorLicenseModelRequestDtoToVendorLicenseModelEntity.java
@@ -0,0 +1,36 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vendorlicense.rest.mapping;
+
+import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity;
+import org.openecomp.sdcrests.mapping.MappingBase;
+import org.openecomp.sdcrests.vendorlicense.types.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());
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapVersionedVendorLicenseModelToVendorLicenseModelEntityDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapVersionedVendorLicenseModelToVendorLicenseModelEntityDto.java
new file mode 100644
index 0000000000..a53d5c9e36
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapVersionedVendorLicenseModelToVendorLicenseModelEntityDto.java
@@ -0,0 +1,60 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vendorlicense.rest.mapping;
+
+import org.openecomp.core.utilities.CommonMethods;
+import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity;
+import org.openecomp.sdc.vendorlicense.types.VersionedVendorLicenseModel;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdc.versioning.types.VersionInfo;
+import org.openecomp.sdcrests.mapping.MappingBase;
+import org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelEntityDto;
+
+import java.util.stream.Collectors;
+
+public class MapVersionedVendorLicenseModelToVendorLicenseModelEntityDto
+ extends MappingBase<VersionedVendorLicenseModel, VendorLicenseModelEntityDto> {
+ @Override
+ public void doMapping(VersionedVendorLicenseModel source, VendorLicenseModelEntityDto target) {
+ VendorLicenseModelEntity sourceVlm = source.getVendorLicenseModel();
+ target.setId(sourceVlm.getId());
+ target.setVendorName(sourceVlm.getVendorName());
+ target.setDescription(sourceVlm.getDescription());
+ target.setIconRef(sourceVlm.getIconRef());
+
+ VersionInfo versionInfo = source.getVersionInfo();
+ if (versionInfo != null) {
+ target.setVersion(versionInfo.getActiveVersion().toString());
+ target.setStatus(versionInfo.getStatus());
+ target.setLockingUser(versionInfo.getLockingUser());
+
+ if (!CommonMethods.isEmpty(versionInfo.getViewableVersions())) {
+ target.setViewableVersions(versionInfo.getViewableVersions().stream().map(Version::toString)
+ .collect(Collectors.toList()));
+ }
+
+ if (!CommonMethods.isEmpty(versionInfo.getFinalVersions())) {
+ target.setFinalVersions(versionInfo.getFinalVersions().stream().map(Version::toString)
+ .collect(Collectors.toList()));
+ }
+ }
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/EntitlementPoolsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/EntitlementPoolsImpl.java
new file mode 100644
index 0000000000..ab9800e612
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/EntitlementPoolsImpl.java
@@ -0,0 +1,157 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vendorlicense.rest.services;
+
+import org.openecomp.sdc.vendorlicense.VendorLicenseManager;
+import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity;
+import org.openecomp.sdc.versioning.dao.types.Version;
+
+import org.openecomp.sdcrests.vendorlicense.rest.EntitlementPools;
+import org.openecomp.sdcrests.vendorlicense.rest.mapping.MapEntitlementPoolEntityToEntitlementPoolEntityDto;
+import org.openecomp.sdcrests.vendorlicense.rest.mapping.MapEntitlementPoolRequestDtoToEntitlementPoolEntity;
+import org.openecomp.sdcrests.vendorlicense.types.EntitlementPoolEntityDto;
+import org.openecomp.sdcrests.vendorlicense.types.EntitlementPoolRequestDto;
+import org.openecomp.sdcrests.wrappers.GenericCollectionWrapper;
+import org.openecomp.sdcrests.wrappers.StringWrapperResponse;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Service;
+
+import java.util.Collection;
+import javax.inject.Named;
+import javax.ws.rs.core.Response;
+
+@Named
+@Service("entitlementPools")
+@Scope(value = "prototype")
+public class EntitlementPoolsImpl implements EntitlementPools {
+
+ @Autowired
+ private VendorLicenseManager vendorLicenseManager;
+
+ /**
+ * List entitlement pools response.
+ *
+ * @param vlmId the vlm id
+ * @param version the version
+ * @param user the user
+ * @return the response
+ */
+ public Response listEntitlementPools(String vlmId, String version, String user) {
+ Collection<EntitlementPoolEntity> entitlementPools =
+ vendorLicenseManager.listEntitlementPools(vlmId, Version.valueOf(version), user);
+
+ GenericCollectionWrapper<EntitlementPoolEntityDto> result = new GenericCollectionWrapper<>();
+ MapEntitlementPoolEntityToEntitlementPoolEntityDto outputMapper =
+ new MapEntitlementPoolEntityToEntitlementPoolEntityDto();
+ for (EntitlementPoolEntity ep : entitlementPools) {
+ result.add(outputMapper.applyMapping(ep, EntitlementPoolEntityDto.class));
+ }
+
+ 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 user) {
+ EntitlementPoolEntity entitlementPoolEntity =
+ new MapEntitlementPoolRequestDtoToEntitlementPoolEntity()
+ .applyMapping(request, EntitlementPoolEntity.class);
+ entitlementPoolEntity.setVendorLicenseModelId(vlmId);
+
+ EntitlementPoolEntity createdEntitlementPool =
+ vendorLicenseManager.createEntitlementPool(entitlementPoolEntity, user);
+ 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 entitlementPoolId, String user) {
+ EntitlementPoolEntity entitlementPoolEntity =
+ new MapEntitlementPoolRequestDtoToEntitlementPoolEntity()
+ .applyMapping(request, EntitlementPoolEntity.class);
+
+ entitlementPoolEntity.setVendorLicenseModelId(vlmId);
+ entitlementPoolEntity.setId(entitlementPoolId);
+
+ vendorLicenseManager.updateEntitlementPool(entitlementPoolEntity, user);
+ return Response.ok().build();
+ }
+
+ /**
+ * Gets entitlement pool.
+ *
+ * @param vlmId the vlm id
+ * @param version the version
+ * @param entitlementPoolId the entitlement pool id
+ * @param user the user
+ * @return the entitlement pool
+ */
+ public Response getEntitlementPool(String vlmId, String version, String entitlementPoolId,
+ String user) {
+ EntitlementPoolEntity epInput = new EntitlementPoolEntity();
+ epInput.setVendorLicenseModelId(vlmId);
+ epInput.setVersion(Version.valueOf(version));
+ epInput.setId(entitlementPoolId);
+ EntitlementPoolEntity entitlementPool = vendorLicenseManager.getEntitlementPool(epInput, user);
+
+ 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 entitlementPoolId, String user) {
+ EntitlementPoolEntity epInput = new EntitlementPoolEntity();
+ epInput.setVendorLicenseModelId(vlmId);
+ epInput.setId(entitlementPoolId);
+ vendorLicenseManager.deleteEntitlementPool(epInput, user);
+ 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
new file mode 100644
index 0000000000..daf35f9ee6
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/FeatureGroupsImpl.java
@@ -0,0 +1,169 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vendorlicense.rest.services;
+
+import org.openecomp.core.utilities.CommonMethods;
+import org.openecomp.sdc.vendorlicense.VendorLicenseManager;
+import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity;
+import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity;
+import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupModel;
+import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdcrests.vendorlicense.rest.FeatureGroups;
+import org.openecomp.sdcrests.vendorlicense.rest.mapping.MapEntitlementPoolEntityToEntitlementPoolEntityDto;
+import org.openecomp.sdcrests.vendorlicense.rest.mapping.MapFeatureGroupDescriptorDtoToFeatureGroupEntity;
+import org.openecomp.sdcrests.vendorlicense.rest.mapping.MapFeatureGroupEntityToFeatureGroupDescriptorDto;
+import org.openecomp.sdcrests.vendorlicense.rest.mapping.MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto;
+import org.openecomp.sdcrests.vendorlicense.types.EntitlementPoolEntityDto;
+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.openecomp.sdcrests.vendorlicense.types.LicenseKeyGroupEntityDto;
+import org.openecomp.sdcrests.wrappers.GenericCollectionWrapper;
+import org.openecomp.sdcrests.wrappers.StringWrapperResponse;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Service;
+
+import java.util.Collection;
+import java.util.HashSet;
+import javax.inject.Named;
+import javax.ws.rs.core.Response;
+
+
+@Named
+@Service("featureGroups")
+@Scope(value = "prototype")
+public class FeatureGroupsImpl implements FeatureGroups {
+
+ @Autowired
+ private VendorLicenseManager vendorLicenseManager;
+
+ @Override
+ public Response listFeatureGroups(String vlmId, String version, String user) {
+ Collection<FeatureGroupEntity> featureGroupEntities =
+ vendorLicenseManager.listFeatureGroups(vlmId, Version.valueOf(version), user);
+
+ MapFeatureGroupEntityToFeatureGroupDescriptorDto outputMapper =
+ new MapFeatureGroupEntityToFeatureGroupDescriptorDto();
+ GenericCollectionWrapper<FeatureGroupEntityDto> results = new GenericCollectionWrapper<>();
+
+ for (FeatureGroupEntity fg : featureGroupEntities) {
+ FeatureGroupEntityDto fgDto = new FeatureGroupEntityDto();
+ fgDto.setId(fg.getId());
+ fgDto.setLicenseKeyGroupsIds(fg.getLicenseKeyGroupIds());
+ fgDto.setEntitlementPoolsIds(fg.getEntitlementPoolIds());
+ fgDto.setReferencingLicenseAgreements(fg.getReferencingLicenseAgreements());
+ outputMapper.doMapping(fg, fgDto);
+ results.add(fgDto);
+ }
+
+ return Response.ok(results).build();
+ }
+
+ @Override
+ public Response createFeatureGroup(FeatureGroupRequestDto request, String vlmId, String user) {
+ FeatureGroupEntity featureGroupEntity = new MapFeatureGroupDescriptorDtoToFeatureGroupEntity()
+ .applyMapping(request, FeatureGroupEntity.class);
+ featureGroupEntity.setVendorLicenseModelId(vlmId);
+ featureGroupEntity.setLicenseKeyGroupIds(request.getAddedLicenseKeyGroupsIds());
+ featureGroupEntity.setEntitlementPoolIds(request.getAddedEntitlementPoolsIds());
+
+ FeatureGroupEntity createdFeatureGroup =
+ vendorLicenseManager.createFeatureGroup(featureGroupEntity, user);
+
+ StringWrapperResponse result =
+ createdFeatureGroup != null ? new StringWrapperResponse(createdFeatureGroup.getId()) : null;
+ return Response.ok(result).build();
+ }
+
+ @Override
+ public Response updateFeatureGroup(FeatureGroupUpdateRequestDto request, String vlmId,
+ String featureGroupId, String user) {
+ FeatureGroupEntity featureGroupEntity = new MapFeatureGroupDescriptorDtoToFeatureGroupEntity()
+ .applyMapping(request, FeatureGroupEntity.class);
+ featureGroupEntity.setVendorLicenseModelId(vlmId);
+ featureGroupEntity.setId(featureGroupId);
+
+ vendorLicenseManager
+ .updateFeatureGroup(featureGroupEntity, request.getAddedLicenseKeyGroupsIds(),
+ request.getRemovedLicenseKeyGroupsIds(), request.getAddedEntitlementPoolsIds(),
+ request.getRemovedEntitlementPoolsIds(), user);
+ return Response.ok().build();
+ }
+
+ @Override
+ public Response getFeatureGroup(String vlmId, String version, String featureGroupId,
+ String user) {
+ FeatureGroupEntity fgInput = new FeatureGroupEntity();
+ fgInput.setVendorLicenseModelId(vlmId);
+ fgInput.setVersion(Version.valueOf(version));
+ fgInput.setId(featureGroupId);
+ FeatureGroupModel featureGroupModel = vendorLicenseManager.getFeatureGroupModel(fgInput, user);
+
+ 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);
+
+ if (!CommonMethods.isEmpty(featureGroupModel.getLicenseKeyGroups())) {
+ fgmDto.setLicenseKeyGroups(new HashSet<>());
+
+ MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto lkgMapper =
+ new MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto();
+ for (LicenseKeyGroupEntity lkg : featureGroupModel.getLicenseKeyGroups()) {
+ fgmDto.getLicenseKeyGroups()
+ .add(lkgMapper.applyMapping(lkg, LicenseKeyGroupEntityDto.class));
+ }
+ }
+
+ if (!CommonMethods.isEmpty(featureGroupModel.getEntitlementPools())) {
+ fgmDto.setEntitlementPools(new HashSet<>());
+
+ 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 featureGroupId, String user) {
+ FeatureGroupEntity fgInput = new FeatureGroupEntity();
+ fgInput.setVendorLicenseModelId(vlmId);
+ fgInput.setId(featureGroupId);
+ vendorLicenseManager.deleteFeatureGroup(fgInput, user);
+ return Response.ok().build();
+ }
+
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseAgreementsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseAgreementsImpl.java
new file mode 100644
index 0000000000..d87be05998
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseAgreementsImpl.java
@@ -0,0 +1,186 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vendorlicense.rest.services;
+
+import org.openecomp.core.utilities.CommonMethods;
+import org.openecomp.sdc.vendorlicense.VendorLicenseManager;
+import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity;
+import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementEntity;
+import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementModel;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdcrests.vendorlicense.rest.LicenseAgreements;
+import org.openecomp.sdcrests.vendorlicense.rest.mapping.MapFeatureGroupEntityToFeatureGroupDescriptorDto;
+import org.openecomp.sdcrests.vendorlicense.rest.mapping.MapLicenseAgreementDescriptorDtoToLicenseAgreementEntity;
+import org.openecomp.sdcrests.vendorlicense.rest.mapping.MapLicenseAgreementEntityToLicenseAgreementDescriptorDto;
+import org.openecomp.sdcrests.vendorlicense.types.FeatureGroupEntityDto;
+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.openecomp.sdcrests.wrappers.GenericCollectionWrapper;
+import org.openecomp.sdcrests.wrappers.StringWrapperResponse;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Service;
+
+import java.util.Collection;
+import java.util.HashSet;
+import javax.inject.Named;
+import javax.ws.rs.core.Response;
+
+@Named
+@Service("licenseAgreements")
+@Scope(value = "prototype")
+public class LicenseAgreementsImpl implements LicenseAgreements {
+
+ @Autowired
+ private VendorLicenseManager vendorLicenseManager;
+
+ /**
+ * List license agreements response.
+ *
+ * @param vlmId the vlm id
+ * @param version the version
+ * @param user the user
+ * @return the response
+ */
+ public Response listLicenseAgreements(String vlmId, String version, String user) {
+ Collection<LicenseAgreementEntity> licenseAgreements =
+ vendorLicenseManager.listLicenseAgreements(vlmId, Version.valueOf(version), user);
+
+ GenericCollectionWrapper<LicenseAgreementEntityDto> results = new GenericCollectionWrapper<>();
+ MapLicenseAgreementEntityToLicenseAgreementDescriptorDto outputMapper =
+ new MapLicenseAgreementEntityToLicenseAgreementDescriptorDto();
+ for (LicenseAgreementEntity lae : licenseAgreements) {
+ LicenseAgreementEntityDto laeDto = new LicenseAgreementEntityDto();
+ laeDto.setId(lae.getId());
+ laeDto.setFeatureGroupsIds(lae.getFeatureGroupIds());
+ outputMapper.doMapping(lae, laeDto);
+ results.add(laeDto);
+ }
+
+ return Response.ok(results).build();
+ }
+
+ /**
+ * Create license agreement response.
+ *
+ * @param request the request
+ * @param vlmId the vlm id
+ * @param user the user
+ * @return the response
+ */
+ public Response createLicenseAgreement(LicenseAgreementRequestDto request, String vlmId,
+ String user) {
+ LicenseAgreementEntity licenseAgreementEntity =
+ new MapLicenseAgreementDescriptorDtoToLicenseAgreementEntity()
+ .applyMapping(request, LicenseAgreementEntity.class);
+ licenseAgreementEntity.setVendorLicenseModelId(vlmId);
+ licenseAgreementEntity.setFeatureGroupIds(request.getAddedFeatureGroupsIds());
+
+ LicenseAgreementEntity createdLicenseAgreement =
+ vendorLicenseManager.createLicenseAgreement(licenseAgreementEntity, user);
+ StringWrapperResponse result =
+ createdLicenseAgreement != null ? new StringWrapperResponse(createdLicenseAgreement.getId())
+ : null;
+
+ return Response.ok(result).build();
+ }
+
+ /**
+ * Update license agreement response.
+ *
+ * @param request the request
+ * @param vlmId the vlm id
+ * @param licenseAgreementId the license agreement id
+ * @param user the user
+ * @return the response
+ */
+ public Response updateLicenseAgreement(LicenseAgreementUpdateRequestDto request, String vlmId,
+ String licenseAgreementId, String user) {
+ LicenseAgreementEntity licenseAgreementEntity =
+ new MapLicenseAgreementDescriptorDtoToLicenseAgreementEntity()
+ .applyMapping(request, LicenseAgreementEntity.class);
+ licenseAgreementEntity.setVendorLicenseModelId(vlmId);
+ licenseAgreementEntity.setId(licenseAgreementId);
+
+ vendorLicenseManager
+ .updateLicenseAgreement(licenseAgreementEntity, request.getAddedFeatureGroupsIds(),
+ request.getRemovedFeatureGroupsIds(), user);
+ return Response.ok().build();
+ }
+
+ /**
+ * Gets license agreement.
+ *
+ * @param vlmId the vlm id
+ * @param version the version
+ * @param licenseAgreementId the license agreement id
+ * @param user the user
+ * @return the license agreement
+ */
+ public Response getLicenseAgreement(String vlmId, String version, String licenseAgreementId,
+ String user) {
+ LicenseAgreementModel licenseAgreementModel = vendorLicenseManager
+ .getLicenseAgreementModel(vlmId, Version.valueOf(version), licenseAgreementId, user);
+
+ if (licenseAgreementModel == null) {
+ return Response.ok().build();
+ }
+
+ LicenseAgreementModelDto lamDto = new LicenseAgreementModelDto();
+ lamDto.setId(licenseAgreementModel.getLicenseAgreement().getId());
+ new MapLicenseAgreementEntityToLicenseAgreementDescriptorDto()
+ .doMapping(licenseAgreementModel.getLicenseAgreement(), lamDto);
+
+ if (!CommonMethods.isEmpty(licenseAgreementModel.getFeatureGroups())) {
+ lamDto.setFeatureGroups(new HashSet<>());
+
+ 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);
+ }
+ }
+
+ return Response.ok(lamDto).build();
+ }
+
+ /**
+ * Delete license agreement response.
+ *
+ * @param vlmId the vlm id
+ * @param licenseAgreementId the license agreement id
+ * @param user the user
+ * @return the response
+ */
+ public Response deleteLicenseAgreement(String vlmId, String licenseAgreementId, String user) {
+ vendorLicenseManager.deleteLicenseAgreement(vlmId, licenseAgreementId, user);
+ return Response.ok().build();
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseKeyGroupsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseKeyGroupsImpl.java
new file mode 100644
index 0000000000..6ef7e194b8
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseKeyGroupsImpl.java
@@ -0,0 +1,159 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vendorlicense.rest.services;
+
+import org.openecomp.sdc.vendorlicense.VendorLicenseManager;
+import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity;
+import org.openecomp.sdc.versioning.dao.types.Version;
+
+import org.openecomp.sdcrests.vendorlicense.rest.LicenseKeyGroups;
+import org.openecomp.sdcrests.vendorlicense.rest.mapping.MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto;
+import org.openecomp.sdcrests.vendorlicense.rest.mapping.MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity;
+import org.openecomp.sdcrests.vendorlicense.types.LicenseKeyGroupEntityDto;
+import org.openecomp.sdcrests.vendorlicense.types.LicenseKeyGroupRequestDto;
+import org.openecomp.sdcrests.wrappers.GenericCollectionWrapper;
+import org.openecomp.sdcrests.wrappers.StringWrapperResponse;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Service;
+import org.springframework.validation.annotation.Validated;
+
+import java.util.Collection;
+import javax.inject.Named;
+import javax.ws.rs.core.Response;
+
+@Named
+@Service("licenseKeyGroups")
+@Scope(value = "prototype")
+@Validated
+public class LicenseKeyGroupsImpl implements LicenseKeyGroups {
+
+ @Autowired
+ private VendorLicenseManager vendorLicenseManager;
+
+ /**
+ * List license key groups response.
+ *
+ * @param vlmId the vlm id
+ * @param version the version
+ * @param user the user
+ * @return the response
+ */
+ public Response listLicenseKeyGroups(String vlmId, String version, String user) {
+ Collection<LicenseKeyGroupEntity> licenseKeyGroups =
+ vendorLicenseManager.listLicenseKeyGroups(vlmId, Version.valueOf(version), user);
+
+ GenericCollectionWrapper<LicenseKeyGroupEntityDto> result = new GenericCollectionWrapper<>();
+ MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto outputMapper =
+ new MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto();
+ for (LicenseKeyGroupEntity ep : licenseKeyGroups) {
+ result.add(outputMapper.applyMapping(ep, LicenseKeyGroupEntityDto.class));
+ }
+
+ 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 user) {
+ LicenseKeyGroupEntity licenseKeyGroupEntity =
+ new MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity()
+ .applyMapping(request, LicenseKeyGroupEntity.class);
+ licenseKeyGroupEntity.setVendorLicenseModelId(vlmId);
+
+ LicenseKeyGroupEntity createdLicenseKeyGroup =
+ vendorLicenseManager.createLicenseKeyGroup(licenseKeyGroupEntity, user);
+ 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 licenseKeyGroupId, String user) {
+ LicenseKeyGroupEntity licenseKeyGroupEntity =
+ new MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity()
+ .applyMapping(request, LicenseKeyGroupEntity.class);
+
+ licenseKeyGroupEntity.setVendorLicenseModelId(vlmId);
+ licenseKeyGroupEntity.setId(licenseKeyGroupId);
+
+ vendorLicenseManager.updateLicenseKeyGroup(licenseKeyGroupEntity, user);
+ return Response.ok().build();
+ }
+
+ /**
+ * Gets license key group.
+ *
+ * @param vlmId the vlm id
+ * @param version the version
+ * @param licenseKeyGroupId the license key group id
+ * @param user the user
+ * @return the license key group
+ */
+ public Response getLicenseKeyGroup(String vlmId, String version, String licenseKeyGroupId,
+ String user) {
+ LicenseKeyGroupEntity lkgInput = new LicenseKeyGroupEntity();
+ lkgInput.setVendorLicenseModelId(vlmId);
+ lkgInput.setVersion(Version.valueOf(version));
+ lkgInput.setId(licenseKeyGroupId);
+ LicenseKeyGroupEntity licenseKeyGroup = vendorLicenseManager.getLicenseKeyGroup(lkgInput, user);
+
+ 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 licenseKeyGroupId, String user) {
+ LicenseKeyGroupEntity lkgInput = new LicenseKeyGroupEntity();
+ lkgInput.setVendorLicenseModelId(vlmId);
+ lkgInput.setId(licenseKeyGroupId);
+ vendorLicenseManager.deleteLicenseKeyGroup(lkgInput, user);
+ 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
new file mode 100644
index 0000000000..c63da86e7a
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/VendorLicenseModelsImpl.java
@@ -0,0 +1,135 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.vendorlicense.rest.services;
+
+import org.openecomp.sdc.vendorlicense.VendorLicenseManager;
+import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity;
+import org.openecomp.sdc.vendorlicense.types.VersionedVendorLicenseModel;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdcrests.vendorlicense.rest.VendorLicenseModels;
+import org.openecomp.sdcrests.vendorlicense.rest.mapping.MapVendorLicenseModelRequestDtoToVendorLicenseModelEntity;
+import org.openecomp.sdcrests.vendorlicense.rest.mapping.MapVersionedVendorLicenseModelToVendorLicenseModelEntityDto;
+import org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelActionRequestDto;
+import org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelEntityDto;
+import org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelRequestDto;
+import org.openecomp.sdcrests.wrappers.GenericCollectionWrapper;
+import org.openecomp.sdcrests.wrappers.StringWrapperResponse;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Service;
+import org.springframework.validation.annotation.Validated;
+
+import java.util.Collection;
+import javax.inject.Named;
+import javax.ws.rs.core.Response;
+
+
+
+@Named
+@Service("vendorLicenseModels")
+@Scope(value = "prototype")
+@Validated
+public class VendorLicenseModelsImpl implements VendorLicenseModels {
+
+ @Autowired
+ private VendorLicenseManager vendorLicenseManager;
+
+ @Override
+ public Response listLicenseModels(String versionFilter, String user) {
+ Collection<VersionedVendorLicenseModel> versionedVendorLicenseModels =
+ vendorLicenseManager.listVendorLicenseModels(versionFilter, user);
+
+ GenericCollectionWrapper<VendorLicenseModelEntityDto> results =
+ new GenericCollectionWrapper<>();
+ MapVersionedVendorLicenseModelToVendorLicenseModelEntityDto outputMapper =
+ new MapVersionedVendorLicenseModelToVendorLicenseModelEntityDto();
+ for (VersionedVendorLicenseModel versionedVlm : versionedVendorLicenseModels) {
+ results.add(outputMapper.applyMapping(versionedVlm, VendorLicenseModelEntityDto.class));
+ }
+
+ return Response.ok(results).build();
+ }
+
+ @Override
+ public Response createLicenseModel(VendorLicenseModelRequestDto request, String user) {
+ VendorLicenseModelEntity vendorLicenseModelEntity =
+ new MapVendorLicenseModelRequestDtoToVendorLicenseModelEntity()
+ .applyMapping(request, VendorLicenseModelEntity.class);
+ VendorLicenseModelEntity createdVendorLicenseModel =
+ vendorLicenseManager.createVendorLicenseModel(vendorLicenseModelEntity, user);
+ StringWrapperResponse result = createdVendorLicenseModel != null ? new StringWrapperResponse(
+ createdVendorLicenseModel.getId()) : null;
+
+ return Response.ok(result).build();
+ }
+
+ @Override
+ public Response updateLicenseModel(VendorLicenseModelRequestDto request, String vlmId,
+ String user) {
+ VendorLicenseModelEntity vendorLicenseModelEntity =
+ new MapVendorLicenseModelRequestDtoToVendorLicenseModelEntity()
+ .applyMapping(request, VendorLicenseModelEntity.class);
+ vendorLicenseModelEntity.setId(vlmId);
+
+ vendorLicenseManager.updateVendorLicenseModel(vendorLicenseModelEntity, user);
+ return Response.ok().build();
+ }
+
+ @Override
+ public Response getLicenseModel(String vlmId, String version, String user) {
+ VersionedVendorLicenseModel versionedVlm =
+ vendorLicenseManager.getVendorLicenseModel(vlmId, Version.valueOf(version), user);
+
+ VendorLicenseModelEntityDto vlmDto = versionedVlm == null ? null :
+ new MapVersionedVendorLicenseModelToVendorLicenseModelEntityDto()
+ .applyMapping(versionedVlm, VendorLicenseModelEntityDto.class);
+ return Response.ok(vlmDto).build();
+ }
+
+ @Override
+ public Response deleteLicenseModel(String vlmId, String user) {
+ vendorLicenseManager.deleteVendorLicenseModel(vlmId, user);
+ return Response.ok().build();
+ }
+
+ @Override
+ public Response actOnLicenseModel(VendorLicenseModelActionRequestDto request, String vlmId,
+ String user) {
+
+ switch (request.getAction()) {
+ case Checkout:
+ vendorLicenseManager.checkout(vlmId, user);
+ break;
+ case Undo_Checkout:
+ vendorLicenseManager.undoCheckout(vlmId, user);
+ break;
+ case Checkin:
+ vendorLicenseManager.checkin(vlmId, user);
+ break;
+ case Submit:
+ vendorLicenseManager.submit(vlmId, user);
+ break;
+ default:
+ }
+
+ return Response.ok().build();
+ }
+}