aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services
diff options
context:
space:
mode:
authoravigaffa <avi.gaffa@amdocs.com>2017-09-10 08:58:51 +0300
committeravigaffa <avi.gaffa@amdocs.com>2017-09-10 10:07:00 +0300
commit00e935fc6b8baae4d9b9ffef2c748202a60b66b4 (patch)
tree56d7b608dbb5a53022db0350f04977da8cd960f5 /openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services
parent75c572279398dc2be7652263843c8802a9406c4f (diff)
Add latest bug fixes to master
Change-Id: Ieddc2330ad4e093984f14a69b52f2ca5cb465a10 Issue-ID: SDC-293 Signed-off-by: avigaffa <avi.gaffa@amdocs.com>
Diffstat (limited to 'openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services')
-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/EntitlementPoolLimitsImpl.java62
-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/LicenseKeyGroupLimitsImpl.java50
2 files changed, 62 insertions, 50 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/services/EntitlementPoolLimitsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/EntitlementPoolLimitsImpl.java
index 36e25e0f2e..4365ace85d 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/EntitlementPoolLimitsImpl.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/EntitlementPoolLimitsImpl.java
@@ -32,7 +32,9 @@ import javax.ws.rs.core.Response;
public class EntitlementPoolLimitsImpl implements EntitlementPoolLimits {
private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
private VendorLicenseManager vendorLicenseManager =
- VendorLicenseManagerFactory.getInstance().createInterface();
+ VendorLicenseManagerFactory.getInstance().createInterface();
+
+ public static final String parent = "EntitlementPool";
@Override
public Response createLimit(LimitRequestDto request,
@@ -44,18 +46,19 @@ public class EntitlementPoolLimitsImpl implements EntitlementPoolLimits {
MdcUtil.initMdc(LoggerServiceName.Create_LIMIT.toString());
vendorLicenseManager.getEntitlementPool(new EntitlementPoolEntity(vlmId, Version.valueOf
- (versionId), entitlementPoolId), user);
+ (versionId), entitlementPoolId), user);
LimitEntity limitEntity =
- new MapLimitRequestDtoToLimitEntity()
- .applyMapping(request, LimitEntity.class);
+ new MapLimitRequestDtoToLimitEntity()
+ .applyMapping(request, LimitEntity.class);
limitEntity.setEpLkgId(entitlementPoolId);
limitEntity.setVendorLicenseModelId(vlmId);
+ limitEntity.setParent(parent);
LimitEntity createdLimit = vendorLicenseManager.createLimit(limitEntity, user);
MapLimitEntityToLimitCreationDto mapper = new MapLimitEntityToLimitCreationDto();
LimitCreationDto createdLimitDto = mapper.applyMapping(createdLimit, LimitCreationDto
- .class);
+ .class);
/*StringWrapperResponse result =
createdLimit != null ? new StringWrapperResponse(createdLimit.getId())
@@ -65,24 +68,24 @@ public class EntitlementPoolLimitsImpl implements EntitlementPoolLimits {
//return Response.ok(result).build();
return Response.ok(createdLimitDto != null ? createdLimitDto : null)
- .build();
+ .build();
}
@Override
public Response listLimits(String vlmId, String versionId, String entitlementPoolId, String
- user) {
+ user) {
mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId, "EP id", entitlementPoolId);
MdcUtil.initMdc(LoggerServiceName.List_EP.toString());
vendorLicenseManager.getEntitlementPool(new EntitlementPoolEntity(vlmId, Version.valueOf
- (versionId), entitlementPoolId), user);
+ (versionId), entitlementPoolId), user);
Collection<LimitEntity> limits =
- vendorLicenseManager.listLimits(vlmId, Version.valueOf(versionId), entitlementPoolId, user);
+ vendorLicenseManager.listLimits(vlmId, Version.valueOf(versionId), entitlementPoolId, user);
GenericCollectionWrapper<LimitEntityDto> result = new GenericCollectionWrapper<>();
MapLimitEntityToLimitDto outputMapper =
- new MapLimitEntityToLimitDto();
+ new MapLimitEntityToLimitDto();
for (LimitEntity limit : limits) {
result.add(outputMapper.applyMapping(limit, LimitEntityDto.class));
}
@@ -96,12 +99,12 @@ public class EntitlementPoolLimitsImpl implements EntitlementPoolLimits {
public Response getLimit( String vlmId, String versionId, String entitlementPoolId,
String limitId, String user) {
mdcDataDebugMessage.debugEntryMessage("VLM id, EP id, Limit Id", vlmId, entitlementPoolId,
- limitId);
+ limitId);
MdcUtil.initMdc(LoggerServiceName.Get_LIMIT.toString());
vendorLicenseManager.getEntitlementPool(new EntitlementPoolEntity(vlmId, Version.valueOf
- (versionId), entitlementPoolId), user);
+ (versionId), entitlementPoolId), user);
LimitEntity epInput = new LimitEntity();
epInput.setVendorLicenseModelId(vlmId);
epInput.setVersion(Version.valueOf(versionId));
@@ -110,11 +113,11 @@ public class EntitlementPoolLimitsImpl implements EntitlementPoolLimits {
LimitEntity limit = vendorLicenseManager.getLimit(epInput, user);
LimitEntityDto entitlementPoolEntityDto = limit == null ? null :
- new MapLimitEntityToLimitDto()
- .applyMapping(limit, LimitEntityDto.class);
+ new MapLimitEntityToLimitDto()
+ .applyMapping(limit, LimitEntityDto.class);
mdcDataDebugMessage.debugExitMessage("VLM id, EP id, Limit Id", vlmId, entitlementPoolId,
- limitId);
+ limitId);
return Response.ok(entitlementPoolEntityDto).build();
}
@@ -127,39 +130,40 @@ public class EntitlementPoolLimitsImpl implements EntitlementPoolLimits {
String limitId,
String user) {
mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId, "EP id", entitlementPoolId, "limit Id",
- limitId);
+ limitId);
MdcUtil.initMdc(LoggerServiceName.Update_LIMIT.toString());
vendorLicenseManager.getEntitlementPool(new EntitlementPoolEntity(vlmId, Version.valueOf
- (versionId), entitlementPoolId), user);
+ (versionId), entitlementPoolId), user);
LimitEntity limitEntity =
- new MapLimitRequestDtoToLimitEntity()
- .applyMapping(request, LimitEntity.class);
+ new MapLimitRequestDtoToLimitEntity()
+ .applyMapping(request, LimitEntity.class);
limitEntity.setEpLkgId(entitlementPoolId);
limitEntity.setVendorLicenseModelId(vlmId);
limitEntity.setId(limitId);
+ limitEntity.setParent(parent);
vendorLicenseManager.updateLimit(limitEntity, user);
mdcDataDebugMessage.debugExitMessage("VLM id", vlmId, "EP id", entitlementPoolId, "limit Id",
- limitId);
+ limitId);
return Response.ok().build();
}
/**
- * Delete entitlement pool.
- *
- * @param vlmId the vlm id
- * @param entitlementPoolId the entitlement pool id
- * @param limitId the limitId
- * @param user the user
- * @return the response
+ * Delete entitlement pool.
+ *
+ * @param vlmId the vlm id
+ * @param entitlementPoolId the entitlement pool id
+ * @param limitId the limitId
+ * @param user the user
+ * @return the response
*/
public Response deleteLimit(String vlmId, String versionId, String entitlementPoolId,
- String limitId, String user) {
+ String limitId, String user) {
mdcDataDebugMessage.debugEntryMessage("VLM id, Verison Id, EP id, Limit Id", vlmId, versionId, entitlementPoolId, limitId);
MdcUtil.initMdc(LoggerServiceName.Delete_LIMIT.toString());
@@ -170,6 +174,8 @@ public class EntitlementPoolLimitsImpl implements EntitlementPoolLimits {
limitInput.setVendorLicenseModelId(vlmId);
limitInput.setEpLkgId(entitlementPoolId);
limitInput.setId(limitId);
+ limitInput.setParent(parent);
+
vendorLicenseManager.deleteLimit(limitInput, user);
mdcDataDebugMessage.debugExitMessage("VLM id, Verison Id, EP id, Limit Id", vlmId, versionId, entitlementPoolId, limitId);
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseKeyGroupLimitsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseKeyGroupLimitsImpl.java
index 4c85cfa45f..bedbc928ed 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseKeyGroupLimitsImpl.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/LicenseKeyGroupLimitsImpl.java
@@ -32,7 +32,9 @@ public class LicenseKeyGroupLimitsImpl implements LicenseKeyGroupLimits {
private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
private VendorLicenseManager vendorLicenseManager =
- VendorLicenseManagerFactory.getInstance().createInterface();
+ VendorLicenseManagerFactory.getInstance().createInterface();
+
+ public static final String parent = "LicenseKeyGroup";
@Override
public Response createLimit(LimitRequestDto request,
@@ -48,15 +50,16 @@ public class LicenseKeyGroupLimitsImpl implements LicenseKeyGroupLimits {
(versionId), licenseKeyGroupId), user);
LimitEntity limitEntity =
- new MapLimitRequestDtoToLimitEntity()
- .applyMapping(request, LimitEntity.class);
+ new MapLimitRequestDtoToLimitEntity()
+ .applyMapping(request, LimitEntity.class);
limitEntity.setEpLkgId(licenseKeyGroupId);
limitEntity.setVendorLicenseModelId(vlmId);
+ limitEntity.setParent(parent);
LimitEntity createdLimit = vendorLicenseManager.createLimit(limitEntity, user);
MapLimitEntityToLimitCreationDto mapper = new MapLimitEntityToLimitCreationDto();
LimitCreationDto createdLimitDto = mapper.applyMapping(createdLimit, LimitCreationDto
- .class);
+ .class);
/*StringWrapperResponse result =
createdLimit != null ? new StringWrapperResponse(createdLimit.getId())
: null;*/
@@ -65,24 +68,24 @@ public class LicenseKeyGroupLimitsImpl implements LicenseKeyGroupLimits {
//return Response.ok(result).build();
return Response.ok(createdLimitDto != null ? createdLimitDto : null)
- .build();
+ .build();
}
@Override
public Response listLimits(String vlmId, String versionId, String licenseKeyGroupId, String
- user) {
+ user) {
mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId, "LKG id", licenseKeyGroupId);
MdcUtil.initMdc(LoggerServiceName.List_EP.toString());
vendorLicenseManager.getLicenseKeyGroup(new LicenseKeyGroupEntity(vlmId, Version.valueOf
- (versionId), licenseKeyGroupId), user);
+ (versionId), licenseKeyGroupId), user);
Collection<LimitEntity> limits =
- vendorLicenseManager.listLimits(vlmId, Version.valueOf(versionId), licenseKeyGroupId, user);
+ vendorLicenseManager.listLimits(vlmId, Version.valueOf(versionId), licenseKeyGroupId, user);
GenericCollectionWrapper<LimitEntityDto> result = new GenericCollectionWrapper<>();
MapLimitEntityToLimitDto outputMapper =
- new MapLimitEntityToLimitDto();
+ new MapLimitEntityToLimitDto();
for (LimitEntity limit : limits) {
result.add(outputMapper.applyMapping(limit, LimitEntityDto.class));
}
@@ -100,24 +103,25 @@ public class LicenseKeyGroupLimitsImpl implements LicenseKeyGroupLimits {
String limitId,
String user) {
mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId, "LKG id", licenseKeyGroupId, "limit Id",
- limitId);
+ limitId);
MdcUtil.initMdc(LoggerServiceName.Update_LIMIT.toString());
vendorLicenseManager.getLicenseKeyGroup(new LicenseKeyGroupEntity(vlmId, Version.valueOf
- (versionId), licenseKeyGroupId), user);
+ (versionId), licenseKeyGroupId), user);
LimitEntity limitEntity =
- new MapLimitRequestDtoToLimitEntity()
- .applyMapping(request, LimitEntity.class);
+ new MapLimitRequestDtoToLimitEntity()
+ .applyMapping(request, LimitEntity.class);
limitEntity.setEpLkgId(licenseKeyGroupId);
limitEntity.setVendorLicenseModelId(vlmId);
limitEntity.setId(limitId);
+ limitEntity.setParent(parent);
vendorLicenseManager.updateLimit(limitEntity, user);
mdcDataDebugMessage.debugExitMessage("VLM id", vlmId, "LKG id", licenseKeyGroupId, "limit Id",
- limitId);
+ limitId);
return Response.ok().build();
}
@@ -134,20 +138,22 @@ public class LicenseKeyGroupLimitsImpl implements LicenseKeyGroupLimits {
public Response deleteLimit(String vlmId, String versionId, String licenseKeyGroupId,
String limitId, String user) {
mdcDataDebugMessage.debugEntryMessage("VLM id, Verison Id, LKG id, Limit Id", vlmId, versionId,
- licenseKeyGroupId, limitId);
+ licenseKeyGroupId, limitId);
MdcUtil.initMdc(LoggerServiceName.Delete_LIMIT.toString());
vendorLicenseManager.getLicenseKeyGroup(new LicenseKeyGroupEntity(vlmId, Version.valueOf
- (versionId), licenseKeyGroupId), user);
+ (versionId), licenseKeyGroupId), user);
LimitEntity limitInput = new LimitEntity();
limitInput.setVendorLicenseModelId(vlmId);
limitInput.setEpLkgId(licenseKeyGroupId);
limitInput.setId(limitId);
+ limitInput.setParent(parent);
+
vendorLicenseManager.deleteLimit(limitInput, user);
mdcDataDebugMessage.debugExitMessage("VLM id, Verison Id, LKG id, Limit Id", vlmId, versionId,
- licenseKeyGroupId, limitId);
+ licenseKeyGroupId, limitId);
return Response.ok().build();
}
@@ -156,11 +162,11 @@ public class LicenseKeyGroupLimitsImpl implements LicenseKeyGroupLimits {
public Response getLimit( String vlmId, String versionId, String licenseKeyGroupId,
String limitId, String user) {
mdcDataDebugMessage.debugEntryMessage("VLM id, LKG id, Limit Id", vlmId, licenseKeyGroupId,
- limitId);
+ limitId);
MdcUtil.initMdc(LoggerServiceName.Get_LIMIT.toString());
vendorLicenseManager.getLicenseKeyGroup(new LicenseKeyGroupEntity(vlmId, Version.valueOf
- (versionId), licenseKeyGroupId), user);
+ (versionId), licenseKeyGroupId), user);
LimitEntity epInput = new LimitEntity();
epInput.setVendorLicenseModelId(vlmId);
epInput.setVersion(Version.valueOf(versionId));
@@ -169,11 +175,11 @@ public class LicenseKeyGroupLimitsImpl implements LicenseKeyGroupLimits {
LimitEntity limit = vendorLicenseManager.getLimit(epInput, user);
LimitEntityDto entitlementPoolEntityDto = limit == null ? null :
- new MapLimitEntityToLimitDto()
- .applyMapping(limit, LimitEntityDto.class);
+ new MapLimitEntityToLimitDto()
+ .applyMapping(limit, LimitEntityDto.class);
mdcDataDebugMessage.debugExitMessage("VLM id, LKG id, Limit Id", vlmId, licenseKeyGroupId,
- limitId);
+ limitId);
return Response.ok(entitlementPoolEntityDto).build();
}