summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src
diff options
context:
space:
mode:
authorAvi Ziv <AVIZI@amdocs.com>2017-07-26 17:37:57 +0300
committerAvi Ziv <avi.ziv@amdocs.com>2017-07-26 18:27:22 +0300
commit61070c9c6b665fdea79b3ccdfeafc3a6b50d262e (patch)
treedfe9c169cfac91d6c72ac9ff23375f2aafac6405 /openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src
parentb824a997e19f6ee9627cb1b1e124c756bd8183fc (diff)
[SDC] Full OnBoard health-check and NFoD support
Change-Id: I606f8a52c7e6d2bd5558f824957d890e552c5423 Signed-off-by: Avi Ziv <avi.ziv@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src')
-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
4 files changed, 151 insertions, 119 deletions
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);