aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src')
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/SimpleHealingServiceServiceFactoryImpl.java11
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/VendorLicenseArtifactServiceFactoryImpl.java11
-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/EntitlementPoolDaoFactoryImpl.java14
-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/FeatureGroupDaoFactoryImpl.java14
-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/LicenseAgreementDaoFactoryImpl.java14
-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/LicenseKeyGroupDaoFactoryImpl.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/LimitDaoFactoryImpl.java11
-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/VendorLicenseModelDaoFactoryImpl.java16
-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/ElementPropertyName.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/zusammen/ElementType.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/zusammen/EntitlementPoolZusammenDaoImpl.java345
-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.java439
-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/LicenseAgreementDaoZusammenImpl.java288
-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.java315
-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.java254
-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/VendorLicenseModelDaoZusammenImpl.java206
-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.java59
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToEntitlementPoolConvertor.java135
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToFeatureGroupConvertor.java115
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToLicenseAgreementConvertor.java108
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToLicenseKeyGroupConvertor.java141
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToLimitConvertor.java56
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToVLMGeneralConvertor.java64
-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/VendorLicenseFacadeFactoryImpl.java16
-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.java507
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/healing/impl/SimpleHealingServiceImpl.java66
-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.java249
-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.java76
-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.java98
-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/XmlArtifact.java44
-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.java130
-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.java130
-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.java55
-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.java50
-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.java97
-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.java103
-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.java18
-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/util/VendorLicenseArtifactsServiceUtils.java221
-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/util/VersionableEntitySortByVlmMajorVersion.java17
39 files changed, 1970 insertions, 2546 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/SimpleHealingServiceServiceFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/SimpleHealingServiceServiceFactoryImpl.java
index 987e8f41d5..1eae03d3df 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/SimpleHealingServiceServiceFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/SimpleHealingServiceServiceFactoryImpl.java
@@ -13,18 +13,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorlicense;
import org.openecomp.sdc.vendorlicense.healing.HealingService;
import org.openecomp.sdc.vendorlicense.healing.impl.SimpleHealingServiceImpl;
public class SimpleHealingServiceServiceFactoryImpl extends HealingServiceFactory {
- private static final HealingService INSTANCE = new SimpleHealingServiceImpl();
- @Override
- public HealingService createInterface() {
- return INSTANCE;
- }
+ private static final HealingService INSTANCE = new SimpleHealingServiceImpl();
+ @Override
+ public HealingService 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/VendorLicenseArtifactServiceFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/VendorLicenseArtifactServiceFactoryImpl.java
index 558c32f79c..162af148ae 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/VendorLicenseArtifactServiceFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/VendorLicenseArtifactServiceFactoryImpl.java
@@ -13,18 +13,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorlicense;
import org.openecomp.sdc.vendorlicense.licenseartifacts.VendorLicenseArtifactsService;
import org.openecomp.sdc.vendorlicense.licenseartifacts.impl.VendorLicenseArtifactsServiceImpl;
public class VendorLicenseArtifactServiceFactoryImpl extends VendorLicenseArtifactServiceFactory {
- private static final VendorLicenseArtifactsService INSTANCE = new VendorLicenseArtifactsServiceImpl();
- @Override
- public VendorLicenseArtifactsService createInterface() {
- return INSTANCE;
- }
+ private static final VendorLicenseArtifactsService INSTANCE = new VendorLicenseArtifactsServiceImpl();
+ @Override
+ public VendorLicenseArtifactsService 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/EntitlementPoolDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/EntitlementPoolDaoFactoryImpl.java
index bcabffb4cd..c456fc5339 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/EntitlementPoolDaoFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/EntitlementPoolDaoFactoryImpl.java
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorlicense.dao.impl;
import org.openecomp.core.zusammen.api.ZusammenAdaptorFactory;
@@ -21,13 +20,12 @@ import org.openecomp.sdc.vendorlicense.dao.EntitlementPoolDao;
import org.openecomp.sdc.vendorlicense.dao.EntitlementPoolDaoFactory;
import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.EntitlementPoolZusammenDaoImpl;
-
public class EntitlementPoolDaoFactoryImpl extends EntitlementPoolDaoFactory {
- private static EntitlementPoolDao instance = new EntitlementPoolZusammenDaoImpl(
- ZusammenAdaptorFactory.getInstance().createInterface());
- @Override
- public EntitlementPoolDao createInterface() {
- return instance;
- }
+ private static EntitlementPoolDao instance = new EntitlementPoolZusammenDaoImpl(ZusammenAdaptorFactory.getInstance().createInterface());
+
+ @Override
+ public EntitlementPoolDao 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/FeatureGroupDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/FeatureGroupDaoFactoryImpl.java
index ca0e090567..295f3c82a1 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/FeatureGroupDaoFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/FeatureGroupDaoFactoryImpl.java
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorlicense.dao.impl;
import org.openecomp.core.zusammen.api.ZusammenAdaptorFactory;
@@ -21,13 +20,12 @@ import org.openecomp.sdc.vendorlicense.dao.FeatureGroupDao;
import org.openecomp.sdc.vendorlicense.dao.FeatureGroupDaoFactory;
import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.FeatureGroupDaoZusammenImpl;
-
public class FeatureGroupDaoFactoryImpl extends FeatureGroupDaoFactory {
- private static FeatureGroupDao instance = new FeatureGroupDaoZusammenImpl(
- ZusammenAdaptorFactory.getInstance().createInterface());
- @Override
- public FeatureGroupDao createInterface() {
- return instance;
- }
+ private static FeatureGroupDao instance = new FeatureGroupDaoZusammenImpl(ZusammenAdaptorFactory.getInstance().createInterface());
+
+ @Override
+ public FeatureGroupDao 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/LicenseAgreementDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/LicenseAgreementDaoFactoryImpl.java
index 25a5f69f02..3a18f6a92e 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/LicenseAgreementDaoFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/LicenseAgreementDaoFactoryImpl.java
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorlicense.dao.impl;
import org.openecomp.core.zusammen.api.ZusammenAdaptorFactory;
@@ -22,12 +21,11 @@ import org.openecomp.sdc.vendorlicense.dao.LicenseAgreementDaoFactory;
import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.LicenseAgreementDaoZusammenImpl;
public class LicenseAgreementDaoFactoryImpl extends LicenseAgreementDaoFactory {
-
- private static final LicenseAgreementDao INSTANCE = new LicenseAgreementDaoZusammenImpl(
- ZusammenAdaptorFactory.getInstance().createInterface());
- @Override
- public LicenseAgreementDao createInterface() {
- return INSTANCE;
- }
+ private static final LicenseAgreementDao INSTANCE = new LicenseAgreementDaoZusammenImpl(ZusammenAdaptorFactory.getInstance().createInterface());
+
+ @Override
+ public LicenseAgreementDao 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/LicenseKeyGroupDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/LicenseKeyGroupDaoFactoryImpl.java
index fbe7dd517e..fe614d8d28 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/LicenseKeyGroupDaoFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/LicenseKeyGroupDaoFactoryImpl.java
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorlicense.dao.impl;
import org.openecomp.core.zusammen.api.ZusammenAdaptorFactory;
@@ -22,11 +21,11 @@ import org.openecomp.sdc.vendorlicense.dao.LicenseKeyGroupDaoFactory;
import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.LicenseKeyGroupZusammenDaoImpl;
public class LicenseKeyGroupDaoFactoryImpl extends LicenseKeyGroupDaoFactory {
- private static final LicenseKeyGroupDao INSTANCE = new LicenseKeyGroupZusammenDaoImpl(
- ZusammenAdaptorFactory.getInstance().createInterface());
- @Override
- public LicenseKeyGroupDao createInterface() {
- return INSTANCE;
- }
+ private static final LicenseKeyGroupDao INSTANCE = new LicenseKeyGroupZusammenDaoImpl(ZusammenAdaptorFactory.getInstance().createInterface());
+
+ @Override
+ public LicenseKeyGroupDao 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/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
index bad6d3299f..980fc557a2 100644
--- 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
@@ -26,11 +26,10 @@ import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.LimitZusammenDaoImpl;
public class LimitDaoFactoryImpl extends LimitDaoFactory {
- private static final LimitDao INSTANCE = new LimitZusammenDaoImpl(
- ZusammenAdaptorFactory.getInstance().createInterface());
+ private static final LimitDao INSTANCE = new LimitZusammenDaoImpl(ZusammenAdaptorFactory.getInstance().createInterface());
- @Override
- public LimitDao createInterface() {
- return INSTANCE;
- }
+ @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/VendorLicenseModelDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/VendorLicenseModelDaoFactoryImpl.java
index 79d0677da7..6cdec701c1 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/VendorLicenseModelDaoFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/VendorLicenseModelDaoFactoryImpl.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.dao.impl;
import org.openecomp.core.zusammen.api.ZusammenAdaptorFactory;
@@ -27,11 +26,10 @@ import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.VendorLicenseModelDaoZu
public class VendorLicenseModelDaoFactoryImpl extends VendorLicenseModelDaoFactory {
- private static VendorLicenseModelDao INSTANCE = new VendorLicenseModelDaoZusammenImpl(
- ZusammenAdaptorFactory.getInstance().createInterface());
+ private static VendorLicenseModelDao INSTANCE = new VendorLicenseModelDaoZusammenImpl(ZusammenAdaptorFactory.getInstance().createInterface());
- @Override
- public VendorLicenseModelDao createInterface() {
- return INSTANCE;
- }
+ @Override
+ public VendorLicenseModelDao 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/ElementPropertyName.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/ElementPropertyName.java
index 4b81cfcd87..540bf50362 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/ElementPropertyName.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/ElementPropertyName.java
@@ -19,7 +19,4 @@
*/
package org.openecomp.sdc.vendorlicense.dao.impl.zusammen;
-public enum ElementPropertyName {
- type,
- compositionData
-}
+public enum ElementPropertyName {type, compositionData}
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 6807476605..4dd9ac22e5 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
@@ -19,7 +19,4 @@
*/
package org.openecomp.sdc.vendorlicense.dao.impl.zusammen;
-public enum ElementType {
- Limit
-
-}
+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 e084cf1c1b..aa90df8389 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
@@ -19,6 +19,8 @@
*/
package org.openecomp.sdc.vendorlicense.dao.impl.zusammen;
+import static org.openecomp.core.zusammen.api.ZusammenUtil.buildElement;
+
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;
@@ -27,6 +29,11 @@ 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 java.util.ArrayList;
+import java.util.Collection;
+import java.util.Map;
+import java.util.Optional;
+import java.util.stream.Collectors;
import org.openecomp.core.zusammen.api.ZusammenAdaptor;
import org.openecomp.core.zusammen.api.ZusammenUtil;
import org.openecomp.sdc.datatypes.model.ElementType;
@@ -35,228 +42,162 @@ import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.convertor.ElementToEnti
import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity;
import org.openecomp.types.ElementPropertyName;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Map;
-import java.util.Optional;
-import java.util.stream.Collectors;
-
-import static org.openecomp.core.zusammen.api.ZusammenUtil.buildElement;
-
public class EntitlementPoolZusammenDaoImpl implements EntitlementPoolDao {
- private ZusammenAdaptor zusammenAdaptor;
-
- public EntitlementPoolZusammenDaoImpl(ZusammenAdaptor zusammenAdaptor) {
- this.zusammenAdaptor = zusammenAdaptor;
- }
-
- @Override
- public void registerVersioning(String versionableEntityType) {
- //no need
- }
-
- @Override
- public void create(EntitlementPoolEntity entitlementPool) {
- ZusammenElement entitlementPoolElement =
- buildEntitlementPoolElement(entitlementPool, Action.CREATE);
-
- ZusammenElement entitlementPoolsElement =
- ZusammenUtil.buildStructuralElement(ElementType.EntitlementPools, Action.IGNORE);
-
- ZusammenElement limitsElement =
- ZusammenUtil.buildStructuralElement(ElementType.Limits, Action.CREATE);
-
- entitlementPoolElement.addSubElement(limitsElement);
- entitlementPoolsElement.addSubElement(entitlementPoolElement);
-
- SessionContext context = ZusammenUtil.createSessionContext();
- Element epsSavedElement = zusammenAdaptor.saveElement(context,
- new ElementContext(entitlementPool.getVendorLicenseModelId(),
- entitlementPool.getVersion().getId()),
- entitlementPoolsElement, "Create entitlement pool");
+ private ZusammenAdaptor zusammenAdaptor;
- entitlementPool
- .setId(epsSavedElement.getSubElements().iterator().next().getElementId().getValue());
- }
-
- @Override
- public void update(EntitlementPoolEntity entitlementPool) {
- ZusammenElement entitlmentpoolElement =
- buildEntitlementPoolElement(entitlementPool, Action.UPDATE);
-
- SessionContext context = ZusammenUtil.createSessionContext();
- ElementContext elementContext = new ElementContext(entitlementPool.getVendorLicenseModelId(),
- entitlementPool.getVersion().getId());
-
- Optional<ElementInfo> epFromDb = zusammenAdaptor.getElementInfo(context, elementContext,
- new Id(entitlementPool.getId()));
+ public EntitlementPoolZusammenDaoImpl(ZusammenAdaptor zusammenAdaptor) {
+ this.zusammenAdaptor = zusammenAdaptor;
+ }
- if (epFromDb.isPresent()) {
- if (entitlmentpoolElement.getRelations() == null) {
- entitlmentpoolElement.setRelations(new ArrayList<>());
- }
- if (epFromDb.get().getRelations() != null && !epFromDb.get().getRelations().isEmpty()) {
- entitlmentpoolElement.getRelations().addAll(epFromDb.get().getRelations());
- }
+ @Override
+ public void registerVersioning(String versionableEntityType) {
+ //no need
}
- zusammenAdaptor.saveElement(context, elementContext, entitlmentpoolElement,
- String.format("Update entitlement pool with id %s", entitlementPool.getId()));
- }
+ @Override
+ public void create(EntitlementPoolEntity entitlementPool) {
+ ZusammenElement entitlementPoolElement = buildEntitlementPoolElement(entitlementPool, Action.CREATE);
+ ZusammenElement entitlementPoolsElement = ZusammenUtil.buildStructuralElement(ElementType.EntitlementPools, Action.IGNORE);
+ ZusammenElement limitsElement = ZusammenUtil.buildStructuralElement(ElementType.Limits, Action.CREATE);
+ entitlementPoolElement.addSubElement(limitsElement);
+ entitlementPoolsElement.addSubElement(entitlementPoolElement);
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Element epsSavedElement = zusammenAdaptor
+ .saveElement(context, new ElementContext(entitlementPool.getVendorLicenseModelId(), entitlementPool.getVersion().getId()),
+ entitlementPoolsElement, "Create entitlement pool");
+ entitlementPool.setId(epsSavedElement.getSubElements().iterator().next().getElementId().getValue());
+ }
- @Override
- public EntitlementPoolEntity get(EntitlementPoolEntity entitlementPool) {
- SessionContext context = ZusammenUtil.createSessionContext();
- ElementContext elementContext = new ElementContext(entitlementPool.getVendorLicenseModelId(),
- entitlementPool.getVersion().getId());
- ElementToEntitlementPoolConvertor convertor = new ElementToEntitlementPoolConvertor();
- return zusammenAdaptor.getElementInfo(context, elementContext, new Id(entitlementPool.getId()))
- .map(elementInfo -> {
- EntitlementPoolEntity entity = convertor.convert(elementInfo);
- entity.setVendorLicenseModelId(entitlementPool.getVendorLicenseModelId());
- entity.setVersion(entitlementPool.getVersion());
- return entity;
- })
- .orElse(null);
- }
+ @Override
+ public void update(EntitlementPoolEntity entitlementPool) {
+ ZusammenElement entitlmentpoolElement = buildEntitlementPoolElement(entitlementPool, Action.UPDATE);
+ SessionContext context = ZusammenUtil.createSessionContext();
+ ElementContext elementContext = new ElementContext(entitlementPool.getVendorLicenseModelId(), entitlementPool.getVersion().getId());
+ Optional<ElementInfo> epFromDb = zusammenAdaptor.getElementInfo(context, elementContext, new Id(entitlementPool.getId()));
+ if (epFromDb.isPresent()) {
+ if (entitlmentpoolElement.getRelations() == null) {
+ entitlmentpoolElement.setRelations(new ArrayList<>());
+ }
+ if (epFromDb.get().getRelations() != null && !epFromDb.get().getRelations().isEmpty()) {
+ entitlmentpoolElement.getRelations().addAll(epFromDb.get().getRelations());
+ }
+ }
+ zusammenAdaptor.saveElement(context, elementContext, entitlmentpoolElement,
+ String.format("Update entitlement pool with id %s", entitlementPool.getId()));
+ }
- @Override
- public void delete(EntitlementPoolEntity entitlementPool) {
- ZusammenElement zusammenElement = buildElement(new Id(entitlementPool.getId()), Action.DELETE);
+ @Override
+ public EntitlementPoolEntity get(EntitlementPoolEntity entitlementPool) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ ElementContext elementContext = new ElementContext(entitlementPool.getVendorLicenseModelId(), entitlementPool.getVersion().getId());
+ ElementToEntitlementPoolConvertor convertor = new ElementToEntitlementPoolConvertor();
+ return zusammenAdaptor.getElementInfo(context, elementContext, new Id(entitlementPool.getId())).map(elementInfo -> {
+ EntitlementPoolEntity entity = convertor.convert(elementInfo);
+ entity.setVendorLicenseModelId(entitlementPool.getVendorLicenseModelId());
+ entity.setVersion(entitlementPool.getVersion());
+ return entity;
+ }).orElse(null);
+ }
- SessionContext context = ZusammenUtil.createSessionContext();
- ElementContext elementContext = new ElementContext(entitlementPool.getVendorLicenseModelId(),
- entitlementPool.getVersion().getId());
- zusammenAdaptor.saveElement(context, elementContext, zusammenElement,
- "delete entitlement pool. id:" + entitlementPool.getId() + ".");
- }
+ @Override
+ public void delete(EntitlementPoolEntity entitlementPool) {
+ ZusammenElement zusammenElement = buildElement(new Id(entitlementPool.getId()), Action.DELETE);
+ SessionContext context = ZusammenUtil.createSessionContext();
+ ElementContext elementContext = new ElementContext(entitlementPool.getVendorLicenseModelId(), entitlementPool.getVersion().getId());
+ zusammenAdaptor.saveElement(context, elementContext, zusammenElement, "delete entitlement pool. id:" + entitlementPool.getId() + ".");
+ }
- @Override
- public Collection<EntitlementPoolEntity> list(EntitlementPoolEntity entitlementPool) {
- SessionContext context = ZusammenUtil.createSessionContext();
- ElementContext elementContext = new ElementContext(entitlementPool.getVendorLicenseModelId(),
- entitlementPool.getVersion().getId());
- ElementToEntitlementPoolConvertor convertor = new ElementToEntitlementPoolConvertor();
- return zusammenAdaptor
- .listElementsByName(context, elementContext, null, ElementType.EntitlementPools.name())
- .stream().map(elementInfo -> {
- EntitlementPoolEntity entity = convertor.convert(elementInfo);
- entity.setVendorLicenseModelId(entitlementPool.getVendorLicenseModelId());
- entity.setVersion(entitlementPool.getVersion());
- return entity;
+ @Override
+ public Collection<EntitlementPoolEntity> list(EntitlementPoolEntity entitlementPool) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ ElementContext elementContext = new ElementContext(entitlementPool.getVendorLicenseModelId(), entitlementPool.getVersion().getId());
+ ElementToEntitlementPoolConvertor convertor = new ElementToEntitlementPoolConvertor();
+ return zusammenAdaptor.listElementsByName(context, elementContext, null, ElementType.EntitlementPools.name()).stream().map(elementInfo -> {
+ EntitlementPoolEntity entity = convertor.convert(elementInfo);
+ entity.setVendorLicenseModelId(entitlementPool.getVendorLicenseModelId());
+ entity.setVersion(entitlementPool.getVersion());
+ return entity;
}).collect(Collectors.toList());
- }
-
- @Override
- public long count(EntitlementPoolEntity entitlementPool) {
- SessionContext context = ZusammenUtil.createSessionContext();
- ElementContext elementContext = new ElementContext(entitlementPool.getVendorLicenseModelId(),
- entitlementPool.getVersion().getId());
-
- return zusammenAdaptor
- .listElementsByName(context, elementContext, null, ElementType.EntitlementPools.name())
- .size();
- }
-
- @Override
- public void removeReferencingFeatureGroup(EntitlementPoolEntity entitlementPool,
- String referencingFeatureGroupId) {
- SessionContext context = ZusammenUtil.createSessionContext();
- ElementContext elementContext = new ElementContext(entitlementPool.getVendorLicenseModelId(),
- entitlementPool.getVersion().getId());
-
- Optional<ElementInfo> elementInfo =
- zusammenAdaptor.getElementInfo(context, elementContext, new Id(entitlementPool.getId()));
-
- if (elementInfo.isPresent()) {
- ZusammenElement zusammenElement = VlmZusammenUtil.getZusammenElement(elementInfo.get());
- zusammenElement.setAction(Action.UPDATE);
- zusammenElement.setRelations(elementInfo.get().getRelations().stream()
- .filter(relation -> !referencingFeatureGroupId
- .equals(relation.getEdge2().getElementId().getValue()))
- .collect(Collectors.toList()));
-
- zusammenAdaptor.saveElement(context, elementContext, zusammenElement,
- "remove referencing feature group");
}
- }
- @Override
- public void addReferencingFeatureGroup(EntitlementPoolEntity entitlementPool,
- String referencingFeatureGroupId) {
- SessionContext context = ZusammenUtil.createSessionContext();
- ElementContext elementContext = new ElementContext(entitlementPool.getVendorLicenseModelId(),
- entitlementPool.getVersion().getId());
+ @Override
+ public long count(EntitlementPoolEntity entitlementPool) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ ElementContext elementContext = new ElementContext(entitlementPool.getVendorLicenseModelId(), entitlementPool.getVersion().getId());
+ return zusammenAdaptor.listElementsByName(context, elementContext, null, ElementType.EntitlementPools.name()).size();
+ }
- Optional<ElementInfo> elementInfo =
- zusammenAdaptor.getElementInfo(context, elementContext, new Id(entitlementPool.getId()));
+ @Override
+ public void removeReferencingFeatureGroup(EntitlementPoolEntity entitlementPool, String referencingFeatureGroupId) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ ElementContext elementContext = new ElementContext(entitlementPool.getVendorLicenseModelId(), entitlementPool.getVersion().getId());
+ Optional<ElementInfo> elementInfo = zusammenAdaptor.getElementInfo(context, elementContext, new Id(entitlementPool.getId()));
+ if (elementInfo.isPresent()) {
+ ZusammenElement zusammenElement = VlmZusammenUtil.getZusammenElement(elementInfo.get());
+ zusammenElement.setAction(Action.UPDATE);
+ zusammenElement.setRelations(elementInfo.get().getRelations().stream()
+ .filter(relation -> !referencingFeatureGroupId.equals(relation.getEdge2().getElementId().getValue())).collect(Collectors.toList()));
+ zusammenAdaptor.saveElement(context, elementContext, zusammenElement, "remove referencing feature group");
+ }
+ }
- if (elementInfo.isPresent()) {
- ZusammenElement zusammenElement = VlmZusammenUtil.getZusammenElement(elementInfo.get());
- zusammenElement.setAction(Action.UPDATE);
- if (zusammenElement.getRelations() == null) {
- zusammenElement.setRelations(new ArrayList<>());
- }
- zusammenElement.getRelations().add(VlmZusammenUtil
- .createRelation(RelationType.EntitlmentPoolToReferencingFeatureGroup,
- referencingFeatureGroupId));
- zusammenAdaptor
- .saveElement(context, elementContext, zusammenElement, "add referencing feature group");
+ @Override
+ public void addReferencingFeatureGroup(EntitlementPoolEntity entitlementPool, String referencingFeatureGroupId) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ ElementContext elementContext = new ElementContext(entitlementPool.getVendorLicenseModelId(), entitlementPool.getVersion().getId());
+ Optional<ElementInfo> elementInfo = zusammenAdaptor.getElementInfo(context, elementContext, new Id(entitlementPool.getId()));
+ if (elementInfo.isPresent()) {
+ ZusammenElement zusammenElement = VlmZusammenUtil.getZusammenElement(elementInfo.get());
+ zusammenElement.setAction(Action.UPDATE);
+ if (zusammenElement.getRelations() == null) {
+ zusammenElement.setRelations(new ArrayList<>());
+ }
+ zusammenElement.getRelations()
+ .add(VlmZusammenUtil.createRelation(RelationType.EntitlmentPoolToReferencingFeatureGroup, referencingFeatureGroupId));
+ zusammenAdaptor.saveElement(context, elementContext, zusammenElement, "add referencing feature group");
+ }
}
- }
- @Override
- public void deleteAll(EntitlementPoolEntity entitlementPool) {
- //not supported
- }
+ @Override
+ public void deleteAll(EntitlementPoolEntity entitlementPool) {
+ //not supported
+ }
- @Override
- public String getManufacturerReferenceNumber(EntitlementPoolEntity entitlementPoolEntity) {
- SessionContext context = ZusammenUtil.createSessionContext();
- ElementContext elementContext =
- new ElementContext(entitlementPoolEntity.getVendorLicenseModelId(),
+ @Override
+ public String getManufacturerReferenceNumber(EntitlementPoolEntity entitlementPoolEntity) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ ElementContext elementContext = new ElementContext(entitlementPoolEntity.getVendorLicenseModelId(),
entitlementPoolEntity.getVersion().getId());
-
- 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");
+ 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");
+ }
+ return manufacturerReferenceNumber;
}
- return manufacturerReferenceNumber;
- }
-
- private ZusammenElement buildEntitlementPoolElement(EntitlementPoolEntity entitlementPool,
- Action action) {
- ZusammenElement entitlementPoolElement =
- buildElement(entitlementPool.getId() == null ? null : new Id(entitlementPool.getId()),
- action);
- Info info = new Info();
- info.setName(entitlementPool.getName());
- info.setDescription(entitlementPool.getDescription());
- info.addProperty(ElementPropertyName.elementType.name(), ElementType.EntitlementPool);
- info.addProperty("version_uuid", entitlementPool.getVersionUuId());
- info.addProperty("EntitlementPoolType", entitlementPool.getType());
- info.addProperty("thresholdValue", entitlementPool.getThresholdValue());
- info.addProperty("threshold_unit", entitlementPool.getThresholdUnit());
- info.addProperty("increments", entitlementPool.getIncrements());
- info.addProperty("operational_scope", entitlementPool.getOperationalScope());
- info.addProperty("startDate", entitlementPool.getStartDate());
- info.addProperty("expiryDate", entitlementPool.getExpiryDate());
- info.addProperty("manufacturerReferenceNumber", entitlementPool.getManufacturerReferenceNumber());
- entitlementPoolElement.setInfo(info);
- if (entitlementPool.getReferencingFeatureGroups() != null
- && !entitlementPool.getReferencingFeatureGroups().isEmpty()) {
- entitlementPoolElement.setRelations(entitlementPool.getReferencingFeatureGroups().stream()
- .map(rel -> VlmZusammenUtil
- .createRelation(RelationType.EntitlmentPoolToReferencingFeatureGroup, rel))
- .collect(Collectors.toList()));
+ private ZusammenElement buildEntitlementPoolElement(EntitlementPoolEntity entitlementPool, Action action) {
+ ZusammenElement entitlementPoolElement = buildElement(entitlementPool.getId() == null ? null : new Id(entitlementPool.getId()), action);
+ Info info = new Info();
+ info.setName(entitlementPool.getName());
+ info.setDescription(entitlementPool.getDescription());
+ info.addProperty(ElementPropertyName.elementType.name(), ElementType.EntitlementPool);
+ info.addProperty("version_uuid", entitlementPool.getVersionUuId());
+ info.addProperty("EntitlementPoolType", entitlementPool.getType());
+ info.addProperty("thresholdValue", entitlementPool.getThresholdValue());
+ info.addProperty("threshold_unit", entitlementPool.getThresholdUnit());
+ info.addProperty("increments", entitlementPool.getIncrements());
+ info.addProperty("operational_scope", entitlementPool.getOperationalScope());
+ info.addProperty("startDate", entitlementPool.getStartDate());
+ info.addProperty("expiryDate", entitlementPool.getExpiryDate());
+ info.addProperty("manufacturerReferenceNumber", entitlementPool.getManufacturerReferenceNumber());
+ entitlementPoolElement.setInfo(info);
+ if (entitlementPool.getReferencingFeatureGroups() != null && !entitlementPool.getReferencingFeatureGroups().isEmpty()) {
+ entitlementPoolElement.setRelations(entitlementPool.getReferencingFeatureGroups().stream()
+ .map(rel -> VlmZusammenUtil.createRelation(RelationType.EntitlmentPoolToReferencingFeatureGroup, rel)).collect(Collectors.toList()));
+ }
+ return entitlementPoolElement;
}
- return entitlementPoolElement;
- }
-
-
}
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 fce2722e63..aacb10982d 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
@@ -19,6 +19,10 @@
*/
package org.openecomp.sdc.vendorlicense.dao.impl.zusammen;
+import static org.openecomp.core.zusammen.api.ZusammenUtil.buildElement;
+import static org.openecomp.core.zusammen.api.ZusammenUtil.buildStructuralElement;
+import static org.openecomp.core.zusammen.api.ZusammenUtil.createSessionContext;
+
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;
@@ -28,6 +32,11 @@ import com.amdocs.zusammen.datatypes.item.Action;
import com.amdocs.zusammen.datatypes.item.ElementContext;
import com.amdocs.zusammen.datatypes.item.Info;
import com.amdocs.zusammen.datatypes.item.Relation;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Optional;
+import java.util.Set;
+import java.util.stream.Collectors;
import org.openecomp.core.zusammen.api.ZusammenAdaptor;
import org.openecomp.sdc.datatypes.model.ElementType;
import org.openecomp.sdc.vendorlicense.dao.FeatureGroupDao;
@@ -35,289 +44,199 @@ import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.convertor.ElementToFeat
import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity;
import org.openecomp.types.ElementPropertyName;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Optional;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-import static org.openecomp.core.zusammen.api.ZusammenUtil.*;
-
public class FeatureGroupDaoZusammenImpl implements FeatureGroupDao {
- private ZusammenAdaptor zusammenAdaptor;
-
- public FeatureGroupDaoZusammenImpl(ZusammenAdaptor zusammenAdaptor) {
- this.zusammenAdaptor = zusammenAdaptor;
- }
-
- @Override
- public void registerVersioning(String versionableEntityType) {
- //no need
- }
-
- @Override
- public void create(FeatureGroupEntity featureGroup) {
- ZusammenElement featureGroupElement = buildFeatureGroupElement(featureGroup, Action.CREATE);
-
- ZusammenElement featureGroupsElement =
- buildStructuralElement(ElementType.FeatureGroups, Action.IGNORE);
-
- featureGroupsElement.addSubElement(featureGroupElement);
-
- SessionContext context = createSessionContext();
- Element featureGroupsSavedElement = zusammenAdaptor.saveElement(context,
- new ElementContext(featureGroup.getVendorLicenseModelId(),
- featureGroup.getVersion().getId()), featureGroupsElement, "Create feature group");
-
- featureGroup.setId(
- featureGroupsSavedElement.getSubElements().iterator().next().getElementId().getValue());
- }
-
- @Override
- public void update(FeatureGroupEntity featureGroup) {
- ZusammenElement featureGroupElement = buildFeatureGroupElement(featureGroup, Action.UPDATE);
-
- SessionContext context = createSessionContext();
- zusammenAdaptor.saveElement(context, new ElementContext(featureGroup.getVendorLicenseModelId(),
- featureGroup.getVersion().getId()), featureGroupElement,
- String.format("Update feature group with id %s", featureGroup.getId()));
- }
-
- @Override
- public FeatureGroupEntity get(FeatureGroupEntity featureGroup) {
- SessionContext context = createSessionContext();
- ElementContext elementContext = new ElementContext(featureGroup.getVendorLicenseModelId(),
- featureGroup.getVersion().getId());
-
- return zusammenAdaptor.getElementInfo(context, elementContext, new Id(featureGroup.getId()))
- .map(elementInfo -> {
- FeatureGroupEntity entity = new ElementToFeatureGroupConvertor().convert(elementInfo);
- entity.setVendorLicenseModelId(featureGroup.getVendorLicenseModelId());
- entity.setVersion(featureGroup.getVersion());
- return entity;
- })
- .orElse(null);
- }
+ private ZusammenAdaptor zusammenAdaptor;
- @Override
- public void delete(FeatureGroupEntity featureGroup) {
- ZusammenElement zusammenElement = buildElement(new Id(featureGroup.getId()), Action.DELETE);
-
- SessionContext context = createSessionContext();
- ElementContext elementContext = new ElementContext(featureGroup.getVendorLicenseModelId(),
- featureGroup.getVersion().getId());
- zusammenAdaptor.saveElement(context, elementContext, zusammenElement,
- "delete feature group. id:" + featureGroup.getId() + ".");
- }
-
- @Override
- public Collection<FeatureGroupEntity> list(FeatureGroupEntity featureGroup) {
- SessionContext context = createSessionContext();
- ElementContext elementContext = new ElementContext(featureGroup.getVendorLicenseModelId(),
- featureGroup.getVersion().getId());
-
- ElementToFeatureGroupConvertor convertor = new ElementToFeatureGroupConvertor();
- return zusammenAdaptor
- .listElementsByName(context, elementContext, null, ElementType.FeatureGroups.name())
- .stream().map(elementInfo -> {
- FeatureGroupEntity entity = convertor.convert(
- elementInfo);
- entity.setVendorLicenseModelId(featureGroup.getVendorLicenseModelId());
- entity.setVersion(featureGroup.getVersion());
- return entity;
- })
- .collect(Collectors.toList());
- }
-
- @Override
- public long count(FeatureGroupEntity featureGroup) {
- SessionContext context = createSessionContext();
- ElementContext elementContext = new ElementContext(featureGroup.getVendorLicenseModelId(),
- featureGroup.getVersion().getId());
-
- return zusammenAdaptor
- .listElementsByName(context, elementContext, null, ElementType.FeatureGroups.name())
- .size();
- }
-
- @Override
- public void removeEntitlementPool(FeatureGroupEntity featureGroup, String entitlementPoolId) {
- removeRelationToContainedEntity(featureGroup, entitlementPoolId, "entitlement pool");
- }
-
- @Override
- public void removeLicenseKeyGroup(FeatureGroupEntity featureGroup, String licenseKeyGroupId) {
- removeRelationToContainedEntity(featureGroup, licenseKeyGroupId, "license Key Group");
- }
-
- private void removeRelationToContainedEntity(FeatureGroupEntity featureGroup,
- String containedEntityId,
- String containedEntityType) {
- SessionContext context = createSessionContext();
- ElementContext elementContext = new ElementContext(featureGroup.getVendorLicenseModelId(),
- featureGroup.getVersion().getId());
-
- Optional<ElementInfo> elementInfo = zusammenAdaptor.getElementInfo(context,
- elementContext, new Id(featureGroup.getId()));
- if (elementInfo.isPresent()) {
- ZusammenElement zusammenElement = VlmZusammenUtil.getZusammenElement(elementInfo.get());
- zusammenElement.setAction(Action.UPDATE);
- zusammenElement.setRelations(elementInfo.get().getRelations().stream()
- .filter(
- relation -> !containedEntityId.equals(relation.getEdge2().getElementId().getValue()))
- .collect(Collectors.toList()));
- zusammenAdaptor.saveElement(context, elementContext, zusammenElement,
- String.format("remove %s", containedEntityType));
+ public FeatureGroupDaoZusammenImpl(ZusammenAdaptor zusammenAdaptor) {
+ this.zusammenAdaptor = zusammenAdaptor;
}
- }
-
- @Override
- public void updateFeatureGroup(FeatureGroupEntity featureGroup,
- Set<String> addedEntitlementPools,
- Set<String> removedEntitlementPools,
- Set<String> addedLicenseKeyGroups,
- Set<String> removedLicenseKeyGroups) {
- ZusammenElement featureGroupElement = buildFeatureGroupElement(featureGroup, Action.UPDATE);
- SessionContext context = createSessionContext();
- ElementContext elementContext = new ElementContext(featureGroup.getVendorLicenseModelId(),
- featureGroup.getVersion().getId());
- ElementToFeatureGroupConvertor convertor = new ElementToFeatureGroupConvertor();
- Optional<ElementInfo> elementInfo = zusammenAdaptor.getElementInfo(context,
- elementContext, new Id(featureGroup.getId()));
- if (elementInfo.isPresent()) {
- FeatureGroupEntity currentFeatureGroup = convertor.convert(elementInfo.get());
- currentFeatureGroup.setVendorLicenseModelId(featureGroup.getVendorLicenseModelId());
- currentFeatureGroup.setVersion(featureGroup.getVersion());
- if (!(removedEntitlementPools == null)) {
- currentFeatureGroup.getEntitlementPoolIds().removeAll(removedEntitlementPools);
- }
- if (!(addedEntitlementPools == null)) {
- currentFeatureGroup.getEntitlementPoolIds().addAll(addedEntitlementPools);
- }
-
- if (featureGroupElement.getRelations() == null) {
- featureGroupElement.setRelations(new ArrayList<>());
- }
- featureGroupElement.getRelations()
- .addAll(currentFeatureGroup.getEntitlementPoolIds().stream()
- .map(relation -> VlmZusammenUtil
- .createRelation(RelationType.FeatureGroupToEntitlmentPool, relation))
- .collect(Collectors.toList()));
- if (!(removedLicenseKeyGroups == null)) {
- currentFeatureGroup.getLicenseKeyGroupIds().removeAll(removedLicenseKeyGroups);
- }
- if (!(addedLicenseKeyGroups == null)) {
- currentFeatureGroup.getLicenseKeyGroupIds().addAll(addedLicenseKeyGroups);
- }
-
- featureGroupElement.getRelations()
- .addAll(currentFeatureGroup.getLicenseKeyGroupIds().stream()
- .map(relation -> VlmZusammenUtil
- .createRelation(RelationType.FeatureGroupToLicenseKeyGroup, relation))
- .collect(Collectors.toList()));
-
- Collection<Relation> laRelations = elementInfo.get().getRelations().stream().filter
- (rel -> rel.getType()
- .equals(RelationType.FeatureGroupToReferencingLicenseAgreement.name()))
- .map(rel -> VlmZusammenUtil.createRelation(RelationType
- .FeatureGroupToReferencingLicenseAgreement, rel.getEdge2().getElementId().toString()))
- .collect(Collectors.toList());
+ @Override
+ public void registerVersioning(String versionableEntityType) {
+ //no need
+ }
- featureGroupElement.getRelations().addAll(laRelations);
+ @Override
+ public void create(FeatureGroupEntity featureGroup) {
+ ZusammenElement featureGroupElement = buildFeatureGroupElement(featureGroup, Action.CREATE);
+ ZusammenElement featureGroupsElement = buildStructuralElement(ElementType.FeatureGroups, Action.IGNORE);
+ featureGroupsElement.addSubElement(featureGroupElement);
+ SessionContext context = createSessionContext();
+ Element featureGroupsSavedElement = zusammenAdaptor
+ .saveElement(context, new ElementContext(featureGroup.getVendorLicenseModelId(), featureGroup.getVersion().getId()), featureGroupsElement,
+ "Create feature group");
+ featureGroup.setId(featureGroupsSavedElement.getSubElements().iterator().next().getElementId().getValue());
+ }
- zusammenAdaptor
- .saveElement(context, elementContext, featureGroupElement, "update feature group");
+ @Override
+ public void update(FeatureGroupEntity featureGroup) {
+ ZusammenElement featureGroupElement = buildFeatureGroupElement(featureGroup, Action.UPDATE);
+ SessionContext context = createSessionContext();
+ zusammenAdaptor
+ .saveElement(context, new ElementContext(featureGroup.getVendorLicenseModelId(), featureGroup.getVersion().getId()), featureGroupElement,
+ String.format("Update feature group with id %s", featureGroup.getId()));
}
- }
- @Override
- public void deleteAll(FeatureGroupEntity featureGroup) {
- //not supported
- }
+ @Override
+ public FeatureGroupEntity get(FeatureGroupEntity featureGroup) {
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(featureGroup.getVendorLicenseModelId(), featureGroup.getVersion().getId());
+ return zusammenAdaptor.getElementInfo(context, elementContext, new Id(featureGroup.getId())).map(elementInfo -> {
+ FeatureGroupEntity entity = new ElementToFeatureGroupConvertor().convert(elementInfo);
+ entity.setVendorLicenseModelId(featureGroup.getVendorLicenseModelId());
+ entity.setVersion(featureGroup.getVersion());
+ return entity;
+ }).orElse(null);
+ }
+ @Override
+ public void delete(FeatureGroupEntity featureGroup) {
+ ZusammenElement zusammenElement = buildElement(new Id(featureGroup.getId()), Action.DELETE);
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(featureGroup.getVendorLicenseModelId(), featureGroup.getVersion().getId());
+ zusammenAdaptor.saveElement(context, elementContext, zusammenElement, "delete feature group. id:" + featureGroup.getId() + ".");
+ }
- @Override
- public void addReferencingLicenseAgreement(FeatureGroupEntity featureGroup,
- String licenseAgreementId) {
- SessionContext context = createSessionContext();
- ElementContext elementContext = new ElementContext(featureGroup.getVendorLicenseModelId(),
- featureGroup.getVersion().getId());
+ @Override
+ public Collection<FeatureGroupEntity> list(FeatureGroupEntity featureGroup) {
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(featureGroup.getVendorLicenseModelId(), featureGroup.getVersion().getId());
+ ElementToFeatureGroupConvertor convertor = new ElementToFeatureGroupConvertor();
+ return zusammenAdaptor.listElementsByName(context, elementContext, null, ElementType.FeatureGroups.name()).stream().map(elementInfo -> {
+ FeatureGroupEntity entity = convertor.convert(elementInfo);
+ entity.setVendorLicenseModelId(featureGroup.getVendorLicenseModelId());
+ entity.setVersion(featureGroup.getVersion());
+ return entity;
+ }).collect(Collectors.toList());
+ }
- Optional<ElementInfo> elementInfo =
- zusammenAdaptor.getElementInfo(context, elementContext, new Id(featureGroup.getId()));
- if (elementInfo.isPresent()) {
- ZusammenElement zusammenElement = VlmZusammenUtil.getZusammenElement(elementInfo.get());
- zusammenElement.setAction(Action.UPDATE);
- zusammenElement.getRelations().add(VlmZusammenUtil
- .createRelation(RelationType.FeatureGroupToReferencingLicenseAgreement,
- licenseAgreementId));
- zusammenAdaptor.saveElement(context, elementContext, zusammenElement,
- "add referencing license agreement");
+ @Override
+ public long count(FeatureGroupEntity featureGroup) {
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(featureGroup.getVendorLicenseModelId(), featureGroup.getVersion().getId());
+ return zusammenAdaptor.listElementsByName(context, elementContext, null, ElementType.FeatureGroups.name()).size();
}
- }
- @Override
- public void removeReferencingLicenseAgreement(FeatureGroupEntity featureGroup,
- String licenseAgreementId) {
- SessionContext context = createSessionContext();
- ElementContext elementContext = new ElementContext(featureGroup.getVendorLicenseModelId(),
- featureGroup.getVersion().getId());
+ @Override
+ public void removeEntitlementPool(FeatureGroupEntity featureGroup, String entitlementPoolId) {
+ removeRelationToContainedEntity(featureGroup, entitlementPoolId, "entitlement pool");
+ }
- Optional<ElementInfo> elementInfo =
- zusammenAdaptor.getElementInfo(context, elementContext, new Id(featureGroup.getId()));
- if (elementInfo.isPresent()) {
- ZusammenElement zusammenElement = VlmZusammenUtil.getZusammenElement(elementInfo.get());
- zusammenElement.setAction(Action.UPDATE);
- zusammenElement.setRelations(elementInfo.get().getRelations().stream()
- .filter(
- relation -> !licenseAgreementId.equals(relation.getEdge2().getElementId().getValue()))
- .collect(Collectors.toList()));
+ @Override
+ public void removeLicenseKeyGroup(FeatureGroupEntity featureGroup, String licenseKeyGroupId) {
+ removeRelationToContainedEntity(featureGroup, licenseKeyGroupId, "license Key Group");
+ }
- zusammenAdaptor.saveElement(context, elementContext, zusammenElement,
- "remove referencing license agreement");
+ private void removeRelationToContainedEntity(FeatureGroupEntity featureGroup, String containedEntityId, String containedEntityType) {
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(featureGroup.getVendorLicenseModelId(), featureGroup.getVersion().getId());
+ Optional<ElementInfo> elementInfo = zusammenAdaptor.getElementInfo(context, elementContext, new Id(featureGroup.getId()));
+ if (elementInfo.isPresent()) {
+ ZusammenElement zusammenElement = VlmZusammenUtil.getZusammenElement(elementInfo.get());
+ zusammenElement.setAction(Action.UPDATE);
+ zusammenElement.setRelations(
+ elementInfo.get().getRelations().stream().filter(relation -> !containedEntityId.equals(relation.getEdge2().getElementId().getValue()))
+ .collect(Collectors.toList()));
+ zusammenAdaptor.saveElement(context, elementContext, zusammenElement, String.format("remove %s", containedEntityType));
+ }
}
- }
- private ZusammenElement buildFeatureGroupElement(FeatureGroupEntity featureGroup, Action action) {
- ZusammenElement featureGroupElement =
- buildElement(featureGroup.getId() == null ? null : new Id(featureGroup.getId()), action);
- Info info = new Info();
- info.setName(featureGroup.getName());
- info.setDescription(featureGroup.getDescription());
- info.addProperty(ElementPropertyName.elementType.name(), ElementType.FeatureGroup);
- info.addProperty("partNumber", featureGroup.getPartNumber());
- featureGroupElement.setInfo(info);
+ @Override
+ public void updateFeatureGroup(FeatureGroupEntity featureGroup, Set<String> addedEntitlementPools, Set<String> removedEntitlementPools,
+ Set<String> addedLicenseKeyGroups, Set<String> removedLicenseKeyGroups) {
+ ZusammenElement featureGroupElement = buildFeatureGroupElement(featureGroup, Action.UPDATE);
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(featureGroup.getVendorLicenseModelId(), featureGroup.getVersion().getId());
+ ElementToFeatureGroupConvertor convertor = new ElementToFeatureGroupConvertor();
+ Optional<ElementInfo> elementInfo = zusammenAdaptor.getElementInfo(context, elementContext, new Id(featureGroup.getId()));
+ if (elementInfo.isPresent()) {
+ FeatureGroupEntity currentFeatureGroup = convertor.convert(elementInfo.get());
+ currentFeatureGroup.setVendorLicenseModelId(featureGroup.getVendorLicenseModelId());
+ currentFeatureGroup.setVersion(featureGroup.getVersion());
+ if (!(removedEntitlementPools == null)) {
+ currentFeatureGroup.getEntitlementPoolIds().removeAll(removedEntitlementPools);
+ }
+ if (!(addedEntitlementPools == null)) {
+ currentFeatureGroup.getEntitlementPoolIds().addAll(addedEntitlementPools);
+ }
+ if (featureGroupElement.getRelations() == null) {
+ featureGroupElement.setRelations(new ArrayList<>());
+ }
+ featureGroupElement.getRelations().addAll(currentFeatureGroup.getEntitlementPoolIds().stream()
+ .map(relation -> VlmZusammenUtil.createRelation(RelationType.FeatureGroupToEntitlmentPool, relation)).collect(Collectors.toList()));
+ if (!(removedLicenseKeyGroups == null)) {
+ currentFeatureGroup.getLicenseKeyGroupIds().removeAll(removedLicenseKeyGroups);
+ }
+ if (!(addedLicenseKeyGroups == null)) {
+ currentFeatureGroup.getLicenseKeyGroupIds().addAll(addedLicenseKeyGroups);
+ }
+ featureGroupElement.getRelations().addAll(currentFeatureGroup.getLicenseKeyGroupIds().stream()
+ .map(relation -> VlmZusammenUtil.createRelation(RelationType.FeatureGroupToLicenseKeyGroup, relation)).collect(Collectors.toList()));
+ Collection<Relation> laRelations = elementInfo.get().getRelations().stream()
+ .filter(rel -> rel.getType().equals(RelationType.FeatureGroupToReferencingLicenseAgreement.name())).map(rel -> VlmZusammenUtil
+ .createRelation(RelationType.FeatureGroupToReferencingLicenseAgreement, rel.getEdge2().getElementId().toString()))
+ .collect(Collectors.toList());
+ featureGroupElement.getRelations().addAll(laRelations);
+ zusammenAdaptor.saveElement(context, elementContext, featureGroupElement, "update feature group");
+ }
+ }
- featureGroupElement.setRelations(new ArrayList<>());
+ @Override
+ public void deleteAll(FeatureGroupEntity featureGroup) {
+ //not supported
+ }
- if (featureGroup.getEntitlementPoolIds() != null &&
- !featureGroup.getEntitlementPoolIds().isEmpty()) {
- featureGroupElement.getRelations().addAll(featureGroup.getEntitlementPoolIds().stream()
- .map(rel -> VlmZusammenUtil
- .createRelation(RelationType.FeatureGroupToEntitlmentPool, rel))
- .collect(Collectors.toList()));
+ @Override
+ public void addReferencingLicenseAgreement(FeatureGroupEntity featureGroup, String licenseAgreementId) {
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(featureGroup.getVendorLicenseModelId(), featureGroup.getVersion().getId());
+ Optional<ElementInfo> elementInfo = zusammenAdaptor.getElementInfo(context, elementContext, new Id(featureGroup.getId()));
+ if (elementInfo.isPresent()) {
+ ZusammenElement zusammenElement = VlmZusammenUtil.getZusammenElement(elementInfo.get());
+ zusammenElement.setAction(Action.UPDATE);
+ zusammenElement.getRelations()
+ .add(VlmZusammenUtil.createRelation(RelationType.FeatureGroupToReferencingLicenseAgreement, licenseAgreementId));
+ zusammenAdaptor.saveElement(context, elementContext, zusammenElement, "add referencing license agreement");
+ }
}
- if (featureGroup.getLicenseKeyGroupIds() != null &&
- !featureGroup.getLicenseKeyGroupIds().isEmpty()) {
- featureGroupElement.getRelations()
- .addAll(featureGroup.getLicenseKeyGroupIds().stream()
- .map(rel -> VlmZusammenUtil
- .createRelation(RelationType.FeatureGroupToLicenseKeyGroup, rel))
- .collect(Collectors.toList()));
+ @Override
+ public void removeReferencingLicenseAgreement(FeatureGroupEntity featureGroup, String licenseAgreementId) {
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(featureGroup.getVendorLicenseModelId(), featureGroup.getVersion().getId());
+ Optional<ElementInfo> elementInfo = zusammenAdaptor.getElementInfo(context, elementContext, new Id(featureGroup.getId()));
+ if (elementInfo.isPresent()) {
+ ZusammenElement zusammenElement = VlmZusammenUtil.getZusammenElement(elementInfo.get());
+ zusammenElement.setAction(Action.UPDATE);
+ zusammenElement.setRelations(elementInfo.get().getRelations().stream()
+ .filter(relation -> !licenseAgreementId.equals(relation.getEdge2().getElementId().getValue())).collect(Collectors.toList()));
+ zusammenAdaptor.saveElement(context, elementContext, zusammenElement, "remove referencing license agreement");
+ }
}
- if (featureGroup.getReferencingLicenseAgreements() != null &&
- !featureGroup.getReferencingLicenseAgreements().isEmpty()) {
- featureGroupElement.getRelations()
- .addAll(featureGroup.getReferencingLicenseAgreements().stream()
- .map(rel -> VlmZusammenUtil
- .createRelation(RelationType.FeatureGroupToReferencingLicenseAgreement,
- rel))
- .collect(Collectors.toList()));
+ private ZusammenElement buildFeatureGroupElement(FeatureGroupEntity featureGroup, Action action) {
+ ZusammenElement featureGroupElement = buildElement(featureGroup.getId() == null ? null : new Id(featureGroup.getId()), action);
+ Info info = new Info();
+ info.setName(featureGroup.getName());
+ info.setDescription(featureGroup.getDescription());
+ info.addProperty(ElementPropertyName.elementType.name(), ElementType.FeatureGroup);
+ info.addProperty("partNumber", featureGroup.getPartNumber());
+ featureGroupElement.setInfo(info);
+ featureGroupElement.setRelations(new ArrayList<>());
+ if (featureGroup.getEntitlementPoolIds() != null && !featureGroup.getEntitlementPoolIds().isEmpty()) {
+ featureGroupElement.getRelations().addAll(featureGroup.getEntitlementPoolIds().stream()
+ .map(rel -> VlmZusammenUtil.createRelation(RelationType.FeatureGroupToEntitlmentPool, rel)).collect(Collectors.toList()));
+ }
+ if (featureGroup.getLicenseKeyGroupIds() != null && !featureGroup.getLicenseKeyGroupIds().isEmpty()) {
+ featureGroupElement.getRelations().addAll(featureGroup.getLicenseKeyGroupIds().stream()
+ .map(rel -> VlmZusammenUtil.createRelation(RelationType.FeatureGroupToLicenseKeyGroup, rel)).collect(Collectors.toList()));
+ }
+ if (featureGroup.getReferencingLicenseAgreements() != null && !featureGroup.getReferencingLicenseAgreements().isEmpty()) {
+ featureGroupElement.getRelations().addAll(featureGroup.getReferencingLicenseAgreements().stream()
+ .map(rel -> VlmZusammenUtil.createRelation(RelationType.FeatureGroupToReferencingLicenseAgreement, rel))
+ .collect(Collectors.toList()));
+ }
+ return featureGroupElement;
}
- return featureGroupElement;
- }
}
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/LicenseAgreementDaoZusammenImpl.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/LicenseAgreementDaoZusammenImpl.java
index d30931c8c7..1e4f7ce29c 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/LicenseAgreementDaoZusammenImpl.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/LicenseAgreementDaoZusammenImpl.java
@@ -13,9 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorlicense.dao.impl.zusammen;
+import static org.openecomp.core.zusammen.api.ZusammenUtil.buildElement;
+import static org.openecomp.core.zusammen.api.ZusammenUtil.buildStructuralElement;
+import static org.openecomp.core.zusammen.api.ZusammenUtil.createSessionContext;
+
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;
@@ -24,6 +27,10 @@ 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 java.util.Collection;
+import java.util.Optional;
+import java.util.Set;
+import java.util.stream.Collectors;
import lombok.AllArgsConstructor;
import org.openecomp.core.zusammen.api.ZusammenAdaptor;
import org.openecomp.sdc.datatypes.model.ElementType;
@@ -32,187 +39,134 @@ import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.convertor.ElementToLice
import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementEntity;
import org.openecomp.types.ElementPropertyName;
-import java.util.Collection;
-import java.util.Optional;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-import static org.openecomp.core.zusammen.api.ZusammenUtil.*;
-
@AllArgsConstructor
public class LicenseAgreementDaoZusammenImpl implements LicenseAgreementDao {
- private ZusammenAdaptor zusammenAdaptor;
-
- @Override
- public void registerVersioning(String versionableEntityType) {
- //no need
- }
-
- @Override
- public void create(LicenseAgreementEntity licenseAgreement) {
- ZusammenElement licenseAgreementElement =
- buildLicenseAgreementElement(licenseAgreement, Action.CREATE);
- ZusammenElement licenseAgreementsElement =
- buildStructuralElement(ElementType.LicenseAgreements, Action.IGNORE);
- licenseAgreementsElement.addSubElement(licenseAgreementElement);
-
- SessionContext context = createSessionContext();
- Element licenseAgreementsSavedElement = zusammenAdaptor.saveElement(context,
- new ElementContext(licenseAgreement.getVendorLicenseModelId(),
- licenseAgreement.getVersion().getId()), licenseAgreementsElement,
- "Create license agreement");
- licenseAgreement
- .setId(licenseAgreementsSavedElement.getSubElements().iterator().next().getElementId()
- .getValue());
- }
+ private ZusammenAdaptor zusammenAdaptor;
- @Override
- public void update(LicenseAgreementEntity licenseAgreement) {
- ZusammenElement licenseAgreementElement =
- buildLicenseAgreementElement(licenseAgreement, Action.UPDATE);
-
- SessionContext context = createSessionContext();
- zusammenAdaptor.saveElement(context,
- new ElementContext(licenseAgreement.getVendorLicenseModelId(),
- licenseAgreement.getVersion().getId()), licenseAgreementElement,
- String.format("Update license agreement with id %s", licenseAgreement.getId()));
- }
-
- @Override
- public LicenseAgreementEntity get(LicenseAgreementEntity licenseAgreement) {
- SessionContext context = createSessionContext();
- ElementContext elementContext = new ElementContext(licenseAgreement.getVendorLicenseModelId(),
- licenseAgreement.getVersion().getId());
- ElementToLicenseAgreementConvertor convertor = new ElementToLicenseAgreementConvertor();
- return zusammenAdaptor.getElementInfo(context, elementContext, new Id(licenseAgreement.getId()))
- .map(elementInfo -> {
- LicenseAgreementEntity entity = convertor.convert(elementInfo);
- entity.setVendorLicenseModelId(licenseAgreement.getVendorLicenseModelId());
- entity.setVersion(licenseAgreement.getVersion());
- return entity;
- })
- .orElse(null);
- }
-
- @Override
- public void delete(LicenseAgreementEntity licenseAgreement) {
- ZusammenElement zusammenElement = buildElement(new Id(licenseAgreement.getId()), Action.DELETE);
-
- SessionContext context = createSessionContext();
- ElementContext elementContext = new ElementContext(licenseAgreement.getVendorLicenseModelId(),
- licenseAgreement.getVersion().getId());
- zusammenAdaptor.saveElement(context, elementContext, zusammenElement,
- "delete license agreement. id:" + licenseAgreement.getId() + ".");
- }
-
-
- @Override
- public Collection<LicenseAgreementEntity> list(LicenseAgreementEntity licenseAgreement) {
- SessionContext context = createSessionContext();
- ElementContext elementContext = new ElementContext(licenseAgreement.getVendorLicenseModelId(),
- licenseAgreement.getVersion().getId());
- ElementToLicenseAgreementConvertor convertor = new ElementToLicenseAgreementConvertor();
- return zusammenAdaptor
- .listElementsByName(context, elementContext, null,
- ElementType.LicenseAgreements.name())
- .stream().map(elementInfo -> {
- LicenseAgreementEntity entity = convertor.convert(elementInfo);
- entity.setVendorLicenseModelId(licenseAgreement.getVendorLicenseModelId());
- entity.setVersion(licenseAgreement.getVersion());
- return entity;
- })
- .collect(Collectors.toList());
- }
+ @Override
+ public void registerVersioning(String versionableEntityType) {
+ //no need
+ }
- @Override
- public long count(LicenseAgreementEntity licenseAgreement) {
- SessionContext context = createSessionContext();
- ElementContext elementContext = new ElementContext(licenseAgreement.getVendorLicenseModelId(),
- licenseAgreement.getVersion().getId());
+ @Override
+ public void create(LicenseAgreementEntity licenseAgreement) {
+ ZusammenElement licenseAgreementElement = buildLicenseAgreementElement(licenseAgreement, Action.CREATE);
+ ZusammenElement licenseAgreementsElement = buildStructuralElement(ElementType.LicenseAgreements, Action.IGNORE);
+ licenseAgreementsElement.addSubElement(licenseAgreementElement);
+ SessionContext context = createSessionContext();
+ Element licenseAgreementsSavedElement = zusammenAdaptor
+ .saveElement(context, new ElementContext(licenseAgreement.getVendorLicenseModelId(), licenseAgreement.getVersion().getId()),
+ licenseAgreementsElement, "Create license agreement");
+ licenseAgreement.setId(licenseAgreementsSavedElement.getSubElements().iterator().next().getElementId().getValue());
+ }
- return zusammenAdaptor.listElementsByName(context, elementContext, null,
- ElementType.LicenseAgreements.name())
- .size();
- }
+ @Override
+ public void update(LicenseAgreementEntity licenseAgreement) {
+ ZusammenElement licenseAgreementElement = buildLicenseAgreementElement(licenseAgreement, Action.UPDATE);
+ SessionContext context = createSessionContext();
+ zusammenAdaptor.saveElement(context, new ElementContext(licenseAgreement.getVendorLicenseModelId(), licenseAgreement.getVersion().getId()),
+ licenseAgreementElement, String.format("Update license agreement with id %s", licenseAgreement.getId()));
+ }
- @Override
- public void deleteAll(LicenseAgreementEntity entity) {
- //not supported
- }
+ @Override
+ public LicenseAgreementEntity get(LicenseAgreementEntity licenseAgreement) {
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(licenseAgreement.getVendorLicenseModelId(), licenseAgreement.getVersion().getId());
+ ElementToLicenseAgreementConvertor convertor = new ElementToLicenseAgreementConvertor();
+ return zusammenAdaptor.getElementInfo(context, elementContext, new Id(licenseAgreement.getId())).map(elementInfo -> {
+ LicenseAgreementEntity entity = convertor.convert(elementInfo);
+ entity.setVendorLicenseModelId(licenseAgreement.getVendorLicenseModelId());
+ entity.setVersion(licenseAgreement.getVersion());
+ return entity;
+ }).orElse(null);
+ }
- @Override
- public void removeFeatureGroup(LicenseAgreementEntity licenseAgreement, String featureGroupId) {
- SessionContext context = createSessionContext();
- ElementContext elementContext = new ElementContext(licenseAgreement.getVendorLicenseModelId(),
- licenseAgreement.getVersion().getId());
+ @Override
+ public void delete(LicenseAgreementEntity licenseAgreement) {
+ ZusammenElement zusammenElement = buildElement(new Id(licenseAgreement.getId()), Action.DELETE);
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(licenseAgreement.getVendorLicenseModelId(), licenseAgreement.getVersion().getId());
+ zusammenAdaptor.saveElement(context, elementContext, zusammenElement, "delete license agreement. id:" + licenseAgreement.getId() + ".");
+ }
- Optional<ElementInfo> elementInfo = zusammenAdaptor.getElementInfo(context,
- elementContext, new Id(licenseAgreement.getId()));
- if (elementInfo.isPresent()) {
- ZusammenElement zusammenElement = VlmZusammenUtil.getZusammenElement(elementInfo.get());
- zusammenElement.setAction(Action.UPDATE);
- zusammenElement.setRelations(elementInfo.get().getRelations().stream()
- .filter(relation -> !featureGroupId.equals(relation.getEdge2().getElementId().getValue()))
- .collect(Collectors.toList()));
- zusammenAdaptor.saveElement(context, elementContext, zusammenElement, "remove feature group");
+ @Override
+ public Collection<LicenseAgreementEntity> list(LicenseAgreementEntity licenseAgreement) {
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(licenseAgreement.getVendorLicenseModelId(), licenseAgreement.getVersion().getId());
+ ElementToLicenseAgreementConvertor convertor = new ElementToLicenseAgreementConvertor();
+ return zusammenAdaptor.listElementsByName(context, elementContext, null, ElementType.LicenseAgreements.name()).stream().map(elementInfo -> {
+ LicenseAgreementEntity entity = convertor.convert(elementInfo);
+ entity.setVendorLicenseModelId(licenseAgreement.getVendorLicenseModelId());
+ entity.setVersion(licenseAgreement.getVersion());
+ return entity;
+ }).collect(Collectors.toList());
}
- }
- @Override
- public void updateColumnsAndDeltaFeatureGroupIds(LicenseAgreementEntity licenseAgreement,
- Set<String> addedFeatureGroupIds,
- Set<String> removedFeatureGroupIds) {
- ZusammenElement licenseAgreementElement =
- buildLicenseAgreementElement(licenseAgreement, Action.UPDATE);
+ @Override
+ public long count(LicenseAgreementEntity licenseAgreement) {
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(licenseAgreement.getVendorLicenseModelId(), licenseAgreement.getVersion().getId());
+ return zusammenAdaptor.listElementsByName(context, elementContext, null, ElementType.LicenseAgreements.name()).size();
+ }
- SessionContext context = createSessionContext();
- ElementContext elementContext = new ElementContext(licenseAgreement.getVendorLicenseModelId(),
- licenseAgreement.getVersion().getId());
- ElementToLicenseAgreementConvertor convertor = new ElementToLicenseAgreementConvertor();
- Optional<ElementInfo> elementInfo =
- zusammenAdaptor.getElementInfo(context, elementContext, new Id(licenseAgreement.getId()));
- if (elementInfo.isPresent()) {
- LicenseAgreementEntity currentLicenseAgreement =
- convertor.convert(elementInfo.get());
- currentLicenseAgreement.setVendorLicenseModelId(licenseAgreement.getVendorLicenseModelId());
- currentLicenseAgreement.setVersion(licenseAgreement.getVersion());
- if (!(removedFeatureGroupIds == null)) {
- currentLicenseAgreement.getFeatureGroupIds().removeAll(removedFeatureGroupIds);
- }
+ @Override
+ public void deleteAll(LicenseAgreementEntity entity) {
+ //not supported
+ }
- if (!(addedFeatureGroupIds == null)) {
- currentLicenseAgreement.getFeatureGroupIds().addAll(addedFeatureGroupIds);
- }
- licenseAgreementElement.setRelations(currentLicenseAgreement.getFeatureGroupIds().stream()
- .map(relation -> VlmZusammenUtil
- .createRelation(RelationType.LicenseAgreementToFeatureGroup, relation))
- .collect(Collectors.toList()));
- zusammenAdaptor.saveElement(context, elementContext, licenseAgreementElement,
- "update license agreement");
+ @Override
+ public void removeFeatureGroup(LicenseAgreementEntity licenseAgreement, String featureGroupId) {
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(licenseAgreement.getVendorLicenseModelId(), licenseAgreement.getVersion().getId());
+ Optional<ElementInfo> elementInfo = zusammenAdaptor.getElementInfo(context, elementContext, new Id(licenseAgreement.getId()));
+ if (elementInfo.isPresent()) {
+ ZusammenElement zusammenElement = VlmZusammenUtil.getZusammenElement(elementInfo.get());
+ zusammenElement.setAction(Action.UPDATE);
+ zusammenElement.setRelations(
+ elementInfo.get().getRelations().stream().filter(relation -> !featureGroupId.equals(relation.getEdge2().getElementId().getValue()))
+ .collect(Collectors.toList()));
+ zusammenAdaptor.saveElement(context, elementContext, zusammenElement, "remove feature group");
+ }
}
- }
- private ZusammenElement buildLicenseAgreementElement(LicenseAgreementEntity licenseAgreement,
- Action action) {
- ZusammenElement licenseAgreementElement =
- buildElement(licenseAgreement.getId() == null ? null : new Id(licenseAgreement.getId()),
- action);
- Info info = new Info();
- info.setName(licenseAgreement.getName());
- info.setDescription(licenseAgreement.getDescription());
- info.addProperty(ElementPropertyName.elementType.name(), ElementType.LicenseAgreement);
- info.addProperty("licenseTerm", licenseAgreement.getLicenseTerm());
- info.addProperty("requirementsAndConstrains", licenseAgreement.getRequirementsAndConstrains());
- licenseAgreementElement.setInfo(info);
+ @Override
+ public void updateColumnsAndDeltaFeatureGroupIds(LicenseAgreementEntity licenseAgreement, Set<String> addedFeatureGroupIds,
+ Set<String> removedFeatureGroupIds) {
+ ZusammenElement licenseAgreementElement = buildLicenseAgreementElement(licenseAgreement, Action.UPDATE);
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(licenseAgreement.getVendorLicenseModelId(), licenseAgreement.getVersion().getId());
+ ElementToLicenseAgreementConvertor convertor = new ElementToLicenseAgreementConvertor();
+ Optional<ElementInfo> elementInfo = zusammenAdaptor.getElementInfo(context, elementContext, new Id(licenseAgreement.getId()));
+ if (elementInfo.isPresent()) {
+ LicenseAgreementEntity currentLicenseAgreement = convertor.convert(elementInfo.get());
+ currentLicenseAgreement.setVendorLicenseModelId(licenseAgreement.getVendorLicenseModelId());
+ currentLicenseAgreement.setVersion(licenseAgreement.getVersion());
+ if (!(removedFeatureGroupIds == null)) {
+ currentLicenseAgreement.getFeatureGroupIds().removeAll(removedFeatureGroupIds);
+ }
+ if (!(addedFeatureGroupIds == null)) {
+ currentLicenseAgreement.getFeatureGroupIds().addAll(addedFeatureGroupIds);
+ }
+ licenseAgreementElement.setRelations(currentLicenseAgreement.getFeatureGroupIds().stream()
+ .map(relation -> VlmZusammenUtil.createRelation(RelationType.LicenseAgreementToFeatureGroup, relation)).collect(Collectors.toList()));
+ zusammenAdaptor.saveElement(context, elementContext, licenseAgreementElement, "update license agreement");
+ }
+ }
- if (licenseAgreement.getFeatureGroupIds() != null &&
- !licenseAgreement.getFeatureGroupIds().isEmpty()) {
- licenseAgreementElement.setRelations(licenseAgreement.getFeatureGroupIds().stream()
- .map(rel -> VlmZusammenUtil
- .createRelation(RelationType.LicenseAgreementToFeatureGroup, rel))
- .collect(Collectors.toList()));
+ private ZusammenElement buildLicenseAgreementElement(LicenseAgreementEntity licenseAgreement, Action action) {
+ ZusammenElement licenseAgreementElement = buildElement(licenseAgreement.getId() == null ? null : new Id(licenseAgreement.getId()), action);
+ Info info = new Info();
+ info.setName(licenseAgreement.getName());
+ info.setDescription(licenseAgreement.getDescription());
+ info.addProperty(ElementPropertyName.elementType.name(), ElementType.LicenseAgreement);
+ info.addProperty("licenseTerm", licenseAgreement.getLicenseTerm());
+ info.addProperty("requirementsAndConstrains", licenseAgreement.getRequirementsAndConstrains());
+ licenseAgreementElement.setInfo(info);
+ if (licenseAgreement.getFeatureGroupIds() != null && !licenseAgreement.getFeatureGroupIds().isEmpty()) {
+ licenseAgreementElement.setRelations(licenseAgreement.getFeatureGroupIds().stream()
+ .map(rel -> VlmZusammenUtil.createRelation(RelationType.LicenseAgreementToFeatureGroup, rel)).collect(Collectors.toList()));
+ }
+ return licenseAgreementElement;
}
- return licenseAgreementElement;
- }
}
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 e5a08ae93a..6d44d1a66a 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
@@ -19,6 +19,10 @@
*/
package org.openecomp.sdc.vendorlicense.dao.impl.zusammen;
+import static org.openecomp.core.zusammen.api.ZusammenUtil.buildElement;
+import static org.openecomp.core.zusammen.api.ZusammenUtil.buildStructuralElement;
+import static org.openecomp.core.zusammen.api.ZusammenUtil.createSessionContext;
+
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;
@@ -27,6 +31,10 @@ 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 java.util.ArrayList;
+import java.util.Collection;
+import java.util.Optional;
+import java.util.stream.Collectors;
import lombok.AllArgsConstructor;
import org.openecomp.core.zusammen.api.ZusammenAdaptor;
import org.openecomp.sdc.datatypes.model.ElementType;
@@ -35,206 +43,145 @@ import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.convertor.ElementToLice
import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity;
import org.openecomp.types.ElementPropertyName;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Optional;
-import java.util.stream.Collectors;
-
-import static org.openecomp.core.zusammen.api.ZusammenUtil.*;
-
@AllArgsConstructor
public class LicenseKeyGroupZusammenDaoImpl implements LicenseKeyGroupDao {
- private ZusammenAdaptor zusammenAdaptor;
-
- @Override
- public void registerVersioning(String versionableEntityType) {
- //no need
- }
-
- @Override
- public void create(LicenseKeyGroupEntity licenseKeyGroup) {
- ZusammenElement licenseKeyGroupElement =
- buildLicenseKeyGroupElement(licenseKeyGroup, Action.CREATE);
-
- ZusammenElement limitsElement = buildStructuralElement(ElementType.Limits, Action.CREATE);
- licenseKeyGroupElement.addSubElement(limitsElement);
-
- ZusammenElement lkgsElement =
- buildStructuralElement(ElementType.LicenseKeyGroups, Action.IGNORE);
- lkgsElement.addSubElement(licenseKeyGroupElement);
-
- SessionContext context = createSessionContext();
- Element lkgsSavedElement = zusammenAdaptor.saveElement(context,
- new ElementContext(licenseKeyGroup.getVendorLicenseModelId(),
- licenseKeyGroup.getVersion().getId()), lkgsElement, "Create license Key Group");
-
- licenseKeyGroup
- .setId(lkgsSavedElement.getSubElements().iterator().next().getElementId().getValue());
- }
-
- @Override
- public void update(LicenseKeyGroupEntity licenseKeyGroup) {
- ZusammenElement licenseKeyGroupElement =
- buildLicenseKeyGroupElement(licenseKeyGroup, Action.UPDATE);
-
- SessionContext context = createSessionContext();
- ElementContext elementContext = new ElementContext(licenseKeyGroup.getVendorLicenseModelId(),
- licenseKeyGroup.getVersion().getId());
- Optional<ElementInfo> lkgFromDb = zusammenAdaptor.getElementInfo(context, elementContext,
- new Id(licenseKeyGroup.getId()));
+ private ZusammenAdaptor zusammenAdaptor;
- if (lkgFromDb.isPresent()) {
-
- if (licenseKeyGroupElement.getRelations() == null) {
- licenseKeyGroupElement.setRelations(new ArrayList<>());
- }
-
- if (lkgFromDb.get().getRelations() != null && !lkgFromDb.get().getRelations().isEmpty()) {
- licenseKeyGroupElement.getRelations().addAll(lkgFromDb.get().getRelations());
- }
+ @Override
+ public void registerVersioning(String versionableEntityType) {
+ //no need
}
- zusammenAdaptor.saveElement(context, elementContext, licenseKeyGroupElement,
- String.format("Update license key group with id %s", licenseKeyGroup.getId()));
- }
-
- @Override
- public LicenseKeyGroupEntity get(LicenseKeyGroupEntity licenseKeyGroup) {
- SessionContext context = createSessionContext();
- ElementContext elementContext = new ElementContext(licenseKeyGroup.getVendorLicenseModelId(),
- licenseKeyGroup.getVersion().getId());
- ElementToLicenseKeyGroupConvertor convertor = new ElementToLicenseKeyGroupConvertor();
- return zusammenAdaptor.getElementInfo(context, elementContext, new Id(licenseKeyGroup.getId()))
- .map(elementInfo -> {
- LicenseKeyGroupEntity entity = convertor.convert(elementInfo);
- entity.setVendorLicenseModelId(licenseKeyGroup.getVendorLicenseModelId());
- entity.setVersion(licenseKeyGroup.getVersion());
- return entity;
- })
- .orElse(null);
- }
-
- @Override
- public void delete(LicenseKeyGroupEntity licenseKeyGroup) {
- ZusammenElement zusammenElement = buildElement(new Id(licenseKeyGroup.getId()), Action.DELETE);
-
- SessionContext context = createSessionContext();
- ElementContext elementContext = new ElementContext(licenseKeyGroup.getVendorLicenseModelId(),
- licenseKeyGroup.getVersion().getId());
-
- zusammenAdaptor.saveElement(context, elementContext, zusammenElement,
- "delete license key group. id:" + licenseKeyGroup.getId() + ".");
- }
-
- @Override
- public Collection<LicenseKeyGroupEntity> list(LicenseKeyGroupEntity licenseKeyGroup) {
- SessionContext context = createSessionContext();
- ElementContext elementContext = new ElementContext(licenseKeyGroup.getVendorLicenseModelId(),
- licenseKeyGroup.getVersion().getId());
- ElementToLicenseKeyGroupConvertor convertor = new ElementToLicenseKeyGroupConvertor();
- return zusammenAdaptor
- .listElementsByName(context, elementContext, null, ElementType.LicenseKeyGroups.name())
- .stream().map(elementInfo -> {
- LicenseKeyGroupEntity entity = convertor.convert(elementInfo);
- entity.setVendorLicenseModelId(licenseKeyGroup.getVendorLicenseModelId());
- entity.setVersion(licenseKeyGroup.getVersion());
- return entity;
- })
- .collect(Collectors.toList());
- }
-
- @Override
- public long count(LicenseKeyGroupEntity licenseKeyGroup) {
- SessionContext context = createSessionContext();
- ElementContext elementContext = new ElementContext(licenseKeyGroup.getVendorLicenseModelId(),
- licenseKeyGroup.getVersion().getId());
-
- return zusammenAdaptor
- .listElementsByName(context, elementContext, null, ElementType.LicenseKeyGroups.name())
- .size();
- }
- @Override
- public void deleteAll(LicenseKeyGroupEntity licenseKeyGroup) {
- //not supported
- }
-
- @Override
- public void removeReferencingFeatureGroup(LicenseKeyGroupEntity licenseKeyGroup,
- String featureGroupId) {
- SessionContext context = createSessionContext();
- ElementContext elementContext = new ElementContext(licenseKeyGroup.getVendorLicenseModelId(),
- licenseKeyGroup.getVersion().getId());
-
- Optional<ElementInfo> elementInfo =
- zusammenAdaptor.getElementInfo(context, elementContext, new Id(licenseKeyGroup.getId()));
+ @Override
+ public void create(LicenseKeyGroupEntity licenseKeyGroup) {
+ ZusammenElement licenseKeyGroupElement = buildLicenseKeyGroupElement(licenseKeyGroup, Action.CREATE);
+ ZusammenElement limitsElement = buildStructuralElement(ElementType.Limits, Action.CREATE);
+ licenseKeyGroupElement.addSubElement(limitsElement);
+ ZusammenElement lkgsElement = buildStructuralElement(ElementType.LicenseKeyGroups, Action.IGNORE);
+ lkgsElement.addSubElement(licenseKeyGroupElement);
+ SessionContext context = createSessionContext();
+ Element lkgsSavedElement = zusammenAdaptor
+ .saveElement(context, new ElementContext(licenseKeyGroup.getVendorLicenseModelId(), licenseKeyGroup.getVersion().getId()), lkgsElement,
+ "Create license Key Group");
+ licenseKeyGroup.setId(lkgsSavedElement.getSubElements().iterator().next().getElementId().getValue());
+ }
- if (elementInfo.isPresent()) {
- ZusammenElement zusammenElement = VlmZusammenUtil.getZusammenElement(elementInfo.get());
- zusammenElement.setAction(Action.UPDATE);
- zusammenElement.setRelations(elementInfo.get().getRelations().stream()
- .filter(relation -> !featureGroupId
- .equals(relation.getEdge2().getElementId().getValue()))
- .collect(Collectors.toList()));
+ @Override
+ public void update(LicenseKeyGroupEntity licenseKeyGroup) {
+ ZusammenElement licenseKeyGroupElement = buildLicenseKeyGroupElement(licenseKeyGroup, Action.UPDATE);
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(licenseKeyGroup.getVendorLicenseModelId(), licenseKeyGroup.getVersion().getId());
+ Optional<ElementInfo> lkgFromDb = zusammenAdaptor.getElementInfo(context, elementContext, new Id(licenseKeyGroup.getId()));
+ if (lkgFromDb.isPresent()) {
+ if (licenseKeyGroupElement.getRelations() == null) {
+ licenseKeyGroupElement.setRelations(new ArrayList<>());
+ }
+ if (lkgFromDb.get().getRelations() != null && !lkgFromDb.get().getRelations().isEmpty()) {
+ licenseKeyGroupElement.getRelations().addAll(lkgFromDb.get().getRelations());
+ }
+ }
+ zusammenAdaptor.saveElement(context, elementContext, licenseKeyGroupElement,
+ String.format("Update license key group with id %s", licenseKeyGroup.getId()));
+ }
- zusammenAdaptor.saveElement(context, elementContext, zusammenElement,
- "remove referencing feature group");
+ @Override
+ public LicenseKeyGroupEntity get(LicenseKeyGroupEntity licenseKeyGroup) {
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(licenseKeyGroup.getVendorLicenseModelId(), licenseKeyGroup.getVersion().getId());
+ ElementToLicenseKeyGroupConvertor convertor = new ElementToLicenseKeyGroupConvertor();
+ return zusammenAdaptor.getElementInfo(context, elementContext, new Id(licenseKeyGroup.getId())).map(elementInfo -> {
+ LicenseKeyGroupEntity entity = convertor.convert(elementInfo);
+ entity.setVendorLicenseModelId(licenseKeyGroup.getVendorLicenseModelId());
+ entity.setVersion(licenseKeyGroup.getVersion());
+ return entity;
+ }).orElse(null);
}
- }
- @Override
- public void addReferencingFeatureGroup(LicenseKeyGroupEntity licenseKeyGroup,
- String featureGroupId) {
- SessionContext context = createSessionContext();
- ElementContext elementContext = new ElementContext(licenseKeyGroup.getVendorLicenseModelId(),
- licenseKeyGroup.getVersion().getId());
+ @Override
+ public void delete(LicenseKeyGroupEntity licenseKeyGroup) {
+ ZusammenElement zusammenElement = buildElement(new Id(licenseKeyGroup.getId()), Action.DELETE);
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(licenseKeyGroup.getVendorLicenseModelId(), licenseKeyGroup.getVersion().getId());
+ zusammenAdaptor.saveElement(context, elementContext, zusammenElement, "delete license key group. id:" + licenseKeyGroup.getId() + ".");
+ }
- Optional<ElementInfo> elementInfo =
- zusammenAdaptor.getElementInfo(context, elementContext, new Id(licenseKeyGroup.getId()));
+ @Override
+ public Collection<LicenseKeyGroupEntity> list(LicenseKeyGroupEntity licenseKeyGroup) {
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(licenseKeyGroup.getVendorLicenseModelId(), licenseKeyGroup.getVersion().getId());
+ ElementToLicenseKeyGroupConvertor convertor = new ElementToLicenseKeyGroupConvertor();
+ return zusammenAdaptor.listElementsByName(context, elementContext, null, ElementType.LicenseKeyGroups.name()).stream().map(elementInfo -> {
+ LicenseKeyGroupEntity entity = convertor.convert(elementInfo);
+ entity.setVendorLicenseModelId(licenseKeyGroup.getVendorLicenseModelId());
+ entity.setVersion(licenseKeyGroup.getVersion());
+ return entity;
+ }).collect(Collectors.toList());
+ }
- if (elementInfo.isPresent()) {
- ZusammenElement zusammenElement = VlmZusammenUtil.getZusammenElement(elementInfo.get());
- zusammenElement.setAction(Action.UPDATE);
- if (zusammenElement.getRelations() == null) {
- zusammenElement.setRelations(new ArrayList<>());
- }
- zusammenElement.getRelations().add(VlmZusammenUtil
- .createRelation(RelationType.LicenseKeyGroupToReferencingFeatureGroup,
- featureGroupId));
- zusammenAdaptor
- .saveElement(context, elementContext, zusammenElement, "add referencing feature group");
+ @Override
+ public long count(LicenseKeyGroupEntity licenseKeyGroup) {
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(licenseKeyGroup.getVendorLicenseModelId(), licenseKeyGroup.getVersion().getId());
+ return zusammenAdaptor.listElementsByName(context, elementContext, null, ElementType.LicenseKeyGroups.name()).size();
}
- }
- private ZusammenElement buildLicenseKeyGroupElement(LicenseKeyGroupEntity licenseKeyGroup,
- Action action) {
- ZusammenElement lkgElement =
- buildElement(licenseKeyGroup.getId() == null ? null : new Id(licenseKeyGroup.getId()),
- action);
- Info info = new Info();
- info.setName(licenseKeyGroup.getName());
- info.setDescription(licenseKeyGroup.getDescription());
- info.addProperty(ElementPropertyName.elementType.name(), ElementType.LicenseKeyGroup);
- info.addProperty("version_uuid", licenseKeyGroup.getVersionUuId());
- info.addProperty("LicenseKeyType", licenseKeyGroup.getType());
- 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());
- info.addProperty("manufacturerReferenceNumber", licenseKeyGroup.getManufacturerReferenceNumber());
- lkgElement.setInfo(info);
+ @Override
+ public void deleteAll(LicenseKeyGroupEntity licenseKeyGroup) {
+ //not supported
+ }
- if (licenseKeyGroup.getReferencingFeatureGroups() != null
- && !licenseKeyGroup.getReferencingFeatureGroups().isEmpty()) {
- lkgElement.setRelations(licenseKeyGroup.getReferencingFeatureGroups().stream()
- .map(rel -> VlmZusammenUtil
- .createRelation(RelationType.LicenseKeyGroupToReferencingFeatureGroup, rel))
- .collect(Collectors.toList()));
+ @Override
+ public void removeReferencingFeatureGroup(LicenseKeyGroupEntity licenseKeyGroup, String featureGroupId) {
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(licenseKeyGroup.getVendorLicenseModelId(), licenseKeyGroup.getVersion().getId());
+ Optional<ElementInfo> elementInfo = zusammenAdaptor.getElementInfo(context, elementContext, new Id(licenseKeyGroup.getId()));
+ if (elementInfo.isPresent()) {
+ ZusammenElement zusammenElement = VlmZusammenUtil.getZusammenElement(elementInfo.get());
+ zusammenElement.setAction(Action.UPDATE);
+ zusammenElement.setRelations(
+ elementInfo.get().getRelations().stream().filter(relation -> !featureGroupId.equals(relation.getEdge2().getElementId().getValue()))
+ .collect(Collectors.toList()));
+ zusammenAdaptor.saveElement(context, elementContext, zusammenElement, "remove referencing feature group");
+ }
}
- return lkgElement;
- }
+ @Override
+ public void addReferencingFeatureGroup(LicenseKeyGroupEntity licenseKeyGroup, String featureGroupId) {
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(licenseKeyGroup.getVendorLicenseModelId(), licenseKeyGroup.getVersion().getId());
+ Optional<ElementInfo> elementInfo = zusammenAdaptor.getElementInfo(context, elementContext, new Id(licenseKeyGroup.getId()));
+ if (elementInfo.isPresent()) {
+ ZusammenElement zusammenElement = VlmZusammenUtil.getZusammenElement(elementInfo.get());
+ zusammenElement.setAction(Action.UPDATE);
+ if (zusammenElement.getRelations() == null) {
+ zusammenElement.setRelations(new ArrayList<>());
+ }
+ zusammenElement.getRelations().add(VlmZusammenUtil.createRelation(RelationType.LicenseKeyGroupToReferencingFeatureGroup, featureGroupId));
+ zusammenAdaptor.saveElement(context, elementContext, zusammenElement, "add referencing feature group");
+ }
+ }
+ private ZusammenElement buildLicenseKeyGroupElement(LicenseKeyGroupEntity licenseKeyGroup, Action action) {
+ ZusammenElement lkgElement = buildElement(licenseKeyGroup.getId() == null ? null : new Id(licenseKeyGroup.getId()), action);
+ Info info = new Info();
+ info.setName(licenseKeyGroup.getName());
+ info.setDescription(licenseKeyGroup.getDescription());
+ info.addProperty(ElementPropertyName.elementType.name(), ElementType.LicenseKeyGroup);
+ info.addProperty("version_uuid", licenseKeyGroup.getVersionUuId());
+ info.addProperty("LicenseKeyType", licenseKeyGroup.getType());
+ 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());
+ info.addProperty("manufacturerReferenceNumber", licenseKeyGroup.getManufacturerReferenceNumber());
+ lkgElement.setInfo(info);
+ if (licenseKeyGroup.getReferencingFeatureGroups() != null && !licenseKeyGroup.getReferencingFeatureGroups().isEmpty()) {
+ lkgElement.setRelations(licenseKeyGroup.getReferencingFeatureGroups().stream()
+ .map(rel -> VlmZusammenUtil.createRelation(RelationType.LicenseKeyGroupToReferencingFeatureGroup, rel)).collect(Collectors.toList()));
+ }
+ return lkgElement;
+ }
}
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
index 9fe3b38565..7b90a270bf 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/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
@@ -19,6 +19,10 @@
*/
package org.openecomp.sdc.vendorlicense.dao.impl.zusammen;
+import static org.openecomp.core.zusammen.api.ZusammenUtil.buildElement;
+import static org.openecomp.core.zusammen.api.ZusammenUtil.buildStructuralElement;
+import static org.openecomp.core.zusammen.api.ZusammenUtil.createSessionContext;
+
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;
@@ -27,6 +31,9 @@ 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 java.util.Collection;
+import java.util.Collections;
+import java.util.stream.Collectors;
import org.openecomp.core.zusammen.api.ZusammenAdaptor;
import org.openecomp.sdc.datatypes.model.ElementType;
import org.openecomp.sdc.vendorlicense.dao.LimitDao;
@@ -36,163 +43,120 @@ import org.openecomp.sdc.vendorlicense.dao.types.LimitType;
import org.openecomp.sdc.versioning.dao.types.Version;
import org.openecomp.types.ElementPropertyName;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.stream.Collectors;
-
-import static org.openecomp.core.zusammen.api.ZusammenUtil.*;
-
public class LimitZusammenDaoImpl implements LimitDao {
- private static final String LIMT_TYPE = "type";
- private static final String METRIC = "metric";
- private static final String AGGREGATIONFUNCTION = "aggregationfunction";
- private static final String TIME = "time";
- private static final String UNIT = "unit";
- private 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 = buildStructuralElement(ElementType.Limits, null);
- limitsElement.setSubElements(Collections.singletonList(limitElement));
-
- ZusammenElement epLkgElement = buildElement(new Id(limitEntity.getEpLkgId()), Action.IGNORE);
- epLkgElement.setSubElements(Collections.singletonList(limitsElement));
-
- SessionContext context = createSessionContext();
- ElementContext elementContext =
- new ElementContext(limitEntity.getVendorLicenseModelId(), limitEntity.getVersion().getId());
-
- Element savedElement =
- zusammenAdaptor.saveElement(context, elementContext, epLkgElement, "Create limit");
- limitEntity.setId(savedElement.getSubElements().iterator().next()
- .getSubElements().iterator().next().getElementId().getValue());
- }
-
- @Override
- public boolean isLimitPresent(LimitEntity limitEntity) {
- SessionContext context = createSessionContext();
- ElementContext elementContext =
- new ElementContext(limitEntity.getVendorLicenseModelId(), limitEntity.getVersion().getId());
-
- Collection<ElementInfo> elementInfos = zusammenAdaptor.listElementsByName(context,
- elementContext, new Id(limitEntity.getEpLkgId()), ElementType.Limits.name());
+ private static final String LIMT_TYPE = "type";
+ private static final String METRIC = "metric";
+ private static final String AGGREGATIONFUNCTION = "aggregationfunction";
+ private static final String TIME = "time";
+ private static final String UNIT = "unit";
+ private static final String VALUE = "value";
+ private ZusammenAdaptor zusammenAdaptor;
- for (ElementInfo elementInfo : elementInfos) {
- if (elementInfo.getId().getValue().equals(limitEntity.getId())) {
- return true;
- }
+ public LimitZusammenDaoImpl(ZusammenAdaptor zusammenAdaptor) {
+ this.zusammenAdaptor = zusammenAdaptor;
}
- return false;
- }
-
- @Override
- public Collection<LimitEntity> list(LimitEntity limitEntity) {
- SessionContext context = createSessionContext();
- ElementContext elementContext =
- new ElementContext(limitEntity.getVendorLicenseModelId(), limitEntity.getVersion().getId());
-
- return listLimits(context, elementContext, limitEntity);
- }
-
- private Collection<LimitEntity> listLimits(SessionContext context, ElementContext elementContext,
- LimitEntity limitEntity) {
- return zusammenAdaptor
- .listElementsByName(context, elementContext, new Id(limitEntity.getEpLkgId()),
- ElementType.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((String) elementInfo.getInfo().getProperties().get(TIME));
- limitEntity.setMetric((String) elementInfo.getInfo().getProperties().get(METRIC));
- 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((String) unit);
- Object value = elementInfo.getInfo().getProperties().get(VALUE);
- limitEntity.setValue((String) value);
-
- return limitEntity;
- }
+ @Override
+ public void create(LimitEntity limitEntity) {
+ ZusammenElement limitElement = limitToZusammen(limitEntity, Action.CREATE);
+ ZusammenElement limitsElement = buildStructuralElement(ElementType.Limits, null);
+ limitsElement.setSubElements(Collections.singletonList(limitElement));
+ ZusammenElement epLkgElement = buildElement(new Id(limitEntity.getEpLkgId()), Action.IGNORE);
+ epLkgElement.setSubElements(Collections.singletonList(limitsElement));
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(limitEntity.getVendorLicenseModelId(), limitEntity.getVersion().getId());
+ Element savedElement = zusammenAdaptor.saveElement(context, elementContext, epLkgElement, "Create limit");
+ limitEntity.setId(savedElement.getSubElements().iterator().next().getSubElements().iterator().next().getElementId().getValue());
+ }
- @Override
- public void update(LimitEntity limitEntity) {
- ZusammenElement limitElement = limitToZusammen(limitEntity, Action.UPDATE);
+ @Override
+ public boolean isLimitPresent(LimitEntity limitEntity) {
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(limitEntity.getVendorLicenseModelId(), limitEntity.getVersion().getId());
+ Collection<ElementInfo> elementInfos = zusammenAdaptor
+ .listElementsByName(context, elementContext, new Id(limitEntity.getEpLkgId()), ElementType.Limits.name());
+ for (ElementInfo elementInfo : elementInfos) {
+ if (elementInfo.getId().getValue().equals(limitEntity.getId())) {
+ return true;
+ }
+ }
+ return false;
+ }
- SessionContext context = createSessionContext();
- ElementContext elementContext =
- new ElementContext(limitEntity.getVendorLicenseModelId(), limitEntity.getVersion().getId());
+ @Override
+ public Collection<LimitEntity> list(LimitEntity limitEntity) {
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(limitEntity.getVendorLicenseModelId(), limitEntity.getVersion().getId());
+ return listLimits(context, elementContext, limitEntity);
+ }
- zusammenAdaptor.saveElement(context, elementContext, limitElement,
- String.format("Update limit with id %s", limitEntity.getId()));
- }
+ private Collection<LimitEntity> listLimits(SessionContext context, ElementContext elementContext, LimitEntity limitEntity) {
+ return zusammenAdaptor.listElementsByName(context, elementContext, new Id(limitEntity.getEpLkgId()), ElementType.Limits.name()).stream().map(
+ elementInfo -> mapElementInfoToLimit(limitEntity.getVendorLicenseModelId(), limitEntity.getVersion(), limitEntity.getEpLkgId(),
+ elementInfo)).collect(Collectors.toList());
+ }
- @Override
- public LimitEntity get(LimitEntity limitEntity) {
- SessionContext context = createSessionContext();
- ElementContext elementContext =
- new ElementContext(limitEntity.getVendorLicenseModelId(), limitEntity.getVersion().getId());
+ 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((String) elementInfo.getInfo().getProperties().get(TIME));
+ limitEntity.setMetric((String) elementInfo.getInfo().getProperties().get(METRIC));
+ 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((String) unit);
+ Object value = elementInfo.getInfo().getProperties().get(VALUE);
+ limitEntity.setValue((String) value);
+ return limitEntity;
+ }
- return zusammenAdaptor.getElementInfo(context, elementContext, new Id(limitEntity.getId()))
- .map(elementInfo -> mapElementInfoToLimit(
- limitEntity.getVendorLicenseModelId(), limitEntity.getVersion(), limitEntity
- .getEpLkgId(), elementInfo))
- .orElse(null);
- }
+ @Override
+ public void update(LimitEntity limitEntity) {
+ ZusammenElement limitElement = limitToZusammen(limitEntity, Action.UPDATE);
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(limitEntity.getVendorLicenseModelId(), limitEntity.getVersion().getId());
+ zusammenAdaptor.saveElement(context, elementContext, limitElement, String.format("Update limit with id %s", limitEntity.getId()));
+ }
- @Override
- public void delete(LimitEntity limitEntity) {
- ZusammenElement zusammenElement = buildElement(new Id(limitEntity.getId()), Action.DELETE);
+ @Override
+ public LimitEntity get(LimitEntity limitEntity) {
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(limitEntity.getVendorLicenseModelId(), limitEntity.getVersion().getId());
+ return zusammenAdaptor.getElementInfo(context, elementContext, new Id(limitEntity.getId())).map(
+ elementInfo -> mapElementInfoToLimit(limitEntity.getVendorLicenseModelId(), limitEntity.getVersion(), limitEntity.getEpLkgId(),
+ elementInfo)).orElse(null);
+ }
- SessionContext context = createSessionContext();
- ElementContext elementContext =
- new ElementContext(limitEntity.getVendorLicenseModelId(), limitEntity.getVersion().getId());
- zusammenAdaptor.saveElement(context, elementContext, zusammenElement,
- "delete limit Id:" + limitEntity.getId() + ".");
- }
+ @Override
+ public void delete(LimitEntity limitEntity) {
+ ZusammenElement zusammenElement = buildElement(new Id(limitEntity.getId()), Action.DELETE);
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(limitEntity.getVendorLicenseModelId(), limitEntity.getVersion().getId());
+ zusammenAdaptor.saveElement(context, elementContext, zusammenElement, "delete limit Id:" + limitEntity.getId() + ".");
+ }
- @Override
- public void registerVersioning(String versionableEntityType) {
- //registerVersioning not implemented for LimitZusammenDaoImpl
- }
+ @Override
+ public void registerVersioning(String versionableEntityType) {
+ //registerVersioning not implemented for LimitZusammenDaoImpl
+ }
- private ZusammenElement limitToZusammen(LimitEntity limit, Action action) {
- ZusammenElement limitElement =
- buildElement(limit.getId() == null ? null : new Id(limit.getId()), action);
- Info info = new Info();
- info.setName(limit.getName());
- info.setDescription(limit.getDescription());
- info.addProperty(ElementPropertyName.elementType.name(), ElementType.Limit);
- 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 limitToZusammen(LimitEntity limit, Action action) {
+ ZusammenElement limitElement = buildElement(limit.getId() == null ? null : new Id(limit.getId()), action);
+ Info info = new Info();
+ info.setName(limit.getName());
+ info.setDescription(limit.getDescription());
+ info.addProperty(ElementPropertyName.elementType.name(), ElementType.Limit);
+ 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;
+ }
}
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/VendorLicenseModelDaoZusammenImpl.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/VendorLicenseModelDaoZusammenImpl.java
index 031d415127..2c4702aec1 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/VendorLicenseModelDaoZusammenImpl.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/VendorLicenseModelDaoZusammenImpl.java
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorlicense.dao.impl.zusammen;
import com.amdocs.zusammen.adaptor.inbound.api.types.item.ZusammenElement;
@@ -21,6 +20,8 @@ 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 java.util.Collection;
+import java.util.stream.Collectors;
import org.openecomp.core.zusammen.api.ZusammenAdaptor;
import org.openecomp.core.zusammen.api.ZusammenUtil;
import org.openecomp.sdc.datatypes.model.ElementType;
@@ -31,130 +32,85 @@ import org.openecomp.sdc.versioning.ActionVersioningManagerFactory;
import org.openecomp.sdc.versioning.types.VersionableEntityMetadata;
import org.openecomp.sdc.versioning.types.VersionableEntityStoreType;
-import java.util.Collection;
-import java.util.stream.Collectors;
-
public class VendorLicenseModelDaoZusammenImpl implements VendorLicenseModelDao {
- private ZusammenAdaptor zusammenAdaptor;
-
- public VendorLicenseModelDaoZusammenImpl(ZusammenAdaptor zusammenAdaptor) {
- this.zusammenAdaptor = zusammenAdaptor;
- }
-
- @Override
- public void registerVersioning(String versionableEntityType) {
- VersionableEntityMetadata metadata =
- new VersionableEntityMetadata(VersionableEntityStoreType.Zusammen, "VendorLicenseModel",
- null, null);
-
- ActionVersioningManagerFactory.getInstance().createInterface()
- .register(versionableEntityType, metadata);
- }
-
- @Override
- public Collection<VendorLicenseModelEntity> list(
- VendorLicenseModelEntity vendorLicenseModelEntity) {
-
- ElementToVLMGeneralConvertor convertor = new ElementToVLMGeneralConvertor();
- return zusammenAdaptor.listItems(ZusammenUtil.createSessionContext()).stream()
- .filter(item -> "VendorLicenseModel".equals(item.getInfo().getProperty("item_type")))
- .map(item -> {
- VendorLicenseModelEntity entity = convertor.convert(item);
- entity.setId(item.getId().getValue());
- entity.setVersion(null);
- return entity;
- })
- .collect(Collectors.toList());
- }
-
- @Override
- public void create(VendorLicenseModelEntity vendorLicenseModel) {
-
- SessionContext context = ZusammenUtil.createSessionContext();
-
- ElementContext elementContext = new ElementContext(vendorLicenseModel.getId(),
- vendorLicenseModel.getVersion().getId());
-
- ZusammenElement generalElement = mapVlmToZusammenElement(vendorLicenseModel, Action.CREATE);
-
- zusammenAdaptor.saveElement(context, elementContext, generalElement,
- "Create VLM General Info Element");
-
- ZusammenElement licenseAgreementsElement =
- ZusammenUtil.buildStructuralElement(ElementType.LicenseAgreements, Action.CREATE);
-
- zusammenAdaptor.saveElement(context, elementContext, licenseAgreementsElement,
- "Create VLM licenseAgreementsElement");
-
- ZusammenElement featureGroupsElement =
- ZusammenUtil.buildStructuralElement(ElementType.FeatureGroups, Action.CREATE);
-
- zusammenAdaptor.saveElement(context, elementContext, featureGroupsElement,
- "Create VLM featureGroupsElement");
-
- ZusammenElement lkgsElement =
- ZusammenUtil.buildStructuralElement(ElementType.LicenseKeyGroups, Action.CREATE);
-
- zusammenAdaptor.saveElement(context, elementContext, lkgsElement,
- "Create VLM lkgsElement");
-
- ZusammenElement entitlementPoolsElement =
- ZusammenUtil.buildStructuralElement(ElementType.EntitlementPools, Action.CREATE);
-
- zusammenAdaptor.saveElement(context, elementContext, entitlementPoolsElement,
- "Create VLM entitlementPoolsElement");
- }
-
- @Override
- public void update(VendorLicenseModelEntity vendorLicenseModel) {
- ZusammenElement generalElement = mapVlmToZusammenElement(vendorLicenseModel, Action.UPDATE);
-
- SessionContext context = ZusammenUtil.createSessionContext();
- zusammenAdaptor.saveElement(context,
- new ElementContext(vendorLicenseModel.getId(), vendorLicenseModel.getVersion().getId()),
- generalElement, "Update VSP General Info Element");
- }
-
- @Override
- public VendorLicenseModelEntity get(VendorLicenseModelEntity vendorLicenseModel) {
- SessionContext context = ZusammenUtil.createSessionContext();
- ElementContext elementContext =
- new ElementContext(vendorLicenseModel.getId(), vendorLicenseModel.getVersion().getId());
- ElementToVLMGeneralConvertor convertor = new ElementToVLMGeneralConvertor();
- return zusammenAdaptor
- .getElementInfoByName(context, elementContext, null, ElementType.VendorLicenseModel.name())
- .map(generalElementInfo -> {
- VendorLicenseModelEntity entity = convertor.convert(generalElementInfo);
- entity.setId(vendorLicenseModel.getId());
- entity.setVersion(vendorLicenseModel.getVersion());
- return entity;
- })
- .orElse(null);
- }
-
- @Override
- public void delete(VendorLicenseModelEntity entity) {
- throw new UnsupportedOperationException("Delete vlm version is done using versioning manager");
- }
-
- private ZusammenElement mapVlmToZusammenElement(VendorLicenseModelEntity vendorLicenseModel,
- Action action) {
- ZusammenElement generalElement =
- ZusammenUtil.buildStructuralElement(ElementType.VendorLicenseModel, action);
- addVlmToInfo(generalElement.getInfo(), vendorLicenseModel);
- return generalElement;
- }
-
- private void addVlmToInfo(Info info, VendorLicenseModelEntity vendorLicenseModel) {
- info.addProperty(InfoPropertyName.name.name(), vendorLicenseModel.getVendorName());
- info.addProperty(InfoPropertyName.description.name(), vendorLicenseModel.getDescription());
- info.addProperty(InfoPropertyName.iconRef.name(), vendorLicenseModel.getIconRef());
- }
-
- public enum InfoPropertyName {
- name,
- description,
- iconRef,
- }
+ private ZusammenAdaptor zusammenAdaptor;
+
+ public VendorLicenseModelDaoZusammenImpl(ZusammenAdaptor zusammenAdaptor) {
+ this.zusammenAdaptor = zusammenAdaptor;
+ }
+
+ @Override
+ public void registerVersioning(String versionableEntityType) {
+ VersionableEntityMetadata metadata = new VersionableEntityMetadata(VersionableEntityStoreType.Zusammen, "VendorLicenseModel", null, null);
+ ActionVersioningManagerFactory.getInstance().createInterface().register(versionableEntityType, metadata);
+ }
+
+ @Override
+ public Collection<VendorLicenseModelEntity> list(VendorLicenseModelEntity vendorLicenseModelEntity) {
+ ElementToVLMGeneralConvertor convertor = new ElementToVLMGeneralConvertor();
+ return zusammenAdaptor.listItems(ZusammenUtil.createSessionContext()).stream()
+ .filter(item -> "VendorLicenseModel".equals(item.getInfo().getProperty("item_type"))).map(item -> {
+ VendorLicenseModelEntity entity = convertor.convert(item);
+ entity.setId(item.getId().getValue());
+ entity.setVersion(null);
+ return entity;
+ }).collect(Collectors.toList());
+ }
+
+ @Override
+ public void create(VendorLicenseModelEntity vendorLicenseModel) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ ElementContext elementContext = new ElementContext(vendorLicenseModel.getId(), vendorLicenseModel.getVersion().getId());
+ ZusammenElement generalElement = mapVlmToZusammenElement(vendorLicenseModel, Action.CREATE);
+ zusammenAdaptor.saveElement(context, elementContext, generalElement, "Create VLM General Info Element");
+ ZusammenElement licenseAgreementsElement = ZusammenUtil.buildStructuralElement(ElementType.LicenseAgreements, Action.CREATE);
+ zusammenAdaptor.saveElement(context, elementContext, licenseAgreementsElement, "Create VLM licenseAgreementsElement");
+ ZusammenElement featureGroupsElement = ZusammenUtil.buildStructuralElement(ElementType.FeatureGroups, Action.CREATE);
+ zusammenAdaptor.saveElement(context, elementContext, featureGroupsElement, "Create VLM featureGroupsElement");
+ ZusammenElement lkgsElement = ZusammenUtil.buildStructuralElement(ElementType.LicenseKeyGroups, Action.CREATE);
+ zusammenAdaptor.saveElement(context, elementContext, lkgsElement, "Create VLM lkgsElement");
+ ZusammenElement entitlementPoolsElement = ZusammenUtil.buildStructuralElement(ElementType.EntitlementPools, Action.CREATE);
+ zusammenAdaptor.saveElement(context, elementContext, entitlementPoolsElement, "Create VLM entitlementPoolsElement");
+ }
+
+ @Override
+ public void update(VendorLicenseModelEntity vendorLicenseModel) {
+ ZusammenElement generalElement = mapVlmToZusammenElement(vendorLicenseModel, Action.UPDATE);
+ SessionContext context = ZusammenUtil.createSessionContext();
+ zusammenAdaptor.saveElement(context, new ElementContext(vendorLicenseModel.getId(), vendorLicenseModel.getVersion().getId()), generalElement,
+ "Update VSP General Info Element");
+ }
+
+ @Override
+ public VendorLicenseModelEntity get(VendorLicenseModelEntity vendorLicenseModel) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ ElementContext elementContext = new ElementContext(vendorLicenseModel.getId(), vendorLicenseModel.getVersion().getId());
+ ElementToVLMGeneralConvertor convertor = new ElementToVLMGeneralConvertor();
+ return zusammenAdaptor.getElementInfoByName(context, elementContext, null, ElementType.VendorLicenseModel.name()).map(generalElementInfo -> {
+ VendorLicenseModelEntity entity = convertor.convert(generalElementInfo);
+ entity.setId(vendorLicenseModel.getId());
+ entity.setVersion(vendorLicenseModel.getVersion());
+ return entity;
+ }).orElse(null);
+ }
+
+ @Override
+ public void delete(VendorLicenseModelEntity entity) {
+ throw new UnsupportedOperationException("Delete vlm version is done using versioning manager");
+ }
+
+ private ZusammenElement mapVlmToZusammenElement(VendorLicenseModelEntity vendorLicenseModel, Action action) {
+ ZusammenElement generalElement = ZusammenUtil.buildStructuralElement(ElementType.VendorLicenseModel, action);
+ addVlmToInfo(generalElement.getInfo(), vendorLicenseModel);
+ return generalElement;
+ }
+
+ private void addVlmToInfo(Info info, VendorLicenseModelEntity vendorLicenseModel) {
+ info.addProperty(InfoPropertyName.name.name(), vendorLicenseModel.getVendorName());
+ info.addProperty(InfoPropertyName.description.name(), vendorLicenseModel.getDescription());
+ info.addProperty(InfoPropertyName.iconRef.name(), vendorLicenseModel.getIconRef());
+ }
+
+ public enum InfoPropertyName {name, description, iconRef,}
}
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 01a15304a9..96c9e2ff83 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
@@ -24,42 +24,39 @@ import com.amdocs.zusammen.adaptor.inbound.api.types.item.ZusammenElement;
import com.amdocs.zusammen.datatypes.Id;
import com.amdocs.zusammen.datatypes.item.Relation;
import com.amdocs.zusammen.datatypes.item.RelationEdge;
-
import java.util.stream.Collectors;
public class VlmZusammenUtil {
- static ZusammenElement getZusammenElement(ElementInfo elementInfo) {
- ZusammenElement zusammenElement = new ZusammenElement();
- zusammenElement.setElementId(elementInfo.getId());
- zusammenElement.setInfo(elementInfo.getInfo());
- zusammenElement.setRelations(elementInfo.getRelations());
- zusammenElement.setSubElements(elementInfo.getSubElements().stream()
- .map(VlmZusammenUtil::getZusammenElement)
- .collect(Collectors.toList()));
- return zusammenElement;
- }
-
- public static Relation createRelation(RelationType type, String to) {
- Relation relation = new Relation();
- relation.setType(type.name());
- RelationEdge edge2 = new RelationEdge();
- edge2.setElementId(new Id(to));
- relation.setEdge2(edge2);
- return relation;
- }
+ static ZusammenElement getZusammenElement(ElementInfo elementInfo) {
+ ZusammenElement zusammenElement = new ZusammenElement();
+ zusammenElement.setElementId(elementInfo.getId());
+ zusammenElement.setInfo(elementInfo.getInfo());
+ zusammenElement.setRelations(elementInfo.getRelations());
+ zusammenElement.setSubElements(elementInfo.getSubElements().stream().map(VlmZusammenUtil::getZusammenElement).collect(Collectors.toList()));
+ return zusammenElement;
+ }
- public static Integer toInteger(Object val) {
- if (val == null) {
- return null;
+ public static Relation createRelation(RelationType type, String to) {
+ Relation relation = new Relation();
+ relation.setType(type.name());
+ RelationEdge edge2 = new RelationEdge();
+ edge2.setElementId(new Id(to));
+ relation.setEdge2(edge2);
+ return relation;
}
- 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;
+
+ public static Integer toInteger(Object val) {
+ if (val == null) {
+ return null;
+ }
+ 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());
}
- 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/dao/impl/zusammen/convertor/ElementToEntitlementPoolConvertor.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToEntitlementPoolConvertor.java
index 2f06b9b0d0..202e0eac68 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToEntitlementPoolConvertor.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToEntitlementPoolConvertor.java
@@ -19,99 +19,88 @@
*/
package org.openecomp.sdc.vendorlicense.dao.impl.zusammen.convertor;
+import static org.openecomp.sdc.vendorlicense.dao.impl.zusammen.VlmZusammenUtil.toInteger;
+
import com.amdocs.zusammen.adaptor.inbound.api.types.item.Element;
import com.amdocs.zusammen.adaptor.inbound.api.types.item.ElementInfo;
import com.amdocs.zusammen.datatypes.item.Info;
import com.amdocs.zusammen.datatypes.item.Relation;
-import org.openecomp.convertor.ElementConvertor;
-import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity;
-import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolType;
-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 java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
-
-import static org.openecomp.sdc.vendorlicense.dao.impl.zusammen.VlmZusammenUtil.toInteger;
-
+import org.openecomp.convertor.ElementConvertor;
+import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity;
+import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolType;
+import org.openecomp.sdc.vendorlicense.dao.types.MultiChoiceOrOther;
+import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope;
+import org.openecomp.sdc.vendorlicense.dao.types.ThresholdUnit;
public class ElementToEntitlementPoolConvertor extends ElementConvertor {
- @Override
- public EntitlementPoolEntity convert(Element element) {
- if (element == null) {
- return null;
- }
- return mapElementToEntitlementPoolEntity(element);
- }
- @Override
- public EntitlementPoolEntity convert(ElementInfo elementInfo) {
- if (elementInfo == null) {
- return null;
+ @Override
+ public EntitlementPoolEntity convert(Element element) {
+ if (element == null) {
+ return null;
+ }
+ return mapElementToEntitlementPoolEntity(element);
}
- return mapElementInfoToEntitlementPoolEntity(elementInfo);
- }
-
- private EntitlementPoolEntity mapElementToEntitlementPoolEntity(Element element) {
- EntitlementPoolEntity entitlementPool =
- new EntitlementPoolEntity();
- entitlementPool.setId(element.getElementId().getValue());
- mapInfoToEntitlementPoolEntity(entitlementPool, element.getInfo());
- mapRelationsToEntitlementPoolEntity(entitlementPool, element.getRelations());
- return entitlementPool;
- }
- private EntitlementPoolEntity mapElementInfoToEntitlementPoolEntity(ElementInfo elementInfo) {
- EntitlementPoolEntity entitlementPool =
- new EntitlementPoolEntity();
- entitlementPool.setId(elementInfo.getId().getValue());
- mapInfoToEntitlementPoolEntity(entitlementPool, elementInfo.getInfo());
- mapRelationsToEntitlementPoolEntity(entitlementPool, elementInfo.getRelations());
- return entitlementPool;
- }
+ @Override
+ public EntitlementPoolEntity convert(ElementInfo elementInfo) {
+ if (elementInfo == null) {
+ return null;
+ }
+ return mapElementInfoToEntitlementPoolEntity(elementInfo);
+ }
- private void mapInfoToEntitlementPoolEntity(EntitlementPoolEntity entitlementPool, Info info) {
- entitlementPool.setName(info.getName());
- entitlementPool.setDescription(info.getDescription());
- entitlementPool.setVersionUuId(info.getProperty("version_uuid"));
- entitlementPool.setType(EntitlementPoolType.permissiveValueOf(info.getProperty("EntitlementPoolType")));
- entitlementPool.setThresholdValue(toInteger(info.getProperty("thresholdValue")));
- String thresholdUnit = info.getProperty("threshold_unit");
- entitlementPool
- .setThresholdUnit(thresholdUnit == null ? null : ThresholdUnit.valueOf(thresholdUnit));
- entitlementPool.setIncrements(info.getProperty("increments"));
- entitlementPool.setOperationalScope(
- getOperationalScopeMultiChoiceOrOther(info.getProperty("operational_scope")));
- entitlementPool.setStartDate(info.getProperty("startDate"));
- entitlementPool.setExpiryDate(info.getProperty("expiryDate"));
- entitlementPool.setManufacturerReferenceNumber(info.getProperty("manufacturerReferenceNumber"));
- }
+ private EntitlementPoolEntity mapElementToEntitlementPoolEntity(Element element) {
+ EntitlementPoolEntity entitlementPool = new EntitlementPoolEntity();
+ entitlementPool.setId(element.getElementId().getValue());
+ mapInfoToEntitlementPoolEntity(entitlementPool, element.getInfo());
+ mapRelationsToEntitlementPoolEntity(entitlementPool, element.getRelations());
+ return entitlementPool;
+ }
- private void mapRelationsToEntitlementPoolEntity(EntitlementPoolEntity entitlementPool,
- Collection<Relation> relations) {
- if (relations != null && relations.size() > 0) {
- entitlementPool
- .setReferencingFeatureGroups(relations.stream().map(relation -> relation
- .getEdge2().getElementId().getValue()).collect(Collectors.toSet()));
+ private EntitlementPoolEntity mapElementInfoToEntitlementPoolEntity(ElementInfo elementInfo) {
+ EntitlementPoolEntity entitlementPool = new EntitlementPoolEntity();
+ entitlementPool.setId(elementInfo.getId().getValue());
+ mapInfoToEntitlementPoolEntity(entitlementPool, elementInfo.getInfo());
+ mapRelationsToEntitlementPoolEntity(entitlementPool, elementInfo.getRelations());
+ return entitlementPool;
}
- }
- private MultiChoiceOrOther<OperationalScope> getOperationalScopeMultiChoiceOrOther(
- Map<String, Object> operationalScope) {
- if (operationalScope == null || operationalScope.isEmpty()) {
- return null;
+ private void mapInfoToEntitlementPoolEntity(EntitlementPoolEntity entitlementPool, Info info) {
+ entitlementPool.setName(info.getName());
+ entitlementPool.setDescription(info.getDescription());
+ entitlementPool.setVersionUuId(info.getProperty("version_uuid"));
+ entitlementPool.setType(EntitlementPoolType.permissiveValueOf(info.getProperty("EntitlementPoolType")));
+ entitlementPool.setThresholdValue(toInteger(info.getProperty("thresholdValue")));
+ String thresholdUnit = info.getProperty("threshold_unit");
+ entitlementPool.setThresholdUnit(thresholdUnit == null ? null : ThresholdUnit.valueOf(thresholdUnit));
+ entitlementPool.setIncrements(info.getProperty("increments"));
+ entitlementPool.setOperationalScope(getOperationalScopeMultiChoiceOrOther(info.getProperty("operational_scope")));
+ entitlementPool.setStartDate(info.getProperty("startDate"));
+ entitlementPool.setExpiryDate(info.getProperty("expiryDate"));
+ entitlementPool.setManufacturerReferenceNumber(info.getProperty("manufacturerReferenceNumber"));
}
- Set<OperationalScope> choices = new HashSet<>();
- ((List<String>) operationalScope.get("choices")).
- forEach(choice -> choices.add(OperationalScope.valueOf(choice)));
+ private void mapRelationsToEntitlementPoolEntity(EntitlementPoolEntity entitlementPool, Collection<Relation> relations) {
+ if (relations != null && relations.size() > 0) {
+ entitlementPool.setReferencingFeatureGroups(
+ relations.stream().map(relation -> relation.getEdge2().getElementId().getValue()).collect(Collectors.toSet()));
+ }
+ }
- Object other = operationalScope.get("other");
- return new MultiChoiceOrOther<>(choices, other == null ? null : (String) other);
- }
+ private MultiChoiceOrOther<OperationalScope> getOperationalScopeMultiChoiceOrOther(Map<String, Object> operationalScope) {
+ if (operationalScope == null || operationalScope.isEmpty()) {
+ return null;
+ }
+ Set<OperationalScope> choices = new HashSet<>();
+ ((List<String>) operationalScope.get("choices")).forEach(choice -> choices.add(OperationalScope.valueOf(choice)));
+ Object other = operationalScope.get("other");
+ return new MultiChoiceOrOther<>(choices, other == null ? null : (String) other);
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToFeatureGroupConvertor.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToFeatureGroupConvertor.java
index 95eee9704c..d12cf3d8ea 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToFeatureGroupConvertor.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToFeatureGroupConvertor.java
@@ -23,80 +23,71 @@ import com.amdocs.zusammen.adaptor.inbound.api.types.item.Element;
import com.amdocs.zusammen.adaptor.inbound.api.types.item.ElementInfo;
import com.amdocs.zusammen.datatypes.item.Info;
import com.amdocs.zusammen.datatypes.item.Relation;
-import org.openecomp.convertor.ElementConvertor;
-import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.RelationType;
-import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity;
-
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
-
+import org.openecomp.convertor.ElementConvertor;
+import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.RelationType;
+import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity;
public class ElementToFeatureGroupConvertor extends ElementConvertor {
- @Override
- public FeatureGroupEntity convert(Element element) {
- if (element == null) {
- return null;
- }
- return mapElementToFeatureGroupEntity(element);
-
- }
- @Override
- public FeatureGroupEntity convert(ElementInfo elementInfo) {
- if (elementInfo == null) {
- return null;
+ @Override
+ public FeatureGroupEntity convert(Element element) {
+ if (element == null) {
+ return null;
+ }
+ return mapElementToFeatureGroupEntity(element);
}
- return mapElementInfoToFeatureGroupEntity(elementInfo);
-
- }
-
-
- private FeatureGroupEntity mapElementToFeatureGroupEntity(Element element) {
- FeatureGroupEntity featureGroup =
- new FeatureGroupEntity();
- featureGroup.setId(element.getElementId().getValue());
- mapInfoToFeatureGroup(featureGroup, element.getInfo());
- mapRelationsToFeatureGroup(featureGroup, element.getRelations());
- return featureGroup;
- }
+ @Override
+ public FeatureGroupEntity convert(ElementInfo elementInfo) {
+ if (elementInfo == null) {
+ return null;
+ }
+ return mapElementInfoToFeatureGroupEntity(elementInfo);
+ }
- private FeatureGroupEntity mapElementInfoToFeatureGroupEntity(ElementInfo elementInfo) {
- FeatureGroupEntity featureGroup = new FeatureGroupEntity();
- featureGroup.setId(elementInfo.getId().getValue());
- mapInfoToFeatureGroup(featureGroup, elementInfo.getInfo());
- mapRelationsToFeatureGroup(featureGroup, elementInfo.getRelations());
- return featureGroup;
- }
+ private FeatureGroupEntity mapElementToFeatureGroupEntity(Element element) {
+ FeatureGroupEntity featureGroup = new FeatureGroupEntity();
+ featureGroup.setId(element.getElementId().getValue());
+ mapInfoToFeatureGroup(featureGroup, element.getInfo());
+ mapRelationsToFeatureGroup(featureGroup, element.getRelations());
+ return featureGroup;
+ }
- private void mapInfoToFeatureGroup(FeatureGroupEntity featureGroup, Info info) {
- featureGroup.setName(info.getName());
- featureGroup.setDescription(info.getDescription());
- featureGroup.setPartNumber(info.getProperty("partNumber"));
- featureGroup.setManufacturerReferenceNumber(info.getProperty("manufacturerReferenceNumber"));
- }
+ private FeatureGroupEntity mapElementInfoToFeatureGroupEntity(ElementInfo elementInfo) {
+ FeatureGroupEntity featureGroup = new FeatureGroupEntity();
+ featureGroup.setId(elementInfo.getId().getValue());
+ mapInfoToFeatureGroup(featureGroup, elementInfo.getInfo());
+ mapRelationsToFeatureGroup(featureGroup, elementInfo.getRelations());
+ return featureGroup;
+ }
- private void mapRelationsToFeatureGroup(FeatureGroupEntity featureGroup,
- Collection<Relation> relations) {
- Set<String> entitlementPoolIds = new HashSet<>();
- Set<String> licenseAgreements = new HashSet<>();
- Set<String> licenseKeyGroupIds = new HashSet<>();
+ private void mapInfoToFeatureGroup(FeatureGroupEntity featureGroup, Info info) {
+ featureGroup.setName(info.getName());
+ featureGroup.setDescription(info.getDescription());
+ featureGroup.setPartNumber(info.getProperty("partNumber"));
+ featureGroup.setManufacturerReferenceNumber(info.getProperty("manufacturerReferenceNumber"));
+ }
- if (relations != null) {
- for (Relation relation : relations) {
- if (RelationType.FeatureGroupToEntitlmentPool.name().equals(relation.getType())) {
- entitlementPoolIds.add(relation.getEdge2().getElementId().getValue());
- } else if (RelationType.FeatureGroupToLicenseKeyGroup.name().equals(relation.getType())) {
- licenseKeyGroupIds.add(relation.getEdge2().getElementId().getValue());
- } else if (RelationType.FeatureGroupToReferencingLicenseAgreement.name()
- .equals(relation.getType())) {
- licenseAgreements.add(relation.getEdge2().getElementId().getValue());
+ private void mapRelationsToFeatureGroup(FeatureGroupEntity featureGroup, Collection<Relation> relations) {
+ Set<String> entitlementPoolIds = new HashSet<>();
+ Set<String> licenseAgreements = new HashSet<>();
+ Set<String> licenseKeyGroupIds = new HashSet<>();
+ if (relations != null) {
+ for (Relation relation : relations) {
+ if (RelationType.FeatureGroupToEntitlmentPool.name().equals(relation.getType())) {
+ entitlementPoolIds.add(relation.getEdge2().getElementId().getValue());
+ } else if (RelationType.FeatureGroupToLicenseKeyGroup.name().equals(relation.getType())) {
+ licenseKeyGroupIds.add(relation.getEdge2().getElementId().getValue());
+ } else if (RelationType.FeatureGroupToReferencingLicenseAgreement.name().equals(relation.getType())) {
+ licenseAgreements.add(relation.getEdge2().getElementId().getValue());
+ }
+ }
}
- }
+ featureGroup.setEntitlementPoolIds(entitlementPoolIds);
+ featureGroup.setLicenseKeyGroupIds(licenseKeyGroupIds);
+ featureGroup.setReferencingLicenseAgreements(licenseAgreements);
}
- featureGroup.setEntitlementPoolIds(entitlementPoolIds);
- featureGroup.setLicenseKeyGroupIds(licenseKeyGroupIds);
- featureGroup.setReferencingLicenseAgreements(licenseAgreements);
- }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToLicenseAgreementConvertor.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToLicenseAgreementConvertor.java
index 0623b10b04..f217c7c4c2 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToLicenseAgreementConvertor.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToLicenseAgreementConvertor.java
@@ -23,83 +23,63 @@ import com.amdocs.zusammen.adaptor.inbound.api.types.item.Element;
import com.amdocs.zusammen.adaptor.inbound.api.types.item.ElementInfo;
import com.amdocs.zusammen.datatypes.item.Info;
import com.amdocs.zusammen.datatypes.item.Relation;
+import java.util.Collection;
+import java.util.Map;
+import java.util.stream.Collectors;
import org.openecomp.convertor.ElementConvertor;
import org.openecomp.sdc.vendorlicense.dao.types.ChoiceOrOther;
import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementEntity;
import org.openecomp.sdc.vendorlicense.dao.types.LicenseTerm;
-import java.util.Collection;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-
public class ElementToLicenseAgreementConvertor extends ElementConvertor {
- @Override
- public LicenseAgreementEntity convert(Element element) {
- if (element == null) {
- return null;
- }
- return mapElementToLicenseAgreementEntity(element);
-
- }
-
- @Override
- public LicenseAgreementEntity convert(ElementInfo elementInfo) {
- if (elementInfo == null) {
- return null;
+ @Override
+ public LicenseAgreementEntity convert(Element element) {
+ if (element == null) {
+ return null;
+ }
+ return mapElementToLicenseAgreementEntity(element);
}
- return mapElementInfoToLicenseAgreementEntity(elementInfo);
-
- }
-
- private LicenseAgreementEntity mapElementToLicenseAgreementEntity(Element element) {
- LicenseAgreementEntity licenseAgreement =
- new LicenseAgreementEntity();
- licenseAgreement.setId(element.getElementId().getValue());
- mapInfoToLicenseAgreementEntity(licenseAgreement, element.getInfo());
- mapRelationsToLicenseAgreementEntity(licenseAgreement, element.getRelations());
- return licenseAgreement;
- }
-
-
- private LicenseAgreementEntity mapElementInfoToLicenseAgreementEntity(ElementInfo elementInfo) {
- LicenseAgreementEntity licenseAgreement =
- new LicenseAgreementEntity();
- licenseAgreement.setId( elementInfo.getId().getValue());
- mapInfoToLicenseAgreementEntity(licenseAgreement, elementInfo.getInfo());
- mapRelationsToLicenseAgreementEntity(licenseAgreement, elementInfo.getRelations());
- return licenseAgreement;
- }
-
- private void mapRelationsToLicenseAgreementEntity(LicenseAgreementEntity licenseAgreementEntity,
- Collection<Relation> relations) {
- if (relations != null && relations.size() > 0) {
- licenseAgreementEntity.setFeatureGroupIds(relations.stream()
- .map(relation -> relation.getEdge2().getElementId().getValue())
- .collect(Collectors.toSet()));
+ @Override
+ public LicenseAgreementEntity convert(ElementInfo elementInfo) {
+ if (elementInfo == null) {
+ return null;
+ }
+ return mapElementInfoToLicenseAgreementEntity(elementInfo);
}
- }
-
- private void mapInfoToLicenseAgreementEntity(LicenseAgreementEntity licenseAgreement, Info info) {
-
-
- licenseAgreement.setName(info.getName());
- licenseAgreement.setDescription(info.getDescription());
-
- licenseAgreement
- .setLicenseTerm(getCoiceOrOther(info.getProperty("licenseTerm")));
- licenseAgreement.setRequirementsAndConstrains(
- info.getProperty("requirementsAndConstrains"));
+ private LicenseAgreementEntity mapElementToLicenseAgreementEntity(Element element) {
+ LicenseAgreementEntity licenseAgreement = new LicenseAgreementEntity();
+ licenseAgreement.setId(element.getElementId().getValue());
+ mapInfoToLicenseAgreementEntity(licenseAgreement, element.getInfo());
+ mapRelationsToLicenseAgreementEntity(licenseAgreement, element.getRelations());
+ return licenseAgreement;
+ }
- }
+ private LicenseAgreementEntity mapElementInfoToLicenseAgreementEntity(ElementInfo elementInfo) {
+ LicenseAgreementEntity licenseAgreement = new LicenseAgreementEntity();
+ licenseAgreement.setId(elementInfo.getId().getValue());
+ mapInfoToLicenseAgreementEntity(licenseAgreement, elementInfo.getInfo());
+ mapRelationsToLicenseAgreementEntity(licenseAgreement, elementInfo.getRelations());
+ return licenseAgreement;
+ }
- private ChoiceOrOther<LicenseTerm> getCoiceOrOther(Map licenseTerm) {
- return new ChoiceOrOther<>(LicenseTerm.valueOf((String) licenseTerm.get("choice")),
- (String) licenseTerm.get("other"));
- }
+ private void mapRelationsToLicenseAgreementEntity(LicenseAgreementEntity licenseAgreementEntity, Collection<Relation> relations) {
+ if (relations != null && relations.size() > 0) {
+ licenseAgreementEntity
+ .setFeatureGroupIds(relations.stream().map(relation -> relation.getEdge2().getElementId().getValue()).collect(Collectors.toSet()));
+ }
+ }
+ private void mapInfoToLicenseAgreementEntity(LicenseAgreementEntity licenseAgreement, Info info) {
+ licenseAgreement.setName(info.getName());
+ licenseAgreement.setDescription(info.getDescription());
+ licenseAgreement.setLicenseTerm(getCoiceOrOther(info.getProperty("licenseTerm")));
+ licenseAgreement.setRequirementsAndConstrains(info.getProperty("requirementsAndConstrains"));
+ }
+ private ChoiceOrOther<LicenseTerm> getCoiceOrOther(Map licenseTerm) {
+ return new ChoiceOrOther<>(LicenseTerm.valueOf((String) licenseTerm.get("choice")), (String) licenseTerm.get("other"));
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToLicenseKeyGroupConvertor.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToLicenseKeyGroupConvertor.java
index c22fcf8935..601a5ec35a 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToLicenseKeyGroupConvertor.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToLicenseKeyGroupConvertor.java
@@ -19,103 +19,88 @@
*/
package org.openecomp.sdc.vendorlicense.dao.impl.zusammen.convertor;
+import static org.openecomp.sdc.vendorlicense.dao.impl.zusammen.VlmZusammenUtil.toInteger;
+
import com.amdocs.zusammen.adaptor.inbound.api.types.item.Element;
import com.amdocs.zusammen.adaptor.inbound.api.types.item.ElementInfo;
import com.amdocs.zusammen.datatypes.item.Info;
import com.amdocs.zusammen.datatypes.item.Relation;
-import org.openecomp.convertor.ElementConvertor;
-import org.openecomp.sdc.vendorlicense.dao.types.*;
-
-import java.util.stream.Collectors;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
-
-
-import static org.openecomp.sdc.vendorlicense.dao.impl.zusammen.VlmZusammenUtil.toInteger;
-
+import java.util.stream.Collectors;
+import org.openecomp.convertor.ElementConvertor;
+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;
public class ElementToLicenseKeyGroupConvertor extends ElementConvertor {
- @Override
- public LicenseKeyGroupEntity convert(Element element) {
- if (element == null) {
- return null;
- }
- return mapElementToLicenseKeyGroupEntity(element);
- }
-
- @Override
- public LicenseKeyGroupEntity convert(ElementInfo elementInfo) {
- if (elementInfo == null) {
- return null;
+ @Override
+ public LicenseKeyGroupEntity convert(Element element) {
+ if (element == null) {
+ return null;
+ }
+ return mapElementToLicenseKeyGroupEntity(element);
}
- return mapElementInfoToLicenseKeyGroupEntity(elementInfo);
-
- }
-
- private LicenseKeyGroupEntity mapElementToLicenseKeyGroupEntity(
- Element element) {
- LicenseKeyGroupEntity licenseKeyGroup =
- new LicenseKeyGroupEntity();
- licenseKeyGroup.setId(element.getElementId().getValue());
- mapInfoToLicenseKeyGroup(licenseKeyGroup, element.getInfo());
- mapRelationsToLicenseKeyGroup(licenseKeyGroup, element.getRelations());
- return licenseKeyGroup;
- }
-
-
- private LicenseKeyGroupEntity mapElementInfoToLicenseKeyGroupEntity(ElementInfo elementInfo) {
- LicenseKeyGroupEntity licenseKeyGroup =
- new LicenseKeyGroupEntity();
- licenseKeyGroup.setId(elementInfo.getId().getValue());
-
- mapInfoToLicenseKeyGroup(licenseKeyGroup, elementInfo.getInfo());
- mapRelationsToLicenseKeyGroup(licenseKeyGroup, elementInfo.getRelations());
- return licenseKeyGroup;
- }
- private void mapInfoToLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup, Info info) {
- licenseKeyGroup.setName(info.getName());
- licenseKeyGroup.setDescription(info.getDescription());
- licenseKeyGroup.setVersionUuId(info.getProperty("version_uuid"));
- licenseKeyGroup.setType(LicenseKeyType.valueOf(info.getProperty("LicenseKeyType")));
- licenseKeyGroup.setOperationalScope(
- getOperationalScopeMultiChoiceOrOther(info.getProperty("operational_scope")));
- licenseKeyGroup.setStartDate(info.getProperty("startDate"));
- licenseKeyGroup.setExpiryDate(info.getProperty("expiryDate"));
-
- String thresholdUnit = info.getProperty("thresholdUnits");
- licenseKeyGroup
- .setThresholdUnits(thresholdUnit == null ? null : ThresholdUnit.valueOf(thresholdUnit));
+ @Override
+ public LicenseKeyGroupEntity convert(ElementInfo elementInfo) {
+ if (elementInfo == null) {
+ return null;
+ }
+ return mapElementInfoToLicenseKeyGroupEntity(elementInfo);
+ }
- licenseKeyGroup.setThresholdValue(toInteger(info.getProperty("thresholdValue")));
- licenseKeyGroup.setIncrements(info.getProperty("increments"));
- licenseKeyGroup.setManufacturerReferenceNumber(info.getProperty("manufacturerReferenceNumber"));
- }
+ private LicenseKeyGroupEntity mapElementToLicenseKeyGroupEntity(Element element) {
+ LicenseKeyGroupEntity licenseKeyGroup = new LicenseKeyGroupEntity();
+ licenseKeyGroup.setId(element.getElementId().getValue());
+ mapInfoToLicenseKeyGroup(licenseKeyGroup, element.getInfo());
+ mapRelationsToLicenseKeyGroup(licenseKeyGroup, element.getRelations());
+ return licenseKeyGroup;
+ }
- private void mapRelationsToLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup,
- Collection<Relation> relations) {
- if (relations != null && relations.size() > 0) {
- licenseKeyGroup
- .setReferencingFeatureGroups((relations.stream().map(relation -> relation
- .getEdge2().getElementId().getValue()).collect(Collectors.toSet())));
+ private LicenseKeyGroupEntity mapElementInfoToLicenseKeyGroupEntity(ElementInfo elementInfo) {
+ LicenseKeyGroupEntity licenseKeyGroup = new LicenseKeyGroupEntity();
+ licenseKeyGroup.setId(elementInfo.getId().getValue());
+ mapInfoToLicenseKeyGroup(licenseKeyGroup, elementInfo.getInfo());
+ mapRelationsToLicenseKeyGroup(licenseKeyGroup, elementInfo.getRelations());
+ return licenseKeyGroup;
}
- }
- private MultiChoiceOrOther<OperationalScope> getOperationalScopeMultiChoiceOrOther(
- Map<String, Object> operationalScope) {
- if (operationalScope == null || operationalScope.isEmpty()) {
- return null;
+ private void mapInfoToLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup, Info info) {
+ licenseKeyGroup.setName(info.getName());
+ licenseKeyGroup.setDescription(info.getDescription());
+ licenseKeyGroup.setVersionUuId(info.getProperty("version_uuid"));
+ licenseKeyGroup.setType(LicenseKeyType.valueOf(info.getProperty("LicenseKeyType")));
+ licenseKeyGroup.setOperationalScope(getOperationalScopeMultiChoiceOrOther(info.getProperty("operational_scope")));
+ licenseKeyGroup.setStartDate(info.getProperty("startDate"));
+ licenseKeyGroup.setExpiryDate(info.getProperty("expiryDate"));
+ String thresholdUnit = info.getProperty("thresholdUnits");
+ licenseKeyGroup.setThresholdUnits(thresholdUnit == null ? null : ThresholdUnit.valueOf(thresholdUnit));
+ licenseKeyGroup.setThresholdValue(toInteger(info.getProperty("thresholdValue")));
+ licenseKeyGroup.setIncrements(info.getProperty("increments"));
+ licenseKeyGroup.setManufacturerReferenceNumber(info.getProperty("manufacturerReferenceNumber"));
}
- Set<OperationalScope> choices = new HashSet<>();
- ((List<String>) operationalScope.get("choices")).
- forEach(choice -> choices.add(OperationalScope.valueOf(choice)));
+ private void mapRelationsToLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup, Collection<Relation> relations) {
+ if (relations != null && relations.size() > 0) {
+ licenseKeyGroup.setReferencingFeatureGroups(
+ (relations.stream().map(relation -> relation.getEdge2().getElementId().getValue()).collect(Collectors.toSet())));
+ }
+ }
- Object other = operationalScope.get("other");
- return new MultiChoiceOrOther<>(choices, other == null ? null : (String) other);
- }
+ private MultiChoiceOrOther<OperationalScope> getOperationalScopeMultiChoiceOrOther(Map<String, Object> operationalScope) {
+ if (operationalScope == null || operationalScope.isEmpty()) {
+ return null;
+ }
+ Set<OperationalScope> choices = new HashSet<>();
+ ((List<String>) operationalScope.get("choices")).forEach(choice -> choices.add(OperationalScope.valueOf(choice)));
+ Object other = operationalScope.get("other");
+ return new MultiChoiceOrOther<>(choices, other == null ? null : (String) other);
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToLimitConvertor.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToLimitConvertor.java
index 20674c669a..ace15af3bf 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToLimitConvertor.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToLimitConvertor.java
@@ -24,36 +24,36 @@ import org.openecomp.sdc.vendorlicense.dao.types.LimitType;
* Created by ayalaben on 9/26/2017
*/
public class ElementToLimitConvertor extends ElementConvertor<LimitEntity> {
- @Override
- public LimitEntity convert(Element element) {
- if (element == null) {
- return null;
- }
- return mapElementToLimitEntity(element);
- }
- private LimitEntity mapElementToLimitEntity(Element element) {
- LimitEntity limit = new LimitEntity();
- limit.setId(element.getElementId().getValue());
- limit.setName(element.getInfo().getName());
- limit.setDescription(element.getInfo().getDescription());
- limit.setUnit(element.getInfo().getProperty("unit"));
- limit.setMetric(element.getInfo().getProperty("metric"));
- limit.setValue(element.getInfo().getProperty("value"));
- limit.setTime(element.getInfo().getProperty("time"));
- limit.setAggregationFunction(element.getInfo().getProperty("aggregationFunction"));
- setLimitType(limit,element.getInfo().getProperty("type"));
+ @Override
+ public LimitEntity convert(Element element) {
+ if (element == null) {
+ return null;
+ }
+ return mapElementToLimitEntity(element);
+ }
- return limit;
- }
+ private LimitEntity mapElementToLimitEntity(Element element) {
+ LimitEntity limit = new LimitEntity();
+ limit.setId(element.getElementId().getValue());
+ limit.setName(element.getInfo().getName());
+ limit.setDescription(element.getInfo().getDescription());
+ limit.setUnit(element.getInfo().getProperty("unit"));
+ limit.setMetric(element.getInfo().getProperty("metric"));
+ limit.setValue(element.getInfo().getProperty("value"));
+ limit.setTime(element.getInfo().getProperty("time"));
+ limit.setAggregationFunction(element.getInfo().getProperty("aggregationFunction"));
+ setLimitType(limit, element.getInfo().getProperty("type"));
+ return limit;
+ }
- private void setLimitType(LimitEntity limit, String type) {
- switch (LimitType.valueOf(type)) {
- case ServiceProvider:
- limit.setType(LimitType.ServiceProvider);
- break;
- case Vendor:
- limit.setType(LimitType.Vendor);
+ private void setLimitType(LimitEntity limit, String type) {
+ switch (LimitType.valueOf(type)) {
+ case ServiceProvider:
+ limit.setType(LimitType.ServiceProvider);
+ break;
+ case Vendor:
+ limit.setType(LimitType.Vendor);
+ }
}
- }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToVLMGeneralConvertor.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToVLMGeneralConvertor.java
index 5dc3b592c0..e274e264c0 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToVLMGeneralConvertor.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToVLMGeneralConvertor.java
@@ -27,39 +27,37 @@ import org.openecomp.convertor.ElementConvertor;
import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.VendorLicenseModelDaoZusammenImpl;
import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity;
-
public class ElementToVLMGeneralConvertor extends ElementConvertor {
- @Override
- public VendorLicenseModelEntity convert(Element element) {
- if(element == null) return null;
- return mapInfoToVendorLicenseModelEntity( element.getInfo());
-
- }
-
- @Override
- public VendorLicenseModelEntity convert(Item item) {
- if(item == null) return null;
- return mapInfoToVendorLicenseModelEntity( item.getInfo());
- }
-
- @Override
- public VendorLicenseModelEntity convert(ElementInfo elementInfo) {
- if(elementInfo == null) return null;
- return mapInfoToVendorLicenseModelEntity( elementInfo.getInfo());
-
- }
-
- private VendorLicenseModelEntity mapInfoToVendorLicenseModelEntity(Info info) {
-
- VendorLicenseModelEntity vendorLicenseModelEntity = new VendorLicenseModelEntity();
-
- vendorLicenseModelEntity.setVendorName(info.getProperty(
- VendorLicenseModelDaoZusammenImpl.InfoPropertyName.name.name()));
- vendorLicenseModelEntity.setDescription(info.getProperty(
- VendorLicenseModelDaoZusammenImpl.InfoPropertyName.description.name()));
- vendorLicenseModelEntity.setIconRef(info.getProperty(
- VendorLicenseModelDaoZusammenImpl.InfoPropertyName.iconRef.name()));
- return vendorLicenseModelEntity;
- }
+ @Override
+ public VendorLicenseModelEntity convert(Element element) {
+ if (element == null) {
+ return null;
+ }
+ return mapInfoToVendorLicenseModelEntity(element.getInfo());
+ }
+
+ @Override
+ public VendorLicenseModelEntity convert(Item item) {
+ if (item == null) {
+ return null;
+ }
+ return mapInfoToVendorLicenseModelEntity(item.getInfo());
+ }
+
+ @Override
+ public VendorLicenseModelEntity convert(ElementInfo elementInfo) {
+ if (elementInfo == null) {
+ return null;
+ }
+ return mapInfoToVendorLicenseModelEntity(elementInfo.getInfo());
+ }
+
+ private VendorLicenseModelEntity mapInfoToVendorLicenseModelEntity(Info info) {
+ VendorLicenseModelEntity vendorLicenseModelEntity = new VendorLicenseModelEntity();
+ vendorLicenseModelEntity.setVendorName(info.getProperty(VendorLicenseModelDaoZusammenImpl.InfoPropertyName.name.name()));
+ vendorLicenseModelEntity.setDescription(info.getProperty(VendorLicenseModelDaoZusammenImpl.InfoPropertyName.description.name()));
+ vendorLicenseModelEntity.setIconRef(info.getProperty(VendorLicenseModelDaoZusammenImpl.InfoPropertyName.iconRef.name()));
+ return vendorLicenseModelEntity;
+ }
}
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/VendorLicenseFacadeFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/facade/impl/VendorLicenseFacadeFactoryImpl.java
index 3cf6d0b806..7eacc8ca9d 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/facade/impl/VendorLicenseFacadeFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/facade/impl/VendorLicenseFacadeFactoryImpl.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,17 +17,17 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.facade.impl;
import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade;
import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacadeFactory;
public class VendorLicenseFacadeFactoryImpl extends VendorLicenseFacadeFactory {
- private static VendorLicenseFacade INSTANCE = new VendorLicenseFacadeImpl();
- @Override
- public VendorLicenseFacade createInterface() {
- return INSTANCE;
- }
+ private static VendorLicenseFacade INSTANCE = new VendorLicenseFacadeImpl();
+
+ @Override
+ public VendorLicenseFacade 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/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 818d772db4..d97b8c8c4d 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
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.facade.impl;
import static org.openecomp.sdc.common.errors.ValidationErrorBuilder.FIELD_VALIDATION_ERROR_ERR_ID;
@@ -71,337 +70,263 @@ import org.openecomp.sdc.versioning.types.ItemStatus;
public class VendorLicenseFacadeImpl implements VendorLicenseFacade {
- private static final VendorLicenseModelDao
- vendorLicenseModelDao = VendorLicenseModelDaoFactory.getInstance().createInterface();
- private static final LicenseAgreementDao
- licenseAgreementDao = LicenseAgreementDaoFactory.getInstance().createInterface();
- private static final FeatureGroupDao featureGroupDao =
- FeatureGroupDaoFactory.getInstance().createInterface();
- private static final EntitlementPoolDao
- entitlementPoolDao = EntitlementPoolDaoFactory.getInstance().createInterface();
- private static final LicenseKeyGroupDao
- licenseKeyGroupDao = LicenseKeyGroupDaoFactory.getInstance().createInterface();
- private static final LimitDao limitDao = LimitDaoFactory.getInstance().createInterface();
- private static final UniqueValueUtil uniqueValueUtil = new UniqueValueUtil
- (UniqueValueDaoFactory.getInstance().createInterface());
- private static final ErrorCode USED_VLM_NOT_EXIST_ERROR =
- new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION).withId(FIELD_VALIDATION_ERROR_ERR_ID)
- .withMessage("The supplied vendor does not exist").build();
- private static final ErrorCode USED_VLM_ARCHIVE_ERROR =
- new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION).withId(FIELD_VALIDATION_ERROR_ERR_ID)
- .withMessage("The supplied vendor is archived and therefore cannot be used").build();
- private static final ErrorCode USED_VLM_IS_DRAFT_ERROR =
- new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION).withId(FIELD_VALIDATION_ERROR_ERR_ID)
- .withMessage("The supplied vendor version is draft and therefore can not be used").build();
-
-
- /**
- * Instantiates a new Vendor license facade.
- */
- public VendorLicenseFacadeImpl() {
- vendorLicenseModelDao.registerVersioning(VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE);
- licenseAgreementDao.registerVersioning(VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE);
- 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
- public FeatureGroupEntity getFeatureGroup(FeatureGroupEntity featureGroup) {
- FeatureGroupEntity retrieved = featureGroupDao.get(featureGroup);
- VersioningUtil
- .validateEntityExistence(retrieved, featureGroup, VendorLicenseModelEntity.ENTITY_TYPE);
-
- return retrieved;
- }
-
- @Override
- public FeatureGroupModel getFeatureGroupModel(FeatureGroupEntity featureGroup) {
- FeatureGroupEntity retrieved = getFeatureGroup(featureGroup);
-
- FeatureGroupModel featureGroupModel = new FeatureGroupModel();
- featureGroupModel.setFeatureGroup(retrieved);
-
- for (String licenseKeyGroupId : retrieved.getLicenseKeyGroupIds()) {
- featureGroupModel.getLicenseKeyGroups().add(licenseKeyGroupDao.get(
- new LicenseKeyGroupEntity(retrieved.getVendorLicenseModelId(), retrieved.getVersion(),
- licenseKeyGroupId)));
+ private static final VendorLicenseModelDao vendorLicenseModelDao = VendorLicenseModelDaoFactory.getInstance().createInterface();
+ private static final LicenseAgreementDao licenseAgreementDao = LicenseAgreementDaoFactory.getInstance().createInterface();
+ private static final FeatureGroupDao featureGroupDao = FeatureGroupDaoFactory.getInstance().createInterface();
+ private static final EntitlementPoolDao entitlementPoolDao = EntitlementPoolDaoFactory.getInstance().createInterface();
+ private static final LicenseKeyGroupDao licenseKeyGroupDao = LicenseKeyGroupDaoFactory.getInstance().createInterface();
+ private static final LimitDao limitDao = LimitDaoFactory.getInstance().createInterface();
+ private static final UniqueValueUtil uniqueValueUtil = new UniqueValueUtil(UniqueValueDaoFactory.getInstance().createInterface());
+ private static final ErrorCode USED_VLM_NOT_EXIST_ERROR = new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION)
+ .withId(FIELD_VALIDATION_ERROR_ERR_ID).withMessage("The supplied vendor does not exist").build();
+ private static final ErrorCode USED_VLM_ARCHIVE_ERROR = new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION)
+ .withId(FIELD_VALIDATION_ERROR_ERR_ID).withMessage("The supplied vendor is archived and therefore cannot be used").build();
+ private static final ErrorCode USED_VLM_IS_DRAFT_ERROR = new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION)
+ .withId(FIELD_VALIDATION_ERROR_ERR_ID).withMessage("The supplied vendor version is draft and therefore can not be used").build();
+
+ /**
+ * Instantiates a new Vendor license facade.
+ */
+ public VendorLicenseFacadeImpl() {
+ vendorLicenseModelDao.registerVersioning(VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE);
+ licenseAgreementDao.registerVersioning(VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE);
+ 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);
}
- for (String entitlementPoolId : retrieved.getEntitlementPoolIds()) {
- featureGroupModel.getEntitlementPools().add(entitlementPoolDao.get(
- new EntitlementPoolEntity(retrieved.getVendorLicenseModelId(), retrieved.getVersion(),
- entitlementPoolId)));
- }
-
- return featureGroupModel;
- }
-
- @Override
- public LicenseAgreementModel getLicenseAgreementModel(String vlmId, Version version,
- String licenseAgreementId) {
- LicenseAgreementEntity retrieved =
- getLicenseAgreement(vlmId, version, licenseAgreementId);
-
- LicenseAgreementModel licenseAgreementModel = new LicenseAgreementModel();
- licenseAgreementModel.setLicenseAgreement(retrieved);
- for (String featureGroupId : retrieved.getFeatureGroupIds()) {
- licenseAgreementModel.getFeatureGroups().add(featureGroupDao
- .get(new FeatureGroupEntity(vlmId, retrieved.getVersion(), featureGroupId)));
+ @Override
+ public FeatureGroupEntity getFeatureGroup(FeatureGroupEntity featureGroup) {
+ FeatureGroupEntity retrieved = featureGroupDao.get(featureGroup);
+ VersioningUtil.validateEntityExistence(retrieved, featureGroup, VendorLicenseModelEntity.ENTITY_TYPE);
+ return retrieved;
}
- return licenseAgreementModel;
- }
-
- @Override
- public EntitlementPoolEntity createEntitlementPool(EntitlementPoolEntity entitlementPool) {
- entitlementPool.setVersionUuId(CommonMethods.nextUuId());
- uniqueValueUtil.createUniqueValue(VendorLicenseConstants.UniqueValues.ENTITLEMENT_POOL_NAME,
- entitlementPool.getVendorLicenseModelId(), entitlementPool.getVersion().getId(),
- entitlementPool.getName());
- entitlementPoolDao.create(entitlementPool);
- return entitlementPool;
- }
-
- @Override
- public void updateEntitlementPool(EntitlementPoolEntity entitlementPool) {
- EntitlementPoolEntity retrieved = entitlementPoolDao.get(entitlementPool);
- VersioningUtil
- .validateEntityExistence(retrieved, entitlementPool, VendorLicenseModelEntity.ENTITY_TYPE);
- if (retrieved.equals(entitlementPool)) {
- return;
+ @Override
+ public FeatureGroupModel getFeatureGroupModel(FeatureGroupEntity featureGroup) {
+ FeatureGroupEntity retrieved = getFeatureGroup(featureGroup);
+ FeatureGroupModel featureGroupModel = new FeatureGroupModel();
+ featureGroupModel.setFeatureGroup(retrieved);
+ for (String licenseKeyGroupId : retrieved.getLicenseKeyGroupIds()) {
+ featureGroupModel.getLicenseKeyGroups().add(
+ licenseKeyGroupDao.get(new LicenseKeyGroupEntity(retrieved.getVendorLicenseModelId(), retrieved.getVersion(), licenseKeyGroupId)));
+ }
+ for (String entitlementPoolId : retrieved.getEntitlementPoolIds()) {
+ featureGroupModel.getEntitlementPools().add(
+ entitlementPoolDao.get(new EntitlementPoolEntity(retrieved.getVendorLicenseModelId(), retrieved.getVersion(), entitlementPoolId)));
+ }
+ return featureGroupModel;
}
- uniqueValueUtil.updateUniqueValue(VendorLicenseConstants.UniqueValues.ENTITLEMENT_POOL_NAME,
- retrieved.getName(), entitlementPool.getName(), entitlementPool.getVendorLicenseModelId(),
- entitlementPool.getVersion().getId());
- entitlementPool.setVersionUuId(CommonMethods.nextUuId());
- entitlementPoolDao.update(entitlementPool);
- }
-
- @Override
- public Collection<LicenseKeyGroupEntity> listLicenseKeyGroups(String vlmId, Version version) {
- return licenseKeyGroupDao.list(new LicenseKeyGroupEntity(vlmId, version, null));
- }
-
- @Override
- public Collection<EntitlementPoolEntity> listEntitlementPools(String vlmId, Version version) {
- return entitlementPoolDao.list(new EntitlementPoolEntity(vlmId, version, null));
- }
- @Override
- public void updateLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup) {
- LicenseKeyGroupEntity retrieved = licenseKeyGroupDao.get(licenseKeyGroup);
- if (retrieved.equals(licenseKeyGroup)) {
- return;
+ @Override
+ public LicenseAgreementModel getLicenseAgreementModel(String vlmId, Version version, String licenseAgreementId) {
+ LicenseAgreementEntity retrieved = getLicenseAgreement(vlmId, version, licenseAgreementId);
+ LicenseAgreementModel licenseAgreementModel = new LicenseAgreementModel();
+ licenseAgreementModel.setLicenseAgreement(retrieved);
+ for (String featureGroupId : retrieved.getFeatureGroupIds()) {
+ licenseAgreementModel.getFeatureGroups().add(featureGroupDao.get(new FeatureGroupEntity(vlmId, retrieved.getVersion(), featureGroupId)));
+ }
+ return licenseAgreementModel;
}
- licenseKeyGroup.setVersionUuId((CommonMethods.nextUuId()));
- VersioningUtil
- .validateEntityExistence(retrieved, licenseKeyGroup, VendorLicenseModelEntity.ENTITY_TYPE);
- uniqueValueUtil.updateUniqueValue(VendorLicenseConstants.UniqueValues.LICENSE_KEY_GROUP_NAME,
- retrieved.getName(), licenseKeyGroup.getName(), licenseKeyGroup.getVendorLicenseModelId(),
- licenseKeyGroup.getVersion().getId());
- licenseKeyGroupDao.update(licenseKeyGroup);
- }
- @Override
- public LicenseKeyGroupEntity createLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup) {
- licenseKeyGroup.setVersionUuId(CommonMethods.nextUuId());
- uniqueValueUtil.createUniqueValue(VendorLicenseConstants.UniqueValues.LICENSE_KEY_GROUP_NAME,
- licenseKeyGroup.getVendorLicenseModelId(), licenseKeyGroup.getVersion().getId(),
- licenseKeyGroup.getName());
- licenseKeyGroupDao.create(licenseKeyGroup);
- return licenseKeyGroup;
- }
-
- @Override
- public VendorLicenseModelEntity getVendorLicenseModel(String vlmId, Version version) {
- VendorLicenseModelEntity vendorLicenseModel =
- vendorLicenseModelDao.get(new VendorLicenseModelEntity(vlmId, version));
- if (vendorLicenseModel == null) {
- throw new CoreException(new VendorLicenseModelNotFoundErrorBuilder(vlmId).build());
+ @Override
+ public EntitlementPoolEntity createEntitlementPool(EntitlementPoolEntity entitlementPool) {
+ entitlementPool.setVersionUuId(CommonMethods.nextUuId());
+ uniqueValueUtil.createUniqueValue(VendorLicenseConstants.UniqueValues.ENTITLEMENT_POOL_NAME, entitlementPool.getVendorLicenseModelId(),
+ entitlementPool.getVersion().getId(), entitlementPool.getName());
+ entitlementPoolDao.create(entitlementPool);
+ return entitlementPool;
}
- return vendorLicenseModel;
- }
- @Override
- public LicenseAgreementEntity createLicenseAgreement(LicenseAgreementEntity licenseAgreement) {
- VersioningUtil.validateEntitiesExistence(licenseAgreement.getFeatureGroupIds(),
- new FeatureGroupEntity(licenseAgreement.getVendorLicenseModelId(),
- licenseAgreement.getVersion(),
- null),
- featureGroupDao, VendorLicenseModelEntity.ENTITY_TYPE);
-
- uniqueValueUtil.validateUniqueValue(VendorLicenseConstants.UniqueValues.LICENSE_AGREEMENT_NAME,
- licenseAgreement.getVendorLicenseModelId(), licenseAgreement.getVersion().getId(),
- licenseAgreement.getName());
-
- licenseAgreementDao.create(licenseAgreement);
- uniqueValueUtil.createUniqueValue(VendorLicenseConstants.UniqueValues.LICENSE_AGREEMENT_NAME,
- licenseAgreement.getVendorLicenseModelId(), licenseAgreement.getVersion().getId(),
- licenseAgreement.getName());
- if (licenseAgreement.getFeatureGroupIds() != null) {
- for (String addedFgId : licenseAgreement.getFeatureGroupIds()) {
- featureGroupDao.addReferencingLicenseAgreement(
- new FeatureGroupEntity(licenseAgreement.getVendorLicenseModelId(),
- licenseAgreement.getVersion(),
- addedFgId), licenseAgreement.getId());
- }
+ @Override
+ public void updateEntitlementPool(EntitlementPoolEntity entitlementPool) {
+ EntitlementPoolEntity retrieved = entitlementPoolDao.get(entitlementPool);
+ VersioningUtil.validateEntityExistence(retrieved, entitlementPool, VendorLicenseModelEntity.ENTITY_TYPE);
+ if (retrieved.equals(entitlementPool)) {
+ return;
+ }
+ uniqueValueUtil.updateUniqueValue(VendorLicenseConstants.UniqueValues.ENTITLEMENT_POOL_NAME, retrieved.getName(), entitlementPool.getName(),
+ entitlementPool.getVendorLicenseModelId(), entitlementPool.getVersion().getId());
+ entitlementPool.setVersionUuId(CommonMethods.nextUuId());
+ entitlementPoolDao.update(entitlementPool);
}
- return licenseAgreement;
- }
- @Override
- public FeatureGroupEntity createFeatureGroup(FeatureGroupEntity featureGroup) {
- VersioningUtil.validateEntitiesExistence(featureGroup.getLicenseKeyGroupIds(),
- new LicenseKeyGroupEntity(featureGroup.getVendorLicenseModelId(), featureGroup.getVersion(),
- null),
- licenseKeyGroupDao, VendorLicenseModelEntity.ENTITY_TYPE);
- VersioningUtil.validateEntitiesExistence(featureGroup.getEntitlementPoolIds(),
- new EntitlementPoolEntity(featureGroup.getVendorLicenseModelId(), featureGroup.getVersion(),
- null),
- entitlementPoolDao, VendorLicenseModelEntity.ENTITY_TYPE);
- uniqueValueUtil.validateUniqueValue(VendorLicenseConstants.UniqueValues.FEATURE_GROUP_NAME,
- featureGroup.getVendorLicenseModelId(), featureGroup.getVersion().getId(),
- featureGroup.getName());
-
- featureGroupDao.create(featureGroup);
- uniqueValueUtil.createUniqueValue(VendorLicenseConstants.UniqueValues.FEATURE_GROUP_NAME,
- featureGroup.getVendorLicenseModelId(), featureGroup.getVersion().getId(),
- featureGroup.getName());
+ @Override
+ public Collection<LicenseKeyGroupEntity> listLicenseKeyGroups(String vlmId, Version version) {
+ return licenseKeyGroupDao.list(new LicenseKeyGroupEntity(vlmId, version, null));
+ }
- if (featureGroup.getLicenseKeyGroupIds() != null) {
- for (String addedLkgId : featureGroup.getLicenseKeyGroupIds()) {
- licenseKeyGroupDao.addReferencingFeatureGroup(
- new LicenseKeyGroupEntity(featureGroup.getVendorLicenseModelId(),
- featureGroup.getVersion(), addedLkgId),
- featureGroup.getId());
- }
+ @Override
+ public Collection<EntitlementPoolEntity> listEntitlementPools(String vlmId, Version version) {
+ return entitlementPoolDao.list(new EntitlementPoolEntity(vlmId, version, null));
}
- if (featureGroup.getEntitlementPoolIds() != null) {
- for (String addedEpId : featureGroup.getEntitlementPoolIds()) {
- entitlementPoolDao.addReferencingFeatureGroup(
- new EntitlementPoolEntity(featureGroup.getVendorLicenseModelId(),
- featureGroup.getVersion(), addedEpId), featureGroup.getId());
- }
+ @Override
+ public void updateLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup) {
+ LicenseKeyGroupEntity retrieved = licenseKeyGroupDao.get(licenseKeyGroup);
+ if (retrieved.equals(licenseKeyGroup)) {
+ return;
+ }
+ licenseKeyGroup.setVersionUuId((CommonMethods.nextUuId()));
+ VersioningUtil.validateEntityExistence(retrieved, licenseKeyGroup, VendorLicenseModelEntity.ENTITY_TYPE);
+ uniqueValueUtil.updateUniqueValue(VendorLicenseConstants.UniqueValues.LICENSE_KEY_GROUP_NAME, retrieved.getName(), licenseKeyGroup.getName(),
+ licenseKeyGroup.getVendorLicenseModelId(), licenseKeyGroup.getVersion().getId());
+ licenseKeyGroupDao.update(licenseKeyGroup);
}
- return featureGroup;
- }
- @Override
- public Collection<FeatureGroupEntity> listFeatureGroups(String vlmId, Version version) {
- return featureGroupDao.list(new FeatureGroupEntity(vlmId, version, null));
- }
+ @Override
+ public LicenseKeyGroupEntity createLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup) {
+ licenseKeyGroup.setVersionUuId(CommonMethods.nextUuId());
+ uniqueValueUtil.createUniqueValue(VendorLicenseConstants.UniqueValues.LICENSE_KEY_GROUP_NAME, licenseKeyGroup.getVendorLicenseModelId(),
+ licenseKeyGroup.getVersion().getId(), licenseKeyGroup.getName());
+ licenseKeyGroupDao.create(licenseKeyGroup);
+ return licenseKeyGroup;
+ }
+ @Override
+ public VendorLicenseModelEntity getVendorLicenseModel(String vlmId, Version version) {
+ VendorLicenseModelEntity vendorLicenseModel = vendorLicenseModelDao.get(new VendorLicenseModelEntity(vlmId, version));
+ if (vendorLicenseModel == null) {
+ throw new CoreException(new VendorLicenseModelNotFoundErrorBuilder(vlmId).build());
+ }
+ return vendorLicenseModel;
+ }
- @Override
- public Collection<ErrorCode> validateLicensingData(String vlmId, Version version,
- String licenseAgreementId,
- Collection<String> featureGroupIds) {
+ @Override
+ public LicenseAgreementEntity createLicenseAgreement(LicenseAgreementEntity licenseAgreement) {
+ VersioningUtil.validateEntitiesExistence(licenseAgreement.getFeatureGroupIds(),
+ new FeatureGroupEntity(licenseAgreement.getVendorLicenseModelId(), licenseAgreement.getVersion(), null), featureGroupDao,
+ VendorLicenseModelEntity.ENTITY_TYPE);
+ uniqueValueUtil.validateUniqueValue(VendorLicenseConstants.UniqueValues.LICENSE_AGREEMENT_NAME, licenseAgreement.getVendorLicenseModelId(),
+ licenseAgreement.getVersion().getId(), licenseAgreement.getName());
+ licenseAgreementDao.create(licenseAgreement);
+ uniqueValueUtil.createUniqueValue(VendorLicenseConstants.UniqueValues.LICENSE_AGREEMENT_NAME, licenseAgreement.getVendorLicenseModelId(),
+ licenseAgreement.getVersion().getId(), licenseAgreement.getName());
+ if (licenseAgreement.getFeatureGroupIds() != null) {
+ for (String addedFgId : licenseAgreement.getFeatureGroupIds()) {
+ featureGroupDao.addReferencingLicenseAgreement(
+ new FeatureGroupEntity(licenseAgreement.getVendorLicenseModelId(), licenseAgreement.getVersion(), addedFgId),
+ licenseAgreement.getId());
+ }
+ }
+ return licenseAgreement;
+ }
- List<ErrorCode> errorMessages = new ArrayList<>();
+ @Override
+ public FeatureGroupEntity createFeatureGroup(FeatureGroupEntity featureGroup) {
+ VersioningUtil.validateEntitiesExistence(featureGroup.getLicenseKeyGroupIds(),
+ new LicenseKeyGroupEntity(featureGroup.getVendorLicenseModelId(), featureGroup.getVersion(), null), licenseKeyGroupDao,
+ VendorLicenseModelEntity.ENTITY_TYPE);
+ VersioningUtil.validateEntitiesExistence(featureGroup.getEntitlementPoolIds(),
+ new EntitlementPoolEntity(featureGroup.getVendorLicenseModelId(), featureGroup.getVersion(), null), entitlementPoolDao,
+ VendorLicenseModelEntity.ENTITY_TYPE);
+ uniqueValueUtil.validateUniqueValue(VendorLicenseConstants.UniqueValues.FEATURE_GROUP_NAME, featureGroup.getVendorLicenseModelId(),
+ featureGroup.getVersion().getId(), featureGroup.getName());
+ featureGroupDao.create(featureGroup);
+ uniqueValueUtil.createUniqueValue(VendorLicenseConstants.UniqueValues.FEATURE_GROUP_NAME, featureGroup.getVendorLicenseModelId(),
+ featureGroup.getVersion().getId(), featureGroup.getName());
+ if (featureGroup.getLicenseKeyGroupIds() != null) {
+ for (String addedLkgId : featureGroup.getLicenseKeyGroupIds()) {
+ licenseKeyGroupDao.addReferencingFeatureGroup(
+ new LicenseKeyGroupEntity(featureGroup.getVendorLicenseModelId(), featureGroup.getVersion(), addedLkgId), featureGroup.getId());
+ }
+ }
+ if (featureGroup.getEntitlementPoolIds() != null) {
+ for (String addedEpId : featureGroup.getEntitlementPoolIds()) {
+ entitlementPoolDao.addReferencingFeatureGroup(
+ new EntitlementPoolEntity(featureGroup.getVendorLicenseModelId(), featureGroup.getVersion(), addedEpId), featureGroup.getId());
+ }
+ }
+ return featureGroup;
+ }
- try {
- getLicenseAgreement(vlmId, version, licenseAgreementId);
- } catch (CoreException exception) {
- errorMessages.add(exception.code());
+ @Override
+ public Collection<FeatureGroupEntity> listFeatureGroups(String vlmId, Version version) {
+ return featureGroupDao.list(new FeatureGroupEntity(vlmId, version, null));
}
- for (String featureGroupId : featureGroupIds) {
- try {
- FeatureGroupEntity featureGroup =
- getFeatureGroup(new FeatureGroupEntity(vlmId, version, featureGroupId));
- if (!featureGroup.getReferencingLicenseAgreements().contains(licenseAgreementId)) {
- errorMessages.add(new VersionableSubEntityNotFoundErrorBuilder(
- featureGroup.getEntityType(),
- featureGroupId,
- LicenseAgreementEntity.ENTITY_TYPE,
- licenseAgreementId,
- version).build());
+ @Override
+ public Collection<ErrorCode> validateLicensingData(String vlmId, Version version, String licenseAgreementId, Collection<String> featureGroupIds) {
+ List<ErrorCode> errorMessages = new ArrayList<>();
+ try {
+ getLicenseAgreement(vlmId, version, licenseAgreementId);
+ } catch (CoreException exception) {
+ errorMessages.add(exception.code());
}
- } catch (CoreException exception) {
- errorMessages.add(exception.code());
- }
+ for (String featureGroupId : featureGroupIds) {
+ try {
+ FeatureGroupEntity featureGroup = getFeatureGroup(new FeatureGroupEntity(vlmId, version, featureGroupId));
+ if (!featureGroup.getReferencingLicenseAgreements().contains(licenseAgreementId)) {
+ errorMessages.add(
+ new VersionableSubEntityNotFoundErrorBuilder(featureGroup.getEntityType(), featureGroupId, LicenseAgreementEntity.ENTITY_TYPE,
+ licenseAgreementId, version).build());
+ }
+ } catch (CoreException exception) {
+ errorMessages.add(exception.code());
+ }
+ }
+ return errorMessages;
}
- return errorMessages;
- }
-
@Override
public Optional<ErrorCode> validateVendorForUsage(String vlmId, Version version) {
Item vlm = ItemManagerFactory.getInstance().createInterface().get(vlmId);
- return vlm == null
- ? Optional.of(USED_VLM_NOT_EXIST_ERROR)
- : ItemStatus.ARCHIVED == vlm.getStatus()
- ? Optional.of(USED_VLM_ARCHIVE_ERROR)
- : isDraftVlm(vlm, version)
- ? Optional.of(USED_VLM_IS_DRAFT_ERROR)
- : Optional.empty();
+ return vlm == null ? Optional.of(USED_VLM_NOT_EXIST_ERROR) : ItemStatus.ARCHIVED == vlm.getStatus() ? Optional.of(USED_VLM_ARCHIVE_ERROR)
+ : isDraftVlm(vlm, version) ? Optional.of(USED_VLM_IS_DRAFT_ERROR) : Optional.empty();
}
- private boolean isDraftVlm(Item vlm, Version version) {
- return (version == null && isVlmWithoutCertifiedVersions(vlm)) ||
- (version != null && VersionStatus.Draft.equals(version.getStatus()));
- }
+ private boolean isDraftVlm(Item vlm, Version version) {
+ return (version == null && isVlmWithoutCertifiedVersions(vlm)) || (version != null && VersionStatus.Draft.equals(version.getStatus()));
+ }
- private boolean isVlmWithoutCertifiedVersions(Item vlm) {
+ private boolean isVlmWithoutCertifiedVersions(Item vlm) {
Integer numOfCertifiedVersions = vlm.getVersionStatusCounters().get(VersionStatus.Certified);
return numOfCertifiedVersions == null || numOfCertifiedVersions < 1;
}
@Override
- public LicenseAgreementEntity getLicenseAgreement(String vlmId, Version version,
- String licenseAgreementId) {
- LicenseAgreementEntity input = new LicenseAgreementEntity(vlmId, version, licenseAgreementId);
- LicenseAgreementEntity retrieved = licenseAgreementDao.get(input);
- VersioningUtil.validateEntityExistence(retrieved, input, VendorLicenseModelEntity.ENTITY_TYPE);
- return retrieved;
- }
-
- @Override
- public Collection<LimitEntity> listLimits(String vlmId, Version version, String epLkgId) {
- return limitDao.list(new LimitEntity(vlmId, version, epLkgId, null));
- }
-
- @Override
- public LimitEntity createLimit(LimitEntity limit) {
- limitDao.create(limit);
- return limit;
- }
+ public LicenseAgreementEntity getLicenseAgreement(String vlmId, Version version, String licenseAgreementId) {
+ LicenseAgreementEntity input = new LicenseAgreementEntity(vlmId, version, licenseAgreementId);
+ LicenseAgreementEntity retrieved = licenseAgreementDao.get(input);
+ VersioningUtil.validateEntityExistence(retrieved, input, VendorLicenseModelEntity.ENTITY_TYPE);
+ return retrieved;
+ }
- @Override
- public void updateLimit(LimitEntity limit) {
- limitDao.update(limit);
- }
+ @Override
+ public Collection<LimitEntity> listLimits(String vlmId, Version version, String epLkgId) {
+ return limitDao.list(new LimitEntity(vlmId, version, epLkgId, null));
+ }
- @Override
- public void validate(String vendorLicenseModelId, Version version) {
- Collection<String> allFeatureGroupEntities = new HashSet<>();
- Collection<LicenseAgreementEntity> licenseAgreements = licenseAgreementDao
- .list(new LicenseAgreementEntity(vendorLicenseModelId, version, null));
+ @Override
+ public LimitEntity createLimit(LimitEntity limit) {
+ limitDao.create(limit);
+ return limit;
+ }
- if (CollectionUtils.isNotEmpty(licenseAgreements)) {
- licenseAgreements.forEach(licenseAgreement -> {
- if (CollectionUtils.isEmpty(licenseAgreement.getFeatureGroupIds())) {
- throw new CoreException(
- new SubmitUncompletedLicenseModelErrorBuilder(
- SUBMIT_UNCOMPLETED_VLM_MSG_LA_MISSING_FG).build());
- }
- allFeatureGroupEntities.addAll(licenseAgreement.getFeatureGroupIds());
- });
+ @Override
+ public void updateLimit(LimitEntity limit) {
+ limitDao.update(limit);
+ }
- allFeatureGroupEntities.forEach(fg -> {
- FeatureGroupEntity featureGroupEntity =
- featureGroupDao.get(new FeatureGroupEntity(vendorLicenseModelId, version, fg));
- if (CollectionUtils.isEmpty(featureGroupEntity.getEntitlementPoolIds())) {
- throw new CoreException(
- new SubmitUncompletedLicenseModelErrorBuilder(
- SUBMIT_UNCOMPLETED_VLM_MSG_FG_MISSING_EP).build());
+ @Override
+ public void validate(String vendorLicenseModelId, Version version) {
+ Collection<String> allFeatureGroupEntities = new HashSet<>();
+ Collection<LicenseAgreementEntity> licenseAgreements = licenseAgreementDao
+ .list(new LicenseAgreementEntity(vendorLicenseModelId, version, null));
+ if (CollectionUtils.isNotEmpty(licenseAgreements)) {
+ licenseAgreements.forEach(licenseAgreement -> {
+ if (CollectionUtils.isEmpty(licenseAgreement.getFeatureGroupIds())) {
+ throw new CoreException(new SubmitUncompletedLicenseModelErrorBuilder(SUBMIT_UNCOMPLETED_VLM_MSG_LA_MISSING_FG).build());
+ }
+ allFeatureGroupEntities.addAll(licenseAgreement.getFeatureGroupIds());
+ });
+ allFeatureGroupEntities.forEach(fg -> {
+ FeatureGroupEntity featureGroupEntity = featureGroupDao.get(new FeatureGroupEntity(vendorLicenseModelId, version, fg));
+ if (CollectionUtils.isEmpty(featureGroupEntity.getEntitlementPoolIds())) {
+ 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/healing/impl/SimpleHealingServiceImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/healing/impl/SimpleHealingServiceImpl.java
index cc2f8acb97..75326b14d3 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/healing/impl/SimpleHealingServiceImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/healing/impl/SimpleHealingServiceImpl.java
@@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorlicense.healing.impl;
+import java.util.UUID;
import org.openecomp.sdc.vendorlicense.dao.EntitlementPoolDao;
import org.openecomp.sdc.vendorlicense.dao.EntitlementPoolDaoFactory;
import org.openecomp.sdc.vendorlicense.dao.LicenseKeyGroupDao;
@@ -27,48 +27,40 @@ import org.openecomp.sdc.versioning.VersioningManager;
import org.openecomp.sdc.versioning.VersioningManagerFactory;
import org.openecomp.sdc.versioning.dao.types.VersionableEntity;
-import java.util.UUID;
-
public class SimpleHealingServiceImpl implements HealingService {
- private static final EntitlementPoolDao entitlementPoolDao =
- EntitlementPoolDaoFactory.getInstance().createInterface();
- private static final LicenseKeyGroupDao licenseKeyGroupDao =
- LicenseKeyGroupDaoFactory.getInstance().createInterface();
- private static final VersioningManager VERSIONING_MANAGER =
- VersioningManagerFactory.getInstance().createInterface();
- @Override
- public VersionableEntity heal(VersionableEntity toHeal) {
- return handleMissingVersionId(toHeal);
- }
+ private static final EntitlementPoolDao entitlementPoolDao = EntitlementPoolDaoFactory.getInstance().createInterface();
+ private static final LicenseKeyGroupDao licenseKeyGroupDao = LicenseKeyGroupDaoFactory.getInstance().createInterface();
+ private static final VersioningManager VERSIONING_MANAGER = VersioningManagerFactory.getInstance().createInterface();
- @Override
- public void persistNoHealing(VersionableEntity alreadyHealed) {
- if (alreadyHealed instanceof EntitlementPoolEntity) {
- entitlementPoolDao.update((EntitlementPoolEntity) alreadyHealed);
- } else if (alreadyHealed instanceof LicenseKeyGroupEntity) {
- licenseKeyGroupDao.update((LicenseKeyGroupEntity) alreadyHealed);
+ @Override
+ public VersionableEntity heal(VersionableEntity toHeal) {
+ return handleMissingVersionId(toHeal);
}
- }
- private VersionableEntity handleMissingVersionId(VersionableEntity toHeal) {
- if (toHeal != null && toHeal.getVersionUuId() != null) {
- return toHeal;
+ @Override
+ public void persistNoHealing(VersionableEntity alreadyHealed) {
+ if (alreadyHealed instanceof EntitlementPoolEntity) {
+ entitlementPoolDao.update((EntitlementPoolEntity) alreadyHealed);
+ } else if (alreadyHealed instanceof LicenseKeyGroupEntity) {
+ licenseKeyGroupDao.update((LicenseKeyGroupEntity) alreadyHealed);
+ }
}
- if (toHeal instanceof EntitlementPoolEntity) {
- toHeal.setVersionUuId(UUID.randomUUID().toString());
- entitlementPoolDao.update((EntitlementPoolEntity) toHeal);
- } else if (toHeal instanceof LicenseKeyGroupEntity) {
- toHeal.setVersionUuId(UUID.randomUUID().toString());
- licenseKeyGroupDao.update((LicenseKeyGroupEntity) toHeal);
- } else {
- throw new UnsupportedOperationException(
- "Unsupported operation for 1610 release/1607->1610 migration.");
+ private VersionableEntity handleMissingVersionId(VersionableEntity toHeal) {
+ if (toHeal != null && toHeal.getVersionUuId() != null) {
+ return toHeal;
+ }
+ if (toHeal instanceof EntitlementPoolEntity) {
+ toHeal.setVersionUuId(UUID.randomUUID().toString());
+ entitlementPoolDao.update((EntitlementPoolEntity) toHeal);
+ } else if (toHeal instanceof LicenseKeyGroupEntity) {
+ toHeal.setVersionUuId(UUID.randomUUID().toString());
+ licenseKeyGroupDao.update((LicenseKeyGroupEntity) toHeal);
+ } else {
+ throw new UnsupportedOperationException("Unsupported operation for 1610 release/1607->1610 migration.");
+ }
+ VERSIONING_MANAGER.publish(toHeal.getFirstClassCitizenId(), toHeal.getVersion(), "Add missing version_uuid on ep/lkg");
+ return toHeal;
}
-
- VERSIONING_MANAGER.publish(toHeal.getFirstClassCitizenId(), toHeal.getVersion(), "Add missing version_uuid on ep/lkg");
-
- return toHeal;
- }
}
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 f0f8a6cb7c..7b5902e08f 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
@@ -13,9 +13,24 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorlicense.licenseartifacts.impl;
+import static org.openecomp.sdc.vendorlicense.VendorLicenseConstants.VENDOR_LICENSE_MODEL_ARTIFACT_NAME_WITH_PATH;
+import static org.openecomp.sdc.vendorlicense.VendorLicenseConstants.VNF_ARTIFACT_NAME_WITH_PATH;
+import static org.openecomp.sdc.vendorlicense.licenseartifacts.impl.util.VendorLicenseArtifactsServiceUtils.filterChangedEntities;
+import static org.openecomp.sdc.vendorlicense.licenseartifacts.impl.util.VendorLicenseArtifactsServiceUtils.getFinalVersionsForVlm;
+import static org.openecomp.sdc.vendorlicense.licenseartifacts.impl.util.VendorLicenseArtifactsServiceUtils.getVendorName;
+import static org.openecomp.sdc.vendorlicense.licenseartifacts.impl.util.VendorLicenseArtifactsServiceUtils.healEPs;
+import static org.openecomp.sdc.vendorlicense.licenseartifacts.impl.util.VendorLicenseArtifactsServiceUtils.healLkgs;
+import static org.openecomp.sdc.vendorlicense.licenseartifacts.impl.util.VendorLicenseArtifactsServiceUtils.prepareForFiltering;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Set;
+import java.util.stream.Collectors;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.openecomp.core.utilities.file.FileContentHandler;
@@ -32,155 +47,105 @@ import org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types.VendorLicense
import org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types.VnfLicenseArtifact;
import org.openecomp.sdc.versioning.dao.types.Version;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Objects;
-import java.util.Optional;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-import static org.openecomp.sdc.vendorlicense.VendorLicenseConstants.VENDOR_LICENSE_MODEL_ARTIFACT_NAME_WITH_PATH;
-import static org.openecomp.sdc.vendorlicense.VendorLicenseConstants.VNF_ARTIFACT_NAME_WITH_PATH;
-import static org.openecomp.sdc.vendorlicense.licenseartifacts.impl.util.VendorLicenseArtifactsServiceUtils.filterChangedEntities;
-import static org.openecomp.sdc.vendorlicense.licenseartifacts.impl.util.VendorLicenseArtifactsServiceUtils.getFinalVersionsForVlm;
-import static org.openecomp.sdc.vendorlicense.licenseartifacts.impl.util.VendorLicenseArtifactsServiceUtils.getVendorName;
-import static org.openecomp.sdc.vendorlicense.licenseartifacts.impl.util.VendorLicenseArtifactsServiceUtils.healEPs;
-import static org.openecomp.sdc.vendorlicense.licenseartifacts.impl.util.VendorLicenseArtifactsServiceUtils.healLkgs;
-import static org.openecomp.sdc.vendorlicense.licenseartifacts.impl.util.VendorLicenseArtifactsServiceUtils.prepareForFiltering;
-
public class VendorLicenseArtifactsServiceImpl implements VendorLicenseArtifactsService {
- public static final VendorLicenseFacade vendorLicenseFacade =
- VendorLicenseFacadeFactory.getInstance().createInterface();
- public static final HealingService healingService =
- HealingServiceFactory.getInstance().createInterface();
- private static byte[] createVnfArtifact(String vspId, String vlmId, Version vlmVersion, String vendorName,
- List<String> featureGroups) {
- VnfLicenseArtifact artifact = new VnfLicenseArtifact();
-
- artifact.setVspId(vspId);
- artifact.setVendorName(vendorName);
- if (featureGroups != null) {
- for (String featureGroupId : featureGroups) {
- FeatureGroupModel featureGroupModel = vendorLicenseFacade
- .getFeatureGroupModel(new FeatureGroupEntity(vlmId, vlmVersion, featureGroupId));
- Set<EntitlementPoolEntity> entitlementPoolEntities =
- featureGroupModel.getEntitlementPools();
- String manufacturerReferenceNumber = featureGroupModel.getEntityManufacturerReferenceNumber();
- for (EntitlementPoolEntity entitlementPoolEntity : entitlementPoolEntities) {
- entitlementPoolEntity.setLimits(vendorLicenseFacade.listLimits(vlmId, vlmVersion,
- entitlementPoolEntity.getId()));
- if (Objects.nonNull(manufacturerReferenceNumber) && !manufacturerReferenceNumber.trim().isEmpty()) {
- entitlementPoolEntity.setManufacturerReferenceNumber(manufacturerReferenceNumber);
- }
+ public static final VendorLicenseFacade vendorLicenseFacade = VendorLicenseFacadeFactory.getInstance().createInterface();
+ public static final HealingService healingService = HealingServiceFactory.getInstance().createInterface();
+
+ private static byte[] createVnfArtifact(String vspId, String vlmId, Version vlmVersion, String vendorName, List<String> featureGroups) {
+ VnfLicenseArtifact artifact = new VnfLicenseArtifact();
+ artifact.setVspId(vspId);
+ artifact.setVendorName(vendorName);
+ if (featureGroups != null) {
+ for (String featureGroupId : featureGroups) {
+ FeatureGroupModel featureGroupModel = vendorLicenseFacade
+ .getFeatureGroupModel(new FeatureGroupEntity(vlmId, vlmVersion, featureGroupId));
+ Set<EntitlementPoolEntity> entitlementPoolEntities = featureGroupModel.getEntitlementPools();
+ String manufacturerReferenceNumber = featureGroupModel.getEntityManufacturerReferenceNumber();
+ for (EntitlementPoolEntity entitlementPoolEntity : entitlementPoolEntities) {
+ entitlementPoolEntity.setLimits(vendorLicenseFacade.listLimits(vlmId, vlmVersion, entitlementPoolEntity.getId()));
+ if (Objects.nonNull(manufacturerReferenceNumber) && !manufacturerReferenceNumber.trim().isEmpty()) {
+ entitlementPoolEntity.setManufacturerReferenceNumber(manufacturerReferenceNumber);
+ }
+ }
+ Set<LicenseKeyGroupEntity> licenseKeyGroupEntities = featureGroupModel.getLicenseKeyGroups();
+ for (LicenseKeyGroupEntity licenseKeyGroupEntity : licenseKeyGroupEntities) {
+ licenseKeyGroupEntity.setLimits(vendorLicenseFacade.listLimits(vlmId, vlmVersion, licenseKeyGroupEntity.getId()));
+ if (Objects.nonNull(manufacturerReferenceNumber) && !manufacturerReferenceNumber.trim().isEmpty()) {
+ licenseKeyGroupEntity.setManufacturerReferenceNumber(manufacturerReferenceNumber);
+ }
+ }
+ featureGroupModel.setEntitlementPools(
+ entitlementPoolEntities.stream().map(entitlementPoolEntity -> (EntitlementPoolEntity) healingService.heal(entitlementPoolEntity))
+ .collect(Collectors.toSet()));
+ featureGroupModel.setLicenseKeyGroups(
+ licenseKeyGroupEntities.stream().map(licenseKeyGroupEntity -> (LicenseKeyGroupEntity) healingService.heal(licenseKeyGroupEntity))
+ .collect(Collectors.toSet()));
+ artifact.getFeatureGroups().add(featureGroupModel);
+ }
}
+ return artifact.toXml().getBytes();
+ }
- Set<LicenseKeyGroupEntity> licenseKeyGroupEntities =
- featureGroupModel.getLicenseKeyGroups();
- for (LicenseKeyGroupEntity licenseKeyGroupEntity : licenseKeyGroupEntities) {
- licenseKeyGroupEntity.setLimits(vendorLicenseFacade.listLimits(vlmId, vlmVersion,
- licenseKeyGroupEntity.getId()));
- if (Objects.nonNull(manufacturerReferenceNumber) && !manufacturerReferenceNumber.trim().isEmpty()) {
- licenseKeyGroupEntity.setManufacturerReferenceNumber(manufacturerReferenceNumber);
- }
+ private static byte[] createVendorLicenseArtifact(String vlmId, String vendorName) {
+ VendorLicenseArtifact vendorLicenseArtifact = new VendorLicenseArtifact();
+ vendorLicenseArtifact.setVendorName(vendorName);
+ Set<EntitlementPoolEntity> entitlementPoolEntities = new HashSet<>();
+ Set<LicenseKeyGroupEntity> licenseKeyGroupEntities = new HashSet<>();
+ List<Version> finalVersions = getFinalVersionsForVlm(vlmId);
+ for (Version finalVersion : finalVersions) {
+ Collection<EntitlementPoolEntity> eps = vendorLicenseFacade.listEntitlementPools(vlmId, finalVersion);
+ eps.forEach(entitlementPoolEntity -> {
+ entitlementPoolEntity.setLimits(vendorLicenseFacade.listLimits(vlmId, finalVersion, entitlementPoolEntity.getId()));
+ Optional<String> manufacturerReferenceNumber = getFeatureGroupManufactureRefNumber(
+ entitlementPoolEntity.getReferencingFeatureGroups(), vlmId, finalVersion);
+ manufacturerReferenceNumber.ifPresent(entitlementPoolEntity::setManufacturerReferenceNumber);
+ });
+ entitlementPoolEntities.addAll(eps);
+ Collection<LicenseKeyGroupEntity> lkgs = vendorLicenseFacade.listLicenseKeyGroups(vlmId, finalVersion);
+ lkgs.forEach(licenseKeyGroupEntity -> {
+ licenseKeyGroupEntity.setLimits(vendorLicenseFacade.listLimits(vlmId, finalVersion, licenseKeyGroupEntity.getId()));
+ Optional<String> manufacturerReferenceNumber = getFeatureGroupManufactureRefNumber(
+ licenseKeyGroupEntity.getReferencingFeatureGroups(), vlmId, finalVersion);
+ manufacturerReferenceNumber.ifPresent(licenseKeyGroupEntity::setManufacturerReferenceNumber);
+ });
+ licenseKeyGroupEntities.addAll(lkgs);
}
-
- featureGroupModel.setEntitlementPools(entitlementPoolEntities.stream().map(
- entitlementPoolEntity -> (EntitlementPoolEntity) healingService
- .heal(entitlementPoolEntity)).collect(Collectors.toSet()));
- featureGroupModel.setLicenseKeyGroups(licenseKeyGroupEntities.stream().map(
- licenseKeyGroupEntity -> (LicenseKeyGroupEntity) healingService
- .heal(licenseKeyGroupEntity)).collect(Collectors.toSet()));
- artifact.getFeatureGroups().add(featureGroupModel);
- }
+ entitlementPoolEntities = healEPs(filterChangedEntities(prepareForFiltering(entitlementPoolEntities, true)));
+ licenseKeyGroupEntities = healLkgs(filterChangedEntities(prepareForFiltering(licenseKeyGroupEntities, false)));
+ vendorLicenseArtifact.setEntitlementPoolEntities(entitlementPoolEntities);
+ vendorLicenseArtifact.setLicenseKeyGroupEntities(licenseKeyGroupEntities);
+ return vendorLicenseArtifact.toXml().getBytes();
}
- return artifact.toXml().getBytes();
- }
-
- private static byte[] createVendorLicenseArtifact(String vlmId, String vendorName) {
- VendorLicenseArtifact vendorLicenseArtifact = new VendorLicenseArtifact();
- vendorLicenseArtifact.setVendorName(vendorName);
- Set<EntitlementPoolEntity> entitlementPoolEntities = new HashSet<>();
- Set<LicenseKeyGroupEntity> licenseKeyGroupEntities = new HashSet<>();
-
- List<Version> finalVersions = getFinalVersionsForVlm(vlmId);
- for (Version finalVersion : finalVersions) {
- Collection<EntitlementPoolEntity> eps =
- vendorLicenseFacade.listEntitlementPools(vlmId, finalVersion);
- eps.forEach(entitlementPoolEntity -> {
- entitlementPoolEntity.setLimits(vendorLicenseFacade.listLimits(vlmId, finalVersion,
- entitlementPoolEntity.getId()));
- Optional<String> manufacturerReferenceNumber = getFeatureGroupManufactureRefNumber
- (entitlementPoolEntity.getReferencingFeatureGroups(), vlmId, finalVersion);
- manufacturerReferenceNumber
- .ifPresent(entitlementPoolEntity::setManufacturerReferenceNumber);
- });
- entitlementPoolEntities.addAll(eps);
- Collection<LicenseKeyGroupEntity> lkgs =
- vendorLicenseFacade.listLicenseKeyGroups(vlmId, finalVersion);
-
- lkgs.forEach(licenseKeyGroupEntity -> {
- licenseKeyGroupEntity.setLimits(vendorLicenseFacade.listLimits(vlmId, finalVersion,
- licenseKeyGroupEntity.getId()));
- Optional<String> manufacturerReferenceNumber = getFeatureGroupManufactureRefNumber
- (licenseKeyGroupEntity.getReferencingFeatureGroups(), vlmId, finalVersion);
- manufacturerReferenceNumber
- .ifPresent(licenseKeyGroupEntity::setManufacturerReferenceNumber);
- });
- licenseKeyGroupEntities.addAll(lkgs);
+ private static Optional<String> getFeatureGroupManufactureRefNumber(Set<String> featureGroupIds, String vlmId, Version finalVersion) {
+ String manufactureReferenceNumber = null;
+ if (CollectionUtils.isNotEmpty(featureGroupIds)) {
+ Object[] featureGroupIdsList = featureGroupIds.toArray();
+ if (featureGroupIdsList.length > 0) {
+ FeatureGroupEntity featureGroup = vendorLicenseFacade
+ .getFeatureGroup(new FeatureGroupEntity(vlmId, finalVersion, featureGroupIdsList[0].toString()));
+ manufactureReferenceNumber = featureGroup != null ? featureGroup.getManufacturerReferenceNumber() : null;
+ }
+ }
+ return StringUtils.isNotEmpty(manufactureReferenceNumber) ? Optional.of(manufactureReferenceNumber) : Optional.empty();
}
-
- entitlementPoolEntities =
- healEPs(filterChangedEntities(prepareForFiltering(entitlementPoolEntities, true)));
- licenseKeyGroupEntities =
- healLkgs(filterChangedEntities(prepareForFiltering(licenseKeyGroupEntities, false)));
- vendorLicenseArtifact.setEntitlementPoolEntities(entitlementPoolEntities);
- vendorLicenseArtifact.setLicenseKeyGroupEntities(licenseKeyGroupEntities);
- return vendorLicenseArtifact.toXml().getBytes();
- }
-
- private static Optional<String> getFeatureGroupManufactureRefNumber(Set<String> featureGroupIds,
- String vlmId,
- Version finalVersion) {
- String manufactureReferenceNumber = null;
- if (CollectionUtils.isNotEmpty(featureGroupIds)) {
- Object[] featureGroupIdsList = featureGroupIds.toArray();
- if (featureGroupIdsList.length > 0) {
- FeatureGroupEntity featureGroup =
- vendorLicenseFacade.getFeatureGroup(new FeatureGroupEntity(vlmId, finalVersion,
- featureGroupIdsList[0].toString()));
- manufactureReferenceNumber = featureGroup != null ? featureGroup
- .getManufacturerReferenceNumber() : null;
- }
+ /**
+ * Create License Artifacts.
+ *
+ * @param vspId vspId
+ * @param vlmId vlmId
+ * @param vlmVersion vlmVersion
+ * @param featureGroups featureGroups
+ * @return FileContentHandler
+ */
+ @Override
+ public FileContentHandler createLicenseArtifacts(String vspId, String vlmId, Version vlmVersion, List<String> featureGroups) {
+ FileContentHandler artifacts = new FileContentHandler();
+ String vendorName = getVendorName(vlmId);
+ artifacts.addFile(VNF_ARTIFACT_NAME_WITH_PATH, createVnfArtifact(vspId, vlmId, vlmVersion, vendorName, featureGroups));
+ artifacts.addFile(VENDOR_LICENSE_MODEL_ARTIFACT_NAME_WITH_PATH, createVendorLicenseArtifact(vlmId, vendorName));
+ return artifacts;
}
- return StringUtils.isNotEmpty(manufactureReferenceNumber) ? Optional.of(manufactureReferenceNumber) :
- Optional.empty();
- }
-
-
- /**
- * Create License Artifacts.
- *
- * @param vspId vspId
- * @param vlmId vlmId
- * @param vlmVersion vlmVersion
- * @param featureGroups featureGroups
- * @return FileContentHandler
- */
- @Override
- public FileContentHandler createLicenseArtifacts(String vspId, String vlmId, Version vlmVersion,
- List<String> featureGroups) {
- FileContentHandler artifacts = new FileContentHandler();
- String vendorName = getVendorName(vlmId);
-
- artifacts.addFile(VNF_ARTIFACT_NAME_WITH_PATH,
- createVnfArtifact(vspId, vlmId, vlmVersion, vendorName, featureGroups));
- artifacts.addFile(VENDOR_LICENSE_MODEL_ARTIFACT_NAME_WITH_PATH,
- createVendorLicenseArtifact(vlmId, vendorName));
- return 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/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 afc1d3151b..a805b75587 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
@@ -7,9 +7,9 @@
* 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.
@@ -17,13 +17,13 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
+import java.util.Collection;
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;
@@ -31,53 +31,47 @@ import org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types.mixins.MixinE
import org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types.mixins.MixinLicenseKeyGroupEntityForVendorLicenseArtifact;
import org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types.mixins.MixinLimitArtifact;
-import java.util.Collection;
-
@JacksonXmlRootElement(localName = "vendor-license-model",
namespace = "http://xmlns.openecomp.org/asdc/license-model/1.0")
public class VendorLicenseArtifact extends XmlArtifact {
- @JsonProperty(value = "vendor-name")
- String vendorName;
- Collection<EntitlementPoolEntity> entitlementPoolEntities;
- Collection<LicenseKeyGroupEntity> licenseKeyGroupEntities;
+ @JsonProperty(value = "vendor-name")
+ String vendorName;
+ Collection<EntitlementPoolEntity> entitlementPoolEntities;
+ Collection<LicenseKeyGroupEntity> licenseKeyGroupEntities;
- public String getVendorName() {
- return vendorName;
- }
+ public String getVendorName() {
+ return vendorName;
+ }
- public void setVendorName(String vendorName) {
- this.vendorName = vendorName;
- }
+ public void setVendorName(String vendorName) {
+ this.vendorName = vendorName;
+ }
- @JacksonXmlProperty(isAttribute = false, localName = "entitlement-pool")
- @JacksonXmlElementWrapper(localName = "entitlement-pool-list")
- public Collection<EntitlementPoolEntity> getEntitlementPoolEntities() {
- return entitlementPoolEntities;
- }
+ @JacksonXmlProperty(isAttribute = false, localName = "entitlement-pool")
+ @JacksonXmlElementWrapper(localName = "entitlement-pool-list")
+ public Collection<EntitlementPoolEntity> getEntitlementPoolEntities() {
+ return entitlementPoolEntities;
+ }
- public void setEntitlementPoolEntities(
- Collection<EntitlementPoolEntity> entitlementPoolEntities) {
- this.entitlementPoolEntities = entitlementPoolEntities;
- }
+ public void setEntitlementPoolEntities(Collection<EntitlementPoolEntity> entitlementPoolEntities) {
+ this.entitlementPoolEntities = entitlementPoolEntities;
+ }
- @JacksonXmlProperty(isAttribute = false, localName = "license-key-group")
- @JacksonXmlElementWrapper(localName = "license-key-group-list")
- public Collection<LicenseKeyGroupEntity> getLicenseKeyGroupEntities() {
- return licenseKeyGroupEntities;
- }
+ @JacksonXmlProperty(isAttribute = false, localName = "license-key-group")
+ @JacksonXmlElementWrapper(localName = "license-key-group-list")
+ public Collection<LicenseKeyGroupEntity> getLicenseKeyGroupEntities() {
+ return licenseKeyGroupEntities;
+ }
- public void setLicenseKeyGroupEntities(
- Collection<LicenseKeyGroupEntity> licenseKeyGroupEntities) {
- this.licenseKeyGroupEntities = licenseKeyGroupEntities;
- }
+ public void setLicenseKeyGroupEntities(Collection<LicenseKeyGroupEntity> licenseKeyGroupEntities) {
+ this.licenseKeyGroupEntities = licenseKeyGroupEntities;
+ }
- @Override
- void initMapper() {
- xmlMapper.addMixIn(EntitlementPoolEntity.class,
- MixinEntitlementPoolEntityForVendorLicenseArtifact.class);
- xmlMapper.addMixIn(LicenseKeyGroupEntity.class,
- MixinLicenseKeyGroupEntityForVendorLicenseArtifact.class);
- xmlMapper.addMixIn(LimitXml.class, MixinLimitArtifact.class);
- }
+ @Override
+ void initMapper() {
+ xmlMapper.addMixIn(EntitlementPoolEntity.class, 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 91a73b6377..1686b9631d 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
@@ -7,9 +7,9 @@
* 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.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types;
import com.ctc.wstx.api.WstxInputProperties;
@@ -29,6 +28,11 @@ import com.fasterxml.jackson.dataformat.xml.XmlMapper;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity;
import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupModel;
import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity;
@@ -38,63 +42,55 @@ import org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types.mixins.MixinF
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;
-
@JacksonXmlRootElement(localName = "vf-license-model",
namespace = "http://xmlns.openecomp.org/asdc/license-model/1.0")
public class VnfLicenseArtifact extends XmlArtifact {
- @JsonProperty(value = "vendor-name")
- String vendorName;
- @JsonProperty(value = "vf-id")
- String vspId;
- List<FeatureGroupModel> featureGroups = new ArrayList<>();
-
- public String getVspId() {
- return vspId;
- }
-
- public void setVspId(String vspId) {
- this.vspId = vspId;
- }
- public String getVendorName() {
- return vendorName;
- }
+ @JsonProperty(value = "vendor-name")
+ String vendorName;
+ @JsonProperty(value = "vf-id")
+ String vspId;
+ List<FeatureGroupModel> featureGroups = new ArrayList<>();
- public void setVendorName(String vendorName) {
- this.vendorName = vendorName;
- }
+ public String getVspId() {
+ return vspId;
+ }
- @JacksonXmlProperty(isAttribute = false, localName = "feature-group")
- @JacksonXmlElementWrapper(localName = "feature-group-list")
- public List<FeatureGroupModel> getFeatureGroups() {
- return featureGroups;
- }
+ public void setVspId(String vspId) {
+ this.vspId = vspId;
+ }
- public void setFeatureGroups(List<FeatureGroupModel> featureGroups) {
- this.featureGroups = featureGroups;
- }
+ public String getVendorName() {
+ return vendorName;
+ }
- void initMapper() {
- WstxOutputFactory wstxOutputFactory = new WstxOutputFactory() {
- @Override
- public XMLStreamWriter createXMLStreamWriter(Writer writer) throws XMLStreamException {
- mConfig.setProperty(WstxInputProperties.P_RETURN_NULL_FOR_DEFAULT_NAMESPACE, true);
- return super.createXMLStreamWriter(writer);
- }
- };
- XmlFactory factory = new XmlFactory(new WstxInputFactory(), wstxOutputFactory);
+ public void setVendorName(String vendorName) {
+ this.vendorName = vendorName;
+ }
- xmlMapper = new XmlMapper(factory);
+ @JacksonXmlProperty(isAttribute = false, localName = "feature-group")
+ @JacksonXmlElementWrapper(localName = "feature-group-list")
+ public List<FeatureGroupModel> getFeatureGroups() {
+ return featureGroups;
+ }
+ public void setFeatureGroups(List<FeatureGroupModel> featureGroups) {
+ this.featureGroups = featureGroups;
+ }
- xmlMapper.addMixIn(EntitlementPoolEntity.class, MixinEntitlementPoolEntityForVnfArtifact.class);
- xmlMapper.addMixIn(LicenseKeyGroupEntity.class, MixinLicenseKeyGroupEntityForVnfArtifact.class);
- xmlMapper.addMixIn(FeatureGroupModel.class, MixinFeatureGroupModel.class);
- xmlMapper.addMixIn(LimitXml.class, MixinLimitArtifact.class);
- }
+ void initMapper() {
+ WstxOutputFactory wstxOutputFactory = new WstxOutputFactory() {
+ @Override
+ public XMLStreamWriter createXMLStreamWriter(Writer writer) throws XMLStreamException {
+ mConfig.setProperty(WstxInputProperties.P_RETURN_NULL_FOR_DEFAULT_NAMESPACE, true);
+ return super.createXMLStreamWriter(writer);
+ }
+ };
+ XmlFactory factory = new XmlFactory(new WstxInputFactory(), wstxOutputFactory);
+ xmlMapper = new XmlMapper(factory);
+ 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/XmlArtifact.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/XmlArtifact.java
index 7052d6afb6..dc5089f57a 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/XmlArtifact.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/XmlArtifact.java
@@ -12,8 +12,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-*/
-
+ */
package org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types;
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
@@ -23,28 +22,23 @@ import org.openecomp.sdc.vendorlicense.errors.JsonErrorBuilder;
public abstract class XmlArtifact {
- XmlMapper xmlMapper = new XmlMapper();
-
- abstract void initMapper();
-
- /**
- * To xml string.
- *
- * @return the string
- */
- public String toXml() {
- initMapper();
- String xml;
-
- try {
- xml = xmlMapper.writeValueAsString(this);
- } catch (com.fasterxml.jackson.core.JsonProcessingException exception) {
- throw new CoreException(new JsonErrorBuilder("Failed to write xml value as string ")
- .build(), exception);
+ XmlMapper xmlMapper = new XmlMapper();
+
+ abstract void initMapper();
+
+ /**
+ * To xml string.
+ *
+ * @return the string
+ */
+ public String toXml() {
+ initMapper();
+ String xml;
+ try {
+ xml = xmlMapper.writeValueAsString(this);
+ } catch (com.fasterxml.jackson.core.JsonProcessingException exception) {
+ throw new CoreException(new JsonErrorBuilder("Failed to write xml value as string ").build(), exception);
+ }
+ return xml.replaceAll(VendorLicenseConstants.VENDOR_LICENSE_MODEL_ARTIFACT_REGEX_REMOVE, "");
}
-
- return xml.replaceAll(VendorLicenseConstants.VENDOR_LICENSE_MODEL_ARTIFACT_REGEX_REMOVE, "");
- }
-
-
}
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 5afd0a9ab1..55301c9b7f 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
@@ -7,9 +7,9 @@
* 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.
@@ -17,98 +17,104 @@
* 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 com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import org.openecomp.sdc.vendorlicense.dao.types.*;
-import org.openecomp.sdc.vendorlicense.dao.types.xml.*;
-
import java.util.Collection;
import java.util.Set;
-
-@JsonPropertyOrder({ "entitlement-pool-invariant-uuid", "entitlement-pool-uuid" })
+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.LimitForXml;
+import org.openecomp.sdc.vendorlicense.dao.types.xml.OperationalScopeForXml;
+import org.openecomp.sdc.vendorlicense.dao.types.xml.ThresholdForXml;
+
+@JsonPropertyOrder({"entitlement-pool-invariant-uuid", "entitlement-pool-uuid"})
public abstract class MixinEntitlementPoolEntityForVendorLicenseArtifact {
- @JsonProperty(value = "threshold-value")
- abstract ThresholdForXml getThresholdForArtifact();
-
- @JsonProperty(value = "entitlement-pool-uuid")
- abstract String getVersionUuId();
-
- @JsonIgnore
- abstract Set<String> getReferencingFeatureGroups();
- @JsonIgnore
- abstract String getFirstClassCitizenId();
+ @JsonProperty(value = "threshold-value")
+ abstract ThresholdForXml getThresholdForArtifact();
- @JsonProperty(value = "entitlement-pool-invariant-uuid")
- abstract String getId();
+ @JsonProperty(value = "entitlement-pool-uuid")
+ abstract String getVersionUuId();
- @JsonProperty(value = "manufacturer-reference-number")
- abstract String getManufacturerReferenceNumber();
+ @JsonIgnore
+ abstract Set<String> getReferencingFeatureGroups();
- @JsonProperty(value = "version")
- abstract String getVersionForArtifact();
+ @JsonIgnore
+ abstract String getFirstClassCitizenId();
- @JsonIgnore
- abstract String getStartDate();
+ @JsonProperty(value = "entitlement-pool-invariant-uuid")
+ abstract String getId();
- @JsonIgnore
- abstract String getExpiryDate();
+ @JsonProperty(value = "manufacturer-reference-number")
+ abstract String getManufacturerReferenceNumber();
- @JsonProperty(value = "start-date")
- abstract String getIsoFormatStartDate();
+ @JsonProperty(value = "version")
+ abstract String getVersionForArtifact();
- @JsonProperty(value = "expiry-date")
- abstract String getIsoFormatExpiryDate();
+ @JsonIgnore
+ abstract String getStartDate();
- @JsonIgnore
- abstract String getVendorLicenseModelId();
+ @JsonIgnore
+ abstract String getExpiryDate();
+ @JsonProperty(value = "start-date")
+ abstract String getIsoFormatStartDate();
+ @JsonProperty(value = "expiry-date")
+ abstract String getIsoFormatExpiryDate();
- @JsonIgnore
- abstract String getThresholdUnit();
+ @JsonIgnore
+ abstract String getVendorLicenseModelId();
- @JsonIgnore
- abstract float getThresholdValue();
+ @JsonIgnore
+ abstract String getThresholdUnit();
- @JsonIgnore
- abstract ChoiceOrOther<EntitlementMetric> getEntitlementMetric();
+ @JsonIgnore
+ abstract float getThresholdValue();
- @JsonIgnore
- abstract ChoiceOrOther<EntitlementTime> getTime();
+ @JsonIgnore
+ abstract ChoiceOrOther<EntitlementMetric> getEntitlementMetric();
- @JsonIgnore
- abstract ChoiceOrOther<AggregationFunction> getAggregationFunction();
+ @JsonIgnore
+ abstract ChoiceOrOther<EntitlementTime> getTime();
- @JsonIgnore
- abstract String getEntityType();
+ @JsonIgnore
+ abstract ChoiceOrOther<AggregationFunction> getAggregationFunction();
- @JsonProperty(value = "operational-scope")
- abstract OperationalScopeForXml getOperationalScopeForArtifact();
+ @JsonIgnore
+ abstract String getEntityType();
- @JsonIgnore
- abstract ChoiceOrOther<OperationalScope> getOperationalScope();
+ @JsonProperty(value = "operational-scope")
+ abstract OperationalScopeForXml getOperationalScopeForArtifact();
- @JsonProperty(value = "entitlement-metric")
- abstract EntitlementMetricForXml getEntitlementMetricForArtifact();
+ @JsonIgnore
+ abstract ChoiceOrOther<OperationalScope> getOperationalScope();
- @JsonProperty(value = "time")
- abstract EntitlementTimeForXml getTimeForArtifact();
+ @JsonProperty(value = "entitlement-metric")
+ abstract EntitlementMetricForXml getEntitlementMetricForArtifact();
+ @JsonProperty(value = "time")
+ abstract EntitlementTimeForXml getTimeForArtifact();
- @JsonProperty(value = "aggregation-function")
- abstract AggregationFunctionForXml getAggregationFunctionForArtifact();
+ @JsonProperty(value = "aggregation-function")
+ abstract AggregationFunctionForXml getAggregationFunctionForArtifact();
- @JsonProperty(value = "sp-limits")
- abstract LimitForXml getSPLimits();
+ @JsonProperty(value = "sp-limits")
+ abstract LimitForXml getSPLimits();
- @JsonProperty(value = "vendor-limits")
- abstract LimitForXml getVendorLimits();
+ @JsonProperty(value = "vendor-limits")
+ abstract LimitForXml getVendorLimits();
- @JsonIgnore
- abstract Collection<LimitEntity> getLimits();
+ @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 32ac6fb532..95dd28ada2 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
@@ -7,9 +7,9 @@
* 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.
@@ -17,99 +17,105 @@
* 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.*;
-import org.openecomp.sdc.vendorlicense.dao.types.xml.*;
-
import java.util.Collection;
import java.util.Set;
+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.LimitForXml;
+import org.openecomp.sdc.vendorlicense.dao.types.xml.OperationalScopeForXml;
+import org.openecomp.sdc.vendorlicense.dao.types.xml.ThresholdForXml;
public abstract class MixinEntitlementPoolEntityForVnfArtifact {
- @JsonProperty(value = "threshold-value")
- abstract ThresholdForXml getThresholdForArtifact();
-
- @JsonProperty(value = "entitlement-pool-invariant-uuid")
- abstract String getId();
-
- @JsonProperty(value = "manufacturer-reference-number")
- abstract String getManufacturerReferenceNumber();
- @JsonIgnore
- abstract Set<String> getReferencingFeatureGroups();
+ @JsonProperty(value = "threshold-value")
+ abstract ThresholdForXml getThresholdForArtifact();
- @JsonIgnore
- abstract String getFirstClassCitizenId();
+ @JsonProperty(value = "entitlement-pool-invariant-uuid")
+ abstract String getId();
- @JsonProperty(value = "entitlement-pool-uuid")
- abstract String getVersionUuId();
+ @JsonProperty(value = "manufacturer-reference-number")
+ abstract String getManufacturerReferenceNumber();
- @JsonIgnore
- abstract String getVersion();
+ @JsonIgnore
+ abstract Set<String> getReferencingFeatureGroups();
- @JsonProperty(value = "version")
- abstract String getVersionForArtifact();
+ @JsonIgnore
+ abstract String getFirstClassCitizenId();
- @JsonIgnore
- abstract String getVendorLicenseModelId();
+ @JsonProperty(value = "entitlement-pool-uuid")
+ abstract String getVersionUuId();
- @JsonIgnore
- abstract String getThresholdUnit();
+ @JsonIgnore
+ abstract String getVersion();
- @JsonIgnore
- abstract float getThresholdValue();
+ @JsonProperty(value = "version")
+ abstract String getVersionForArtifact();
- @JsonIgnore
- abstract String getStartDate();
+ @JsonIgnore
+ abstract String getVendorLicenseModelId();
- @JsonIgnore
- abstract String getExpiryDate();
+ @JsonIgnore
+ abstract String getThresholdUnit();
- @JsonProperty(value = "start-date")
- abstract String getIsoFormatStartDate();
+ @JsonIgnore
+ abstract float getThresholdValue();
- @JsonProperty(value = "expiry-date")
- abstract String getIsoFormatExpiryDate();
+ @JsonIgnore
+ abstract String getStartDate();
- @JsonIgnore
- abstract ChoiceOrOther<EntitlementMetric> getEntitlementMetric();
+ @JsonIgnore
+ abstract String getExpiryDate();
- @JsonIgnore
- abstract ChoiceOrOther<EntitlementTime> getTime();
+ @JsonProperty(value = "start-date")
+ abstract String getIsoFormatStartDate();
- @JsonIgnore
- abstract ChoiceOrOther<AggregationFunction> getAggregationFunction();
+ @JsonProperty(value = "expiry-date")
+ abstract String getIsoFormatExpiryDate();
- @JsonIgnore
- abstract String getEntityType();
+ @JsonIgnore
+ abstract ChoiceOrOther<EntitlementMetric> getEntitlementMetric();
- @JsonProperty(value = "operational-scope")
- abstract OperationalScopeForXml getOperationalScopeForArtifact();
+ @JsonIgnore
+ abstract ChoiceOrOther<EntitlementTime> getTime();
- @JsonIgnore
- abstract ChoiceOrOther<OperationalScope> getOperationalScope();
+ @JsonIgnore
+ abstract ChoiceOrOther<AggregationFunction> getAggregationFunction();
+ @JsonIgnore
+ abstract String getEntityType();
- @JsonProperty(value = "entitlement-metric")
- abstract EntitlementMetricForXml getEntitlementMetricForArtifact();
+ @JsonProperty(value = "operational-scope")
+ abstract OperationalScopeForXml getOperationalScopeForArtifact();
- @JsonProperty(value = "time")
- abstract EntitlementTimeForXml getTimeForArtifact();
+ @JsonIgnore
+ abstract ChoiceOrOther<OperationalScope> getOperationalScope();
+ @JsonProperty(value = "entitlement-metric")
+ abstract EntitlementMetricForXml getEntitlementMetricForArtifact();
- @JsonProperty(value = "aggregation-function")
- abstract AggregationFunctionForXml getAggregationFunctionForArtifact();
+ @JsonProperty(value = "time")
+ abstract EntitlementTimeForXml getTimeForArtifact();
- @JsonProperty(value = "sp-limits")
- abstract LimitForXml getSPLimits();
+ @JsonProperty(value = "aggregation-function")
+ abstract AggregationFunctionForXml getAggregationFunctionForArtifact();
- @JsonProperty(value = "vendor-limits")
- abstract LimitForXml getVendorLimits();
+ @JsonProperty(value = "sp-limits")
+ abstract LimitForXml getSPLimits();
- @JsonIgnore
- abstract Collection<LimitEntity> getLimits();
+ @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 61751b111b..970290b25a 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
@@ -7,9 +7,9 @@
* 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.
@@ -17,49 +17,44 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types.mixins;
import com.fasterxml.jackson.annotation.JsonIgnore;
-import org.openecomp.sdc.versioning.dao.types.Version;
-
import java.util.Set;
+import org.openecomp.sdc.versioning.dao.types.Version;
public abstract class MixinFeatureGroupEntity {
- @JsonIgnore
- abstract String getVendorLicenseModelId();
-
- @JsonIgnore
- abstract String getEntityType();
-
-
- @JsonIgnore
- abstract Version getVersion();
+ @JsonIgnore
+ abstract String getVendorLicenseModelId();
- @JsonIgnore
- abstract String getId();
+ @JsonIgnore
+ abstract String getEntityType();
- @JsonIgnore
- abstract String getName();
+ @JsonIgnore
+ abstract Version getVersion();
- @JsonIgnore
- abstract String getDescription();
+ @JsonIgnore
+ abstract String getId();
- @JsonIgnore
- abstract String getPartNumber();
+ @JsonIgnore
+ abstract String getName();
- @JsonIgnore
- abstract String getManufacturerReferenceNumber();
+ @JsonIgnore
+ abstract String getDescription();
- @JsonIgnore
- abstract Set<String> getLicenseKeyGroupIds();
+ @JsonIgnore
+ abstract String getPartNumber();
- @JsonIgnore
- abstract Set<String> getEntitlementPoolIds();
+ @JsonIgnore
+ abstract String getManufacturerReferenceNumber();
+ @JsonIgnore
+ abstract Set<String> getLicenseKeyGroupIds();
- @JsonIgnore
- abstract Set<String> getReferencingLicenseAgreements();
+ @JsonIgnore
+ abstract Set<String> getEntitlementPoolIds();
+ @JsonIgnore
+ abstract Set<String> getReferencingLicenseAgreements();
}
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 b8c45ba4c6..45feb365e5 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
@@ -7,9 +7,9 @@
* 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.
@@ -17,48 +17,44 @@
* 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.dataformat.xml.annotation.JacksonXmlElementWrapper;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
+import java.util.Set;
import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity;
import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity;
import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity;
-import java.util.Set;
-
public abstract class MixinFeatureGroupModel {
- @JacksonXmlProperty(isAttribute = false, localName = "entitlement-pool")
- @JacksonXmlElementWrapper(localName = "entitlement-pool-list")
- abstract Set<EntitlementPoolEntity> getEntitlementPools();
-
- @JacksonXmlProperty(isAttribute = false, localName = "license-key-group")
- @JacksonXmlElementWrapper(localName = "license-key-group-list")
- abstract Set<LicenseKeyGroupEntity> getLicenseKeyGroups();
-
- @JacksonXmlProperty(isAttribute = false, localName = "part-number")
- abstract String getEntityPartNumber();
- @JacksonXmlProperty(isAttribute = false, localName = "feature-group-uuid")
- abstract String getEntityId();
+ @JacksonXmlProperty(isAttribute = false, localName = "entitlement-pool")
+ @JacksonXmlElementWrapper(localName = "entitlement-pool-list")
+ abstract Set<EntitlementPoolEntity> getEntitlementPools();
- @JacksonXmlProperty(isAttribute = false, localName = "description")
- abstract String getEntityDesc();
+ @JacksonXmlProperty(isAttribute = false, localName = "license-key-group")
+ @JacksonXmlElementWrapper(localName = "license-key-group-list")
+ abstract Set<LicenseKeyGroupEntity> getLicenseKeyGroups();
- @JacksonXmlProperty(isAttribute = false, localName = "name")
- abstract String getEntityName();
+ @JacksonXmlProperty(isAttribute = false, localName = "part-number")
+ abstract String getEntityPartNumber();
+ @JacksonXmlProperty(isAttribute = false, localName = "feature-group-uuid")
+ abstract String getEntityId();
- @JsonIgnore
- abstract FeatureGroupEntity getFeatureGroup();
+ @JacksonXmlProperty(isAttribute = false, localName = "description")
+ abstract String getEntityDesc();
- @JsonIgnore
- abstract String getEntityType();
+ @JacksonXmlProperty(isAttribute = false, localName = "name")
+ abstract String getEntityName();
- @JsonIgnore
- abstract String getEntityManufacturerReferenceNumber();
+ @JsonIgnore
+ abstract FeatureGroupEntity getFeatureGroup();
+ @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 eeaa7c0a3a..03bc6c83ad 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
@@ -7,9 +7,9 @@
* 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.
@@ -17,11 +17,12 @@
* 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 java.util.Collection;
+import java.util.Set;
import org.openecomp.sdc.vendorlicense.dao.types.ChoiceOrOther;
import org.openecomp.sdc.vendorlicense.dao.types.LimitEntity;
import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope;
@@ -30,74 +31,68 @@ 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;
-
public abstract class MixinLicenseKeyGroupEntityForVendorLicenseArtifact {
- @JsonProperty(value = "license-key-group-uuid")
- abstract String getVersionUuId();
-
- @JsonIgnore
- abstract Set<String> getReferencingFeatureGroups();
-
- @JsonProperty(value = "version")
- abstract String getVersionForArtifact();
-
- @JsonIgnore
- abstract String getVendorLicenseModelId();
+ @JsonProperty(value = "license-key-group-uuid")
+ abstract String getVersionUuId();
- @JsonIgnore
- abstract String getEntityType();
+ @JsonIgnore
+ abstract Set<String> getReferencingFeatureGroups();
- @JsonIgnore
- abstract String getFirstClassCitizenId();
+ @JsonProperty(value = "version")
+ abstract String getVersionForArtifact();
- @JsonProperty(value = "license-key-group-invariant-uuid")
- abstract String getId();
+ @JsonIgnore
+ abstract String getVendorLicenseModelId();
+ @JsonIgnore
+ abstract String getEntityType();
- @JsonIgnore
- abstract ChoiceOrOther<OperationalScope> getOperationalScope();
+ @JsonIgnore
+ abstract String getFirstClassCitizenId();
- @JsonProperty(value = "operational-scope")
- abstract OperationalScopeForXml getOperationalScopeForArtifact();
+ @JsonProperty(value = "license-key-group-invariant-uuid")
+ abstract String getId();
+ @JsonIgnore
+ abstract ChoiceOrOther<OperationalScope> getOperationalScope();
- @JsonIgnore
- abstract LicenseKeyTypeForXml getTypeForArtifact();
+ @JsonProperty(value = "operational-scope")
+ abstract OperationalScopeForXml getOperationalScopeForArtifact();
- @JsonIgnore
- abstract String getVersionableId();
+ @JsonIgnore
+ abstract LicenseKeyTypeForXml getTypeForArtifact();
- @JsonProperty(value = "sp-limits")
- abstract LimitForXml getSPLimits();
+ @JsonIgnore
+ abstract String getVersionableId();
- @JsonProperty(value = "vendor-limits")
- abstract LimitForXml getVendorLimits();
+ @JsonProperty(value = "sp-limits")
+ abstract LimitForXml getSPLimits();
- @JsonIgnore
- abstract Collection<LimitEntity> getLimits();
+ @JsonProperty(value = "vendor-limits")
+ abstract LimitForXml getVendorLimits();
- @JsonIgnore
- abstract String getStartDate();
+ @JsonIgnore
+ abstract Collection<LimitEntity> getLimits();
- @JsonIgnore
- abstract String getExpiryDate();
+ @JsonIgnore
+ abstract String getStartDate();
- @JsonProperty(value = "start-date")
- abstract String getIsoFormatStartDate();
+ @JsonIgnore
+ abstract String getExpiryDate();
- @JsonProperty(value = "expiry-date")
- abstract String getIsoFormatExpiryDate();
+ @JsonProperty(value = "start-date")
+ abstract String getIsoFormatStartDate();
- @JsonProperty(value = "threshold-value")
- abstract ThresholdForXml getThresholdForArtifact();
+ @JsonProperty(value = "expiry-date")
+ abstract String getIsoFormatExpiryDate();
- @JsonIgnore
- abstract String getThresholdUnits();
+ @JsonProperty(value = "threshold-value")
+ abstract ThresholdForXml getThresholdForArtifact();
- @JsonIgnore
- abstract float getThresholdValue();
+ @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 f560f363a1..c9e21806ce 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
@@ -7,9 +7,9 @@
* 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.
@@ -17,11 +17,12 @@
* 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 java.util.Collection;
+import java.util.Set;
import org.openecomp.sdc.vendorlicense.dao.types.ChoiceOrOther;
import org.openecomp.sdc.vendorlicense.dao.types.LimitEntity;
import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope;
@@ -30,78 +31,74 @@ 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;
-
public abstract class MixinLicenseKeyGroupEntityForVnfArtifact {
- @JsonProperty(value = "license-key-group-invariant-uuid")
- abstract String getId();
-
- @JsonProperty(value = "manufacturer-reference-number")
- abstract String getManufacturerReferenceNumber();
- @JsonIgnore
- abstract Set<String> getReferencingFeatureGroups();
+ @JsonProperty(value = "license-key-group-invariant-uuid")
+ abstract String getId();
- @JsonIgnore
- abstract String getVersion();
+ @JsonProperty(value = "manufacturer-reference-number")
+ abstract String getManufacturerReferenceNumber();
- @JsonProperty(value = "version")
- abstract String getVersionForArtifact();
+ @JsonIgnore
+ abstract Set<String> getReferencingFeatureGroups();
- @JsonIgnore
- abstract String getVendorLicenseModelId();
+ @JsonIgnore
+ abstract String getVersion();
+ @JsonProperty(value = "version")
+ abstract String getVersionForArtifact();
- @JsonIgnore
- abstract String getEntityType();
+ @JsonIgnore
+ abstract String getVendorLicenseModelId();
- @JsonProperty(value = "license-key-group-uuid")
- abstract String getVersionUuId();
+ @JsonIgnore
+ abstract String getEntityType();
- @JsonIgnore
- abstract String getFirstClassCitizenId();
+ @JsonProperty(value = "license-key-group-uuid")
+ abstract String getVersionUuId();
+ @JsonIgnore
+ abstract String getFirstClassCitizenId();
- @JsonIgnore
- abstract ChoiceOrOther<OperationalScope> getOperationalScope();
+ @JsonIgnore
+ abstract ChoiceOrOther<OperationalScope> getOperationalScope();
- @JsonProperty(value = "operational-scope")
- abstract OperationalScopeForXml getOperationalScopeForArtifact();
+ @JsonProperty(value = "operational-scope")
+ abstract OperationalScopeForXml getOperationalScopeForArtifact();
+ @JsonIgnore
+ abstract LicenseKeyTypeForXml getTypeForArtifact();
- @JsonIgnore
- abstract LicenseKeyTypeForXml getTypeForArtifact();
+ @JsonIgnore
+ abstract String getVersionableId();
- @JsonIgnore
- abstract String getVersionableId();
+ @JsonProperty(value = "threshold-value")
+ abstract ThresholdForXml getThresholdForArtifact();
- @JsonProperty(value = "threshold-value")
- abstract ThresholdForXml getThresholdForArtifact();
- @JsonProperty(value = "sp-limits")
- abstract LimitForXml getSPLimits();
+ @JsonProperty(value = "sp-limits")
+ abstract LimitForXml getSPLimits();
- @JsonProperty(value = "vendor-limits")
- abstract LimitForXml getVendorLimits();
+ @JsonProperty(value = "vendor-limits")
+ abstract LimitForXml getVendorLimits();
- @JsonIgnore
- abstract Collection<LimitEntity> getLimits();
+ @JsonIgnore
+ abstract Collection<LimitEntity> getLimits();
- @JsonIgnore
- abstract String getStartDate();
+ @JsonIgnore
+ abstract String getStartDate();
- @JsonIgnore
- abstract String getExpiryDate();
+ @JsonIgnore
+ abstract String getExpiryDate();
- @JsonProperty(value = "start-date")
- abstract String getIsoFormatStartDate();
+ @JsonProperty(value = "start-date")
+ abstract String getIsoFormatStartDate();
- @JsonProperty(value = "expiry-date")
- abstract String getIsoFormatExpiryDate();
+ @JsonProperty(value = "expiry-date")
+ abstract String getIsoFormatExpiryDate();
- @JsonIgnore
- abstract String getThresholdUnits();
+ @JsonIgnore
+ abstract String getThresholdUnits();
- @JsonIgnore
- abstract float getThresholdValue();
+ @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/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
index 1a15a6e557..7627d5f243 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/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
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types.mixins;
import com.fasterxml.jackson.annotation.JsonIgnore;
@@ -27,16 +26,15 @@ import org.openecomp.sdc.vendorlicense.dao.types.xml.EntitlementTimeForXml;
public abstract class MixinLimitArtifact {
- @JsonIgnore
- abstract String getTime();
-
- @JsonIgnore
- abstract String getAggregationFunction();
+ @JsonIgnore
+ abstract String getTime();
- @JsonProperty(value = "aggregation-function")
- abstract AggregationFunctionForXml getAggregationFunctionForArtifact();
+ @JsonIgnore
+ abstract String getAggregationFunction();
- @JsonProperty(value = "time")
- abstract EntitlementTimeForXml getTimeForArtifact();
+ @JsonProperty(value = "aggregation-function")
+ abstract AggregationFunctionForXml getAggregationFunctionForArtifact();
+ @JsonProperty(value = "time")
+ abstract EntitlementTimeForXml getTimeForArtifact();
}
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/util/VendorLicenseArtifactsServiceUtils.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/util/VendorLicenseArtifactsServiceUtils.java
index 7153f45d2f..7dbbad7b44 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/util/VendorLicenseArtifactsServiceUtils.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/util/VendorLicenseArtifactsServiceUtils.java
@@ -13,17 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorlicense.licenseartifacts.impl.util;
-
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
-
import org.apache.commons.collections4.MultiValuedMap;
import org.apache.commons.collections4.multimap.ArrayListValuedHashMap;
import org.openecomp.sdc.vendorlicense.HealingServiceFactory;
@@ -38,148 +35,116 @@ import org.openecomp.sdc.versioning.dao.types.Version;
import org.openecomp.sdc.versioning.dao.types.VersionStatus;
import org.openecomp.sdc.versioning.dao.types.VersionableEntity;
-
-
/**
* @author katyr
* @since January 10, 2017
*/
-
public class VendorLicenseArtifactsServiceUtils {
- private static final HealingService healingService =
- HealingServiceFactory.getInstance().createInterface();
- /**
- * maps the entities by id
- *
- * @return a Map of id -> list of versionable entities with that id
- */
- private static MultiValuedMap<String, VersionableEntity> mapById(
- Collection<? extends VersionableEntity> versionableEntities) {
- MultiValuedMap<String, VersionableEntity> mappedById = new ArrayListValuedHashMap<>();
- for (VersionableEntity ve : versionableEntities) {
- mappedById.put(ve.getId(), ve);
+ private static final HealingService healingService = HealingServiceFactory.getInstance().createInterface();
+
+ /**
+ * maps the entities by id
+ *
+ * @return a Map of id -> list of versionable entities with that id
+ */
+ private static MultiValuedMap<String, VersionableEntity> mapById(Collection<? extends VersionableEntity> versionableEntities) {
+ MultiValuedMap<String, VersionableEntity> mappedById = new ArrayListValuedHashMap<>();
+ for (VersionableEntity ve : versionableEntities) {
+ mappedById.put(ve.getId(), ve);
+ }
+ return mappedById;
}
- return mappedById;
- }
-
- /**
- * For all entities with same id, only entities that differ from one another will be returned.
- * If no change has occured, the entity with the earlier VLM version will be returned.
- * If only one version of said entities exists it will be returned
- *
- * @return a list of entities that has been changed
- */
- public static List<VersionableEntity> filterChangedEntities(
- Collection<? extends VersionableEntity> versionableEntities) {
- MultiValuedMap<String, VersionableEntity> entitiesById = mapById(
- versionableEntities);
- MultiValuedMap<String, VersionableEntity> entitiesByVersionUuId =
- new ArrayListValuedHashMap<>();
- List<VersionableEntity> changedOnly = new ArrayList<>();
- for (String epId : entitiesById.keySet()) {
- Collection<VersionableEntity> versionableEntitiesForId = entitiesById.get(epId);
- for (VersionableEntity ep : versionableEntitiesForId) {
- entitiesByVersionUuId.put(ep.getVersionUuId(), ep);
- }
+ /**
+ * For all entities with same id, only entities that differ from one another will be returned. If no change has occured, the entity with the
+ * earlier VLM version will be returned. If only one version of said entities exists it will be returned
+ *
+ * @return a list of entities that has been changed
+ */
+ public static List<VersionableEntity> filterChangedEntities(Collection<? extends VersionableEntity> versionableEntities) {
+ MultiValuedMap<String, VersionableEntity> entitiesById = mapById(versionableEntities);
+ MultiValuedMap<String, VersionableEntity> entitiesByVersionUuId = new ArrayListValuedHashMap<>();
+ List<VersionableEntity> changedOnly = new ArrayList<>();
+ for (String epId : entitiesById.keySet()) {
+ Collection<VersionableEntity> versionableEntitiesForId = entitiesById.get(epId);
+ for (VersionableEntity ep : versionableEntitiesForId) {
+ entitiesByVersionUuId.put(ep.getVersionUuId(), ep);
+ }
+ }
+ //for every list of eps which have the same uuid, get the one with the earliest vlm version.
+ for (String versionUid : entitiesByVersionUuId.keySet()) {
+ List<VersionableEntity> versionableEntitiesForUuid = (List<VersionableEntity>) entitiesByVersionUuId.get(versionUid);
+ versionableEntitiesForUuid.sort(new VersionableEntitySortByVlmMajorVersion());
+ changedOnly.add(versionableEntitiesForUuid.get(0));
+ }
+ return changedOnly;
}
- //for every list of eps which have the same uuid, get the one with the earliest vlm version.
- for (String versionUid : entitiesByVersionUuId.keySet()) {
- List<VersionableEntity> versionableEntitiesForUuid =
- (List<VersionableEntity>) entitiesByVersionUuId.get(versionUid);
- versionableEntitiesForUuid.sort(new VersionableEntitySortByVlmMajorVersion());
- changedOnly.add(versionableEntitiesForUuid.get(0));
+ public static Set<LicenseKeyGroupEntity> healLkgs(Collection<? extends VersionableEntity> licenseKeyGroupEntities) {
+ Set<LicenseKeyGroupEntity> healed = new HashSet<>();
+ for (VersionableEntity licenseKeyGroupEntity : licenseKeyGroupEntities) {
+ healed.add((LicenseKeyGroupEntity) VendorLicenseArtifactsServiceImpl.healingService.heal(licenseKeyGroupEntity));
+ }
+ return healed;
}
- return changedOnly;
- }
-
- public static Set<LicenseKeyGroupEntity> healLkgs(
- Collection<? extends VersionableEntity> licenseKeyGroupEntities) {
- Set<LicenseKeyGroupEntity> healed = new HashSet<>();
- for (VersionableEntity licenseKeyGroupEntity : licenseKeyGroupEntities) {
- healed.add((LicenseKeyGroupEntity) VendorLicenseArtifactsServiceImpl.healingService
- .heal(licenseKeyGroupEntity));
+ public static Set<EntitlementPoolEntity> healEPs(Collection<? extends VersionableEntity> entitlementPoolEntities) {
+ Set<EntitlementPoolEntity> healed = new HashSet<>();
+ for (VersionableEntity entitlementPoolEntity : entitlementPoolEntities) {
+ healed.add((EntitlementPoolEntity) VendorLicenseArtifactsServiceImpl.healingService.heal(entitlementPoolEntity));
+ }
+ return healed;
}
- return healed;
- }
-
- public static Set<EntitlementPoolEntity> healEPs(
- Collection<? extends VersionableEntity> entitlementPoolEntities) {
- Set<EntitlementPoolEntity> healed = new HashSet<>();
- for (VersionableEntity entitlementPoolEntity : entitlementPoolEntities) {
- healed.add((EntitlementPoolEntity) VendorLicenseArtifactsServiceImpl.healingService
- .heal(entitlementPoolEntity));
+ public static List<Version> getFinalVersionsForVlm(String vlmId) {
+ VersioningManager versioningManager = VersioningManagerFactory.getInstance().createInterface();
+ return versioningManager.list(vlmId).stream().filter(version -> VersionStatus.Certified == version.getStatus())
+ .map(certifiedVersion -> versioningManager.get(vlmId, certifiedVersion)) //sync to private
+ .collect(Collectors.toList());
}
- return healed;
- }
-
- public static List<Version> getFinalVersionsForVlm(String vlmId) {
- VersioningManager versioningManager = VersioningManagerFactory.getInstance().createInterface();
- return versioningManager.list(vlmId).stream()
- .filter(version -> VersionStatus.Certified == version.getStatus())
- .map(certifiedVersion -> versioningManager.get(vlmId, certifiedVersion)) //sync to private
- .collect(Collectors.toList());
- }
-
- public static String getVendorName(String vendorLicenseModelId) {
- return AsdcItemManagerFactory.getInstance().createInterface().get(vendorLicenseModelId)
- .getName();
- }
-
-
- /**
- * Written to handle the consequences of ATTASDC-4780 where version_uuid was not saved or
- * retrieved correctly by DAO for EPs and LKGs. Performs a healing of sorts according to the
- * following : 1. all versions of a specific entity (EP or LKG that have the same invariant_uuid)
- * are ordered by their VLM version 2. first element is sent to healing (which will set a
- * versionUUID for it IF it doesnt exist) 3. each subsequent element is compared to previous . If
- * same, UUID is copied from the previous element , if they differ - the current element is sent
- * to healing as before. For VLMs created post-bugfix this code should not update any element
- */
- public static Collection<? extends VersionableEntity> prepareForFiltering(Collection<? extends
- VersionableEntity> versionableEntities, boolean isEP) {
- MultiValuedMap<String, VersionableEntity> entitiesById = mapById(
- versionableEntities);
-
- for (String epId : entitiesById.keySet()) {
- List<VersionableEntity> versionableEntitiesForId = new ArrayList<>();
- versionableEntitiesForId.addAll(entitiesById.get(epId));
- versionableEntitiesForId.sort(new VersionableEntitySortByVlmMajorVersion());
- healingService.heal(versionableEntitiesForId.get(0));
- for (int i = 1; i < versionableEntitiesForId.size(); i++) {
- if (isEP) {
- EntitlementPoolEntity current = (EntitlementPoolEntity) versionableEntitiesForId.get(i);
- EntitlementPoolEntity previous = (EntitlementPoolEntity) versionableEntitiesForId
- .get(i - 1);
- if (current.equals(previous) && current.getVersionUuId() == null) {
- current.setVersionUuId(previous.getVersionUuId());
- healingService.persistNoHealing(current);
- } else {
- versionableEntitiesForId.set(i, healingService.heal(versionableEntitiesForId.get(i)));
- }
-
- } else {
- LicenseKeyGroupEntity current = (LicenseKeyGroupEntity) versionableEntitiesForId.get(i);
- LicenseKeyGroupEntity previous = (LicenseKeyGroupEntity) versionableEntitiesForId
- .get(i - 1);
- if (current.equals(previous) && current.getVersionUuId() == null) {
- current.setVersionUuId(previous.getVersionUuId());
- healingService.persistNoHealing(current);
- } else {
- versionableEntitiesForId.set(i, healingService.heal(versionableEntitiesForId.get(i)));
- }
-
+ public static String getVendorName(String vendorLicenseModelId) {
+ return AsdcItemManagerFactory.getInstance().createInterface().get(vendorLicenseModelId).getName();
+ }
+ /**
+ * Written to handle the consequences of ATTASDC-4780 where version_uuid was not saved or retrieved correctly by DAO for EPs and LKGs. Performs a
+ * healing of sorts according to the following : 1. all versions of a specific entity (EP or LKG that have the same invariant_uuid) are ordered by
+ * their VLM version 2. first element is sent to healing (which will set a versionUUID for it IF it doesnt exist) 3. each subsequent element is
+ * compared to previous . If same, UUID is copied from the previous element , if they differ - the current element is sent to healing as before.
+ * For VLMs created post-bugfix this code should not update any element
+ */
+ public static Collection<? extends VersionableEntity> prepareForFiltering(Collection<? extends VersionableEntity> versionableEntities,
+ boolean isEP) {
+ MultiValuedMap<String, VersionableEntity> entitiesById = mapById(versionableEntities);
+ for (String epId : entitiesById.keySet()) {
+ List<VersionableEntity> versionableEntitiesForId = new ArrayList<>();
+ versionableEntitiesForId.addAll(entitiesById.get(epId));
+ versionableEntitiesForId.sort(new VersionableEntitySortByVlmMajorVersion());
+ healingService.heal(versionableEntitiesForId.get(0));
+ for (int i = 1; i < versionableEntitiesForId.size(); i++) {
+ if (isEP) {
+ EntitlementPoolEntity current = (EntitlementPoolEntity) versionableEntitiesForId.get(i);
+ EntitlementPoolEntity previous = (EntitlementPoolEntity) versionableEntitiesForId.get(i - 1);
+ if (current.equals(previous) && current.getVersionUuId() == null) {
+ current.setVersionUuId(previous.getVersionUuId());
+ healingService.persistNoHealing(current);
+ } else {
+ versionableEntitiesForId.set(i, healingService.heal(versionableEntitiesForId.get(i)));
+ }
+ } else {
+ LicenseKeyGroupEntity current = (LicenseKeyGroupEntity) versionableEntitiesForId.get(i);
+ LicenseKeyGroupEntity previous = (LicenseKeyGroupEntity) versionableEntitiesForId.get(i - 1);
+ if (current.equals(previous) && current.getVersionUuId() == null) {
+ current.setVersionUuId(previous.getVersionUuId());
+ healingService.persistNoHealing(current);
+ } else {
+ versionableEntitiesForId.set(i, healingService.heal(versionableEntitiesForId.get(i)));
+ }
+ }
+ }
}
- }
+ return versionableEntities;
}
- return versionableEntities;
- }
-
-
}
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/util/VersionableEntitySortByVlmMajorVersion.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/util/VersionableEntitySortByVlmMajorVersion.java
index 1aee2dd97e..2626382479 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/util/VersionableEntitySortByVlmMajorVersion.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/util/VersionableEntitySortByVlmMajorVersion.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,22 +17,19 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.licenseartifacts.impl.util;
-import org.openecomp.sdc.versioning.dao.types.VersionableEntity;
-
import java.util.Comparator;
+import org.openecomp.sdc.versioning.dao.types.VersionableEntity;
/**
* @author katyr
* @since January 10, 2017
*/
-
public class VersionableEntitySortByVlmMajorVersion implements Comparator<VersionableEntity> {
- @Override
- public int compare(VersionableEntity o1, VersionableEntity o2) {
- return Integer.compare(o1.getVersion().getMajor(), o2.getVersion().getMajor());
- }
+ @Override
+ public int compare(VersionableEntity o1, VersionableEntity o2) {
+ return Integer.compare(o1.getVersion().getMajor(), o2.getVersion().getMajor());
+ }
}