aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-vendor-license-lib
diff options
context:
space:
mode:
authorMichael Lando <ml636r@att.com>2017-07-12 00:54:52 +0300
committerMichael Lando <ml636r@att.com>2017-07-12 01:55:12 +0300
commitdd60339b06d252fcb1382aa97ab3d65b37dad021 (patch)
treec1551ce67cd77ca810ad5f579eb3617af86be85f /openecomp-be/lib/openecomp-sdc-vendor-license-lib
parentab146a193c43e9be0e9efeac7bab2690a7ba2d33 (diff)
[sdc] rebase update
Change-Id: I8f1fc7150975122dd9f3f4e653b9983064b399a6 Signed-off-by: Michael Lando <ml636r@att.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-vendor-license-lib')
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/EntitlementPoolZusammenDaoImpl.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/FeatureGroupDaoZusammenImpl.java8
-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.java24
3 files changed, 42 insertions, 6 deletions
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 f133aaad9a..ffaf7809c8 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
@@ -73,8 +73,20 @@ public class EntitlementPoolZusammenDaoImpl implements EntitlementPoolDao {
SessionContext context = ZusammenUtil.createSessionContext();
Id itemId = new Id(entitlementPool.getVendorLicenseModelId());
- zusammenAdaptor.saveElement(context, new ElementContext(itemId,
- VlmZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor)), entitlmentpoolElement,
+ ElementContext elementContext = new ElementContext(itemId,
+ VlmZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor));
+
+ Optional<ElementInfo> epFromDb = zusammenAdaptor.getElementInfo(context, elementContext,
+ new Id(entitlementPool.getId()));
+
+ if (epFromDb.isPresent()) {
+ if (entitlmentpoolElement.getRelations() == null) {
+ entitlmentpoolElement.setRelations(new ArrayList<>());
+ }
+ entitlmentpoolElement.getRelations().addAll(epFromDb.get().getRelations());
+ }
+
+ zusammenAdaptor.saveElement(context,elementContext, entitlmentpoolElement,
String.format("Update entitlement pool with id %s", entitlementPool.getId()));
}
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 624ffeb05e..6484e83319 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
@@ -204,6 +204,14 @@ public class FeatureGroupDaoZusammenImpl implements FeatureGroupDao {
.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");
}
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 bf1899cb04..03537a287b 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
@@ -62,14 +62,30 @@ public class LicenseKeyGroupZusammenDaoImpl implements LicenseKeyGroupDao {
@Override
public void update(LicenseKeyGroupEntity licenseKeyGroup) {
- ZusammenElement locenseKeyGroupElement =
+ ZusammenElement licenseKeyGroupElement =
buildLicenseKeyGroupElement(licenseKeyGroup, Action.UPDATE);
SessionContext context = ZusammenUtil.createSessionContext();
Id itemId = new Id(licenseKeyGroup.getVendorLicenseModelId());
- zusammenAdaptor.saveElement(context, new ElementContext(itemId,
- VlmZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor)),
- locenseKeyGroupElement,
+
+ ElementContext elementContext = new ElementContext(itemId,
+ VlmZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor));
+
+ Optional<ElementInfo> lkgFromDb = zusammenAdaptor.getElementInfo(context, elementContext,
+ new Id(licenseKeyGroup.getId()));
+
+ if(lkgFromDb.isPresent()) {
+
+ if( licenseKeyGroupElement.getRelations() == null) {
+ licenseKeyGroupElement.setRelations(new ArrayList<>());
+ }
+
+ lkgFromDb.get().getRelations().forEach(relation ->
+ licenseKeyGroupElement.getRelations().add(relation));
+ }
+
+ zusammenAdaptor.saveElement(context, elementContext,
+ licenseKeyGroupElement,
String.format("Update license key group with id %s", licenseKeyGroup.getId()));
}