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/types/EntitlementPoolEntity.java137
-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.java92
-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/OperationalScopeForXml.java38
-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.java3
-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/zusammen/EntitlementPoolZusammenDaoImpl.java36
-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.java33
-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.java110
-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.java42
-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.java10
-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.java10
-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.java6
-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.java23
-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.java24
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/pom.xml.versionsBackup23
16 files changed, 336 insertions, 359 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
deleted file mode 100644
index fc22abcf38..0000000000
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/pom.xml.versionsBackup
+++ /dev/null
@@ -1,55 +0,0 @@
-<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/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 ce225931f5..dce2939ae5 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
@@ -26,12 +26,10 @@ import com.datastax.driver.mapping.annotations.Enumerated;
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.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.vendorlicense.dao.types.xml.LimitXml;
+import org.openecomp.sdc.vendorlicense.dao.types.xml.OperationalScopeForXml;
+import org.openecomp.sdc.vendorlicense.dao.types.xml.ThresholdForXml;
import org.openecomp.sdc.versioning.dao.types.Version;
import org.openecomp.sdc.versioning.dao.types.VersionableEntity;
@@ -65,25 +63,12 @@ public class EntitlementPoolEntity implements VersionableEntity {
@Enumerated
private ThresholdUnit thresholdUnit;
- @Column(name = "entitlement_metric")
- @Frozen
- private ChoiceOrOther<EntitlementMetric> entitlementMetric;
private String increments;
- @Column(name = "aggregation_func")
- @Frozen
- private ChoiceOrOther<AggregationFunction> aggregationFunction;
-
@Column(name = "operational_scope")
@Frozen
private MultiChoiceOrOther<OperationalScope> operationalScope;
- @Frozen
- private ChoiceOrOther<EntitlementTime> time;
-
- @Column(name = "manufacturer_ref_num")
- private String manufacturerReferenceNumber;
-
@Column(name = "ref_fg_ids")
private Set<String> referencingFeatureGroups = new HashSet<>();
@@ -96,6 +81,9 @@ public class EntitlementPoolEntity implements VersionableEntity {
private Collection<LimitEntity> limits;
+ //Defined and used only for License Artifcat XMLs
+ private String manufacturerReferenceNumber;
+
public EntitlementPoolEntity() {
}
@@ -200,15 +188,6 @@ public class EntitlementPoolEntity implements VersionableEntity {
this.thresholdUnit = thresholdUnits;
}
- public ChoiceOrOther<EntitlementMetric> getEntitlementMetric() {
- return entitlementMetric;
- }
-
- public void setEntitlementMetric(ChoiceOrOther<EntitlementMetric> entitlementMetric) {
- entitlementMetric.resolveEnum(EntitlementMetric.class);
- this.entitlementMetric = entitlementMetric;
- }
-
public String getIncrements() {
return increments;
}
@@ -217,15 +196,6 @@ public class EntitlementPoolEntity implements VersionableEntity {
this.increments = increments;
}
- public ChoiceOrOther<AggregationFunction> getAggregationFunction() {
- return aggregationFunction;
- }
-
- public void setAggregationFunction(ChoiceOrOther<AggregationFunction> aggregationFunction) {
- aggregationFunction.resolveEnum(AggregationFunction.class);
- this.aggregationFunction = aggregationFunction;
- }
-
public MultiChoiceOrOther<OperationalScope> getOperationalScope() {
return operationalScope;
}
@@ -237,23 +207,6 @@ public class EntitlementPoolEntity implements VersionableEntity {
this.operationalScope = operationalScope;
}
- public ChoiceOrOther<EntitlementTime> getTime() {
- return time;
- }
-
- public void setTime(ChoiceOrOther<EntitlementTime> time) {
- time.resolveEnum(EntitlementTime.class);
- this.time = time;
- }
-
- public String getManufacturerReferenceNumber() {
- return manufacturerReferenceNumber;
- }
-
- public void setManufacturerReferenceNumber(String manufacturerReferenceNumber) {
- this.manufacturerReferenceNumber = manufacturerReferenceNumber;
- }
-
/**
* Gets threshold for artifact.
*
@@ -274,35 +227,6 @@ public class EntitlementPoolEntity implements VersionableEntity {
return version.toString();
}
- /**
- * Gets entitlement metric for artifact.
- *
- * @return the entitlement metric for artifact
- */
- public EntitlementMetricForXml getEntitlementMetricForArtifact() {
- EntitlementMetricForXml metric = new EntitlementMetricForXml();
- if (entitlementMetric != null) {
- metric.setValue(entitlementMetric.getResult());
- } else {
- metric.setValue(null);
- }
- return metric;
- }
-
- /**
- * Gets time for artifact.
- *
- * @return the time for artifact
- */
- public EntitlementTimeForXml getTimeForArtifact() {
- EntitlementTimeForXml timeForXml = new EntitlementTimeForXml();
- if (time != null) {
- timeForXml.setValue(time.getResult());
- }
-
- return timeForXml;
- }
-
public String getStartDate() {
return startDate;
}
@@ -334,7 +258,7 @@ public class EntitlementPoolEntity implements VersionableEntity {
if(obj.getType().equals(LimitType.ServiceProvider)){
LimitXml xmlObj = new LimitXml();
xmlObj.setDescription(obj.getDescription());
- xmlObj.setMetric(obj.getMetric().toString());
+ xmlObj.setMetric(obj.getMetric()!=null?obj.getMetric().name():null);
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);
@@ -357,7 +281,7 @@ public class EntitlementPoolEntity implements VersionableEntity {
if(obj.getType().equals(LimitType.Vendor)){
LimitXml xmlObj = new LimitXml();
xmlObj.setDescription(obj.getDescription());
- xmlObj.setMetric(obj.getMetric().toString());
+ xmlObj.setMetric(obj.getMetric()!=null?obj.getMetric().name():null);
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);
@@ -378,8 +302,7 @@ public class EntitlementPoolEntity implements VersionableEntity {
public int hashCode() {
return Objects
.hash(vendorLicenseModelId, version, id, name, description, thresholdValue, thresholdUnit,
- entitlementMetric, increments, aggregationFunction, operationalScope, time,
- manufacturerReferenceNumber, referencingFeatureGroups, startDate, expiryDate);
+ increments, operationalScope, referencingFeatureGroups, startDate, expiryDate);
}
@Override
@@ -397,12 +320,8 @@ public class EntitlementPoolEntity implements VersionableEntity {
&& Objects.equals(name, that.name)
&& Objects.equals(description, that.description)
&& Objects.equals(thresholdUnit, that.thresholdUnit)
- && Objects.equals(entitlementMetric, that.entitlementMetric)
&& Objects.equals(increments, that.increments)
- && Objects.equals(aggregationFunction, that.aggregationFunction)
&& Objects.equals(operationalScope, that.operationalScope)
- && Objects.equals(time, that.time)
- && Objects.equals(manufacturerReferenceNumber, that.manufacturerReferenceNumber)
&& Objects.equals(referencingFeatureGroups, that.referencingFeatureGroups)
&& Objects.equals(startDate, that.startDate)
&& Objects.equals(expiryDate, that.expiryDate);
@@ -418,12 +337,8 @@ public class EntitlementPoolEntity implements VersionableEntity {
+ ", description='" + description + '\''
+ ", thresholdValue=" + thresholdValue
+ ", thresholdUnit='" + thresholdUnit + '\''
- + ", entitlementMetric=" + entitlementMetric
+ ", increments='" + increments + '\''
- + ", aggregationFunction=" + aggregationFunction
+ ", operationalScope=" + operationalScope
- + ", time=" + time
- + ", manufacturerReferenceNumber='" + manufacturerReferenceNumber + '\''
+ ", referencingFeatureGroups=" + referencingFeatureGroups
+ ", version_uuid=" + versionUuId
+ ", startDate=" + startDate
@@ -432,30 +347,26 @@ public class EntitlementPoolEntity implements VersionableEntity {
}
/**
- * Gets aggregation function for artifact.
- *
- * @return the aggregation function for artifact
- */
- public AggregationFunctionForXml getAggregationFunctionForArtifact() {
- AggregationFunctionForXml aggregationFunctionForXml = new AggregationFunctionForXml();
- if (entitlementMetric != null) {
- aggregationFunctionForXml.setValue(aggregationFunction.getResult());
- } else {
- aggregationFunctionForXml.setValue(null);
- }
- return aggregationFunctionForXml;
- }
-
- /**
* Gets operational scope for artifact.
*
* @return the operational scope for artifact
*/
- public Set<String> getOperationalScopeForArtifact() {
+ public OperationalScopeForXml getOperationalScopeForArtifact() {
+ OperationalScopeForXml obj = new OperationalScopeForXml();
if (operationalScope != null) {
- return operationalScope.getResults();
- } else {
- return null;
+ if(operationalScope.getResults().size() > 0) {
+ obj.setValue(operationalScope.getResults());
+ }
}
+ return obj;
+ }
+
+ //Defined and used only for License Artifcat XMLs
+ public void setManufacturerReferenceNumber(String manufacturerReferenceNumber) {
+ this.manufacturerReferenceNumber = manufacturerReferenceNumber;
+ }
+
+ public String getManufacturerReferenceNumber() {
+ return manufacturerReferenceNumber;
}
}
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 654093de28..d5efd59a6b 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
@@ -29,6 +29,8 @@ 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.vendorlicense.dao.types.xml.OperationalScopeForXml;
+import org.openecomp.sdc.vendorlicense.dao.types.xml.ThresholdForXml;
import org.openecomp.sdc.versioning.dao.types.Version;
import org.openecomp.sdc.versioning.dao.types.VersionableEntity;
@@ -61,8 +63,17 @@ public class LicenseKeyGroupEntity implements VersionableEntity {
private Set<String> referencingFeatureGroups = new HashSet<>();
@Column(name = "version_uuid")
private String versionUuId;
+ private Integer thresholdValue;
+ private ThresholdUnit thresholdUnits;
+ private String increments;
private Collection<LimitEntity> limits;
+ private String startDate;
+ private String expiryDate;
+
+ //Defined and used only for License Artifcat XMLs
+ private String manufacturerReferenceNumber;
+
public LicenseKeyGroupEntity() {
}
@@ -167,6 +178,37 @@ public class LicenseKeyGroupEntity implements VersionableEntity {
this.referencingFeatureGroups = referencingFeatureGroups;
}
+ public Integer getThresholdValue() {
+ return thresholdValue;
+ }
+
+ public void setThresholdValue(Integer thresholdValue) {
+ this.thresholdValue = thresholdValue;
+ }
+
+ public ThresholdUnit getThresholdUnits() {
+ return thresholdUnits;
+ }
+
+ public void setThresholdUnits(ThresholdUnit thresholdUnit) {
+ this.thresholdUnits = thresholdUnit;
+ }
+
+ public String getIncrements() {
+ return increments;
+ }
+
+ public void setIncrements(String increments) {
+ this.increments = increments;
+ }
+
+ public ThresholdForXml getThresholdForArtifact() {
+ ThresholdForXml threshold = new ThresholdForXml();
+ threshold.setUnit(getThresholdUnits() == null ? null : getThresholdUnits().name());
+ threshold.setValue(getThresholdValue());
+ return threshold;
+ }
+
public Collection<LimitEntity> getLimits() {
return limits;
}
@@ -221,11 +263,28 @@ public class LicenseKeyGroupEntity implements VersionableEntity {
return null;
}
+ 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;
+ }
+
@Override
public int hashCode() {
return Objects
.hash(vendorLicenseModelId, version, id, name, description, type, operationalScope,
- referencingFeatureGroups);
+ referencingFeatureGroups, startDate, expiryDate,
+ thresholdValue, thresholdUnits, increments);
}
@Override
@@ -243,7 +302,12 @@ public class LicenseKeyGroupEntity implements VersionableEntity {
&& Objects.equals(description, that.description)
&& type == that.type
&& Objects.equals(operationalScope, that.operationalScope)
- && Objects.equals(referencingFeatureGroups, that.referencingFeatureGroups);
+ && Objects.equals(referencingFeatureGroups, that.referencingFeatureGroups)
+ && Objects.equals(startDate, that.startDate)
+ && Objects.equals(expiryDate, that.expiryDate)
+ && Objects.equals(thresholdValue, that.thresholdValue)
+ && Objects.equals(thresholdUnits, that.thresholdUnits)
+ && Objects.equals(increments, that.increments);
}
@Override
@@ -257,6 +321,11 @@ public class LicenseKeyGroupEntity implements VersionableEntity {
+ ", operationalScope=" + operationalScope
+ ", referencingFeatureGroups=" + referencingFeatureGroups
+ ", versionUuId='" + versionUuId + '\''
+ + ", startDate=" + startDate
+ + ", expiryDate=" + expiryDate
+ + ", thresholdValue='" + thresholdValue + '\''
+ + ", thresholdUnits='" + thresholdUnits + '\''
+ + ", increments='" + increments + '\''
+ '}';
}
@@ -265,12 +334,14 @@ public class LicenseKeyGroupEntity implements VersionableEntity {
*
* @return the operational scope for artifact
*/
- public Set<String> getOperationalScopeForArtifact() {
+ public OperationalScopeForXml getOperationalScopeForArtifact() {
+ OperationalScopeForXml obj = new OperationalScopeForXml();
if (operationalScope != null) {
- return operationalScope.getResults();
- } else {
- return null;
+ if(operationalScope.getResults().size() > 0) {
+ obj.setValue(operationalScope.getResults());
+ }
}
+ return obj;
}
/**
@@ -295,4 +366,13 @@ public class LicenseKeyGroupEntity implements VersionableEntity {
}
return typeXml;
}
+
+ //Defined and used only for License Artifcat XMLs
+ public String getManufacturerReferenceNumber() {
+ return manufacturerReferenceNumber;
+ }
+
+ public void setManufacturerReferenceNumber(String manufacturerReferenceNumber) {
+ this.manufacturerReferenceNumber = manufacturerReferenceNumber;
+ }
}
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/OperationalScopeForXml.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/OperationalScopeForXml.java
new file mode 100644
index 0000000000..f51a4127c0
--- /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/OperationalScopeForXml.java
@@ -0,0 +1,38 @@
+/*-
+ * ============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 java.util.Set;
+
+public class OperationalScopeForXml {
+ Set<String> value;
+
+ @JacksonXmlElementWrapper(localName = "value", useWrapping = false)
+ public Set<String> getValue() {
+ return value;
+ }
+
+ public void setValue(Set<String> 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/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 9ab7c0c64d..3d27de3a88 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
@@ -76,6 +76,9 @@ public interface VendorLicenseFacade {
LicenseAgreementEntity createLicenseAgreement(LicenseAgreementEntity licenseAgreement,
String user);
+ Collection<FeatureGroupEntity> listFeatureGroups(String vlmId, Version version,
+ String user);
+
FeatureGroupEntity createFeatureGroup(FeatureGroupEntity featureGroup, String user);
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
deleted file mode 100644
index b1141fc5cd..0000000000
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/pom.xml.versionsBackup
+++ /dev/null
@@ -1,53 +0,0 @@
-<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/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 4cccb6712a..b880c67cbc 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
@@ -11,11 +11,7 @@ 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.EntitlementPoolDao;
-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.EntitlementPoolEntity;
-import org.openecomp.sdc.vendorlicense.dao.types.EntitlementTime;
import org.openecomp.sdc.vendorlicense.dao.types.MultiChoiceOrOther;
import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope;
import org.openecomp.sdc.vendorlicense.dao.types.ThresholdUnit;
@@ -214,15 +210,11 @@ public class EntitlementPoolZusammenDaoImpl implements EntitlementPoolDao {
Info info = new Info();
info.setName(entitlementPool.getName());
info.setDescription(entitlementPool.getDescription());
+ info.addProperty("version_uuid", entitlementPool.getVersionUuId());
info.addProperty("thresholdValue", entitlementPool.getThresholdValue());
info.addProperty("threshold_unit", entitlementPool.getThresholdUnit());
- info.addProperty("entitlement_metric", entitlementPool.getEntitlementMetric());
info.addProperty("increments", entitlementPool.getIncrements());
- info.addProperty("aggregation_func", entitlementPool.getAggregationFunction());
info.addProperty("operational_scope", entitlementPool.getOperationalScope());
- info.addProperty("EntitlementTime", entitlementPool.getTime());
- info.addProperty("manufacturerReferenceNumber",
- entitlementPool.getManufacturerReferenceNumber());
info.addProperty("startDate", entitlementPool.getStartDate());
info.addProperty("expiryDate", entitlementPool.getExpiryDate());
entitlementPoolElement.setInfo(info);
@@ -243,6 +235,7 @@ public class EntitlementPoolZusammenDaoImpl implements EntitlementPoolDao {
new EntitlementPoolEntity(vlmId, version, elementInfo.getId().getValue());
entitlmentPool.setName(elementInfo.getInfo().getName());
entitlmentPool.setDescription(elementInfo.getInfo().getDescription());
+ entitlmentPool.setVersionUuId(elementInfo.getInfo().getProperty("version_uuid"));
entitlmentPool
.setThresholdValue(elementInfo.getInfo().getProperty("thresholdValue") != null
? VlmZusammenUtil.toInteger(elementInfo.getInfo().getProperty("thresholdValue")) : null);
@@ -250,17 +243,9 @@ public class EntitlementPoolZusammenDaoImpl implements EntitlementPoolDao {
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"));
- entitlmentPool.setAggregationFunction(
- getAggregationFuncCoiceOrOther(elementInfo.getInfo().getProperty("aggregation_func")));
entitlmentPool.setOperationalScope(getOperationalScopeMultiChoiceOrOther(
elementInfo.getInfo().getProperty("operational_scope")));
- entitlmentPool.setTime(
- getEntitlementTimeCoiceOrOther(elementInfo.getInfo().getProperty("EntitlementTime")));
- entitlmentPool.setManufacturerReferenceNumber(
- elementInfo.getInfo().getProperty("manufacturerReferenceNumber"));
entitlmentPool.setStartDate(elementInfo.getInfo().getProperty("startDate"));
entitlmentPool.setExpiryDate(elementInfo.getInfo().getProperty("expiryDate"));
@@ -272,23 +257,6 @@ public class EntitlementPoolZusammenDaoImpl implements EntitlementPoolDao {
return entitlmentPool;
}
- private ChoiceOrOther<AggregationFunction> getAggregationFuncCoiceOrOther(
- Map aggregationFunction) {
- return new ChoiceOrOther<>
- (AggregationFunction.valueOf((String) aggregationFunction.get("choice")),
- (String) aggregationFunction.get("other"));
- }
-
- private ChoiceOrOther<EntitlementMetric> getEntitlementMetricCoiceOrOther(Map entitlementMetric) {
- return new ChoiceOrOther<>(EntitlementMetric.valueOf((String) entitlementMetric.get("choice")
- ), (String) entitlementMetric.get("other"));
- }
-
- private ChoiceOrOther<EntitlementTime> getEntitlementTimeCoiceOrOther(Map entitlementTime) {
- return new ChoiceOrOther<>(EntitlementTime.valueOf((String) entitlementTime.get("choice")),
- (String) entitlementTime.get("other"));
- }
-
private MultiChoiceOrOther<OperationalScope> getOperationalScopeMultiChoiceOrOther
(Map<String, Object>
operationalScope) {
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 95dfd79cb6..976db94f39 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
@@ -15,6 +15,7 @@ import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity;
import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyType;
import org.openecomp.sdc.vendorlicense.dao.types.MultiChoiceOrOther;
import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope;
+import org.openecomp.sdc.vendorlicense.dao.types.ThresholdUnit;
import org.openecomp.sdc.versioning.dao.types.Version;
import java.util.ArrayList;
@@ -212,8 +213,15 @@ public class LicenseKeyGroupZusammenDaoImpl implements LicenseKeyGroupDao {
Info info = new Info();
info.setName(licenseKeyGroup.getName());
info.setDescription(licenseKeyGroup.getDescription());
+ info.addProperty("version_uuid", licenseKeyGroup.getVersionUuId());
info.addProperty("LicenseKeyType", licenseKeyGroup.getType());
+ info.addProperty("version_uuid", licenseKeyGroup.getVersionUuId());
info.addProperty("operational_scope", licenseKeyGroup.getOperationalScope());
+ info.addProperty("startDate", licenseKeyGroup.getStartDate());
+ info.addProperty("expiryDate", licenseKeyGroup.getExpiryDate());
+ info.addProperty("thresholdValue", licenseKeyGroup.getThresholdValue());
+ info.addProperty("thresholdUnits", licenseKeyGroup.getThresholdUnits());
+ info.addProperty("increments", licenseKeyGroup.getIncrements());
lkgElement.setInfo(info);
if (licenseKeyGroup.getReferencingFeatureGroups() != null
@@ -233,11 +241,23 @@ public class LicenseKeyGroupZusammenDaoImpl implements LicenseKeyGroupDao {
new LicenseKeyGroupEntity(vlmId, version, elementInfo.getId().getValue());
licenseKeyGroup.setName(elementInfo.getInfo().getName());
licenseKeyGroup.setDescription(elementInfo.getInfo().getDescription());
-
+ licenseKeyGroup.setVersionUuId(elementInfo.getInfo().getProperty("version_uuid"));
licenseKeyGroup
.setType(LicenseKeyType.valueOf(elementInfo.getInfo().getProperty("LicenseKeyType")));
+ licenseKeyGroup.setVersionUuId(elementInfo.getInfo().getProperty("version_uuid"));
licenseKeyGroup.setOperationalScope(getOperationalScopeMultiChoiceOrOther(
elementInfo.getInfo().getProperty("operational_scope")));
+ licenseKeyGroup.setStartDate(elementInfo.getInfo().getProperty("startDate"));
+ licenseKeyGroup.setExpiryDate(elementInfo.getInfo().getProperty("expiryDate"));
+ if (elementInfo.getInfo().getProperty("thresholdUnits") != null ){
+ licenseKeyGroup.setThresholdUnits(ThresholdUnit.valueOf(elementInfo
+ .getInfo().getProperty("thresholdUnits")));
+ }
+ if (elementInfo.getInfo().getProperty("thresholdValue") != null ){
+ licenseKeyGroup.setThresholdValue(toInteger(elementInfo.getInfo().getProperty
+ ("thresholdValue")));
+ }
+ licenseKeyGroup.setIncrements(elementInfo.getInfo().getProperty("increments"));
if (elementInfo.getRelations() != null && elementInfo.getRelations().size() > 0) {
licenseKeyGroup
@@ -259,4 +279,15 @@ public class LicenseKeyGroupZusammenDaoImpl implements LicenseKeyGroupDao {
}
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;
+ }
+ 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 857ee7f9fa..5f9dd10816 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
@@ -25,6 +25,7 @@ import static org.openecomp.sdc.vendorlicense.errors.UncompletedVendorLicenseMod
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.apache.commons.collections4.CollectionUtils;
import org.openecomp.core.util.UniqueValueUtil;
import org.openecomp.core.utilities.CommonMethods;
import org.openecomp.sdc.common.errors.CoreException;
@@ -70,10 +71,7 @@ import org.openecomp.sdc.versioning.errors.VersionableSubEntityNotFoundErrorBuil
import org.openecomp.sdc.versioning.types.VersionInfo;
import org.openecomp.sdc.versioning.types.VersionableEntityAction;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
+import java.util.*;
public class VendorLicenseFacadeImpl implements VendorLicenseFacade {
@@ -128,8 +126,6 @@ public class VendorLicenseFacadeImpl implements VendorLicenseFacade {
getVersionInfo(featureGroup.getVendorLicenseModelId(), VersionableEntityAction.Read,
user), user);
featureGroup.setVersion(version);
-
-
return getFeatureGroup(featureGroup);
}
@@ -137,19 +133,9 @@ 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);
- }
+ if (retrieved.getManufacturerReferenceNumber() == null) {
+ updateManufacturerNumberInFeatureGroup(retrieved);
}
-
return retrieved;
}
@@ -400,6 +386,20 @@ public class VendorLicenseFacadeImpl implements VendorLicenseFacade {
}
@Override
+ public Collection<FeatureGroupEntity> listFeatureGroups(String vlmId, Version version,
+ String user) {
+ Collection<FeatureGroupEntity> featureGroupEntities =
+ featureGroupDao.list(new FeatureGroupEntity(vlmId, VersioningUtil
+ .resolveVersion(version, getVersionInfo(vlmId, VersionableEntityAction.Read, user),
+ user), null));
+ featureGroupEntities.stream()
+ .filter(fgEntity -> Objects.isNull(fgEntity.getManufacturerReferenceNumber()))
+ .forEach(fgEntity -> updateManufacturerNumberInFeatureGroup(fgEntity));
+ return featureGroupEntities;
+ }
+
+
+ @Override
public Collection<ErrorCode> validateLicensingData(String vlmId, Version version,
String licenseAgreementId,
Collection<String> featureGroupIds) {
@@ -503,41 +503,49 @@ public class VendorLicenseFacadeImpl implements VendorLicenseFacade {
return retrieved;
}
- private void validateCompletedVendorLicenseModel(String vendorLicenseModelId, String user) {
- Version version = VersioningUtil.resolveVersion(null,
- getVersionInfo(vendorLicenseModelId, VersionableEntityAction.Read, user), user);
- Collection<LicenseAgreementEntity> licenseAgreements = licenseAgreementDao
- .list(new LicenseAgreementEntity(vendorLicenseModelId, version, null));
-
- if (licenseAgreements == null || licenseAgreements.isEmpty()) {
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.SUBMIT_ENTITY, ErrorLevel.ERROR.name(),
- LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.SUBMIT_ENTITY);
- throw new CoreException(
- new SubmitUncompletedLicenseModelErrorBuilder(SUBMIT_UNCOMPLETED_VLM_MSG_MISSING_LA).build());
- }
-
- for (LicenseAgreementEntity licenseAgreement : licenseAgreements) {
- if (licenseAgreement.getFeatureGroupIds() == null || licenseAgreement.getFeatureGroupIds().isEmpty()) {
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.SUBMIT_ENTITY, ErrorLevel.ERROR.name(),
- LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.SUBMIT_ENTITY);
- throw new CoreException(
- new SubmitUncompletedLicenseModelErrorBuilder(SUBMIT_UNCOMPLETED_VLM_MSG_LA_MISSING_FG).build());
+ private void updateManufacturerNumberInFeatureGroup(FeatureGroupEntity featureGroupEntity) {
+ if (CollectionUtils.isNotEmpty(featureGroupEntity.getEntitlementPoolIds())) {
+ Object[] entitlementPoolIdsList = featureGroupEntity.getEntitlementPoolIds().toArray();
+ if (entitlementPoolIdsList != null && entitlementPoolIdsList.length > 0) {
+ String entitlementPoolId = entitlementPoolIdsList[0].toString();
+ EntitlementPoolEntity entitlementPoolEntity =
+ new EntitlementPoolEntity(featureGroupEntity.getVendorLicenseModelId(),
+ featureGroupEntity.getVersion(), entitlementPoolId);
+ entitlementPoolEntity = entitlementPoolDao.get(entitlementPoolEntity);
+ featureGroupEntity.setManufacturerReferenceNumber(
+ entitlementPoolDao.getManufacturerReferenceNumber(entitlementPoolEntity));
+ featureGroupDao.update(featureGroupEntity);
}
}
-
- Collection<FeatureGroupEntity> featureGroupEntities =
- featureGroupDao.list(new FeatureGroupEntity(vendorLicenseModelId, version, null));
- for (FeatureGroupEntity featureGroupEntity : featureGroupEntities) {
- if (featureGroupEntity.getEntitlementPoolIds() == null || featureGroupEntity.getEntitlementPoolIds().isEmpty()) {
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
- LoggerTragetServiceName.SUBMIT_ENTITY, ErrorLevel.ERROR.name(),
- LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.SUBMIT_ENTITY);
- throw new CoreException(
- new SubmitUncompletedLicenseModelErrorBuilder(SUBMIT_UNCOMPLETED_VLM_MSG_FG_MISSING_EP).build());
+ }
+ private void validateCompletedVendorLicenseModel(String vendorLicenseModelId, String user) {
+ Version version = VersioningUtil.resolveVersion(null,
+ getVersionInfo(vendorLicenseModelId, VersionableEntityAction.Read, user), user);
+ Collection<LicenseAgreementEntity> licenseAgreements = licenseAgreementDao
+ .list(new LicenseAgreementEntity(vendorLicenseModelId, version, null));
+
+ if (CollectionUtils.isNotEmpty(licenseAgreements)) {
+ licenseAgreements.forEach(licenseAgreement -> {
+ if (CollectionUtils.isEmpty(licenseAgreement.getFeatureGroupIds())) {
+ MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+ LoggerTragetServiceName.SUBMIT_ENTITY, ErrorLevel.ERROR.name(),
+ LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.SUBMIT_ENTITY);
+ throw new CoreException(
+ new SubmitUncompletedLicenseModelErrorBuilder(SUBMIT_UNCOMPLETED_VLM_MSG_LA_MISSING_FG).build());
+ }
+ });
+
+ Collection<FeatureGroupEntity> featureGroupEntities = featureGroupDao.list(
+ new FeatureGroupEntity(vendorLicenseModelId, version, null));
+ featureGroupEntities.forEach(featureGroupEntity -> {
+ if(CollectionUtils.isEmpty(featureGroupEntity.getEntitlementPoolIds())) {
+ MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+ LoggerTragetServiceName.SUBMIT_ENTITY, ErrorLevel.ERROR.name(),
+ LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.SUBMIT_ENTITY);
+ throw new CoreException(
+ new SubmitUncompletedLicenseModelErrorBuilder(SUBMIT_UNCOMPLETED_VLM_MSG_FG_MISSING_EP).build());
+ }
+ });
}
- }
-
}
}
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 d91a5107af..7d2cdc5474 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
@@ -20,6 +20,7 @@
package org.openecomp.sdc.vendorlicense.licenseartifacts.impl;
+import org.apache.commons.collections.CollectionUtils;
import org.openecomp.core.utilities.file.FileContentHandler;
import org.openecomp.sdc.common.utils.CommonUtil;
import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
@@ -41,6 +42,7 @@ import org.openecomp.sdc.versioning.dao.types.Version;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
+import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
@@ -74,11 +76,15 @@ public class VendorLicenseArtifactsServiceImpl implements VendorLicenseArtifacts
for(EntitlementPoolEntity entitlementPoolEntity : entitlementPoolEntities){
entitlementPoolEntity.setLimits(vendorLicenseFacade.listLimits(vlmId, vlmVersion,
entitlementPoolEntity.getId(), user));
+ entitlementPoolEntity.setManufacturerReferenceNumber(featureGroupModel.
+ getEntityManufacturerReferenceNumber());
}
Set<LicenseKeyGroupEntity> licenseKeyGroupEntities = featureGroupModel.getLicenseKeyGroups();
for(LicenseKeyGroupEntity licenseKeyGroupEntity : licenseKeyGroupEntities){
licenseKeyGroupEntity.setLimits(vendorLicenseFacade.listLimits(vlmId, vlmVersion,
licenseKeyGroupEntity.getId(), user));
+ licenseKeyGroupEntity.setManufacturerReferenceNumber(featureGroupModel.
+ getEntityManufacturerReferenceNumber());
}
featureGroupModel.setEntitlementPools(entitlementPoolEntities.stream().map(
@@ -109,18 +115,29 @@ public class VendorLicenseArtifactsServiceImpl implements VendorLicenseArtifacts
for (Version finalVersion : finalVersions) {
Collection<EntitlementPoolEntity> coll = vendorLicenseFacade.listEntitlementPools(vlmId,
finalVersion, user);
- for(EntitlementPoolEntity entitlementPoolEntity : coll){
+ coll.stream().forEach( entitlementPoolEntity -> {
entitlementPoolEntity.setLimits(vendorLicenseFacade.listLimits(vlmId, finalVersion,
entitlementPoolEntity.getId(), user));
- }
+ Optional<String> manufacturerReferenceNumber = getFeatureGroupManufactureRefNumber
+ (entitlementPoolEntity.getReferencingFeatureGroups(), vlmId, finalVersion, user);
+ manufacturerReferenceNumber.ifPresent(mrn -> entitlementPoolEntity
+ .setManufacturerReferenceNumber(mrn));
+ });
+
entitlementPoolEntities.addAll(coll);
Collection<LicenseKeyGroupEntity> coll2 = vendorLicenseFacade.listLicenseKeyGroups(vlmId,
finalVersion, user);
- for(LicenseKeyGroupEntity licenseKeyGroupEntity : coll2){
+
+ coll2.stream().forEach( licenseKeyGroupEntity -> {
licenseKeyGroupEntity.setLimits(vendorLicenseFacade.listLimits(vlmId, finalVersion,
licenseKeyGroupEntity.getId(), user));
- }
+ Optional<String> manufacturerReferenceNumber = getFeatureGroupManufactureRefNumber
+ (licenseKeyGroupEntity.getReferencingFeatureGroups(), vlmId, finalVersion, user);
+ manufacturerReferenceNumber.ifPresent(mrn -> licenseKeyGroupEntity
+ .setManufacturerReferenceNumber(mrn));
+ });
+
licenseKeyGroupEntities.addAll(coll2);
}
@@ -138,6 +155,23 @@ public class VendorLicenseArtifactsServiceImpl implements VendorLicenseArtifacts
return vendorLicenseArtifact.toXml().getBytes();
}
+ private static Optional<String> getFeatureGroupManufactureRefNumber(Set<String> featureGroupIds,
+ String vlmId, Version finalVersion, String user) {
+ String manufactureReferenceNumber = null;
+ if (CollectionUtils.isNotEmpty(featureGroupIds)) {
+ Object[] featureGroupIdsList = featureGroupIds.toArray();
+ if (featureGroupIdsList != null && featureGroupIdsList.length > 0) {
+ FeatureGroupEntity featureGroup =
+ vendorLicenseFacade.getFeatureGroup(new FeatureGroupEntity(vlmId, finalVersion,
+ featureGroupIdsList[0].toString()), user);
+ manufactureReferenceNumber = featureGroup != null ? featureGroup
+ .getManufacturerReferenceNumber() : null;
+ }
+ }
+ return manufactureReferenceNumber != null ? Optional.of(manufactureReferenceNumber) :
+ Optional.empty();
+ }
+
/**
* Create License Artifacts.
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 936f4da2a7..dc0db0d96c 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
@@ -35,6 +35,7 @@ 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.OperationalScopeForXml;
import org.openecomp.sdc.vendorlicense.dao.types.xml.ThresholdForXml;
import org.openecomp.sdc.vendorlicense.dao.types.xml.LimitForXml;
@@ -64,10 +65,10 @@ public abstract class MixinEntitlementPoolEntityForVendorLicenseArtifact {
@JsonProperty(value = "version")
abstract String getVersionForArtifact();
- @JsonInclude(JsonInclude.Include.NON_NULL)
+ @JsonProperty(value = "start-date")
abstract String getStartDate();
- @JsonInclude(JsonInclude.Include.NON_NULL)
+ @JsonProperty(value = "expiry-date")
abstract String getExpiryDate();
@JsonIgnore
@@ -93,9 +94,8 @@ public abstract class MixinEntitlementPoolEntityForVendorLicenseArtifact {
@JsonIgnore
abstract String getEntityType();
- @JacksonXmlProperty(localName = "value")
- @JacksonXmlElementWrapper(localName = "operational-scope")
- abstract String getOperationalScopeForArtifact();
+ @JsonProperty(value = "operational-scope")
+ abstract OperationalScopeForXml getOperationalScopeForArtifact();
@JsonIgnore
abstract ChoiceOrOther<OperationalScope> getOperationalScope();
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 1a29d5b2c9..8a2d17d9ff 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
@@ -34,6 +34,7 @@ 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.OperationalScopeForXml;
import org.openecomp.sdc.vendorlicense.dao.types.xml.ThresholdForXml;
import org.openecomp.sdc.vendorlicense.dao.types.xml.LimitForXml;
@@ -74,10 +75,10 @@ public abstract class MixinEntitlementPoolEntityForVnfArtifact {
@JsonIgnore
abstract float getThresholdValue();
- @JsonInclude(JsonInclude.Include.NON_NULL)
+ @JsonProperty(value = "start-date")
abstract String getStartDate();
- @JsonInclude(JsonInclude.Include.NON_NULL)
+ @JsonProperty(value = "expiry-date")
abstract String getExpiryDate();
@JsonIgnore
@@ -92,9 +93,8 @@ public abstract class MixinEntitlementPoolEntityForVnfArtifact {
@JsonIgnore
abstract String getEntityType();
- @JacksonXmlProperty(isAttribute = false, localName = "value")
- @JacksonXmlElementWrapper(localName = "operational-scope")
- abstract String getOperationalScopeForArtifact();
+ @JsonProperty(value = "operational-scope")
+ abstract OperationalScopeForXml getOperationalScopeForArtifact();
@JsonIgnore
abstract ChoiceOrOther<OperationalScope> getOperationalScope();
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 75beee4c6a..b8c45ba4c6 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,9 +41,6 @@ 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();
@@ -60,5 +57,8 @@ public abstract class MixinFeatureGroupModel {
@JsonIgnore
abstract String getEntityType();
+ @JsonIgnore
+ abstract String getEntityManufacturerReferenceNumber();
+
}
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 6238988ece..78bf531e82 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
@@ -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,6 +29,8 @@ 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.OperationalScopeForXml;
+import org.openecomp.sdc.vendorlicense.dao.types.xml.ThresholdForXml;
import org.openecomp.sdc.vendorlicense.dao.types.xml.LimitForXml;
import java.util.Collection;
@@ -60,9 +63,8 @@ public abstract class MixinLicenseKeyGroupEntityForVendorLicenseArtifact {
@JsonIgnore
abstract ChoiceOrOther<OperationalScope> getOperationalScope();
- @JacksonXmlProperty(isAttribute = false, localName = "value")
- @JacksonXmlElementWrapper(localName = "operational-scope")
- abstract String getOperationalScopeForArtifact();
+ @JsonProperty(value = "operational-scope")
+ abstract OperationalScopeForXml getOperationalScopeForArtifact();
@JsonIgnore
@@ -80,4 +82,19 @@ public abstract class MixinLicenseKeyGroupEntityForVendorLicenseArtifact {
@JsonIgnore
abstract Collection<LimitEntity> getLimits();
+ @JsonProperty(value = "start-date")
+ abstract String getStartDate();
+
+ @JsonProperty(value = "expiry-date")
+ abstract String getExpiryDate();
+
+ @JsonProperty(value = "threshold-value")
+ abstract ThresholdForXml getThresholdForArtifact();
+
+ @JsonIgnore
+ abstract String getThresholdUnits();
+
+ @JsonIgnore
+ abstract float getThresholdValue();
+
}
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 80ae054db0..b25b93ff7c 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
@@ -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;
@@ -29,6 +30,8 @@ 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 org.openecomp.sdc.vendorlicense.dao.types.xml.OperationalScopeForXml;
+import org.openecomp.sdc.vendorlicense.dao.types.xml.ThresholdForXml;
import java.util.Collection;
import java.util.Set;
@@ -37,6 +40,9 @@ public abstract class MixinLicenseKeyGroupEntityForVnfArtifact {
@JsonIgnore
abstract String getId();
+ @JsonProperty(value = "manufacturer-reference-number")
+ abstract String getManufacturerReferenceNumber();
+
@JsonIgnore
abstract Set<String> getReferencingFeatureGroups();
@@ -63,9 +69,8 @@ public abstract class MixinLicenseKeyGroupEntityForVnfArtifact {
@JsonIgnore
abstract ChoiceOrOther<OperationalScope> getOperationalScope();
- @JacksonXmlProperty(isAttribute = false, localName = "value")
- @JacksonXmlElementWrapper(localName = "operational-scope")
- abstract String getOperationalScopeForArtifact();
+ @JsonProperty(value = "operational-scope")
+ abstract OperationalScopeForXml getOperationalScopeForArtifact();
@JsonIgnore
@@ -74,6 +79,8 @@ public abstract class MixinLicenseKeyGroupEntityForVnfArtifact {
@JsonIgnore
abstract String getVersionableId();
+ @JsonProperty(value = "threshold-value")
+ abstract ThresholdForXml getThresholdForArtifact();
@JsonProperty(value = "sp-limits")
abstract LimitForXml getSPLimits();
@@ -83,4 +90,15 @@ public abstract class MixinLicenseKeyGroupEntityForVnfArtifact {
@JsonIgnore
abstract Collection<LimitEntity> getLimits();
+ @JsonProperty(value = "start-date")
+ abstract String getStartDate();
+
+ @JsonProperty(value = "expiry-date")
+ abstract String getExpiryDate();
+
+ @JsonIgnore
+ abstract String getThresholdUnits();
+
+ @JsonIgnore
+ abstract float getThresholdValue();
}
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
deleted file mode 100644
index 0b6ebb62d8..0000000000
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/pom.xml.versionsBackup
+++ /dev/null
@@ -1,23 +0,0 @@
-<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