aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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.java4
-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.java4
-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.java5
-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.java5
-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.java4
-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.java4
-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.java10
-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.java14
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolEntityToEntitlementPoolEntityDtoTest.java13
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolRequestDtoToEntitlementPoolEntityTest.java12
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapFeatureGroupDescriptorDtoToFeatureGroupEntityTest.java12
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapFeatureGroupEntityToFeatureGroupDescriptorDtoTest.java12
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDtoTest.java12
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntityTest.java12
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/EntitlementPoolRequestDto.java13
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/FeatureGroupDescriptorDto.java3
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseKeyGroupRequestDto.java13
-rw-r--r--openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/togglz/ToggleableFeature.java5
-rw-r--r--openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/resources/entityHealingConfiguration.json3
-rw-r--r--openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/ManufacturerReferenceNumberHealer.java106
-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/EntitlementPoolZusammenDaoImpl.java1
-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/LicenseKeyGroupZusammenDaoImpl.java1
-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/convertor/ElementToEntitlementPoolConvertor.java1
-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/convertor/ElementToLicenseKeyGroupConvertor.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.java7
-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.java73
-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/types/FeatureGroupForArtifact.java65
27 files changed, 295 insertions, 120 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/mapping/MapEntitlementPoolEntityToEntitlementPoolEntityDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolEntityToEntitlementPoolEntityDto.java
index ba23b8cbb0..18435b3c71 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolEntityToEntitlementPoolEntityDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolEntityToEntitlementPoolEntityDto.java
@@ -20,6 +20,7 @@
package org.openecomp.sdcrests.vendorlicense.rest.mapping;
+import org.openecomp.sdc.common.togglz.ToggleableFeature;
import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity;
import org.openecomp.sdcrests.mapping.MappingBase;
import org.openecomp.sdcrests.vendorlicense.types.EntitlementPoolEntityDto;
@@ -46,5 +47,8 @@ public class MapEntitlementPoolEntityToEntitlementPoolEntityDto
target.setStartDate(source.getStartDate());
target.setExpiryDate(source.getExpiryDate());
target.setVersionUUID(source.getVersionUuId());
+ if (ToggleableFeature.MRN.isActive()) {
+ target.setManufacturerReferenceNumber(source.getManufacturerReferenceNumber());
+ }
}
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolRequestDtoToEntitlementPoolEntity.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolRequestDtoToEntitlementPoolEntity.java
index 9b215d69aa..bed7e696e7 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolRequestDtoToEntitlementPoolEntity.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolRequestDtoToEntitlementPoolEntity.java
@@ -20,6 +20,7 @@
package org.openecomp.sdcrests.vendorlicense.rest.mapping;
+import org.openecomp.sdc.common.togglz.ToggleableFeature;
import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity;
import org.openecomp.sdc.vendorlicense.dao.types.MultiChoiceOrOther;
import org.openecomp.sdcrests.mapping.MappingBase;
@@ -30,6 +31,9 @@ public class MapEntitlementPoolRequestDtoToEntitlementPoolEntity
@Override
public void doMapping(EntitlementPoolRequestDto source, EntitlementPoolEntity target) {
target.setName(source.getName());
+ if (ToggleableFeature.MRN.isActive()) {
+ target.setManufacturerReferenceNumber(source.getManufacturerReferenceNumber());
+ }
target.setDescription(source.getDescription());
target.setThresholdValue(source.getThresholdValue());
target.setThresholdUnit(source.getThresholdUnits());
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapFeatureGroupDescriptorDtoToFeatureGroupEntity.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapFeatureGroupDescriptorDtoToFeatureGroupEntity.java
index dedc2a01f0..232588779c 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapFeatureGroupDescriptorDtoToFeatureGroupEntity.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapFeatureGroupDescriptorDtoToFeatureGroupEntity.java
@@ -20,6 +20,7 @@
package org.openecomp.sdcrests.vendorlicense.rest.mapping;
+import org.openecomp.sdc.common.togglz.ToggleableFeature;
import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity;
import org.openecomp.sdcrests.mapping.MappingBase;
import org.openecomp.sdcrests.vendorlicense.types.FeatureGroupDescriptorDto;
@@ -31,6 +32,8 @@ public class MapFeatureGroupDescriptorDtoToFeatureGroupEntity
target.setName(source.getName());
target.setDescription(source.getDescription());
target.setPartNumber(source.getPartNumber());
- target.setManufacturerReferenceNumber(source.getManufacturerReferenceNumber());
+ if (!ToggleableFeature.MRN.isActive()) {
+ target.setManufacturerReferenceNumber(source.getManufacturerReferenceNumber());
+ }
}
} \ No newline at end of file
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapFeatureGroupEntityToFeatureGroupDescriptorDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapFeatureGroupEntityToFeatureGroupDescriptorDto.java
index ce69384f41..e103b27687 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapFeatureGroupEntityToFeatureGroupDescriptorDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapFeatureGroupEntityToFeatureGroupDescriptorDto.java
@@ -20,6 +20,7 @@
package org.openecomp.sdcrests.vendorlicense.rest.mapping;
+import org.openecomp.sdc.common.togglz.ToggleableFeature;
import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity;
import org.openecomp.sdcrests.mapping.MappingBase;
import org.openecomp.sdcrests.vendorlicense.types.FeatureGroupDescriptorDto;
@@ -31,6 +32,8 @@ public class MapFeatureGroupEntityToFeatureGroupDescriptorDto
target.setName(source.getName());
target.setDescription(source.getDescription());
target.setPartNumber(source.getPartNumber());
- target.setManufacturerReferenceNumber(source.getManufacturerReferenceNumber());
+ if (!ToggleableFeature.MRN.isActive()) {
+ 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/MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto.java
index 2b314b7416..a7d4b5bc42 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto.java
@@ -20,6 +20,7 @@
package org.openecomp.sdcrests.vendorlicense.rest.mapping;
+import org.openecomp.sdc.common.togglz.ToggleableFeature;
import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity;
import org.openecomp.sdcrests.mapping.MappingBase;
import org.openecomp.sdcrests.vendorlicense.types.LicenseKeyGroupEntityDto;
@@ -42,5 +43,8 @@ public class MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto
target.setThresholdValue(source.getThresholdValue());
target.setIncrements(source.getIncrements());
target.setVersionUUID(source.getVersionUuId());
+ if (ToggleableFeature.MRN.isActive()) {
+ target.setManufacturerReferenceNumber(source.getManufacturerReferenceNumber());
+ }
}
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity.java
index 4682a46216..0eeda4a8b7 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity.java
@@ -20,6 +20,7 @@
package org.openecomp.sdcrests.vendorlicense.rest.mapping;
+import org.openecomp.sdc.common.togglz.ToggleableFeature;
import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity;
import org.openecomp.sdc.vendorlicense.dao.types.MultiChoiceOrOther;
import org.openecomp.sdcrests.mapping.MappingBase;
@@ -30,6 +31,9 @@ public class MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity
@Override
public void doMapping(LicenseKeyGroupRequestDto source, LicenseKeyGroupEntity target) {
target.setName(source.getName());
+ if (ToggleableFeature.MRN.isActive()) {
+ target.setManufacturerReferenceNumber(source.getManufacturerReferenceNumber());
+ }
target.setDescription(source.getDescription());
target.setType(source.getType());
target.setOperationalScope(new MapMultiChoiceOrOtherDtoToMultiChoiceOrOther()
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/EntitlementPoolsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/EntitlementPoolsImpl.java
index 076ae45017..292b4a0937 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/EntitlementPoolsImpl.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/EntitlementPoolsImpl.java
@@ -20,6 +20,9 @@
package org.openecomp.sdcrests.vendorlicense.rest.services;
+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.VendorLicenseManager;
import org.openecomp.sdc.vendorlicense.VendorLicenseManagerFactory;
import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity;
@@ -37,6 +40,7 @@ import org.springframework.stereotype.Service;
import javax.inject.Named;
import javax.ws.rs.core.Response;
import java.util.Collection;
+import java.util.Objects;
@Named
@Service("entitlementPools")
@@ -76,6 +80,12 @@ public class EntitlementPoolsImpl implements EntitlementPools {
*/
public Response createEntitlementPool(EntitlementPoolRequestDto request, String vlmId,
String versionId, String user) {
+ if (ToggleableFeature.MRN.isActive()) {
+ if (Objects.isNull(request.getManufacturerReferenceNumber())) {
+ throw new CoreException((new ErrorCode.ErrorCodeBuilder().withMessage("Field does not conform to "
+ + "predefined criteria : manufacturerReferenceNumber : is mandatory and should not be empty").build()));
+ }
+ }
EntitlementPoolEntity entitlementPoolEntity =
new MapEntitlementPoolRequestDtoToEntitlementPoolEntity()
.applyMapping(request, EntitlementPoolEntity.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/services/FeatureGroupsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/FeatureGroupsImpl.java
index cd11a45886..1c967ffa08 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/FeatureGroupsImpl.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/FeatureGroupsImpl.java
@@ -21,6 +21,9 @@
package org.openecomp.sdcrests.vendorlicense.rest.services;
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.VendorLicenseManager;
import org.openecomp.sdc.vendorlicense.VendorLicenseManagerFactory;
import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity;
@@ -48,6 +51,7 @@ import javax.inject.Named;
import javax.ws.rs.core.Response;
import java.util.Collection;
import java.util.HashSet;
+import java.util.Objects;
@Named
@Service("featureGroups")
@@ -71,7 +75,6 @@ public class FeatureGroupsImpl implements FeatureGroups {
fgDto.setLicenseKeyGroupsIds(fg.getLicenseKeyGroupIds());
fgDto.setEntitlementPoolsIds(fg.getEntitlementPoolIds());
fgDto.setReferencingLicenseAgreements(fg.getReferencingLicenseAgreements());
- fgDto.setManufacturerReferenceNumber(fg.getManufacturerReferenceNumber());
outputMapper.doMapping(fg, fgDto);
results.add(fgDto);
}
@@ -81,6 +84,15 @@ public class FeatureGroupsImpl implements FeatureGroups {
@Override
public Response createFeatureGroup(FeatureGroupRequestDto request, String vlmId, String versionId,
String user) {
+ //Below if block is introduced to have feature toggleable. This if block needs to remove when
+ // we remove toggle.
+ if (!ToggleableFeature.MRN.isActive()) {
+ if (Objects.isNull(request.getManufacturerReferenceNumber())) {
+ throw new CoreException((new ErrorCode.ErrorCodeBuilder().withMessage("Field does not " +
+ "conform to predefined criteria : manufacturerReferenceNumber : is mandatory and should not be empty").build()));
+ }
+ }
+
FeatureGroupEntity featureGroupEntity = new MapFeatureGroupDescriptorDtoToFeatureGroupEntity()
.applyMapping(request, FeatureGroupEntity.class);
featureGroupEntity.setVendorLicenseModelId(vlmId);
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolEntityToEntitlementPoolEntityDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolEntityToEntitlementPoolEntityDtoTest.java
index 0d03c19808..a00c01080e 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolEntityToEntitlementPoolEntityDtoTest.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolEntityToEntitlementPoolEntityDtoTest.java
@@ -141,4 +141,17 @@ public class MapEntitlementPoolEntityToEntitlementPoolEntityDtoTest {
mapper.doMapping(source, target);
assertEquals(target.getStartDate(), param);
}
+
+ @Test
+ public void testManufacturerReferenceNumber() {
+ EntitlementPoolEntity source = new EntitlementPoolEntity();
+ EntitlementPoolEntityDto target = new EntitlementPoolEntityDto();
+ MapEntitlementPoolEntityToEntitlementPoolEntityDto mapper = new
+ MapEntitlementPoolEntityToEntitlementPoolEntityDto();
+
+ String param = "02402e1e-7092-485a-9574-46e2d49cca97";
+ source.setManufacturerReferenceNumber(param);
+ mapper.doMapping(source, target);
+ assertEquals(target.getManufacturerReferenceNumber(), param);
+ }
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolRequestDtoToEntitlementPoolEntityTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolRequestDtoToEntitlementPoolEntityTest.java
index 86e94510bc..d927dc471c 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolRequestDtoToEntitlementPoolEntityTest.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolRequestDtoToEntitlementPoolEntityTest.java
@@ -114,6 +114,18 @@ public class MapEntitlementPoolRequestDtoToEntitlementPoolEntityTest {
assertEquals(target.getStartDate(), param);
}
+ @Test
+ public void testManufacturerReferenceNumber() {
+ EntitlementPoolRequestDto source = new EntitlementPoolRequestDto();
+ EntitlementPoolEntity target = new EntitlementPoolEntity();
+ MapEntitlementPoolRequestDtoToEntitlementPoolEntity mapper = new
+ MapEntitlementPoolRequestDtoToEntitlementPoolEntity();
+ String param = "02402e1e-7092-485a-9574-46e2d49cca97";
+ source.setManufacturerReferenceNumber(param);
+ mapper.doMapping(source, target);
+ assertEquals(target.getManufacturerReferenceNumber(), param);
+ }
+
enum TestEnum {
Yes
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapFeatureGroupDescriptorDtoToFeatureGroupEntityTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapFeatureGroupDescriptorDtoToFeatureGroupEntityTest.java
index ea8c59b94c..7024931523 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapFeatureGroupDescriptorDtoToFeatureGroupEntityTest.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapFeatureGroupDescriptorDtoToFeatureGroupEntityTest.java
@@ -50,18 +50,6 @@ public class MapFeatureGroupDescriptorDtoToFeatureGroupEntityTest {
}
@Test
- public void testManufacturerReferenceNumber() {
- FeatureGroupDescriptorDto source = new FeatureGroupDescriptorDto();
- FeatureGroupEntity target = new FeatureGroupEntity();
- MapFeatureGroupDescriptorDtoToFeatureGroupEntity mapper =
- new MapFeatureGroupDescriptorDtoToFeatureGroupEntity();
- String param = "6751e741-ffc2-4034-863b-f0083f62c033";
- source.setManufacturerReferenceNumber(param);
- mapper.doMapping(source, target);
- assertEquals(target.getManufacturerReferenceNumber(), param);
- }
-
- @Test
public void testPartNumber() {
FeatureGroupDescriptorDto source = new FeatureGroupDescriptorDto();
FeatureGroupEntity target = new FeatureGroupEntity();
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapFeatureGroupEntityToFeatureGroupDescriptorDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapFeatureGroupEntityToFeatureGroupDescriptorDtoTest.java
index b575febac8..2a9c18f828 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapFeatureGroupEntityToFeatureGroupDescriptorDtoTest.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapFeatureGroupEntityToFeatureGroupDescriptorDtoTest.java
@@ -26,18 +26,6 @@ import org.openecomp.sdcrests.vendorlicense.types.FeatureGroupDescriptorDto;
public class MapFeatureGroupEntityToFeatureGroupDescriptorDtoTest {
@Test
- public void testManufacturerReferenceNumber() {
- FeatureGroupEntity source = new FeatureGroupEntity();
- FeatureGroupDescriptorDto target = new FeatureGroupDescriptorDto();
- MapFeatureGroupEntityToFeatureGroupDescriptorDto mapper =
- new MapFeatureGroupEntityToFeatureGroupDescriptorDto();
- String param = "02402e1e-7092-485a-9574-46e2d49cca97";
- source.setManufacturerReferenceNumber(param);
- mapper.doMapping(source, target);
- assertEquals(target.getManufacturerReferenceNumber(), param);
- }
-
- @Test
public void testDescription() {
FeatureGroupEntity source = new FeatureGroupEntity();
FeatureGroupDescriptorDto target = new FeatureGroupDescriptorDto();
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDtoTest.java
index ce8363def4..0b17f6014d 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDtoTest.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDtoTest.java
@@ -167,6 +167,18 @@ public class MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDtoTest {
assertEquals(target.getStartDate(), param);
}
+ @Test
+ public void testManufacturerReferenceNumber() {
+ LicenseKeyGroupEntity source = new LicenseKeyGroupEntity();
+ LicenseKeyGroupEntityDto target = new LicenseKeyGroupEntityDto();
+ MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto mapper = new
+ MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto();
+ String param = "02402e1e-7092-485a-9574-46e2d49cca97";
+ source.setManufacturerReferenceNumber(param);
+ mapper.doMapping(source, target);
+ assertEquals(target.getManufacturerReferenceNumber(), param);
+ }
+
enum TestEnum {
Yes
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntityTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntityTest.java
index 8d0769ae05..a1e617e526 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntityTest.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntityTest.java
@@ -137,4 +137,16 @@ public class MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntityTest {
mapper.doMapping(source, target);
assertEquals(target.getStartDate(), param);
}
+
+ @Test
+ public void testManufacturerReferenceNumber() {
+ LicenseKeyGroupRequestDto source = new LicenseKeyGroupRequestDto();
+ LicenseKeyGroupEntity target = new LicenseKeyGroupEntity();
+ MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity mapper = new
+ MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity();
+ String param = "02402e1e-7092-485a-9574-46e2d49cca97";
+ source.setManufacturerReferenceNumber(param);
+ mapper.doMapping(source, target);
+ assertEquals(target.getManufacturerReferenceNumber(), param);
+ }
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/EntitlementPoolRequestDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/EntitlementPoolRequestDto.java
index 18488ab83d..8fa34b8579 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/EntitlementPoolRequestDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/EntitlementPoolRequestDto.java
@@ -30,13 +30,16 @@ import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
@ApiModel(value = "EntitlementPoolRequest")
-@JsonIgnoreProperties({"manufacturerReferenceNumber", "time", "aggregationFunction", "entitlementMetric"})
+@JsonIgnoreProperties({"time", "aggregationFunction", "entitlementMetric"})
public class EntitlementPoolRequestDto {
@NotNull
@Size(max = 120)
private String name;
+ @Size(max = 100)
+ private String manufacturerReferenceNumber;
+
@Size(max = 1000)
private String description;
@@ -60,6 +63,14 @@ public class EntitlementPoolRequestDto {
this.name = name;
}
+ public String getManufacturerReferenceNumber() {
+ return manufacturerReferenceNumber;
+ }
+
+ public void setManufacturerReferenceNumber(String manufacturerReferenceNumber) {
+ this.manufacturerReferenceNumber = manufacturerReferenceNumber;
+ }
+
public String getDescription() {
return description;
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/FeatureGroupDescriptorDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/FeatureGroupDescriptorDto.java
index 56b3c25635..4270ffee9e 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/FeatureGroupDescriptorDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/FeatureGroupDescriptorDto.java
@@ -20,7 +20,6 @@
package org.openecomp.sdcrests.vendorlicense.types;
-import org.hibernate.validator.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
@@ -35,7 +34,7 @@ public class FeatureGroupDescriptorDto {
@NotNull
private String partNumber;
- @NotBlank(message = "is mandatory and should not be empty")
+
@Size(max = 100)
private String manufacturerReferenceNumber;
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseKeyGroupRequestDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseKeyGroupRequestDto.java
index fb56f85326..c1e2ef05bf 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseKeyGroupRequestDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseKeyGroupRequestDto.java
@@ -32,8 +32,13 @@ public class LicenseKeyGroupRequestDto {
@NotNull
@Size(max = 120)
private String name;
+
+ @Size(max = 100)
+ private String manufacturerReferenceNumber;
+
@Size(max = 1000)
private String description;
+
@NotNull
private LicenseKeyType type;
@@ -58,6 +63,14 @@ public class LicenseKeyGroupRequestDto {
this.name = name;
}
+ public String getManufacturerReferenceNumber() {
+ return manufacturerReferenceNumber;
+ }
+
+ public void setManufacturerReferenceNumber(String manufacturerReferenceNumber) {
+ this.manufacturerReferenceNumber = manufacturerReferenceNumber;
+ }
+
public String getDescription() {
return description;
}
diff --git a/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/togglz/ToggleableFeature.java b/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/togglz/ToggleableFeature.java
index 74623d5d04..493b891cde 100644
--- a/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/togglz/ToggleableFeature.java
+++ b/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/togglz/ToggleableFeature.java
@@ -10,7 +10,10 @@ public enum ToggleableFeature implements Feature {
ARCHIVE_ITEM,
@Label("Filter")
- FILTER;
+ FILTER,
+
+ @Label(("MRN"))
+ MRN;
public boolean isActive() {
return FeatureContext.getFeatureManager().isActive(this);
diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/resources/entityHealingConfiguration.json b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/resources/entityHealingConfiguration.json
index d8f6986a73..a70c4afc6b 100644
--- a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/resources/entityHealingConfiguration.json
+++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/resources/entityHealingConfiguration.json
@@ -12,6 +12,9 @@
"vlm": {
"structure": [
"org.openecomp.sdc.healing.healers.OwnerHealer"
+ ],
+ "data": [
+ "org.openecomp.sdc.healing.healers.ManufacturerReferenceNumberHealer"
]
}
} \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/ManufacturerReferenceNumberHealer.java b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/ManufacturerReferenceNumberHealer.java
new file mode 100644
index 0000000000..237e4bf55b
--- /dev/null
+++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/ManufacturerReferenceNumberHealer.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright © 2016-2018 European Support Limited
+ *
+ * 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.
+ */
+
+package org.openecomp.sdc.healing.healers;
+
+import org.openecomp.sdc.healing.interfaces.Healer;
+import org.openecomp.sdc.vendorlicense.dao.FeatureGroupDao;
+import org.openecomp.sdc.vendorlicense.dao.FeatureGroupDaoFactory;
+import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity;
+import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity;
+import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity;
+import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade;
+import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacadeFactory;
+import org.openecomp.sdc.versioning.dao.types.Version;
+
+import java.util.Collection;
+import java.util.Objects;
+import java.util.Set;
+
+public class ManufacturerReferenceNumberHealer implements Healer {
+
+ private static final String manufacturerReferenceNumber = "MRN";
+ private VendorLicenseFacade vendorLicenseFacade = VendorLicenseFacadeFactory.getInstance()
+ .createInterface();
+ private static final FeatureGroupDao featureGroupDao =
+ FeatureGroupDaoFactory.getInstance().createInterface();
+
+ @Override
+ public boolean isHealingNeeded(String itemId, Version version) {
+ return Objects.isNull(vendorLicenseFacade.listEntitlementPools
+ (itemId, version).iterator().next().getManufacturerReferenceNumber()) ? true :
+ false;
+ }
+
+ @Override
+ public void heal(String itemId, Version version) throws Exception {
+
+ healEntitlementPools(itemId, version);
+ healLicenseKeyGroups(itemId, version);
+ healFeatureGroups(itemId, version);
+ }
+
+ private void healEntitlementPools(String itemId, Version version) {
+ Collection<EntitlementPoolEntity> entitlementPoolEntities = vendorLicenseFacade
+ .listEntitlementPools(itemId, version);
+
+ for (EntitlementPoolEntity entitlementPoolEntity : entitlementPoolEntities) {
+ Set<String> referencingFeatureGroup = entitlementPoolEntity.getReferencingFeatureGroups();
+
+ if (referencingFeatureGroup.size() == 1) {
+ entitlementPoolEntity.setManufacturerReferenceNumber(getMRN(itemId, version,
+ referencingFeatureGroup));
+ } else {
+ entitlementPoolEntity.setManufacturerReferenceNumber(manufacturerReferenceNumber);
+ }
+ vendorLicenseFacade.updateEntitlementPool(entitlementPoolEntity);
+ }
+ }
+
+ private void healLicenseKeyGroups(String itemId, Version version) {
+ Collection<LicenseKeyGroupEntity> licenseKeyGroupEntities = vendorLicenseFacade
+ .listLicenseKeyGroups(itemId, version);
+
+ for (LicenseKeyGroupEntity licenseKeyGroupEntity : licenseKeyGroupEntities) {
+ Set<String> referencingFeatureGroup = licenseKeyGroupEntity.getReferencingFeatureGroups();
+ if (referencingFeatureGroup.size() == 1) {
+ licenseKeyGroupEntity.setManufacturerReferenceNumber(getMRN(itemId, version,
+ referencingFeatureGroup));
+ } else {
+ licenseKeyGroupEntity.setManufacturerReferenceNumber(manufacturerReferenceNumber);
+ }
+ vendorLicenseFacade.updateLicenseKeyGroup(licenseKeyGroupEntity);
+ }
+ }
+
+ private String getMRN(String itemId, Version
+ version, Set<String> referencingFeatureGroup) {
+ FeatureGroupEntity featureGroupEntity = vendorLicenseFacade.getFeatureGroup(new
+ FeatureGroupEntity(itemId, version, referencingFeatureGroup.iterator().next()));
+ return featureGroupEntity.getManufacturerReferenceNumber();
+ }
+
+ private void healFeatureGroups(String itemId, Version version) {
+
+ Collection<FeatureGroupEntity> featureGroupEntities = vendorLicenseFacade.listFeatureGroups
+ (itemId, version);
+
+ for (FeatureGroupEntity featureGroupEntity : featureGroupEntities) {
+ featureGroupEntity.setManufacturerReferenceNumber("");
+ featureGroupDao.update(featureGroupEntity);
+ }
+ }
+}
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/EntitlementPoolZusammenDaoImpl.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/EntitlementPoolZusammenDaoImpl.java
index be073abae5..b3adddb3d2 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/EntitlementPoolZusammenDaoImpl.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/EntitlementPoolZusammenDaoImpl.java
@@ -225,6 +225,7 @@ public class EntitlementPoolZusammenDaoImpl implements EntitlementPoolDao {
info.addProperty("operational_scope", entitlementPool.getOperationalScope());
info.addProperty("startDate", entitlementPool.getStartDate());
info.addProperty("expiryDate", entitlementPool.getExpiryDate());
+ info.addProperty("manufacturerReferenceNumber", entitlementPool.getManufacturerReferenceNumber());
entitlementPoolElement.setInfo(info);
if (entitlementPool.getReferencingFeatureGroups() != null
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/LicenseKeyGroupZusammenDaoImpl.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/LicenseKeyGroupZusammenDaoImpl.java
index d302ab49b5..1b458f3a47 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/LicenseKeyGroupZusammenDaoImpl.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/LicenseKeyGroupZusammenDaoImpl.java
@@ -209,6 +209,7 @@ public class LicenseKeyGroupZusammenDaoImpl implements LicenseKeyGroupDao {
info.addProperty("thresholdValue", licenseKeyGroup.getThresholdValue());
info.addProperty("thresholdUnits", licenseKeyGroup.getThresholdUnits());
info.addProperty("increments", licenseKeyGroup.getIncrements());
+ info.addProperty("manufacturerReferenceNumber", licenseKeyGroup.getManufacturerReferenceNumber());
lkgElement.setInfo(info);
if (licenseKeyGroup.getReferencingFeatureGroups() != null
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/convertor/ElementToEntitlementPoolConvertor.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/convertor/ElementToEntitlementPoolConvertor.java
index 75fc6f2605..c7895456ad 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/convertor/ElementToEntitlementPoolConvertor.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/convertor/ElementToEntitlementPoolConvertor.java
@@ -68,6 +68,7 @@ public class ElementToEntitlementPoolConvertor extends ElementConvertor {
getOperationalScopeMultiChoiceOrOther(info.getProperty("operational_scope")));
entitlementPool.setStartDate(info.getProperty("startDate"));
entitlementPool.setExpiryDate(info.getProperty("expiryDate"));
+ entitlementPool.setManufacturerReferenceNumber(info.getProperty("manufacturerReferenceNumber"));
}
private void mapRelationsToEntitlementPoolEntity(EntitlementPoolEntity entitlementPool,
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/convertor/ElementToLicenseKeyGroupConvertor.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/convertor/ElementToLicenseKeyGroupConvertor.java
index 5956c3e6f1..2627798514 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/convertor/ElementToLicenseKeyGroupConvertor.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/convertor/ElementToLicenseKeyGroupConvertor.java
@@ -77,6 +77,7 @@ public class ElementToLicenseKeyGroupConvertor extends ElementConvertor {
licenseKeyGroup.setThresholdValue(toInteger(info.getProperty("thresholdValue")));
licenseKeyGroup.setIncrements(info.getProperty("increments"));
+ licenseKeyGroup.setManufacturerReferenceNumber(info.getProperty("manufacturerReferenceNumber"));
}
private void mapRelationsToLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup,
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 633de716b7..576cb639c7 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,6 +26,7 @@ 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.EntitlementPoolDao;
import org.openecomp.sdc.vendorlicense.dao.EntitlementPoolDaoFactory;
@@ -95,8 +96,10 @@ public class VendorLicenseFacadeImpl implements VendorLicenseFacade {
FeatureGroupEntity retrieved = featureGroupDao.get(featureGroup);
VersioningUtil
.validateEntityExistence(retrieved, featureGroup, VendorLicenseModelEntity.ENTITY_TYPE);
- if (retrieved.getManufacturerReferenceNumber() == null) {
- updateManufacturerNumberInFeatureGroup(retrieved);
+ if (!ToggleableFeature.MRN.isActive()) { //Remove updateManufacturerNumberInFeatureGroup() while removing remove toggle
+ if (retrieved.getManufacturerReferenceNumber() == null) {
+ updateManufacturerNumberInFeatureGroup(retrieved);
+ }
}
return retrieved;
}
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 db745a1b42..b9fd403db1 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
@@ -18,6 +18,7 @@ package org.openecomp.sdc.vendorlicense.licenseartifacts.impl;
import org.apache.commons.collections.CollectionUtils;
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;
@@ -34,6 +35,7 @@ import org.openecomp.sdc.versioning.dao.types.Version;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
+import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
@@ -63,36 +65,63 @@ public class VendorLicenseArtifactsServiceImpl implements VendorLicenseArtifacts
for (String featureGroupId : featureGroups) {
FeatureGroupModel featureGroupModel = vendorLicenseFacade
.getFeatureGroupModel(new FeatureGroupEntity(vlmId, vlmVersion, featureGroupId));
- Set<EntitlementPoolEntity> entitlementPoolEntities =
- featureGroupModel.getEntitlementPools();
- for (EntitlementPoolEntity entitlementPoolEntity : entitlementPoolEntities) {
- entitlementPoolEntity.setLimits(vendorLicenseFacade.listLimits(vlmId, vlmVersion,
- entitlementPoolEntity.getId()));
- entitlementPoolEntity.setManufacturerReferenceNumber(featureGroupModel.
- getEntityManufacturerReferenceNumber());
- }
- Set<LicenseKeyGroupEntity> licenseKeyGroupEntities =
- featureGroupModel.getLicenseKeyGroups();
- for (LicenseKeyGroupEntity licenseKeyGroupEntity : licenseKeyGroupEntities) {
- licenseKeyGroupEntity.setLimits(vendorLicenseFacade.listLimits(vlmId, vlmVersion,
- licenseKeyGroupEntity.getId()));
- licenseKeyGroupEntity.setManufacturerReferenceNumber(featureGroupModel.
- getEntityManufacturerReferenceNumber());
- }
+ updateEntitlementPools(vlmId, vlmVersion, featureGroupModel);
+ updateLicenseKeyGroupEntities(vlmId, vlmVersion, featureGroupModel);
- 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);
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/types/FeatureGroupForArtifact.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/FeatureGroupForArtifact.java
deleted file mode 100644
index 61eb474736..0000000000
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/FeatureGroupForArtifact.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*-
- * ============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.sdc.vendorlicense.licenseartifacts.impl.types;
-
-import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity;
-import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-public class FeatureGroupForArtifact {
- Collection<EntitlementPoolEntity> entitlementPoolEntities = new ArrayList<>();
- Collection<LicenseKeyGroupEntity> licenseKeyGroupEntities = new ArrayList<>();
- private String name;
- private String description;
- private String partNumber;
- private String manufacturerReferenceNumber;
- private String id;
-
- public String getName() {
- return name;
- }
-
- public String getDescription() {
- return description;
- }
-
- public String getPartNumber() {
- return partNumber;
- }
-
- public String getManufacturerReferenceNumber(){
- return manufacturerReferenceNumber;
- }
-
- public String getId() {
- return id;
- }
-
- public Collection<EntitlementPoolEntity> getEntitlementPoolEntities() {
- return entitlementPoolEntities;
- }
-
- public Collection<LicenseKeyGroupEntity> getLicenseKeyGroupEntities() {
- return licenseKeyGroupEntities;
- }
-}