aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main
diff options
context:
space:
mode:
authorAvi Ziv <AVIZI@amdocs.com>2017-07-26 17:37:57 +0300
committerAvi Ziv <avi.ziv@amdocs.com>2017-07-26 18:27:22 +0300
commit61070c9c6b665fdea79b3ccdfeafc3a6b50d262e (patch)
treedfe9c169cfac91d6c72ac9ff23375f2aafac6405 /openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main
parentb824a997e19f6ee9627cb1b1e124c756bd8183fc (diff)
[SDC] Full OnBoard health-check and NFoD support
Change-Id: I606f8a52c7e6d2bd5558f824957d890e552c5423 Signed-off-by: Avi Ziv <avi.ziv@amdocs.com>
Diffstat (limited to 'openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main')
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseManagerImpl.java106
1 files changed, 62 insertions, 44 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseManagerImpl.java
index 622ff02501..b570170985 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseManagerImpl.java
@@ -365,9 +365,7 @@ public class VendorLicenseManagerImpl implements VendorLicenseManager {
String user) {
mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId);
mdcDataDebugMessage.debugExitMessage("VLM id", vlmId);
- return featureGroupDao.list(new FeatureGroupEntity(vlmId, VersioningUtil
- .resolveVersion(version, getVersionInfo(vlmId, VersionableEntityAction.Read, user), user),
- null));
+ return vendorLicenseFacade.listFeatureGroups(vlmId, version, user);
}
@Override
@@ -487,15 +485,6 @@ public class VendorLicenseManagerImpl implements VendorLicenseManager {
.debugEntryMessage("VLM id", entitlementPool.getVendorLicenseModelId());
mdcDataDebugMessage
.debugExitMessage("VLM id", entitlementPool.getVendorLicenseModelId());
- validateCreateDate(entitlementPool);
- return vendorLicenseFacade.createEntitlementPool(entitlementPool, user);
- }
-
- private void validateCreateDate(EntitlementPoolEntity entitlementPool){
- mdcDataDebugMessage.debugEntryMessage("Start date and end date", entitlementPool.getStartDate
- ()+" "+entitlementPool.getExpiryDate());
-
- DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy'T'HH:mm:ss'Z'");
entitlementPool.setStartDate(entitlementPool.getStartDate() != null ? (entitlementPool
.getStartDate().trim().length() != 0 ? entitlementPool.getStartDate()+"T00:00:00Z"
@@ -504,40 +493,49 @@ public class VendorLicenseManagerImpl implements VendorLicenseManager {
.getExpiryDate().trim().length() != 0 ? entitlementPool.getExpiryDate()+"T23:59:59Z"
: null) : null);
- if(entitlementPool.getStartDate() != null && entitlementPool.getExpiryDate() != null) {
- if (LocalDate.parse(entitlementPool.getStartDate(), formatter).atStartOfDay().isBefore
- (LocalDate.now().atStartOfDay()) ||
- LocalDate.parse(entitlementPool.getExpiryDate(), formatter).atStartOfDay()
- .isEqual(LocalDate.now().atStartOfDay()) ||
- LocalDate.parse(entitlementPool.getExpiryDate(), formatter)
- .isBefore(LocalDate.parse(entitlementPool.getStartDate(), formatter))) {
+ validateCreateDate(entitlementPool.getStartDate(), entitlementPool.getExpiryDate(),
+ entitlementPool.getVendorLicenseModelId());
+ return vendorLicenseFacade.createEntitlementPool(entitlementPool, user);
+ }
+
+ private void validateCreateDate(String startDate, String expiryDate, String vendorLicenseModelId){
+ mdcDataDebugMessage.debugEntryMessage("Start date and end date", startDate
+ +" "+expiryDate);
+
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy'T'HH:mm:ss'Z'");
+
+ if(startDate != null && expiryDate != null) {
+ if (LocalDate.parse(startDate, formatter).atStartOfDay().isBefore
+ (LocalDate.now().atStartOfDay()) || LocalDate.parse(expiryDate, formatter).atStartOfDay()
+ .isEqual(LocalDate.parse(startDate, formatter).atStartOfDay()) || LocalDate
+ .parse(expiryDate, formatter).isBefore(LocalDate.parse(startDate, formatter))) {
MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
LoggerTragetServiceName.VALIDATE_DATE_RANGE,ErrorLevel.ERROR.name(),
LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.INVALID_VALUE);
throw new CoreException(
- new InvalidDateErrorBuilder(entitlementPool.getVendorLicenseModelId())
+ new InvalidDateErrorBuilder(vendorLicenseModelId)
.build());
}
}
- if(entitlementPool.getStartDate() != null && entitlementPool.getExpiryDate() == null) {
- if (LocalDate.parse(entitlementPool.getStartDate(), formatter).atStartOfDay().isBefore
+ if(startDate != null && expiryDate == null) {
+ if (LocalDate.parse(startDate, formatter).atStartOfDay().isBefore
(LocalDate.now().atStartOfDay())) {
MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
LoggerTragetServiceName.VALIDATE_DATE_RANGE,ErrorLevel.ERROR.name(),
LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.INVALID_VALUE);
throw new CoreException(
- new InvalidDateErrorBuilder(entitlementPool.getVendorLicenseModelId())
+ new InvalidDateErrorBuilder(vendorLicenseModelId)
.build());
}
}
- if(entitlementPool.getStartDate() == null && entitlementPool.getExpiryDate() != null) {
+ if(startDate == null && expiryDate != null) {
MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
LoggerTragetServiceName.VALIDATE_DATE_RANGE,ErrorLevel.ERROR.name(),
LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.INVALID_VALUE);
throw new CoreException(
- new InvalidDateErrorBuilder(entitlementPool.getVendorLicenseModelId())
+ new InvalidDateErrorBuilder(vendorLicenseModelId)
.build());
}
@@ -545,39 +543,31 @@ public class VendorLicenseManagerImpl implements VendorLicenseManager {
mdcDataDebugMessage.debugExitMessage(null,null);
}
- private void validateUpdateDate(EntitlementPoolEntity entitlementPool){
- mdcDataDebugMessage.debugEntryMessage("Start date and end date", entitlementPool.getStartDate
- ()+" "+entitlementPool.getExpiryDate());
+ private void validateUpdateDate(String startDate, String expiryDate, String vendorLicenseModelId){
+ mdcDataDebugMessage.debugEntryMessage("Start date and end date", startDate
+ +" "+ expiryDate);
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy'T'HH:mm:ss'Z'");
- entitlementPool.setStartDate(entitlementPool.getStartDate() != null ? (entitlementPool
- .getStartDate().trim().length() != 0 ? entitlementPool.getStartDate()+"T00:00:00Z"
- : null) : null);
- entitlementPool.setExpiryDate(entitlementPool.getExpiryDate() != null ? (entitlementPool
- .getExpiryDate().trim().length() != 0 ? entitlementPool.getExpiryDate()+"T23:59:59Z"
- : null) : null);
-
- if(entitlementPool.getStartDate() != null && entitlementPool.getExpiryDate() != null) {
- if (LocalDate.parse(entitlementPool.getExpiryDate(), formatter).atStartOfDay()
- .isEqual(LocalDate.parse(entitlementPool.getStartDate(), formatter).atStartOfDay()) ||
- LocalDate.parse(entitlementPool.getExpiryDate(), formatter)
- .isBefore(LocalDate.parse(entitlementPool.getStartDate(), formatter))) {
+ if(startDate != null && expiryDate != null) {
+ if (LocalDate.parse(expiryDate, formatter).atStartOfDay()
+ .isEqual(LocalDate.parse(startDate, formatter).atStartOfDay()) ||
+ LocalDate.parse(expiryDate, formatter).isBefore(LocalDate.parse(startDate, formatter))) {
MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
LoggerTragetServiceName.VALIDATE_DATE_RANGE,ErrorLevel.ERROR.name(),
LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.INVALID_VALUE);
throw new CoreException(
- new InvalidDateErrorBuilder(entitlementPool.getVendorLicenseModelId())
+ new InvalidDateErrorBuilder(vendorLicenseModelId)
.build());
}
}
- if(entitlementPool.getStartDate() == null && entitlementPool.getExpiryDate() != null) {
+ if(startDate == null && expiryDate != null) {
MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
LoggerTragetServiceName.VALIDATE_DATE_RANGE,ErrorLevel.ERROR.name(),
LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.INVALID_VALUE);
throw new CoreException(
- new InvalidDateErrorBuilder(entitlementPool.getVendorLicenseModelId())
+ new InvalidDateErrorBuilder(vendorLicenseModelId)
.build());
}
@@ -590,7 +580,15 @@ public class VendorLicenseManagerImpl implements VendorLicenseManager {
mdcDataDebugMessage.debugEntryMessage("VLM id, EP id", entitlementPool
.getVendorLicenseModelId(), entitlementPool.getId());
- validateUpdateDate(entitlementPool);
+ entitlementPool.setStartDate(entitlementPool.getStartDate() != null ? (entitlementPool
+ .getStartDate().trim().length() != 0 ? entitlementPool.getStartDate()+"T00:00:00Z"
+ : null) : null);
+ entitlementPool.setExpiryDate(entitlementPool.getExpiryDate() != null ? (entitlementPool
+ .getExpiryDate().trim().length() != 0 ? entitlementPool.getExpiryDate()+"T23:59:59Z"
+ : null) : null);
+
+ validateUpdateDate(entitlementPool.getStartDate(), entitlementPool.getExpiryDate(),
+ entitlementPool.getVendorLicenseModelId());
Version version = VersioningUtil.resolveVersion(entitlementPool.getVersion(),
getVersionInfo(entitlementPool.getVendorLicenseModelId(), VersionableEntityAction.Write,
user), user);
@@ -692,6 +690,16 @@ public class VendorLicenseManagerImpl implements VendorLicenseManager {
mdcDataDebugMessage.debugExitMessage("VLM id", licenseKeyGroup
.getVendorLicenseModelId());
+
+ licenseKeyGroup.setStartDate(licenseKeyGroup.getStartDate() != null ? (licenseKeyGroup
+ .getStartDate().trim().length() != 0 ? licenseKeyGroup.getStartDate()+"T00:00:00Z"
+ : null) : null);
+ licenseKeyGroup.setExpiryDate(licenseKeyGroup.getExpiryDate() != null ? (licenseKeyGroup
+ .getExpiryDate().trim().length() != 0 ? licenseKeyGroup.getExpiryDate()+"T23:59:59Z"
+ : null) : null);
+
+ validateCreateDate(licenseKeyGroup.getStartDate(), licenseKeyGroup.getExpiryDate(),
+ licenseKeyGroup.getVendorLicenseModelId());
return vendorLicenseFacade.createLicenseKeyGroup(licenseKeyGroup, user);
}
@@ -700,6 +708,16 @@ public class VendorLicenseManagerImpl implements VendorLicenseManager {
mdcDataDebugMessage.debugEntryMessage("VLM id, LKG id", licenseKeyGroup
.getVendorLicenseModelId(), licenseKeyGroup.getId());
+ licenseKeyGroup.setStartDate(licenseKeyGroup.getStartDate() != null ? (licenseKeyGroup
+ .getStartDate().trim().length() != 0 ? licenseKeyGroup.getStartDate()+"T00:00:00Z"
+ : null) : null);
+ licenseKeyGroup.setExpiryDate(licenseKeyGroup.getExpiryDate() != null ? (licenseKeyGroup
+ .getExpiryDate().trim().length() != 0 ? licenseKeyGroup.getExpiryDate()+"T23:59:59Z"
+ : null) : null);
+
+ validateUpdateDate(licenseKeyGroup.getStartDate(), licenseKeyGroup.getExpiryDate(),
+ licenseKeyGroup.getVendorLicenseModelId());
+
Version version = VersioningUtil.resolveVersion(licenseKeyGroup.getVersion(),
getVersionInfo(licenseKeyGroup.getVendorLicenseModelId(), VersionableEntityAction.Write,
user), user);