aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core')
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/FeatureGroupDaoZusammenImpl.java1
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/facade/impl/VendorLicenseFacadeImpl.java31
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/VendorLicenseArtifactsServiceImpl.java78
3 files changed, 29 insertions, 81 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/FeatureGroupDaoZusammenImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/FeatureGroupDaoZusammenImpl.java
index f1b9026cf6..13e41e2e88 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/FeatureGroupDaoZusammenImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/FeatureGroupDaoZusammenImpl.java
@@ -269,7 +269,6 @@ public class FeatureGroupDaoZusammenImpl implements FeatureGroupDao {
info.setDescription(featureGroup.getDescription());
info.addProperty(ElementPropertyName.elementType.name(), ElementType.FeatureGroup);
info.addProperty("partNumber", featureGroup.getPartNumber());
- info.addProperty("manufacturerReferenceNumber", featureGroup.getManufacturerReferenceNumber());
featureGroupElement.setInfo(info);
featureGroupElement.setRelations(new ArrayList<>());
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/facade/impl/VendorLicenseFacadeImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/facade/impl/VendorLicenseFacadeImpl.java
index 6770424101..a0173fa0ad 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/facade/impl/VendorLicenseFacadeImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/facade/impl/VendorLicenseFacadeImpl.java
@@ -26,7 +26,6 @@ import org.openecomp.core.util.UniqueValueUtil;
import org.openecomp.core.utilities.CommonMethods;
import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.common.errors.ErrorCode;
-import org.openecomp.sdc.common.togglz.ToggleableFeature;
import org.openecomp.sdc.vendorlicense.VendorLicenseConstants;
import org.openecomp.sdc.vendorlicense.dao.*;
import org.openecomp.sdc.vendorlicense.dao.types.*;
@@ -41,7 +40,6 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
-import java.util.Objects;
import static org.openecomp.sdc.vendorlicense.VendorLicenseConstants.VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE;
@@ -79,11 +77,7 @@ public class VendorLicenseFacadeImpl implements VendorLicenseFacade {
FeatureGroupEntity retrieved = featureGroupDao.get(featureGroup);
VersioningUtil
.validateEntityExistence(retrieved, featureGroup, VendorLicenseModelEntity.ENTITY_TYPE);
- if (!ToggleableFeature.MRN.isActive()) { //Remove updateManufacturerNumberInFeatureGroup() while removing remove toggle
- if (retrieved.getManufacturerReferenceNumber() == null) {
- updateManufacturerNumberInFeatureGroup(retrieved);
- }
- }
+
return retrieved;
}
@@ -262,12 +256,7 @@ public class VendorLicenseFacadeImpl implements VendorLicenseFacade {
@Override
public Collection<FeatureGroupEntity> listFeatureGroups(String vlmId, Version version) {
- Collection<FeatureGroupEntity> featureGroupEntities =
- featureGroupDao.list(new FeatureGroupEntity(vlmId, version, null));
- featureGroupEntities.stream()
- .filter(fgEntity -> Objects.isNull(fgEntity.getManufacturerReferenceNumber()))
- .forEach(this::updateManufacturerNumberInFeatureGroup);
- return featureGroupEntities;
+ return featureGroupDao.list(new FeatureGroupEntity(vlmId, version, null));
}
@@ -329,22 +318,6 @@ public class VendorLicenseFacadeImpl implements VendorLicenseFacade {
limitDao.update(limit);
}
- private void updateManufacturerNumberInFeatureGroup(FeatureGroupEntity featureGroupEntity) {
- if (CollectionUtils.isNotEmpty(featureGroupEntity.getEntitlementPoolIds())) {
- Object[] entitlementPoolIdsList = featureGroupEntity.getEntitlementPoolIds().toArray();
- if (entitlementPoolIdsList.length > 0) {
- String entitlementPoolId = entitlementPoolIdsList[0].toString();
- EntitlementPoolEntity entitlementPoolEntity =
- new EntitlementPoolEntity(featureGroupEntity.getVendorLicenseModelId(),
- featureGroupEntity.getVersion(), entitlementPoolId);
- entitlementPoolEntity = entitlementPoolDao.get(entitlementPoolEntity);
- featureGroupEntity.setManufacturerReferenceNumber(
- entitlementPoolDao.getManufacturerReferenceNumber(entitlementPoolEntity));
- featureGroupDao.update(featureGroupEntity);
- }
- }
- }
-
@Override
public void validate(String vendorLicenseModelId, Version version) {
Collection<String> allFeatureGroupEntities = new HashSet<>();
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/VendorLicenseArtifactsServiceImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/VendorLicenseArtifactsServiceImpl.java
index b9fd403db1..f0f8a6cb7c 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/VendorLicenseArtifactsServiceImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/VendorLicenseArtifactsServiceImpl.java
@@ -17,8 +17,8 @@
package org.openecomp.sdc.vendorlicense.licenseartifacts.impl;
import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang.StringUtils;
import org.openecomp.core.utilities.file.FileContentHandler;
-import org.openecomp.sdc.common.togglz.ToggleableFeature;
import org.openecomp.sdc.vendorlicense.HealingServiceFactory;
import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity;
import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity;
@@ -65,63 +65,39 @@ public class VendorLicenseArtifactsServiceImpl implements VendorLicenseArtifacts
for (String featureGroupId : featureGroups) {
FeatureGroupModel featureGroupModel = vendorLicenseFacade
.getFeatureGroupModel(new FeatureGroupEntity(vlmId, vlmVersion, featureGroupId));
+ Set<EntitlementPoolEntity> entitlementPoolEntities =
+ featureGroupModel.getEntitlementPools();
+ String manufacturerReferenceNumber = featureGroupModel.getEntityManufacturerReferenceNumber();
+ for (EntitlementPoolEntity entitlementPoolEntity : entitlementPoolEntities) {
+ entitlementPoolEntity.setLimits(vendorLicenseFacade.listLimits(vlmId, vlmVersion,
+ entitlementPoolEntity.getId()));
+ if (Objects.nonNull(manufacturerReferenceNumber) && !manufacturerReferenceNumber.trim().isEmpty()) {
+ entitlementPoolEntity.setManufacturerReferenceNumber(manufacturerReferenceNumber);
+ }
+ }
- updateEntitlementPools(vlmId, vlmVersion, featureGroupModel);
- updateLicenseKeyGroupEntities(vlmId, vlmVersion, featureGroupModel);
+ Set<LicenseKeyGroupEntity> licenseKeyGroupEntities =
+ featureGroupModel.getLicenseKeyGroups();
+ for (LicenseKeyGroupEntity licenseKeyGroupEntity : licenseKeyGroupEntities) {
+ licenseKeyGroupEntity.setLimits(vendorLicenseFacade.listLimits(vlmId, vlmVersion,
+ licenseKeyGroupEntity.getId()));
+ if (Objects.nonNull(manufacturerReferenceNumber) && !manufacturerReferenceNumber.trim().isEmpty()) {
+ licenseKeyGroupEntity.setManufacturerReferenceNumber(manufacturerReferenceNumber);
+ }
+ }
+ featureGroupModel.setEntitlementPools(entitlementPoolEntities.stream().map(
+ entitlementPoolEntity -> (EntitlementPoolEntity) healingService
+ .heal(entitlementPoolEntity)).collect(Collectors.toSet()));
+ featureGroupModel.setLicenseKeyGroups(licenseKeyGroupEntities.stream().map(
+ licenseKeyGroupEntity -> (LicenseKeyGroupEntity) healingService
+ .heal(licenseKeyGroupEntity)).collect(Collectors.toSet()));
artifact.getFeatureGroups().add(featureGroupModel);
}
}
return artifact.toXml().getBytes();
}
- private static void updateEntitlementPools(String vlmId, Version vlmVersion, FeatureGroupModel featureGroupModel) {
-
- Set<EntitlementPoolEntity> entitlementPoolEntities =
- featureGroupModel.getEntitlementPools();
-
- for (EntitlementPoolEntity entitlementPoolEntity : entitlementPoolEntities) {
- entitlementPoolEntity.setLimits(vendorLicenseFacade.listLimits(vlmId, vlmVersion,
- entitlementPoolEntity.getId()));
- String manuFacturerReferenceNumber = featureGroupModel.getEntityManufacturerReferenceNumber();
- if (ToggleableFeature.MRN.isActive()) {
- if (Objects.nonNull(manuFacturerReferenceNumber)
- && !manuFacturerReferenceNumber.trim().isEmpty()) {
- entitlementPoolEntity.setManufacturerReferenceNumber(manuFacturerReferenceNumber);
- }
- } else {
- entitlementPoolEntity.setManufacturerReferenceNumber(manuFacturerReferenceNumber);
- }
- }
- featureGroupModel.setEntitlementPools(entitlementPoolEntities.stream().map(
- entitlementPoolEntity -> (EntitlementPoolEntity) healingService
- .heal(entitlementPoolEntity)).collect(Collectors.toSet()));
- }
-
- private static void updateLicenseKeyGroupEntities(String vlmId, Version vlmVersion, FeatureGroupModel featureGroupModel) {
-
- Set<LicenseKeyGroupEntity> licenseKeyGroupEntities =
- featureGroupModel.getLicenseKeyGroups();
- for (LicenseKeyGroupEntity licenseKeyGroupEntity : licenseKeyGroupEntities) {
- licenseKeyGroupEntity.setLimits(vendorLicenseFacade.listLimits(vlmId, vlmVersion,
- licenseKeyGroupEntity.getId()));
- String manuFacturerReferenceNumber = featureGroupModel.getEntityManufacturerReferenceNumber();
- if (ToggleableFeature.MRN.isActive()) {
- if (Objects.nonNull(manuFacturerReferenceNumber)
- && !manuFacturerReferenceNumber.trim().isEmpty()) {
- licenseKeyGroupEntity.setManufacturerReferenceNumber(manuFacturerReferenceNumber);
- }
- } else {
- licenseKeyGroupEntity.setManufacturerReferenceNumber(manuFacturerReferenceNumber);
- }
- }
-
- featureGroupModel.setLicenseKeyGroups(licenseKeyGroupEntities.stream().map(
- licenseKeyGroupEntity -> (LicenseKeyGroupEntity) healingService
- .heal(licenseKeyGroupEntity)).collect(Collectors.toSet()));
-
- }
-
private static byte[] createVendorLicenseArtifact(String vlmId, String vendorName) {
VendorLicenseArtifact vendorLicenseArtifact = new VendorLicenseArtifact();
vendorLicenseArtifact.setVendorName(vendorName);
@@ -180,7 +156,7 @@ public class VendorLicenseArtifactsServiceImpl implements VendorLicenseArtifacts
.getManufacturerReferenceNumber() : null;
}
}
- return manufactureReferenceNumber != null ? Optional.of(manufactureReferenceNumber) :
+ return StringUtils.isNotEmpty(manufactureReferenceNumber) ? Optional.of(manufactureReferenceNumber) :
Optional.empty();
}