summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-vendor-license-lib
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-vendor-license-lib')
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/pom.xml.versionsBackup55
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/EntitlementPoolDao.java2
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/LimitDao.java10
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/LimitDaoFactory.java10
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/EntitlementPoolEntity.java100
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/FeatureGroupEntity.java17
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/FeatureGroupModel.java4
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LicenseKeyGroupEntity.java62
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LimitEntity.java193
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LimitType.java10
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/MultiChoiceOrOther.java16
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/LimitForXml.java42
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/LimitXml.java95
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/ThresholdForXml.java6
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/InvalidDateErrorBuilder.java43
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/VendorLicenseErrorCodes.java8
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/facade/VendorLicenseFacade.java8
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/resources/factoryConfiguration.json4
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/pom.xml2
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/pom.xml.versionsBackup53
-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/EntitlementPoolCassandraDaoImpl.java5
-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/LimitDaoFactoryImpl.java17
-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/ElementType.java2
-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.java55
-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.java13
-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.java25
-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/LimitZusammenDaoImpl.java215
-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/StructureElement.java3
-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/VlmZusammenUtil.java11
-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.java62
-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.java58
-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.java5
-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/VendorLicenseArtifact.java3
-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/VnfLicenseArtifact.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/types/mixins/MixinEntitlementPoolEntityForVendorLicenseArtifact.java19
-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/mixins/MixinEntitlementPoolEntityForVnfArtifact.java19
-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/mixins/MixinFeatureGroupEntity.java3
-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/mixins/MixinFeatureGroupModel.java3
-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/mixins/MixinLicenseKeyGroupEntityForVendorLicenseArtifact.java11
-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/mixins/MixinLicenseKeyGroupEntityForVnfArtifact.java11
-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/mixins/MixinLimitArtifact.java42
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/pom.xml.versionsBackup23
42 files changed, 1269 insertions, 83 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/pom.xml.versionsBackup
new file mode 100644
index 0000000000..fc22abcf38
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/pom.xml.versionsBackup
@@ -0,0 +1,55 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <name>openecomp-sdc-vendor-license-api</name>
+ <artifactId>openecomp-sdc-vendor-license-api</artifactId>
+ <parent>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-lib</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../..</relativePath>
+ </parent>
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-facade-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-versioning-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-nosqldb-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>javax.el-api</artifactId>
+ <version>${javax.el-api.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish.web</groupId>
+ <artifactId>javax.el</artifactId>
+ <version>2.2.4</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-annotations</artifactId>
+ <version>2.7.4</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.dataformat</groupId>
+ <artifactId>jackson-dataformat-xml</artifactId>
+ <version>2.7.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>woodstox-core-asl</artifactId>
+ <version>4.4.1</version>
+ </dependency>
+ </dependencies>
+</project> \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/EntitlementPoolDao.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/EntitlementPoolDao.java
index 28524e8977..b42f64de7c 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/EntitlementPoolDao.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/EntitlementPoolDao.java
@@ -35,6 +35,8 @@ public interface EntitlementPoolDao extends VersionableDao, BaseDao<EntitlementP
EntitlementPoolEntity get(EntitlementPoolEntity entitlementPool);
+ String getManufacturerReferenceNumber(EntitlementPoolEntity entitlementPoolEntity);
+
Collection<EntitlementPoolEntity> list(EntitlementPoolEntity entitlementPool);
long count(EntitlementPoolEntity entitlementPool);
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/LimitDao.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/LimitDao.java
new file mode 100644
index 0000000000..49112ecf9f
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/LimitDao.java
@@ -0,0 +1,10 @@
+package org.openecomp.sdc.vendorlicense.dao;
+
+import org.openecomp.core.dao.BaseDao;
+import org.openecomp.sdc.vendorlicense.dao.types.LimitEntity;
+import org.openecomp.sdc.versioning.dao.VersionableDao;
+
+public interface LimitDao extends VersionableDao, BaseDao<LimitEntity> {
+
+ boolean isLimitPresent(LimitEntity limitEntity);
+}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/LimitDaoFactory.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/LimitDaoFactory.java
new file mode 100644
index 0000000000..72e8f42e78
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/LimitDaoFactory.java
@@ -0,0 +1,10 @@
+package org.openecomp.sdc.vendorlicense.dao;
+
+import org.openecomp.core.factory.api.AbstractComponentFactory;
+import org.openecomp.core.factory.api.AbstractFactory;
+
+public abstract class LimitDaoFactory extends AbstractComponentFactory<LimitDao> {
+ public static LimitDaoFactory getInstance() {
+ return AbstractFactory.getInstance(LimitDaoFactory.class);
+ }
+}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/EntitlementPoolEntity.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/EntitlementPoolEntity.java
index 0a704721d5..ce225931f5 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/EntitlementPoolEntity.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/EntitlementPoolEntity.java
@@ -30,9 +30,12 @@ import org.openecomp.sdc.vendorlicense.dao.types.xml.AggregationFunctionForXml;
import org.openecomp.sdc.vendorlicense.dao.types.xml.EntitlementMetricForXml;
import org.openecomp.sdc.vendorlicense.dao.types.xml.EntitlementTimeForXml;
import org.openecomp.sdc.vendorlicense.dao.types.xml.ThresholdForXml;
+import org.openecomp.sdc.vendorlicense.dao.types.xml.LimitXml;
+import org.openecomp.sdc.vendorlicense.dao.types.xml.LimitForXml;
import org.openecomp.sdc.versioning.dao.types.Version;
import org.openecomp.sdc.versioning.dao.types.VersionableEntity;
+import java.util.Collection;
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
@@ -56,7 +59,7 @@ public class EntitlementPoolEntity implements VersionableEntity {
private String description;
@Column(name = "threshold")
- private int thresholdValue;
+ private Integer thresholdValue;
@Column(name = "threshold_unit")
@Enumerated
@@ -87,6 +90,12 @@ public class EntitlementPoolEntity implements VersionableEntity {
@Column(name = "version_uuid")
private String versionUuId;
+
+ private String startDate;
+ private String expiryDate;
+
+ private Collection<LimitEntity> limits;
+
public EntitlementPoolEntity() {
}
@@ -175,11 +184,11 @@ public class EntitlementPoolEntity implements VersionableEntity {
this.description = description;
}
- public int getThresholdValue() {
+ public Integer getThresholdValue() {
return thresholdValue;
}
- public void setThresholdValue(int thresholdValue) {
+ public void setThresholdValue(Integer thresholdValue) {
this.thresholdValue = thresholdValue;
}
@@ -222,7 +231,9 @@ public class EntitlementPoolEntity implements VersionableEntity {
}
public void setOperationalScope(MultiChoiceOrOther<OperationalScope> operationalScope) {
- operationalScope.resolveEnum(OperationalScope.class);
+ if(operationalScope != null) {
+ operationalScope.resolveEnum(OperationalScope.class);
+ }
this.operationalScope = operationalScope;
}
@@ -292,12 +303,83 @@ public class EntitlementPoolEntity implements VersionableEntity {
return timeForXml;
}
+ public String getStartDate() {
+ return startDate;
+ }
+
+ public void setStartDate(String startDate) {
+ this.startDate = startDate;
+ }
+
+ public String getExpiryDate() {
+ return expiryDate;
+ }
+
+ public void setExpiryDate(String expiryDate) {
+ this.expiryDate = expiryDate;
+ }
+
+ public Collection<LimitEntity> getLimits() {
+ return limits;
+ }
+
+ public void setLimits(Collection<LimitEntity> limits) {
+ this.limits = limits;
+ }
+
+ public LimitForXml getSPLimits(){
+ if(limits != null){
+ Set<LimitXml> hs = new HashSet<>();
+ for(LimitEntity obj : limits){
+ if(obj.getType().equals(LimitType.ServiceProvider)){
+ LimitXml xmlObj = new LimitXml();
+ xmlObj.setDescription(obj.getDescription());
+ xmlObj.setMetric(obj.getMetric().toString());
+ xmlObj.setValues(obj.getValue()!=null?Integer.toString(obj.getValue()):null);
+ xmlObj.setUnit(obj.getUnit()!=null?Integer.toString(obj.getUnit()):null);
+ xmlObj.setAggregationFunction(obj.getAggregationFunction()!=null?obj.getAggregationFunction().name():null);
+ xmlObj.setTime(obj.getTime()!=null?obj.getTime().name():null);
+ hs.add(xmlObj);
+ }
+ }
+ LimitForXml spLimitForXml = new LimitForXml();
+ spLimitForXml.setLimits(hs);
+ return spLimitForXml;
+ }
+
+ return null;
+ }
+
+ public LimitForXml getVendorLimits(){
+ if(limits != null){
+ Set<LimitXml> hs = new HashSet<>();
+ for(LimitEntity obj : limits){
+ if(obj.getType().equals(LimitType.Vendor)){
+ LimitXml xmlObj = new LimitXml();
+ xmlObj.setDescription(obj.getDescription());
+ xmlObj.setMetric(obj.getMetric().toString());
+ xmlObj.setValues(obj.getValue()!=null?Integer.toString(obj.getValue()):null);
+ xmlObj.setUnit(obj.getUnit()!=null?Integer.toString(obj.getUnit()):null);
+ xmlObj.setAggregationFunction(obj.getAggregationFunction()!=null?obj.getAggregationFunction().name():null);
+ xmlObj.setTime(obj.getTime()!=null?obj.getTime().name():null);
+ hs.add(xmlObj);
+ }
+ }
+ LimitForXml vendorLimitForXml = new LimitForXml();
+ vendorLimitForXml.setLimits(hs);
+ return vendorLimitForXml;
+ }
+
+ return null;
+ }
+
+
@Override
public int hashCode() {
return Objects
.hash(vendorLicenseModelId, version, id, name, description, thresholdValue, thresholdUnit,
entitlementMetric, increments, aggregationFunction, operationalScope, time,
- manufacturerReferenceNumber, referencingFeatureGroups);
+ manufacturerReferenceNumber, referencingFeatureGroups, startDate, expiryDate);
}
@Override
@@ -309,7 +391,7 @@ public class EntitlementPoolEntity implements VersionableEntity {
return false;
}
EntitlementPoolEntity that = (EntitlementPoolEntity) obj;
- return Float.compare(that.thresholdValue, thresholdValue) == 0
+ return Objects.equals(that.thresholdValue, thresholdValue)
&& Objects.equals(vendorLicenseModelId, that.vendorLicenseModelId)
&& Objects.equals(id, that.id)
&& Objects.equals(name, that.name)
@@ -321,7 +403,9 @@ public class EntitlementPoolEntity implements VersionableEntity {
&& Objects.equals(operationalScope, that.operationalScope)
&& Objects.equals(time, that.time)
&& Objects.equals(manufacturerReferenceNumber, that.manufacturerReferenceNumber)
- && Objects.equals(referencingFeatureGroups, that.referencingFeatureGroups);
+ && Objects.equals(referencingFeatureGroups, that.referencingFeatureGroups)
+ && Objects.equals(startDate, that.startDate)
+ && Objects.equals(expiryDate, that.expiryDate);
}
@Override
@@ -342,6 +426,8 @@ public class EntitlementPoolEntity implements VersionableEntity {
+ ", manufacturerReferenceNumber='" + manufacturerReferenceNumber + '\''
+ ", referencingFeatureGroups=" + referencingFeatureGroups
+ ", version_uuid=" + versionUuId
+ + ", startDate=" + startDate
+ + ", expiryDate=" + expiryDate
+ '}';
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/FeatureGroupEntity.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/FeatureGroupEntity.java
index a297f8aa63..f1fc1a96f1 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/FeatureGroupEntity.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/FeatureGroupEntity.java
@@ -49,6 +49,8 @@ public class FeatureGroupEntity implements VersionableEntity {
private String description;
@Column(name = "part_num")
private String partNumber;
+ @Column(name = "manufacturer_ref_num")
+ private String manufacturerReferenceNumber;
@Column(name = "lkg_ids")
private Set<String> licenseKeyGroupIds = new HashSet<>();
@Column(name = "ep_ids")
@@ -134,6 +136,14 @@ public class FeatureGroupEntity implements VersionableEntity {
this.partNumber = partNumber;
}
+ public String getManufacturerReferenceNumber() {
+ return manufacturerReferenceNumber;
+ }
+
+ public void setManufacturerReferenceNumber(String manufacturerReferenceNumber) {
+ this.manufacturerReferenceNumber = manufacturerReferenceNumber;
+ }
+
public Set<String> getLicenseKeyGroupIds() {
return licenseKeyGroupIds;
}
@@ -161,8 +171,9 @@ public class FeatureGroupEntity implements VersionableEntity {
@Override
public int hashCode() {
return Objects
- .hash(vendorLicenseModelId, version, id, name, description, partNumber, licenseKeyGroupIds,
- entitlementPoolIds, referencingLicenseAgreements);
+ .hash(vendorLicenseModelId, version, id, name, description, partNumber,
+ manufacturerReferenceNumber, licenseKeyGroupIds, entitlementPoolIds,
+ referencingLicenseAgreements);
}
@Override
@@ -180,6 +191,7 @@ public class FeatureGroupEntity implements VersionableEntity {
&& Objects.equals(name, that.name)
&& Objects.equals(description, that.description)
&& Objects.equals(partNumber, that.partNumber)
+ && Objects.equals(manufacturerReferenceNumber, that.manufacturerReferenceNumber)
&& Objects.equals(licenseKeyGroupIds, that.licenseKeyGroupIds)
&& Objects.equals(entitlementPoolIds, that.entitlementPoolIds)
&& Objects.equals(referencingLicenseAgreements, that.referencingLicenseAgreements);
@@ -194,6 +206,7 @@ public class FeatureGroupEntity implements VersionableEntity {
+ ", name='" + name + '\''
+ ", description='" + description + '\''
+ ", partNumber='" + partNumber + '\''
+ + ", manufacturerReferenceNumber='" + manufacturerReferenceNumber + '\''
+ ", licenseKeyGroupIds=" + licenseKeyGroupIds
+ ", entitlementPoolIds=" + entitlementPoolIds
+ ", referencingLicenseAgreements=" + referencingLicenseAgreements
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/FeatureGroupModel.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/FeatureGroupModel.java
index 174cbbb9b9..7e4ba8051e 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/FeatureGroupModel.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/FeatureGroupModel.java
@@ -70,5 +70,9 @@ public class FeatureGroupModel {
return featureGroup.getPartNumber();
}
+ public String getEntityManufacturerReferenceNumber(){
+ return featureGroup.getManufacturerReferenceNumber();
+ }
+
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LicenseKeyGroupEntity.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LicenseKeyGroupEntity.java
index 07641594c2..654093de28 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LicenseKeyGroupEntity.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LicenseKeyGroupEntity.java
@@ -27,9 +27,12 @@ import com.datastax.driver.mapping.annotations.Frozen;
import com.datastax.driver.mapping.annotations.PartitionKey;
import com.datastax.driver.mapping.annotations.Table;
import org.openecomp.sdc.vendorlicense.dao.types.xml.LicenseKeyTypeForXml;
+import org.openecomp.sdc.vendorlicense.dao.types.xml.LimitXml;
+import org.openecomp.sdc.vendorlicense.dao.types.xml.LimitForXml;
import org.openecomp.sdc.versioning.dao.types.Version;
import org.openecomp.sdc.versioning.dao.types.VersionableEntity;
+import java.util.Collection;
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
@@ -59,6 +62,7 @@ public class LicenseKeyGroupEntity implements VersionableEntity {
@Column(name = "version_uuid")
private String versionUuId;
+ private Collection<LimitEntity> limits;
public LicenseKeyGroupEntity() {
}
@@ -149,7 +153,9 @@ public class LicenseKeyGroupEntity implements VersionableEntity {
}
public void setOperationalScope(MultiChoiceOrOther<OperationalScope> operationalScope) {
- operationalScope.resolveEnum(OperationalScope.class);
+ if(operationalScope != null) {
+ operationalScope.resolveEnum(OperationalScope.class);
+ }
this.operationalScope = operationalScope;
}
@@ -161,6 +167,60 @@ public class LicenseKeyGroupEntity implements VersionableEntity {
this.referencingFeatureGroups = referencingFeatureGroups;
}
+ public Collection<LimitEntity> getLimits() {
+ return limits;
+ }
+
+ public void setLimits(Collection<LimitEntity> limits) {
+ this.limits = limits;
+ }
+
+ public LimitForXml getSPLimits(){
+ if(limits != null){
+ Set<LimitXml> hs = new HashSet<>();
+ for(LimitEntity obj : limits){
+ if(obj.getType().equals(LimitType.ServiceProvider)){
+ LimitXml xmlObj = new LimitXml();
+ xmlObj.setDescription(obj.getDescription());
+ xmlObj.setMetric(obj.getMetric().toString());
+ xmlObj.setValues(obj.getValue()!=null?Integer.toString(obj.getValue()):null);
+ xmlObj.setUnit(obj.getUnit()!=null?Integer.toString(obj.getUnit()):null);
+ xmlObj.setAggregationFunction(obj.getAggregationFunction()!=null?obj.getAggregationFunction().name():null);
+ xmlObj.setTime(obj.getTime()!=null?obj.getTime().name():null);
+ hs.add(xmlObj);
+ }
+ }
+ LimitForXml spLimitForXml = new LimitForXml();
+ spLimitForXml.setLimits(hs);
+ return spLimitForXml;
+ }
+
+ return null;
+ }
+
+ public LimitForXml getVendorLimits(){
+ if(limits != null){
+ Set<LimitXml> hs = new HashSet<>();
+ for(LimitEntity obj : limits){
+ if(obj.getType().equals(LimitType.Vendor)){
+ LimitXml xmlObj = new LimitXml();
+ xmlObj.setDescription(obj.getDescription());
+ xmlObj.setMetric(obj.getMetric().toString());
+ xmlObj.setValues(obj.getValue()!=null?Integer.toString(obj.getValue()):null);
+ xmlObj.setUnit(obj.getUnit()!=null?Integer.toString(obj.getUnit()):null);
+ xmlObj.setAggregationFunction(obj.getAggregationFunction()!=null?obj.getAggregationFunction().name():null);
+ xmlObj.setTime(obj.getTime()!=null?obj.getTime().name():null);
+ hs.add(xmlObj);
+ }
+ }
+ LimitForXml vendorLimitForXml = new LimitForXml();
+ vendorLimitForXml.setLimits(hs);
+ return vendorLimitForXml;
+ }
+
+ return null;
+ }
+
@Override
public int hashCode() {
return Objects
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LimitEntity.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LimitEntity.java
new file mode 100644
index 0000000000..ba9c38f453
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LimitEntity.java
@@ -0,0 +1,193 @@
+package org.openecomp.sdc.vendorlicense.dao.types;
+
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdc.versioning.dao.types.VersionableEntity;
+
+import java.util.Objects;
+
+public class LimitEntity implements VersionableEntity {
+ private static final String ENTITY_TYPE = "Limit";
+
+ private String id;
+ private String vendorLicenseModelId;
+ private String epLkgId;
+ private String name;
+ private LimitType type;
+ private String description;
+ private EntitlementMetric metric;
+ private Version version;
+ private Integer value;
+ private Integer unit;
+ private AggregationFunction aggregationFunction;
+ private EntitlementTime time;
+
+ public LimitEntity() {
+ }
+
+ public LimitEntity(String vlmId, Version version, String epLkgId, String id) {
+ this.vendorLicenseModelId = vlmId;
+ this.version = version;
+ this.epLkgId = epLkgId;
+ this.id = id;
+ }
+
+ public Integer getUnit() {
+ return unit;
+ }
+
+ public void setUnit(Integer unit) {
+ this.unit = unit;
+ }
+
+ public AggregationFunction getAggregationFunction() {
+ return aggregationFunction;
+ }
+
+ public void setAggregationFunction(
+ AggregationFunction aggregationFunction) {
+ this.aggregationFunction = aggregationFunction;
+ }
+
+ public EntitlementTime getTime() {
+ return time;
+ }
+
+ public void setTime(EntitlementTime time) {
+ this.time = time;
+ }
+
+
+ @Override
+ public String getEntityType() {
+ return ENTITY_TYPE;
+ }
+
+ @Override
+ public String getFirstClassCitizenId() {
+ return getVendorLicenseModelId();
+ }
+
+ @Override
+ public String getId() {
+ return id;
+ }
+
+ @Override
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ @Override
+ public Version getVersion() {
+ return version;
+ }
+
+ public String getEpLkgId() {
+ return epLkgId;
+ }
+
+ public void setEpLkgId(String epLkgId) {
+ this.epLkgId = epLkgId;
+ }
+
+ @Override
+ public void setVersion(Version version) {
+ this.version = version;
+ }
+
+ public String getVendorLicenseModelId() {
+ return vendorLicenseModelId;
+ }
+
+ public void setVendorLicenseModelId(String vendorLicenseModelId) {
+ this.vendorLicenseModelId = vendorLicenseModelId;
+ }
+
+ public LimitType getType() {
+ return type;
+ }
+
+ public void setType(LimitType type) {
+ this.type = type;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public EntitlementMetric getMetric() {
+ return metric;
+ }
+
+ public void setMetric(EntitlementMetric metric) {
+ this.metric = metric;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Integer getValue() {
+ return value;
+ }
+
+ public void setValue(Integer value) {
+ this.value = value;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(vendorLicenseModelId, version, epLkgId, id, name, description, type,
+ metric, unit, time, aggregationFunction, value);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null || getClass() != obj.getClass()) {
+ return false;
+ }
+ LimitEntity that = (LimitEntity) obj;
+ return Objects.equals(that.unit, unit)
+ && Objects.equals(that.value, value)
+ && Objects.equals(vendorLicenseModelId, that.vendorLicenseModelId)
+ && Objects.equals(epLkgId, that.epLkgId)
+ && Objects.equals(id, that.id)
+ && Objects.equals(name, that.name)
+ && Objects.equals(description, that.description)
+ && Objects.equals(type, that.type)
+ && Objects.equals(metric, that.metric)
+ && Objects.equals(aggregationFunction, that.aggregationFunction);
+
+ }
+
+ @Override
+ public String toString() {
+ return "LimitEntity{"
+ + "vendorLicenseModelId='" + vendorLicenseModelId + '\''
+ + ", version=" + version
+ + ", epLkgId=" + epLkgId
+ + ", id='" + id + '\''
+ + ", name='" + name + '\''
+ + ", description='" + description + '\''
+ + ", type=" + type
+ + ", metric=" + metric
+ + ", value='" + value + '\''
+ + ", unit='" + unit + '\''
+ + ", aggregationFunction=" + aggregationFunction
+ + ", time=" + time
+
+ + '}';
+ }
+
+}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LimitType.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LimitType.java
new file mode 100644
index 0000000000..ff0eff8042
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LimitType.java
@@ -0,0 +1,10 @@
+package org.openecomp.sdc.vendorlicense.dao.types;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public enum LimitType {
+ ServiceProvider,
+ Vendor;
+
+}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/MultiChoiceOrOther.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/MultiChoiceOrOther.java
index 165260f9c5..36f54ac45e 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/MultiChoiceOrOther.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/MultiChoiceOrOther.java
@@ -102,13 +102,15 @@ public class MultiChoiceOrOther<E extends Enum<E>> {
}
private Set<String> resolveResult() {
- results = new HashSet<>();
- if (choices.size() == 1 && OTHER_ENUM_VALUE.equals(choices.iterator().next().name())) {
- results.add(other);
- } else {
- for (E choice : choices) {
- results.add(choice.name());
- }
+ if (choices != null) {
+ results = new HashSet<>();
+ if(choices.size() == 1 && OTHER_ENUM_VALUE.equals(choices.iterator().next().name())) {
+ results.add(other);
+ } else {
+ for (E choice : choices) {
+ results.add(choice.name());
+ }
+ }
}
return results;
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/LimitForXml.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/LimitForXml.java
new file mode 100644
index 0000000000..0a3680b719
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/LimitForXml.java
@@ -0,0 +1,42 @@
+/*-
+ * ============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.dao.types.xml;
+
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
+
+import java.util.Set;
+
+public class LimitForXml {
+
+ Set<LimitXml> limits;
+
+ @JacksonXmlProperty(isAttribute = false, localName = "limit")
+ @JacksonXmlElementWrapper(localName = "limits", useWrapping = false)
+ public Set<LimitXml> getLimits() {
+ return limits;
+ }
+
+ public void setLimits(
+ Set<LimitXml> limits) {
+ this.limits = limits;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/LimitXml.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/LimitXml.java
new file mode 100644
index 0000000000..9cc1aed72b
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/LimitXml.java
@@ -0,0 +1,95 @@
+/*-
+ * ============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.dao.types.xml;
+
+public class LimitXml {
+ String description;
+ String metric;
+ String values;
+ String unit;
+ String time;
+ String aggregationFunction;
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getMetric() {
+ return metric;
+ }
+
+ public void setMetric(String metric) {
+ this.metric = metric;
+ }
+
+ public String getValues() {
+ return values;
+ }
+
+ public void setValues(String values) {
+ this.values = values;
+ }
+
+ public String getUnit() {
+ return unit;
+ }
+
+ public void setUnit(String unit) {
+ this.unit = unit;
+ }
+
+ public String getTime() {
+ return time;
+ }
+
+ public void setTime(String time) {
+ this.time = time;
+ }
+
+ public String getAggregationFunction() {
+ return aggregationFunction;
+ }
+
+ public void setAggregationFunction(String aggregationFunction) {
+ this.aggregationFunction = aggregationFunction;
+ }
+
+ public EntitlementTimeForXml getTimeForArtifact() {
+ EntitlementTimeForXml timeForXml = new EntitlementTimeForXml();
+ if (time != null) {
+ timeForXml.setValue(time);
+ }
+
+ return timeForXml;
+ }
+
+ public AggregationFunctionForXml getAggregationFunctionForArtifact() {
+ AggregationFunctionForXml aggregationFunctionForXml = new AggregationFunctionForXml();
+ if (aggregationFunction != null) {
+ aggregationFunctionForXml.setValue(aggregationFunction);
+ }
+ return aggregationFunctionForXml;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/ThresholdForXml.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/ThresholdForXml.java
index 11627160ad..a50b815069 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/ThresholdForXml.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/ThresholdForXml.java
@@ -22,7 +22,7 @@ package org.openecomp.sdc.vendorlicense.dao.types.xml;
public class ThresholdForXml {
String unit;
- int value;
+ Integer value;
public String getUnit() {
return unit;
@@ -32,11 +32,11 @@ public class ThresholdForXml {
this.unit = unit;
}
- public int getValue() {
+ public Integer getValue() {
return value;
}
- public void setValue(int value) {
+ public void setValue(Integer value) {
this.value = value;
}
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/InvalidDateErrorBuilder.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/InvalidDateErrorBuilder.java
new file mode 100644
index 0000000000..e1857532a8
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/InvalidDateErrorBuilder.java
@@ -0,0 +1,43 @@
+/*-
+ * ============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.errors;
+
+import org.openecomp.sdc.common.errors.ErrorCategory;
+import org.openecomp.sdc.common.errors.ErrorCode;
+
+public class InvalidDateErrorBuilder {
+
+ private static final String DATE_RANGE_INVALID = "Vendor license model with id %s has invalid " +
+ "date range.";
+
+ private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+
+ public InvalidDateErrorBuilder(String vendorLicenseModelId){
+ builder.withId(VendorLicenseErrorCodes.DATE_RANGE_INVALID);
+ builder.withCategory(ErrorCategory.APPLICATION);
+ builder.withMessage(String.format(DATE_RANGE_INVALID, vendorLicenseModelId));
+ }
+
+ public ErrorCode build() {
+ return builder.build();
+ }
+
+}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/VendorLicenseErrorCodes.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/VendorLicenseErrorCodes.java
index 98f773860c..e8c252f7be 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/VendorLicenseErrorCodes.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/VendorLicenseErrorCodes.java
@@ -26,4 +26,12 @@ public class VendorLicenseErrorCodes {
public static final String VENDOR_LICENSE_MODEL_NOT_FOUND = "VENDOR_LICENSE_MODEL_NOT_FOUND";
public static final String SUBMIT_UNCOMPLETED_LICENSE_MODEL = "SUBMIT_UNCOMPLETED_LICENSE_MODEL";
public static final String LICENSING_DATA_INVALID = "LICENSING_DATA_INVALID";
+
+ public static final String LIMIT_INVALID_TYPE = "LIMIT_INVALID_TYPE";
+ public static final String LIMIT_INVALID_METRIC = "LIMIT_INVALID_METRIC";
+ public static final String LIMIT_INVALID_AGGREGATIONFUNCTION = "LIMIT_INVALID_AGGREGATIONFUNCTION";
+ public static final String LIMIT_INVALID_TIME = "LIMIT_INVALID_TIME";
+ public static final String DUPLICATE_LIMIT_NAME_NOT_ALLOWED =
+ "DUPLICATE_LIMIT_NAME_NOT_ALLOWED";
+ public static final String DATE_RANGE_INVALID = "DATE_RANGE_INVALID";
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/facade/VendorLicenseFacade.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/facade/VendorLicenseFacade.java
index ecff0f56d6..9ab7c0c64d 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/facade/VendorLicenseFacade.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/facade/VendorLicenseFacade.java
@@ -27,6 +27,7 @@ import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupModel;
import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementEntity;
import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementModel;
import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity;
+import org.openecomp.sdc.vendorlicense.dao.types.LimitEntity;
import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity;
import org.openecomp.sdc.vendorlicense.types.VersionedVendorLicenseModel;
import org.openecomp.sdc.versioning.dao.types.Version;
@@ -86,4 +87,11 @@ public interface VendorLicenseFacade {
String user);
void updateVlmLastModificationTime(String vendorLicenseModelId, Version version);
+
+ LimitEntity createLimit(LimitEntity limit, String user);
+
+ Collection<LimitEntity> listLimits(String vlmId, Version version, String epLkgId
+ ,String user);
+
+ void updateLimit(LimitEntity limit, String user);
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/resources/factoryConfiguration.json b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/resources/factoryConfiguration.json
index 7f59b42103..6c7f30d119 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/resources/factoryConfiguration.json
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/resources/factoryConfiguration.json
@@ -6,6 +6,8 @@
"org.openecomp.sdc.vendorlicense.dao.LicenseAgreementDaoFactory": "org.openecomp.sdc.vendorlicense.dao.impl.LicenseAgreementDaoFactoryImpl",
"org.openecomp.sdc.vendorlicense.dao.FeatureGroupDaoFactory": "org.openecomp.sdc.vendorlicense.dao.impl.FeatureGroupDaoFactoryImpl",
"org.openecomp.sdc.vendorlicense.dao.LicenseKeyGroupDaoFactory": "org.openecomp.sdc.vendorlicense.dao.impl.LicenseKeyGroupDaoFactoryImpl",
- "org.openecomp.sdc.vendorlicense.dao.EntitlementPoolDaoFactory": "org.openecomp.sdc.vendorlicense.dao.impl.EntitlementPoolDaoFactoryImpl"
+ "org.openecomp.sdc.vendorlicense.dao.EntitlementPoolDaoFactory": "org.openecomp.sdc.vendorlicense.dao.impl.EntitlementPoolDaoFactoryImpl",
+ "org.openecomp.sdc.vendorlicense.dao.LimitDaoFactory": "org.openecomp.sdc.vendorlicense.dao.impl.LimitDaoFactoryImpl"
+
} \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/pom.xml b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/pom.xml
index 61fce1d371..ea2f0dc272 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/pom.xml
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/pom.xml
@@ -52,7 +52,7 @@
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
- <version>4.11</version>
+ <version>${junit.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/pom.xml.versionsBackup
new file mode 100644
index 0000000000..b1141fc5cd
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/pom.xml.versionsBackup
@@ -0,0 +1,53 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <name>openecomp-sdc-vendor-license-core</name>
+ <artifactId>openecomp-sdc-vendor-license-core</artifactId>
+
+
+ <parent>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-lib</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../..</relativePath>
+ </parent>
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-vendor-license-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
+ <scope>test</scope>
+ <version>1.10.19</version>
+ </dependency>
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <scope>test</scope>
+ <version>6.8.5</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>snakeyaml</artifactId>
+ <groupId>org.yaml</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ <version>4.11</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.dataformat</groupId>
+ <artifactId>jackson-dataformat-xml</artifactId>
+ <version>2.7.4</version>
+ </dependency>
+ </dependencies>
+
+</project> \ No newline at end of file
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/EntitlementPoolCassandraDaoImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/EntitlementPoolCassandraDaoImpl.java
index 496e653ef0..cc32d00906 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/EntitlementPoolCassandraDaoImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/EntitlementPoolCassandraDaoImpl.java
@@ -83,6 +83,11 @@ public class EntitlementPoolCassandraDaoImpl extends CassandraBaseDao<Entitlemen
}
@Override
+ public String getManufacturerReferenceNumber(EntitlementPoolEntity entitlementPoolEntity){
+ return null;
+ }
+
+ @Override
public Collection<EntitlementPoolEntity> list(EntitlementPoolEntity entity) {
return accessor.listByVlmVersion(entity.getVendorLicenseModelId(),
versionMapper.toUDT(entity.getVersion())).all();
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/LimitDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/LimitDaoFactoryImpl.java
new file mode 100644
index 0000000000..6189a8bf6f
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/LimitDaoFactoryImpl.java
@@ -0,0 +1,17 @@
+package org.openecomp.sdc.vendorlicense.dao.impl;
+
+import org.openecomp.core.zusammen.api.ZusammenAdaptorFactory;
+import org.openecomp.sdc.vendorlicense.dao.LimitDao;
+import org.openecomp.sdc.vendorlicense.dao.LimitDaoFactory;
+import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.LimitZusammenDaoImpl;
+
+public class LimitDaoFactoryImpl extends LimitDaoFactory {
+
+ private static LimitDao INSTANCE = new LimitZusammenDaoImpl(ZusammenAdaptorFactory.getInstance()
+ .createInterface());
+
+ @Override
+ public LimitDao createInterface() {
+ return INSTANCE;
+ }
+}
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/ElementType.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/ElementType.java
index 4d9c0fa98c..1fc941bf1b 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/ElementType.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/ElementType.java
@@ -1,6 +1,6 @@
package org.openecomp.sdc.vendorlicense.dao.impl.zusammen;
public enum ElementType {
-
+ Limit
}
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 ffaf7809c8..4cccb6712a 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
@@ -83,7 +83,9 @@ public class EntitlementPoolZusammenDaoImpl implements EntitlementPoolDao {
if (entitlmentpoolElement.getRelations() == null) {
entitlmentpoolElement.setRelations(new ArrayList<>());
}
- entitlmentpoolElement.getRelations().addAll(epFromDb.get().getRelations());
+ if (epFromDb.get().getRelations() != null && epFromDb.get().getRelations().size() > 0) {
+ entitlmentpoolElement.getRelations().addAll(epFromDb.get().getRelations());
+ }
}
zusammenAdaptor.saveElement(context,elementContext, entitlmentpoolElement,
@@ -203,6 +205,7 @@ public class EntitlementPoolZusammenDaoImpl implements EntitlementPoolDao {
private ZusammenElement buildEntitlementPoolElement(EntitlementPoolEntity entitlementPool,
Action action) {
+
ZusammenElement entitlementPoolElement = new ZusammenElement();
entitlementPoolElement.setAction(action);
if (entitlementPool.getId() != null) {
@@ -220,10 +223,12 @@ public class EntitlementPoolZusammenDaoImpl implements EntitlementPoolDao {
info.addProperty("EntitlementTime", entitlementPool.getTime());
info.addProperty("manufacturerReferenceNumber",
entitlementPool.getManufacturerReferenceNumber());
+ info.addProperty("startDate", entitlementPool.getStartDate());
+ info.addProperty("expiryDate", entitlementPool.getExpiryDate());
entitlementPoolElement.setInfo(info);
- if (entitlementPool.getReferencingFeatureGroups() != null &&
- entitlementPool.getReferencingFeatureGroups().size() > 0) {
+ if (entitlementPool.getReferencingFeatureGroups() != null
+ && entitlementPool.getReferencingFeatureGroups().size() > 0) {
entitlementPoolElement.setRelations(entitlementPool.getReferencingFeatureGroups().stream()
.map(rel -> VlmZusammenUtil
.createRelation(RelationType.EntitlmentPoolToReferencingFeatureGroup, rel))
@@ -239,9 +244,12 @@ public class EntitlementPoolZusammenDaoImpl implements EntitlementPoolDao {
entitlmentPool.setName(elementInfo.getInfo().getName());
entitlmentPool.setDescription(elementInfo.getInfo().getDescription());
entitlmentPool
- .setThresholdValue(toInteger(elementInfo.getInfo().getProperty("thresholdValue")));
- entitlmentPool.setThresholdUnit(
- ThresholdUnit.valueOf(elementInfo.getInfo().getProperty("threshold_unit")));
+ .setThresholdValue(elementInfo.getInfo().getProperty("thresholdValue") != null
+ ? VlmZusammenUtil.toInteger(elementInfo.getInfo().getProperty("thresholdValue")) : null);
+
+ Object threshold_unit = elementInfo.getInfo().getProperty("threshold_unit");
+ entitlmentPool.setThresholdUnit( threshold_unit != null ?
+ ThresholdUnit.valueOf(elementInfo.getInfo().getProperty("threshold_unit")) : null);
entitlmentPool.setEntitlementMetric(
getEntitlementMetricCoiceOrOther(elementInfo.getInfo().getProperty("entitlement_metric")));
entitlmentPool.setIncrements(elementInfo.getInfo().getProperty("increments"));
@@ -253,6 +261,8 @@ public class EntitlementPoolZusammenDaoImpl implements EntitlementPoolDao {
getEntitlementTimeCoiceOrOther(elementInfo.getInfo().getProperty("EntitlementTime")));
entitlmentPool.setManufacturerReferenceNumber(
elementInfo.getInfo().getProperty("manufacturerReferenceNumber"));
+ entitlmentPool.setStartDate(elementInfo.getInfo().getProperty("startDate"));
+ entitlmentPool.setExpiryDate(elementInfo.getInfo().getProperty("expiryDate"));
if (elementInfo.getRelations() != null && elementInfo.getRelations().size() > 0) {
entitlmentPool
@@ -282,22 +292,31 @@ public class EntitlementPoolZusammenDaoImpl implements EntitlementPoolDao {
private MultiChoiceOrOther<OperationalScope> getOperationalScopeMultiChoiceOrOther
(Map<String, Object>
operationalScope) {
- Set<OperationalScope> choices = new HashSet<>();
- ((List<String>) operationalScope.get("choices")).
- forEach(choice -> choices.add(OperationalScope.valueOf(choice)));
+ if(operationalScope != null && !operationalScope.isEmpty()) {
+ Set<OperationalScope> choices = new HashSet<>();
+ ((List<String>) operationalScope.get("choices")).
+ forEach(choice -> choices.add(OperationalScope.valueOf(choice)));
- return new MultiChoiceOrOther<>(choices, (String) operationalScope.get("other"));
+ return new MultiChoiceOrOther<>(choices, operationalScope.get("other")==null?null:
+ (String) operationalScope.get("other"));
+ }
+ return null;
}
- private Integer toInteger(Object val) {
- if (val instanceof Double) {
- return ((Double) val).intValue();
- } else if (val instanceof String) {
- return new Integer((String) val);
- } else if (val instanceof Integer) {
- return (Integer) val;
+ @Override
+ public String getManufacturerReferenceNumber(EntitlementPoolEntity entitlementPoolEntity){
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(entitlementPoolEntity.getVendorLicenseModelId());
+ ElementContext elementContext = new ElementContext(itemId,
+ VlmZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor),
+ VlmZusammenUtil.getVersionTag(entitlementPoolEntity.getVersion()));
+ Optional<ElementInfo> elementInfo1 = zusammenAdaptor.getElementInfo(context, elementContext, new Id(entitlementPoolEntity.getId()));
+ Map<String, Object> properties = elementInfo1.get().getInfo().getProperties();
+ String manufacturerReferenceNumber = null;
+ if(properties != null && properties.containsKey("manufacturerReferenceNumber") ) {
+ manufacturerReferenceNumber = (String)properties.get("manufacturerReferenceNumber");
}
- throw new RuntimeException("invalid value for integer:" + val.getClass());
+ return manufacturerReferenceNumber;
}
}
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 6484e83319..aa9e6c7ae0 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
@@ -176,12 +176,13 @@ public class FeatureGroupDaoZusammenImpl implements FeatureGroupDao {
mapElementInfoToFeatureGroup(featureGroup.getId(), featureGroup.getVersion(),
elementInfo.get());
- if (!(removedEntitlementPools == null)) {
+ if (!(removedEntitlementPools == null )) {
currentFeatureGroup.getEntitlementPoolIds().removeAll(removedEntitlementPools);
}
if (!(addedEntitlementPools == null)) {
currentFeatureGroup.getEntitlementPoolIds().addAll(addedEntitlementPools);
}
+
if (featureGroupElement.getRelations() == null) {
featureGroupElement.setRelations(new ArrayList<>());
}
@@ -191,13 +192,12 @@ public class FeatureGroupDaoZusammenImpl implements FeatureGroupDao {
.createRelation(RelationType.FeatureGroupToEntitlmentPool, relation))
.collect(Collectors.toList()));
- if (!(removedLicenseKeyGroups == null)) {
+ if (! ( removedLicenseKeyGroups == null)) {
currentFeatureGroup.getLicenseKeyGroupIds().removeAll(removedLicenseKeyGroups);
}
- if (!(addedLicenseKeyGroups == null)) {
+ if (! ( addedLicenseKeyGroups == null)) {
currentFeatureGroup.getLicenseKeyGroupIds().addAll(addedLicenseKeyGroups);
}
- currentFeatureGroup.getLicenseKeyGroupIds().addAll(addedLicenseKeyGroups);
featureGroupElement.getRelations()
.addAll(currentFeatureGroup.getLicenseKeyGroupIds().stream()
.map(relation -> VlmZusammenUtil
@@ -268,6 +268,7 @@ public class FeatureGroupDaoZusammenImpl implements FeatureGroupDao {
}
private ZusammenElement buildFeatureGroupElement(FeatureGroupEntity featureGroup, Action action) {
+
ZusammenElement featureGroupElement = new ZusammenElement();
featureGroupElement.setAction(action);
if (featureGroup.getId() != null) {
@@ -277,6 +278,7 @@ public class FeatureGroupDaoZusammenImpl implements FeatureGroupDao {
info.setName(featureGroup.getName());
info.setDescription(featureGroup.getDescription());
info.addProperty("partNumber", featureGroup.getPartNumber());
+ info.addProperty("manufacturerReferenceNumber", featureGroup.getManufacturerReferenceNumber());
featureGroupElement.setInfo(info);
featureGroupElement.setRelations(new ArrayList<>());
@@ -308,6 +310,7 @@ public class FeatureGroupDaoZusammenImpl implements FeatureGroupDao {
.collect(Collectors.toList()));
}
return featureGroupElement;
+
}
private FeatureGroupEntity mapElementInfoToFeatureGroup(String vlmId, Version version,
@@ -317,6 +320,8 @@ public class FeatureGroupDaoZusammenImpl implements FeatureGroupDao {
featureGroup.setName(elementInfo.getInfo().getName());
featureGroup.setDescription(elementInfo.getInfo().getDescription());
featureGroup.setPartNumber(elementInfo.getInfo().getProperty("partNumber"));
+ featureGroup.setManufacturerReferenceNumber(elementInfo.getInfo()
+ .getProperty("manufacturerReferenceNumber"));
Set<String> entitlementPoolIds = new HashSet<>();
Set<String> licenseAgreements = 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/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 03537a287b..95dfd79cb6 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
@@ -77,11 +77,12 @@ public class LicenseKeyGroupZusammenDaoImpl implements LicenseKeyGroupDao {
if(lkgFromDb.isPresent()) {
if( licenseKeyGroupElement.getRelations() == null) {
- licenseKeyGroupElement.setRelations(new ArrayList<>());
+ licenseKeyGroupElement.setRelations(new ArrayList<>());
}
- lkgFromDb.get().getRelations().forEach(relation ->
- licenseKeyGroupElement.getRelations().add(relation));
+ if (lkgFromDb.get().getRelations() != null && lkgFromDb.get().getRelations().size() > 0) {
+ licenseKeyGroupElement.getRelations().addAll(lkgFromDb.get().getRelations());
+ }
}
zusammenAdaptor.saveElement(context, elementContext,
@@ -202,6 +203,7 @@ public class LicenseKeyGroupZusammenDaoImpl implements LicenseKeyGroupDao {
private ZusammenElement buildLicenseKeyGroupElement(LicenseKeyGroupEntity licenseKeyGroup,
Action action) {
+
ZusammenElement lkgElement = new ZusammenElement();
lkgElement.setAction(action);
if (licenseKeyGroup.getId() != null) {
@@ -214,13 +216,14 @@ public class LicenseKeyGroupZusammenDaoImpl implements LicenseKeyGroupDao {
info.addProperty("operational_scope", licenseKeyGroup.getOperationalScope());
lkgElement.setInfo(info);
- if (licenseKeyGroup.getReferencingFeatureGroups() != null &&
- licenseKeyGroup.getReferencingFeatureGroups().size() > 0) {
+ if (licenseKeyGroup.getReferencingFeatureGroups() != null
+ && licenseKeyGroup.getReferencingFeatureGroups().size() > 0) {
lkgElement.setRelations(licenseKeyGroup.getReferencingFeatureGroups().stream()
.map(rel -> VlmZusammenUtil
.createRelation(RelationType.LicenseKeyGroupToReferencingFeatureGroup, rel))
.collect(Collectors.toList()));
}
+
return lkgElement;
}
@@ -247,13 +250,13 @@ public class LicenseKeyGroupZusammenDaoImpl implements LicenseKeyGroupDao {
private MultiChoiceOrOther<OperationalScope> getOperationalScopeMultiChoiceOrOther
(Map<String, Object>
operationalScope) {
-
+ if(operationalScope != null && !operationalScope.isEmpty()) {
Set<OperationalScope> choices = new HashSet<>();
- ((List<String>) operationalScope.get("choices")).
- forEach(choice -> choices.add(OperationalScope.valueOf(choice)));
+ ((List<String>) operationalScope.get("choices"))
+ .forEach(choice -> choices.add(OperationalScope.valueOf(choice)));
- return new MultiChoiceOrOther<>(choices, (String) operationalScope.get("other"));
+ return new MultiChoiceOrOther<>(choices, operationalScope.get("other")==null?null:(String) operationalScope.get("other"));
+ }
+ return 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/LimitZusammenDaoImpl.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/LimitZusammenDaoImpl.java
new file mode 100644
index 0000000000..c8612bfeaa
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/LimitZusammenDaoImpl.java
@@ -0,0 +1,215 @@
+package org.openecomp.sdc.vendorlicense.dao.impl.zusammen;
+
+import com.amdocs.zusammen.adaptor.inbound.api.types.item.Element;
+import com.amdocs.zusammen.adaptor.inbound.api.types.item.ElementInfo;
+import com.amdocs.zusammen.adaptor.inbound.api.types.item.ZusammenElement;
+import com.amdocs.zusammen.datatypes.Id;
+import com.amdocs.zusammen.datatypes.SessionContext;
+import com.amdocs.zusammen.datatypes.item.Action;
+import com.amdocs.zusammen.datatypes.item.ElementContext;
+import com.amdocs.zusammen.datatypes.item.Info;
+import org.openecomp.core.zusammen.api.ZusammenAdaptor;
+import org.openecomp.core.zusammen.api.ZusammenUtil;
+import org.openecomp.sdc.vendorlicense.dao.LimitDao;
+import org.openecomp.sdc.vendorlicense.dao.types.AggregationFunction;
+import org.openecomp.sdc.vendorlicense.dao.types.EntitlementMetric;
+import org.openecomp.sdc.vendorlicense.dao.types.EntitlementTime;
+import org.openecomp.sdc.vendorlicense.dao.types.LimitEntity;
+import org.openecomp.sdc.vendorlicense.dao.types.LimitType;
+import org.openecomp.sdc.versioning.dao.types.Version;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+public class LimitZusammenDaoImpl implements LimitDao {
+
+ public static final String LIMT_TYPE = "type";
+ public static final String METRIC = "metric";
+ public static final String AGGREGATIONFUNCTION = "aggregationfunction";
+ public static final String TIME = "time";
+ public static final String UNIT = "unit";
+ public static final String VALUE = "value";
+ private ZusammenAdaptor zusammenAdaptor;
+
+ public LimitZusammenDaoImpl(ZusammenAdaptor zusammenAdaptor) {
+ this.zusammenAdaptor = zusammenAdaptor;
+ }
+
+ @Override
+ public void create(LimitEntity limitEntity) {
+ ZusammenElement limitElement = limitToZusammen(limitEntity, Action.CREATE);
+
+ ZusammenElement limitsElement =
+ VlmZusammenUtil.buildStructuralElement(StructureElement.Limits, null);
+ limitsElement.setSubElements(Collections.singletonList(limitElement));
+
+ ZusammenElement epLkgElement =
+ buildZusammenElement(new Id(limitEntity.getEpLkgId()), Action.IGNORE);
+ epLkgElement.setSubElements(Collections.singletonList(limitsElement));
+
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(limitEntity.getVendorLicenseModelId());
+ ElementContext elementContext = new ElementContext(itemId,
+ VlmZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor));
+
+ Optional<Element> savedElement =
+ zusammenAdaptor.saveElement(context, elementContext, epLkgElement, "Create limit");
+ savedElement.ifPresent(element ->
+ limitEntity.setId(element.getSubElements().iterator().next()
+ .getSubElements().iterator().next().getElementId().getValue()));
+ }
+
+ @Override
+ public boolean isLimitPresent(LimitEntity limitEntity) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(limitEntity.getVendorLicenseModelId());
+ ElementContext elementContext = new ElementContext(itemId,
+ VlmZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor),
+ VlmZusammenUtil.getVersionTag(limitEntity.getVersion()));
+
+ Collection<ElementInfo> elementInfos = zusammenAdaptor.listElementsByName(context,
+ elementContext, new Id(limitEntity.getEpLkgId()),StructureElement.Limits.name());
+
+ for (ElementInfo elementInfo : elementInfos) {
+ if (elementInfo.getId().getValue().equals(limitEntity.getId())) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ @Override
+ public Collection<LimitEntity> list(LimitEntity limitEntity) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(limitEntity.getVendorLicenseModelId());
+ ElementContext elementContext = new ElementContext(itemId,
+ VlmZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor),
+ VlmZusammenUtil.getVersionTag(limitEntity.getVersion()));
+
+ return listLimits(context, elementContext, limitEntity);
+ }
+
+ private Collection<LimitEntity> listLimits(SessionContext context, ElementContext elementContext,
+ LimitEntity limitEntity) {
+ return zusammenAdaptor
+ .listElementsByName(context, elementContext, new Id(limitEntity.getEpLkgId()),
+ StructureElement.Limits.name())
+ .stream().map(elementInfo -> mapElementInfoToLimit(
+ limitEntity.getVendorLicenseModelId(), limitEntity.getVersion(),
+ limitEntity.getEpLkgId(), elementInfo))
+ .collect(Collectors.toList());
+ }
+
+ private LimitEntity mapElementInfoToLimit(String vlmId, Version version,
+ String epLkgId, ElementInfo elementInfo) {
+ LimitEntity limitEntity =
+ new LimitEntity(vlmId, version, epLkgId, elementInfo.getId().getValue());
+
+ limitEntity.setName(elementInfo.getInfo().getName());
+ limitEntity.setDescription(elementInfo.getInfo().getDescription());
+ limitEntity.setType( elementInfo.getInfo().getProperties().get(LIMT_TYPE) != null ?
+ LimitType.valueOf((String) elementInfo.getInfo().getProperties().get(LIMT_TYPE)) :
+ null);
+ limitEntity.setTime( elementInfo.getInfo().getProperties().get(TIME) != null ?
+ EntitlementTime.valueOf((String) elementInfo.getInfo().getProperties().get(TIME)) :
+ null);
+ limitEntity.setMetric( elementInfo.getInfo().getProperties().get(METRIC) != null ?
+ EntitlementMetric.valueOf((String) elementInfo.getInfo().getProperties().get(METRIC)) :
+ null);
+ limitEntity.setAggregationFunction( elementInfo.getInfo().getProperties().get
+ (AGGREGATIONFUNCTION) != null ?
+ AggregationFunction.valueOf((String) elementInfo.getInfo().getProperties()
+ .get(AGGREGATIONFUNCTION)) : null);
+ Object unit = elementInfo.getInfo().getProperties().get(UNIT);
+ limitEntity.setUnit(unit != null ? VlmZusammenUtil.toInteger(unit) : null);
+ Object value = elementInfo.getInfo().getProperties().get(VALUE);
+ limitEntity.setValue(value != null ? VlmZusammenUtil.toInteger(value) : null);
+
+ return limitEntity;
+ }
+
+ @Override
+ public void update(LimitEntity entity) {
+ ZusammenElement limitElement = limitToZusammen(entity, Action.UPDATE);
+
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(entity.getVendorLicenseModelId());
+ ElementContext elementContext = new ElementContext(itemId,
+ VlmZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor));
+
+ zusammenAdaptor.saveElement(context,elementContext, limitElement,
+ String.format("Update limit with id %s", entity.getId()));
+ }
+
+ @Override
+ public LimitEntity get(LimitEntity limitEntity) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(limitEntity.getVendorLicenseModelId());
+ ElementContext elementContext = new ElementContext(itemId,
+ VlmZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor),
+ VlmZusammenUtil.getVersionTag(limitEntity.getVersion()));
+
+ return zusammenAdaptor.getElementInfo(context, elementContext, new Id(limitEntity.getId()))
+ .map(elementInfo -> mapElementInfoToLimit(
+ limitEntity.getVendorLicenseModelId(), limitEntity.getVersion(), limitEntity
+ .getEpLkgId(), elementInfo))
+ .orElse(null);
+ }
+
+ @Override
+ public void delete(LimitEntity entity) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ ZusammenElement zusammenElement = new ZusammenElement();
+ zusammenElement.setAction(Action.DELETE);
+ zusammenElement.setElementId(new Id(entity.getId()));
+
+ Id itemId = new Id(entity.getVendorLicenseModelId());
+ ElementContext elementContext =
+ new ElementContext(itemId,
+ VlmZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor));
+ zusammenAdaptor.saveElement(context, elementContext, zusammenElement,
+ "delete limit Id:" + entity.getId() + ".");
+ }
+
+ @Override
+ public void registerVersioning(String versionableEntityType) {
+
+ }
+
+ private ZusammenElement limitToZusammen(LimitEntity limit,
+ Action action) {
+ ZusammenElement limitElement = buildLimitElement(limit, action);
+ return limitElement;
+ }
+
+ private ZusammenElement buildLimitElement(LimitEntity limit,
+ Action action) {
+ ZusammenElement limitElement = new ZusammenElement();
+ limitElement.setAction(action);
+ if (limit.getId() != null) {
+ limitElement.setElementId(new Id(limit.getId()));
+ }
+
+ Info info = new Info();
+ info.setName(limit.getName());
+ info.setDescription(limit.getDescription());
+ info.addProperty(LIMT_TYPE, limit.getType());
+ info.addProperty(METRIC, limit.getMetric());
+ info.addProperty(AGGREGATIONFUNCTION, limit.getAggregationFunction());
+ info.addProperty(TIME, limit.getTime());
+ info.addProperty(VALUE, limit.getValue());
+ info.addProperty(UNIT, limit.getUnit());
+ limitElement.setInfo(info);
+ return limitElement;
+ }
+
+ private ZusammenElement buildZusammenElement(Id elementId, Action action) {
+ ZusammenElement element = new ZusammenElement();
+ element.setElementId(elementId);
+ element.setAction(action);
+ return element;
+ }
+}
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/StructureElement.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/StructureElement.java
index 767fa52d44..3cb389936d 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/StructureElement.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/StructureElement.java
@@ -5,5 +5,6 @@ public enum StructureElement {
LicenseAgreements,
FeatureGroups,
EntitlementPools,
- LicenseKeyGroups
+ LicenseKeyGroups,
+ Limits
}
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/VlmZusammenUtil.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/VlmZusammenUtil.java
index b2802bee66..f16d0fae67 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/VlmZusammenUtil.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/VlmZusammenUtil.java
@@ -65,4 +65,15 @@ public class VlmZusammenUtil {
relation.setEdge2(edge2);
return relation;
}
+
+ public static Integer toInteger(Object val) {
+ if (val instanceof Double) {
+ return ((Double) val).intValue();
+ } else if (val instanceof String) {
+ return new Integer((String) val);
+ } else if (val instanceof Integer) {
+ return (Integer) val;
+ }
+ throw new RuntimeException("invalid value for integer:" + val.getClass());
+ }
}
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 6f3573981c..857ee7f9fa 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
@@ -20,6 +20,11 @@
package org.openecomp.sdc.vendorlicense.facade.impl;
+import static org.openecomp.sdc.vendorlicense.VendorLicenseConstants.VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE;
+import static org.openecomp.sdc.vendorlicense.errors.UncompletedVendorLicenseModelErrorType.SUBMIT_UNCOMPLETED_VLM_MSG_FG_MISSING_EP;
+import static org.openecomp.sdc.vendorlicense.errors.UncompletedVendorLicenseModelErrorType.SUBMIT_UNCOMPLETED_VLM_MSG_LA_MISSING_FG;
+import static org.openecomp.sdc.vendorlicense.errors.UncompletedVendorLicenseModelErrorType.SUBMIT_UNCOMPLETED_VLM_MSG_MISSING_LA;
+
import org.openecomp.core.util.UniqueValueUtil;
import org.openecomp.core.utilities.CommonMethods;
import org.openecomp.sdc.common.errors.CoreException;
@@ -40,6 +45,8 @@ import org.openecomp.sdc.vendorlicense.dao.LicenseAgreementDao;
import org.openecomp.sdc.vendorlicense.dao.LicenseAgreementDaoFactory;
import org.openecomp.sdc.vendorlicense.dao.LicenseKeyGroupDao;
import org.openecomp.sdc.vendorlicense.dao.LicenseKeyGroupDaoFactory;
+import org.openecomp.sdc.vendorlicense.dao.LimitDao;
+import org.openecomp.sdc.vendorlicense.dao.LimitDaoFactory;
import org.openecomp.sdc.vendorlicense.dao.VendorLicenseModelDao;
import org.openecomp.sdc.vendorlicense.dao.VendorLicenseModelDaoFactory;
import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity;
@@ -48,6 +55,7 @@ import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupModel;
import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementEntity;
import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementModel;
import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity;
+import org.openecomp.sdc.vendorlicense.dao.types.LimitEntity;
import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity;
import org.openecomp.sdc.vendorlicense.errors.SubmitUncompletedLicenseModelErrorBuilder;
import org.openecomp.sdc.vendorlicense.errors.VendorLicenseModelNotFoundErrorBuilder;
@@ -67,11 +75,6 @@ import java.util.Collection;
import java.util.Collections;
import java.util.List;
-import static org.openecomp.sdc.vendorlicense.VendorLicenseConstants.VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE;
-import static org.openecomp.sdc.vendorlicense.errors.UncompletedVendorLicenseModelErrorType.SUBMIT_UNCOMPLETED_VLM_MSG_FG_MISSING_EP;
-import static org.openecomp.sdc.vendorlicense.errors.UncompletedVendorLicenseModelErrorType.SUBMIT_UNCOMPLETED_VLM_MSG_LA_MISSING_FG;
-import static org.openecomp.sdc.vendorlicense.errors.UncompletedVendorLicenseModelErrorType.SUBMIT_UNCOMPLETED_VLM_MSG_MISSING_LA;
-
public class VendorLicenseFacadeImpl implements VendorLicenseFacade {
private static final VersioningManager versioningManager =
@@ -87,6 +90,7 @@ public class VendorLicenseFacadeImpl implements VendorLicenseFacade {
entitlementPoolDao = EntitlementPoolDaoFactory.getInstance().createInterface();
private static final LicenseKeyGroupDao
licenseKeyGroupDao = LicenseKeyGroupDaoFactory.getInstance().createInterface();
+ private static final LimitDao limitDao = LimitDaoFactory.getInstance().createInterface();
private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
/**
@@ -98,6 +102,7 @@ public class VendorLicenseFacadeImpl implements VendorLicenseFacade {
featureGroupDao.registerVersioning(VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE);
entitlementPoolDao.registerVersioning(VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE);
licenseKeyGroupDao.registerVersioning(VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE);
+ limitDao.registerVersioning(VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE);
}
@Override
@@ -123,6 +128,8 @@ public class VendorLicenseFacadeImpl implements VendorLicenseFacade {
getVersionInfo(featureGroup.getVendorLicenseModelId(), VersionableEntityAction.Read,
user), user);
featureGroup.setVersion(version);
+
+
return getFeatureGroup(featureGroup);
}
@@ -130,6 +137,19 @@ public class VendorLicenseFacadeImpl implements VendorLicenseFacade {
FeatureGroupEntity retrieved = featureGroupDao.get(featureGroup);
VersioningUtil
.validateEntityExistence(retrieved, featureGroup, VendorLicenseModelEntity.ENTITY_TYPE);
+ if(retrieved.getManufacturerReferenceNumber() == null){
+ Object[] entitlementPoolIdsList = retrieved.getEntitlementPoolIds().toArray();
+ if(entitlementPoolIdsList != null && entitlementPoolIdsList.length > 0){
+ String entitlementPoolId = entitlementPoolIdsList[0].toString();
+ EntitlementPoolEntity entitlementPoolEntity = new EntitlementPoolEntity(retrieved.getVendorLicenseModelId(),
+ retrieved.getVersion(), entitlementPoolId);
+ entitlementPoolEntity = entitlementPoolDao.get(entitlementPoolEntity);
+ retrieved.setManufacturerReferenceNumber(entitlementPoolDao.getManufacturerReferenceNumber(
+ entitlementPoolEntity));
+ featureGroupDao.update(retrieved);
+ }
+ }
+
return retrieved;
}
@@ -443,6 +463,38 @@ public class VendorLicenseFacadeImpl implements VendorLicenseFacade {
.resolveVersion(version, getVersionInfo(vlmId, VersionableEntityAction.Read, user), user));
}
+ @Override
+ public LimitEntity createLimit(LimitEntity limit, String user) {
+ limit.setVersion(VersioningUtil.resolveVersion(limit.getVersion(),
+ getVersionInfo(limit.getVendorLicenseModelId(), VersionableEntityAction.Write,
+ user), user));
+ //limit.setVersionUuId(CommonMethods.nextUuId());
+ limitDao.create(limit);
+ updateVlmLastModificationTime(limit.getVendorLicenseModelId(),
+ limit.getVersion());
+ return limit;
+ }
+
+ @Override
+ public Collection<LimitEntity> listLimits(String vlmId, Version version, String epLkgId,
+ String user) {
+ return limitDao.list(new LimitEntity(vlmId, VersioningUtil
+ .resolveVersion(version, getVersionInfo(vlmId, VersionableEntityAction.Read, user), user),
+ epLkgId, null));
+
+ }
+
+ @Override
+ public void updateLimit(LimitEntity limit, String user) {
+ limit.setVersion(VersioningUtil.resolveVersion(limit.getVersion(),
+ getVersionInfo(limit.getVendorLicenseModelId(), VersionableEntityAction.Write,
+ user), user));
+ //limit.setVersionUuId(CommonMethods.nextUuId());
+ limitDao.update(limit);
+ updateVlmLastModificationTime(limit.getVendorLicenseModelId(),
+ limit.getVersion());
+ }
+
private LicenseAgreementEntity getLicenseAgreement(String vlmId, String licenseAgreementId,
Version version) {
LicenseAgreementEntity input = new LicenseAgreementEntity(vlmId, version, licenseAgreementId);
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 580fc6c0e5..d91a5107af 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
@@ -28,6 +28,7 @@ import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity;
import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity;
import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupModel;
import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity;
+import org.openecomp.sdc.vendorlicense.dao.types.LimitEntity;
import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade;
import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacadeFactory;
import org.openecomp.sdc.vendorlicense.healing.HealingService;
@@ -37,6 +38,7 @@ import org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types.VnfLicenseArt
import org.openecomp.sdc.vendorlicense.licenseartifacts.impl.util.VendorLicenseArtifactsServiceUtils;
import org.openecomp.sdc.versioning.dao.types.Version;
+import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -64,19 +66,29 @@ public class VendorLicenseArtifactsServiceImpl implements VendorLicenseArtifacts
artifact.setVspId(vspId);
artifact.setVendorName(vendorName);
- for (String featureGroupId : featureGroups) {
- FeatureGroupModel featureGroupModel = vendorLicenseFacade
- .getFeatureGroupModel(new FeatureGroupEntity(vlmId, vlmVersion, featureGroupId), user);
- Set<EntitlementPoolEntity> entitlementPoolEntities = featureGroupModel.getEntitlementPools();
- Set<LicenseKeyGroupEntity> licenseKeyGroupEntities = featureGroupModel.getLicenseKeyGroups();
-
- featureGroupModel.setEntitlementPools(entitlementPoolEntities.stream().map(
- entitlementPoolEntity -> (EntitlementPoolEntity) healingService
- .heal(entitlementPoolEntity, user)).collect(Collectors.toSet()));
- featureGroupModel.setLicenseKeyGroups(licenseKeyGroupEntities.stream().map(
- licenseKeyGroupEntity -> (LicenseKeyGroupEntity) healingService
- .heal(licenseKeyGroupEntity, user)).collect(Collectors.toSet()));
- artifact.getFeatureGroups().add(featureGroupModel);
+ if(featureGroups != null) {
+ for (String featureGroupId : featureGroups) {
+ FeatureGroupModel featureGroupModel = vendorLicenseFacade
+ .getFeatureGroupModel(new FeatureGroupEntity(vlmId, vlmVersion, featureGroupId), user);
+ Set<EntitlementPoolEntity> entitlementPoolEntities = featureGroupModel.getEntitlementPools();
+ for(EntitlementPoolEntity entitlementPoolEntity : entitlementPoolEntities){
+ entitlementPoolEntity.setLimits(vendorLicenseFacade.listLimits(vlmId, vlmVersion,
+ entitlementPoolEntity.getId(), user));
+ }
+ Set<LicenseKeyGroupEntity> licenseKeyGroupEntities = featureGroupModel.getLicenseKeyGroups();
+ for(LicenseKeyGroupEntity licenseKeyGroupEntity : licenseKeyGroupEntities){
+ licenseKeyGroupEntity.setLimits(vendorLicenseFacade.listLimits(vlmId, vlmVersion,
+ licenseKeyGroupEntity.getId(), user));
+ }
+
+ featureGroupModel.setEntitlementPools(entitlementPoolEntities.stream().map(
+ entitlementPoolEntity -> (EntitlementPoolEntity) healingService
+ .heal(entitlementPoolEntity, user)).collect(Collectors.toSet()));
+ featureGroupModel.setLicenseKeyGroups(licenseKeyGroupEntities.stream().map(
+ licenseKeyGroupEntity -> (LicenseKeyGroupEntity) healingService
+ .heal(licenseKeyGroupEntity, user)).collect(Collectors.toSet()));
+ artifact.getFeatureGroups().add(featureGroupModel);
+ }
}
mdcDataDebugMessage.debugExitMessage("VLM name", vendorName);
@@ -95,13 +107,23 @@ public class VendorLicenseArtifactsServiceImpl implements VendorLicenseArtifacts
List<Version> finalVersions = VendorLicenseArtifactsServiceUtils.getFinalVersionsForVlm(vlmId);
for (Version finalVersion : finalVersions) {
- entitlementPoolEntities
- .addAll(vendorLicenseFacade.listEntitlementPools(vlmId, finalVersion, user));
- licenseKeyGroupEntities
- .addAll(vendorLicenseFacade.listLicenseKeyGroups(vlmId, finalVersion, user));
+ Collection<EntitlementPoolEntity> coll = vendorLicenseFacade.listEntitlementPools(vlmId,
+ finalVersion, user);
+ for(EntitlementPoolEntity entitlementPoolEntity : coll){
+ entitlementPoolEntity.setLimits(vendorLicenseFacade.listLimits(vlmId, finalVersion,
+ entitlementPoolEntity.getId(), user));
+ }
+ entitlementPoolEntities.addAll(coll);
+
+ Collection<LicenseKeyGroupEntity> coll2 = vendorLicenseFacade.listLicenseKeyGroups(vlmId,
+ finalVersion, user);
+ for(LicenseKeyGroupEntity licenseKeyGroupEntity : coll2){
+ licenseKeyGroupEntity.setLimits(vendorLicenseFacade.listLimits(vlmId, finalVersion,
+ licenseKeyGroupEntity.getId(), user));
+ }
+ licenseKeyGroupEntities.addAll(coll2);
}
-
entitlementPoolEntities = VendorLicenseArtifactsServiceUtils
.healEPs(user,
VendorLicenseArtifactsServiceUtils.filterChangedEntities(entitlementPoolEntities));
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
index 6dddb9ac69..61eb474736 100644
--- 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
@@ -32,6 +32,7 @@ public class FeatureGroupForArtifact {
private String name;
private String description;
private String partNumber;
+ private String manufacturerReferenceNumber;
private String id;
public String getName() {
@@ -46,6 +47,10 @@ public class FeatureGroupForArtifact {
return partNumber;
}
+ public String getManufacturerReferenceNumber(){
+ return manufacturerReferenceNumber;
+ }
+
public String getId() {
return id;
}
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/VendorLicenseArtifact.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/VendorLicenseArtifact.java
index 589b7fa668..afc1d3151b 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/VendorLicenseArtifact.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/VendorLicenseArtifact.java
@@ -26,8 +26,10 @@ import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity;
import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity;
+import org.openecomp.sdc.vendorlicense.dao.types.xml.LimitXml;
import org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types.mixins.MixinEntitlementPoolEntityForVendorLicenseArtifact;
import org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types.mixins.MixinLicenseKeyGroupEntityForVendorLicenseArtifact;
+import org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types.mixins.MixinLimitArtifact;
import java.util.Collection;
@@ -76,5 +78,6 @@ public class VendorLicenseArtifact extends XmlArtifact {
MixinEntitlementPoolEntityForVendorLicenseArtifact.class);
xmlMapper.addMixIn(LicenseKeyGroupEntity.class,
MixinLicenseKeyGroupEntityForVendorLicenseArtifact.class);
+ xmlMapper.addMixIn(LimitXml.class, MixinLimitArtifact.class);
}
}
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/VnfLicenseArtifact.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/VnfLicenseArtifact.java
index f1da629960..b2cb710eec 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/VnfLicenseArtifact.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/VnfLicenseArtifact.java
@@ -32,15 +32,17 @@ import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity;
import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupModel;
import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity;
+import org.openecomp.sdc.vendorlicense.dao.types.xml.LimitXml;
import org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types.mixins.MixinEntitlementPoolEntityForVnfArtifact;
import org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types.mixins.MixinFeatureGroupModel;
import org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types.mixins.MixinLicenseKeyGroupEntityForVnfArtifact;
+import org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types.mixins.MixinLimitArtifact;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
import java.io.Writer;
import java.util.ArrayList;
import java.util.List;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
@JacksonXmlRootElement(localName = "vf-license-model",
namespace = "http://xmlns.openecomp.org/asdc/license-model/1.0")
@@ -93,5 +95,6 @@ public class VnfLicenseArtifact extends XmlArtifact {
xmlMapper.addMixIn(EntitlementPoolEntity.class, MixinEntitlementPoolEntityForVnfArtifact.class);
xmlMapper.addMixIn(LicenseKeyGroupEntity.class, MixinLicenseKeyGroupEntityForVnfArtifact.class);
xmlMapper.addMixIn(FeatureGroupModel.class, MixinFeatureGroupModel.class);
+ xmlMapper.addMixIn(LimitXml.class, MixinLimitArtifact.class);
}
}
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/mixins/MixinEntitlementPoolEntityForVendorLicenseArtifact.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/mixins/MixinEntitlementPoolEntityForVendorLicenseArtifact.java
index 020316f019..936f4da2a7 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinEntitlementPoolEntityForVendorLicenseArtifact.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/mixins/MixinEntitlementPoolEntityForVendorLicenseArtifact.java
@@ -21,6 +21,7 @@
package org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types.mixins;
import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
@@ -28,13 +29,16 @@ import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import org.openecomp.sdc.vendorlicense.dao.types.ChoiceOrOther;
import org.openecomp.sdc.vendorlicense.dao.types.EntitlementMetric;
import org.openecomp.sdc.vendorlicense.dao.types.EntitlementTime;
+import org.openecomp.sdc.vendorlicense.dao.types.LimitEntity;
import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope;
import org.openecomp.sdc.vendorlicense.dao.types.AggregationFunction;
import org.openecomp.sdc.vendorlicense.dao.types.xml.AggregationFunctionForXml;
import org.openecomp.sdc.vendorlicense.dao.types.xml.EntitlementMetricForXml;
import org.openecomp.sdc.vendorlicense.dao.types.xml.EntitlementTimeForXml;
import org.openecomp.sdc.vendorlicense.dao.types.xml.ThresholdForXml;
+import org.openecomp.sdc.vendorlicense.dao.types.xml.LimitForXml;
+import java.util.Collection;
import java.util.Set;
@JsonPropertyOrder({ "entitlement-pool-invariant-uuid", "entitlement-pool-uuid" })
@@ -60,6 +64,12 @@ public abstract class MixinEntitlementPoolEntityForVendorLicenseArtifact {
@JsonProperty(value = "version")
abstract String getVersionForArtifact();
+ @JsonInclude(JsonInclude.Include.NON_NULL)
+ abstract String getStartDate();
+
+ @JsonInclude(JsonInclude.Include.NON_NULL)
+ abstract String getExpiryDate();
+
@JsonIgnore
abstract String getVendorLicenseModelId();
@@ -90,7 +100,6 @@ public abstract class MixinEntitlementPoolEntityForVendorLicenseArtifact {
@JsonIgnore
abstract ChoiceOrOther<OperationalScope> getOperationalScope();
-
@JsonProperty(value = "entitlement-metric")
abstract EntitlementMetricForXml getEntitlementMetricForArtifact();
@@ -101,4 +110,12 @@ public abstract class MixinEntitlementPoolEntityForVendorLicenseArtifact {
@JsonProperty(value = "aggregation-function")
abstract AggregationFunctionForXml getAggregationFunctionForArtifact();
+ @JsonProperty(value = "sp-limits")
+ abstract LimitForXml getSPLimits();
+
+ @JsonProperty(value = "vendor-limits")
+ abstract LimitForXml getVendorLimits();
+
+ @JsonIgnore
+ abstract Collection<LimitEntity> getLimits();
}
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/mixins/MixinEntitlementPoolEntityForVnfArtifact.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/mixins/MixinEntitlementPoolEntityForVnfArtifact.java
index 064d17b8fa..1a29d5b2c9 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinEntitlementPoolEntityForVnfArtifact.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/mixins/MixinEntitlementPoolEntityForVnfArtifact.java
@@ -21,6 +21,7 @@
package org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types.mixins;
import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
@@ -28,12 +29,15 @@ import org.openecomp.sdc.vendorlicense.dao.types.AggregationFunction;
import org.openecomp.sdc.vendorlicense.dao.types.ChoiceOrOther;
import org.openecomp.sdc.vendorlicense.dao.types.EntitlementMetric;
import org.openecomp.sdc.vendorlicense.dao.types.EntitlementTime;
+import org.openecomp.sdc.vendorlicense.dao.types.LimitEntity;
import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope;
import org.openecomp.sdc.vendorlicense.dao.types.xml.AggregationFunctionForXml;
import org.openecomp.sdc.vendorlicense.dao.types.xml.EntitlementMetricForXml;
import org.openecomp.sdc.vendorlicense.dao.types.xml.EntitlementTimeForXml;
import org.openecomp.sdc.vendorlicense.dao.types.xml.ThresholdForXml;
+import org.openecomp.sdc.vendorlicense.dao.types.xml.LimitForXml;
+import java.util.Collection;
import java.util.Set;
public abstract class MixinEntitlementPoolEntityForVnfArtifact {
@@ -70,6 +74,12 @@ public abstract class MixinEntitlementPoolEntityForVnfArtifact {
@JsonIgnore
abstract float getThresholdValue();
+ @JsonInclude(JsonInclude.Include.NON_NULL)
+ abstract String getStartDate();
+
+ @JsonInclude(JsonInclude.Include.NON_NULL)
+ abstract String getExpiryDate();
+
@JsonIgnore
abstract ChoiceOrOther<EntitlementMetric> getEntitlementMetric();
@@ -100,4 +110,13 @@ public abstract class MixinEntitlementPoolEntityForVnfArtifact {
@JsonProperty(value = "aggregation-function")
abstract AggregationFunctionForXml getAggregationFunctionForArtifact();
+ @JsonProperty(value = "sp-limits")
+ abstract LimitForXml getSPLimits();
+
+ @JsonProperty(value = "vendor-limits")
+ abstract LimitForXml getVendorLimits();
+
+ @JsonIgnore
+ abstract Collection<LimitEntity> getLimits();
+
}
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/mixins/MixinFeatureGroupEntity.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/mixins/MixinFeatureGroupEntity.java
index be6bd61357..61751b111b 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinFeatureGroupEntity.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/mixins/MixinFeatureGroupEntity.java
@@ -50,6 +50,9 @@ public abstract class MixinFeatureGroupEntity {
abstract String getPartNumber();
@JsonIgnore
+ abstract String getManufacturerReferenceNumber();
+
+ @JsonIgnore
abstract Set<String> getLicenseKeyGroupIds();
@JsonIgnore
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/mixins/MixinFeatureGroupModel.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/mixins/MixinFeatureGroupModel.java
index f5eb5f0bad..75beee4c6a 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinFeatureGroupModel.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/mixins/MixinFeatureGroupModel.java
@@ -41,6 +41,9 @@ public abstract class MixinFeatureGroupModel {
@JacksonXmlProperty(isAttribute = false, localName = "part-number")
abstract String getEntityPartNumber();
+ @JacksonXmlProperty(isAttribute = false, localName = "manufacturer-reference-number")
+ abstract String getManufacturerReferenceNumber();
+
@JacksonXmlProperty(isAttribute = false, localName = "feature-group-uuid")
abstract String getEntityId();
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/mixins/MixinLicenseKeyGroupEntityForVendorLicenseArtifact.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/mixins/MixinLicenseKeyGroupEntityForVendorLicenseArtifact.java
index b5fb2f4549..6238988ece 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinLicenseKeyGroupEntityForVendorLicenseArtifact.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/mixins/MixinLicenseKeyGroupEntityForVendorLicenseArtifact.java
@@ -25,9 +25,12 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import org.openecomp.sdc.vendorlicense.dao.types.ChoiceOrOther;
+import org.openecomp.sdc.vendorlicense.dao.types.LimitEntity;
import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope;
import org.openecomp.sdc.vendorlicense.dao.types.xml.LicenseKeyTypeForXml;
+import org.openecomp.sdc.vendorlicense.dao.types.xml.LimitForXml;
+import java.util.Collection;
import java.util.Set;
public abstract class MixinLicenseKeyGroupEntityForVendorLicenseArtifact {
@@ -68,5 +71,13 @@ public abstract class MixinLicenseKeyGroupEntityForVendorLicenseArtifact {
@JsonIgnore
abstract String getVersionableId();
+ @JsonProperty(value = "sp-limits")
+ abstract LimitForXml getSPLimits();
+
+ @JsonProperty(value = "vendor-limits")
+ abstract LimitForXml getVendorLimits();
+
+ @JsonIgnore
+ abstract Collection<LimitEntity> getLimits();
}
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/mixins/MixinLicenseKeyGroupEntityForVnfArtifact.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/mixins/MixinLicenseKeyGroupEntityForVnfArtifact.java
index ed171c6a4b..80ae054db0 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinLicenseKeyGroupEntityForVnfArtifact.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/mixins/MixinLicenseKeyGroupEntityForVnfArtifact.java
@@ -25,9 +25,12 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import org.openecomp.sdc.vendorlicense.dao.types.ChoiceOrOther;
+import org.openecomp.sdc.vendorlicense.dao.types.LimitEntity;
import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope;
import org.openecomp.sdc.vendorlicense.dao.types.xml.LicenseKeyTypeForXml;
+import org.openecomp.sdc.vendorlicense.dao.types.xml.LimitForXml;
+import java.util.Collection;
import java.util.Set;
public abstract class MixinLicenseKeyGroupEntityForVnfArtifact {
@@ -71,5 +74,13 @@ public abstract class MixinLicenseKeyGroupEntityForVnfArtifact {
@JsonIgnore
abstract String getVersionableId();
+ @JsonProperty(value = "sp-limits")
+ abstract LimitForXml getSPLimits();
+
+ @JsonProperty(value = "vendor-limits")
+ abstract LimitForXml getVendorLimits();
+
+ @JsonIgnore
+ abstract Collection<LimitEntity> getLimits();
}
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/mixins/MixinLimitArtifact.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/mixins/MixinLimitArtifact.java
new file mode 100644
index 0000000000..1a15a6e557
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinLimitArtifact.java
@@ -0,0 +1,42 @@
+/*-
+ * ============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.mixins;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import org.openecomp.sdc.vendorlicense.dao.types.xml.AggregationFunctionForXml;
+import org.openecomp.sdc.vendorlicense.dao.types.xml.EntitlementTimeForXml;
+
+public abstract class MixinLimitArtifact {
+
+ @JsonIgnore
+ abstract String getTime();
+
+ @JsonIgnore
+ abstract String getAggregationFunction();
+
+ @JsonProperty(value = "aggregation-function")
+ abstract AggregationFunctionForXml getAggregationFunctionForArtifact();
+
+ @JsonProperty(value = "time")
+ abstract EntitlementTimeForXml getTimeForArtifact();
+
+}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/pom.xml.versionsBackup
new file mode 100644
index 0000000000..0b6ebb62d8
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/pom.xml.versionsBackup
@@ -0,0 +1,23 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <name>openecomp-sdc-vendor-license-lib</name>
+ <artifactId>openecomp-sdc-vendor-license-lib</artifactId>
+
+ <packaging>pom</packaging>
+ <parent>
+ <artifactId>openecomp-sdc-lib</artifactId>
+ <groupId>org.openecomp.sdc</groupId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <modules>
+ <module>openecomp-sdc-vendor-license-api</module>
+ <module>openecomp-sdc-vendor-license-core</module>
+ </modules>
+
+ <dependencies>
+
+ </dependencies>
+</project> \ No newline at end of file