2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.sdc.vendorlicense.impl;
23 import static org.openecomp.sdc.vendorlicense.VendorLicenseConstants
24 .VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE;
26 import org.openecomp.core.util.UniqueValueUtil;
27 import org.openecomp.sdc.vendorlicense.VendorLicenseConstants;
28 import org.openecomp.sdc.vendorlicense.VendorLicenseManager;
29 import org.openecomp.sdc.vendorlicense.dao.EntitlementPoolDao;
30 import org.openecomp.sdc.vendorlicense.dao.EntitlementPoolDaoFactory;
31 import org.openecomp.sdc.vendorlicense.dao.FeatureGroupDao;
32 import org.openecomp.sdc.vendorlicense.dao.FeatureGroupDaoFactory;
33 import org.openecomp.sdc.vendorlicense.dao.LicenseAgreementDaoFactory;
34 import org.openecomp.sdc.vendorlicense.dao.LicenseKeyGroupDao;
35 import org.openecomp.sdc.vendorlicense.dao.LicenseKeyGroupDaoFactory;
36 import org.openecomp.sdc.vendorlicense.dao.VendorLicenseModelDao;
37 import org.openecomp.sdc.vendorlicense.dao.VendorLicenseModelDaoFactory;
38 import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity;
39 import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupModel;
40 import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementEntity;
41 import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementModel;
42 import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity;
43 import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity;
44 import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade;
45 import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacadeFactory;
46 import org.openecomp.sdc.vendorlicense.types.VersionedVendorLicenseModel;
47 import org.openecomp.sdc.versioning.VersioningManager;
48 import org.openecomp.sdc.versioning.VersioningUtil;
49 import org.openecomp.sdc.versioning.dao.types.Version;
50 import org.openecomp.sdc.versioning.dao.types.VersionStatus;
51 import org.openecomp.sdc.versioning.types.VersionInfo;
52 import org.openecomp.sdc.versioning.types.VersionableEntityAction;
54 import java.util.ArrayList;
55 import java.util.Collection;
56 import java.util.Collections;
57 import java.util.Comparator;
58 import java.util.List;
62 public class VendorLicenseManagerImpl implements VendorLicenseManager {
64 private static final VersioningManager versioningManager =
65 org.openecomp.sdc.versioning.VersioningManagerFactory.getInstance().createInterface();
66 private static final VendorLicenseFacade vendorLicenseFacade =
67 VendorLicenseFacadeFactory.getInstance().createInterface();
69 private static final VendorLicenseModelDao
70 vendorLicenseModelDao = VendorLicenseModelDaoFactory.getInstance().createInterface();
71 private static final org.openecomp.sdc.vendorlicense.dao.LicenseAgreementDao
72 licenseAgreementDao = LicenseAgreementDaoFactory.getInstance().createInterface();
73 private static final FeatureGroupDao featureGroupDao =
74 FeatureGroupDaoFactory.getInstance().createInterface();
75 private static final EntitlementPoolDao
76 entitlementPoolDao = EntitlementPoolDaoFactory.getInstance().createInterface();
77 private static final LicenseKeyGroupDao
78 licenseKeyGroupDao = LicenseKeyGroupDaoFactory.getInstance().createInterface();
80 private static void sortVlmListByModificationTimeDescOrder(
81 List<VersionedVendorLicenseModel> vendorLicenseModels) {
82 Collections.sort(vendorLicenseModels, new Comparator<VersionedVendorLicenseModel>() {
84 public int compare(VersionedVendorLicenseModel o1, VersionedVendorLicenseModel o2) {
85 return o2.getVendorLicenseModel().getWritetimeMicroSeconds()
86 .compareTo(o1.getVendorLicenseModel().getWritetimeMicroSeconds());
92 public void checkout(String vendorLicenseModelId, String user) {
93 Version newVersion = versioningManager
94 .checkout(VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE, vendorLicenseModelId, user);
95 vendorLicenseFacade.updateVlmLastModificationTime(vendorLicenseModelId, newVersion);
99 public void undoCheckout(String vendorLicenseModelId, String user) {
100 Version newVersion = versioningManager
101 .undoCheckout(VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE, vendorLicenseModelId, user);
102 vendorLicenseFacade.updateVlmLastModificationTime(vendorLicenseModelId, newVersion);
106 public void checkin(String vendorLicenseModelId, String user) {
107 vendorLicenseFacade.checkin(vendorLicenseModelId, user);
111 public void submit(String vendorLicenseModelId, String user) {
112 vendorLicenseFacade.submit(vendorLicenseModelId, user);
116 public Collection<VersionedVendorLicenseModel> listVendorLicenseModels(String versionFilter,
118 Map<String, VersionInfo> idToVersionsInfo = versioningManager
119 .listEntitiesVersionInfo(VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE, user,
120 VersionableEntityAction.Read);
122 List<VersionedVendorLicenseModel> vendorLicenseModels = new ArrayList<>();
123 for (Map.Entry<String, VersionInfo> entry : idToVersionsInfo.entrySet()) {
124 VersionInfo versionInfo = entry.getValue();
125 if (versionFilter != null && versionFilter.equals(VersionStatus.Final.name())) {
126 if (versionInfo.getLatestFinalVersion() == null) {
129 versionInfo.setActiveVersion(versionInfo.getLatestFinalVersion());
130 versionInfo.setStatus(VersionStatus.Final);
131 versionInfo.setLockingUser(null);
134 VendorLicenseModelEntity
135 vlm = vendorLicenseModelDao
136 .get(new VendorLicenseModelEntity(entry.getKey(), versionInfo.getActiveVersion()));
138 VersionedVendorLicenseModel versionedVlm = new VersionedVendorLicenseModel();
139 versionedVlm.setVendorLicenseModel(vlm);
140 versionedVlm.setVersionInfo(versionInfo);
141 vendorLicenseModels.add(versionedVlm);
145 sortVlmListByModificationTimeDescOrder(vendorLicenseModels);
147 return vendorLicenseModels;
151 public VendorLicenseModelEntity createVendorLicenseModel(
152 VendorLicenseModelEntity vendorLicenseModelEntity, String user) {
153 return vendorLicenseFacade.createVendorLicenseModel(vendorLicenseModelEntity, user);
157 public void updateVendorLicenseModel(VendorLicenseModelEntity vendorLicenseModelEntity,
159 Version activeVersion =
160 getVersionInfo(vendorLicenseModelEntity.getId(), VersionableEntityAction.Write, user)
162 vendorLicenseModelEntity.setVersion(activeVersion);
164 String existingVendorName = vendorLicenseModelDao.get(vendorLicenseModelEntity).getVendorName();
166 .updateUniqueValue(VendorLicenseConstants.UniqueValues.VENDOR_NAME, existingVendorName,
167 vendorLicenseModelEntity.getVendorName());
168 vendorLicenseModelDao.update(vendorLicenseModelEntity);
171 .updateVlmLastModificationTime(vendorLicenseModelEntity.getId(), activeVersion);
175 public VersionedVendorLicenseModel getVendorLicenseModel(String vlmId, Version version,
177 return vendorLicenseFacade.getVendorLicenseModel(vlmId, version, user);
181 public void deleteVendorLicenseModel(String vlmId, String user) {
182 throw new UnsupportedOperationException("Unsupported operation for 1607 release.");
184 /* Version activeVersion = getVersionInfo(vlmId, VersionableEntityAction.Write, user)
187 vendorLicenseModelDao.delete(new VendorLicenseModelEntity(vlmId, activeVersion));
188 licenseAgreementDao.deleteAll(new LicenseAgreementEntity(vlmId, activeVersion, null));
189 featureGroupDao.deleteAll(new FeatureGroupEntity(vlmId, activeVersion, null));
190 licenseKeyGroupDao.deleteAll(new LicenseKeyGroupEntity(vlmId, activeVersion, null));
191 entitlementPoolDao.deleteAll(new EntitlementPoolEntity(vlmId, activeVersion, null));*/
195 public Collection<LicenseAgreementEntity> listLicenseAgreements(String vlmId, Version version,
197 return licenseAgreementDao.list(new LicenseAgreementEntity(vlmId, VersioningUtil
198 .resolveVersion(version, getVersionInfo(vlmId, VersionableEntityAction.Read, user)), null));
202 public LicenseAgreementEntity createLicenseAgreement(LicenseAgreementEntity licenseAgreement,
204 return vendorLicenseFacade.createLicenseAgreement(licenseAgreement, user);
208 public void updateLicenseAgreement(LicenseAgreementEntity licenseAgreement,
209 Set<String> addedFeatureGroupIds,
210 Set<String> removedFeatureGroupIds, String user) {
211 Version activeVersion =
212 getVersionInfo(licenseAgreement.getVendorLicenseModelId(), VersionableEntityAction.Write,
213 user).getActiveVersion();
214 licenseAgreement.setVersion(activeVersion);
215 LicenseAgreementEntity retrieved = licenseAgreementDao.get(licenseAgreement);
217 .validateEntityExistence(retrieved, licenseAgreement, VendorLicenseModelEntity.ENTITY_TYPE);
218 VersioningUtil.validateContainedEntitiesExistence(
219 new org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity().getEntityType(),
220 removedFeatureGroupIds, retrieved, retrieved.getFeatureGroupIds());
221 VersioningUtil.validateEntitiesExistence(addedFeatureGroupIds,
222 new org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity(
223 licenseAgreement.getVendorLicenseModelId(), activeVersion, null),
224 featureGroupDao, VendorLicenseModelEntity.ENTITY_TYPE);
226 UniqueValueUtil.updateUniqueValue(VendorLicenseConstants.UniqueValues.LICENSE_AGREEMENT_NAME,
227 retrieved.getName(), licenseAgreement.getName(), licenseAgreement.getVendorLicenseModelId(),
228 licenseAgreement.getVersion().toString());
229 licenseAgreementDao.updateColumnsAndDeltaFeatureGroupIds(licenseAgreement, addedFeatureGroupIds,
230 removedFeatureGroupIds);
232 addFeatureGroupsToLicenseAgreementRef(addedFeatureGroupIds, licenseAgreement);
233 removeFeatureGroupsToLicenseAgreementRef(removedFeatureGroupIds, licenseAgreement);
236 .updateVlmLastModificationTime(licenseAgreement.getVendorLicenseModelId(), activeVersion);
240 public LicenseAgreementModel getLicenseAgreementModel(String vlmId, Version version,
241 String licenseAgreementId, String user) {
242 return vendorLicenseFacade.getLicenseAgreementModel(vlmId, version, licenseAgreementId, user);
246 public void deleteLicenseAgreement(String vlmId, String licenseAgreementId, String user) {
247 Version activeVersion =
248 getVersionInfo(vlmId, VersionableEntityAction.Write, user).getActiveVersion();
249 LicenseAgreementEntity input =
250 new LicenseAgreementEntity(vlmId, activeVersion, licenseAgreementId);
251 LicenseAgreementEntity retrieved = licenseAgreementDao.get(input);
252 VersioningUtil.validateEntityExistence(retrieved, input, VendorLicenseModelEntity.ENTITY_TYPE);
254 removeFeatureGroupsToLicenseAgreementRef(retrieved.getFeatureGroupIds(), retrieved);
256 licenseAgreementDao.delete(input);
257 UniqueValueUtil.deleteUniqueValue(VendorLicenseConstants.UniqueValues.LICENSE_AGREEMENT_NAME,
258 retrieved.getVendorLicenseModelId(), retrieved.getVersion().toString(),
259 retrieved.getName());
262 .updateVlmLastModificationTime(input.getVendorLicenseModelId(), input.getVersion());
266 public Collection<org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity> listFeatureGroups(
267 String vlmId, Version version,
269 return featureGroupDao
270 .list(new org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity(vlmId, VersioningUtil
271 .resolveVersion(version, getVersionInfo(vlmId, VersionableEntityAction.Read, user)),
276 public org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity createFeatureGroup(
277 org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity featureGroup, String user) {
278 return vendorLicenseFacade.createFeatureGroup(featureGroup, user);
282 public void updateFeatureGroup(
283 org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity featureGroup,
284 Set<String> addedLicenseKeyGroups,
285 Set<String> removedLicenseKeyGroups,
286 Set<String> addedEntitlementPools,
287 Set<String> removedEntitlementPools,
289 Version activeVersion =
290 getVersionInfo(featureGroup.getVendorLicenseModelId(), VersionableEntityAction.Write, user)
292 featureGroup.setVersion(activeVersion);
294 org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity retrieved =
295 featureGroupDao.get(featureGroup);
297 .validateEntityExistence(retrieved, featureGroup, VendorLicenseModelEntity.ENTITY_TYPE);
299 VersioningUtil.validateContainedEntitiesExistence(new LicenseKeyGroupEntity().getEntityType(),
300 removedLicenseKeyGroups, retrieved, retrieved.getLicenseKeyGroupIds());
301 VersioningUtil.validateContainedEntitiesExistence(new EntitlementPoolEntity().getEntityType(),
302 removedEntitlementPools, retrieved, retrieved.getEntitlementPoolIds());
304 VersioningUtil.validateEntitiesExistence(addedLicenseKeyGroups,
305 new LicenseKeyGroupEntity(featureGroup.getVendorLicenseModelId(), activeVersion, null),
306 licenseKeyGroupDao, VendorLicenseModelEntity.ENTITY_TYPE);
307 VersioningUtil.validateEntitiesExistence(addedEntitlementPools,
308 new EntitlementPoolEntity(featureGroup.getVendorLicenseModelId(), activeVersion, null),
309 entitlementPoolDao, VendorLicenseModelEntity.ENTITY_TYPE);
310 UniqueValueUtil.updateUniqueValue(VendorLicenseConstants.UniqueValues.FEATURE_GROUP_NAME,
311 retrieved.getName(), featureGroup.getName(), featureGroup.getVendorLicenseModelId(),
312 featureGroup.getVersion().toString());
314 addLicenseKeyGroupsToFeatureGroupsRef(addedLicenseKeyGroups, featureGroup);
315 removeLicenseKeyGroupsToFeatureGroupsRef(removedLicenseKeyGroups, featureGroup);
316 addEntitlementPoolsToFeatureGroupsRef(addedEntitlementPools, featureGroup);
317 removeEntitlementPoolsToFeatureGroupsRef(removedEntitlementPools, featureGroup);
319 featureGroupDao.updateFeatureGroup(featureGroup, addedEntitlementPools, removedEntitlementPools,
320 addedLicenseKeyGroups, removedLicenseKeyGroups);
323 .updateVlmLastModificationTime(featureGroup.getVendorLicenseModelId(), activeVersion);
327 public FeatureGroupModel getFeatureGroupModel(
328 org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity featureGroup, String user) {
329 return vendorLicenseFacade.getFeatureGroupModel(featureGroup, user);
333 public void deleteFeatureGroup(
334 org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity featureGroup, String user) {
335 Version activeVersion =
336 getVersionInfo(featureGroup.getVendorLicenseModelId(), VersionableEntityAction.Write, user)
338 featureGroup.setVersion(activeVersion);
339 org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity retrieved =
340 featureGroupDao.get(featureGroup);
342 .validateEntityExistence(retrieved, featureGroup, VendorLicenseModelEntity.ENTITY_TYPE);
344 removeLicenseKeyGroupsToFeatureGroupsRef(retrieved.getLicenseKeyGroupIds(), featureGroup);
345 removeEntitlementPoolsToFeatureGroupsRef(retrieved.getEntitlementPoolIds(), featureGroup);
347 for (String licenceAgreementId : retrieved.getReferencingLicenseAgreements()) {
348 licenseAgreementDao.removeFeatureGroup(
349 new LicenseAgreementEntity(featureGroup.getVendorLicenseModelId(), activeVersion,
350 licenceAgreementId), featureGroup.getId());
353 featureGroupDao.delete(featureGroup);
354 UniqueValueUtil.deleteUniqueValue(VendorLicenseConstants.UniqueValues.FEATURE_GROUP_NAME,
355 retrieved.getVendorLicenseModelId(), retrieved.getVersion().toString(),
356 retrieved.getName());
358 vendorLicenseFacade.updateVlmLastModificationTime(featureGroup.getVendorLicenseModelId(),
359 featureGroup.getVersion());
363 public Collection<EntitlementPoolEntity> listEntitlementPools(String vlmId, Version version,
365 return vendorLicenseFacade.listEntitlementPools(vlmId, version, user);
369 public EntitlementPoolEntity createEntitlementPool(EntitlementPoolEntity entitlementPool,
371 return vendorLicenseFacade.createEntitlementPool(entitlementPool, user);
375 public void updateEntitlementPool(EntitlementPoolEntity entitlementPool, String user) {
376 Version activeVersion =
377 getVersionInfo(entitlementPool.getVendorLicenseModelId(), VersionableEntityAction.Write,
378 user).getActiveVersion();
380 .updateVlmLastModificationTime(entitlementPool.getVendorLicenseModelId(), activeVersion);
381 vendorLicenseFacade.updateEntitlementPool(entitlementPool, user);
385 public EntitlementPoolEntity getEntitlementPool(EntitlementPoolEntity entitlementPool,
387 entitlementPool.setVersion(VersioningUtil.resolveVersion(entitlementPool.getVersion(),
388 getVersionInfo(entitlementPool.getVendorLicenseModelId(), VersionableEntityAction.Read,
391 EntitlementPoolEntity retrieved = entitlementPoolDao.get(entitlementPool);
393 .validateEntityExistence(retrieved, entitlementPool, VendorLicenseModelEntity.ENTITY_TYPE);
398 public void deleteEntitlementPool(EntitlementPoolEntity entitlementPool, String user) {
399 Version activeVersion =
400 getVersionInfo(entitlementPool.getVendorLicenseModelId(), VersionableEntityAction.Write,
401 user).getActiveVersion();
402 entitlementPool.setVersion(activeVersion);
404 EntitlementPoolEntity retrieved = entitlementPoolDao.get(entitlementPool);
406 .validateEntityExistence(retrieved, entitlementPool, VendorLicenseModelEntity.ENTITY_TYPE);
408 for (String referencingFeatureGroupId : retrieved.getReferencingFeatureGroups()) {
409 featureGroupDao.removeEntitlementPool(
410 new org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity(
411 entitlementPool.getVendorLicenseModelId(), activeVersion,
412 referencingFeatureGroupId), entitlementPool.getId());
415 entitlementPoolDao.delete(entitlementPool);
416 UniqueValueUtil.deleteUniqueValue(VendorLicenseConstants.UniqueValues.ENTITLEMENT_POOL_NAME,
417 retrieved.getVendorLicenseModelId(), retrieved.getVersion().toString(),
418 retrieved.getName());
420 vendorLicenseFacade.updateVlmLastModificationTime(entitlementPool.getVendorLicenseModelId(),
421 entitlementPool.getVersion());
425 public Collection<LicenseKeyGroupEntity> listLicenseKeyGroups(String vlmId, Version version,
427 return vendorLicenseFacade.listLicenseKeyGroups(vlmId, version, user);
431 public LicenseKeyGroupEntity createLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup,
433 return vendorLicenseFacade.createLicenseKeyGroup(licenseKeyGroup, user);
437 public void updateLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup, String user) {
438 Version activeVersion =
439 getVersionInfo(licenseKeyGroup.getVendorLicenseModelId(), VersionableEntityAction.Write,
440 user).getActiveVersion();
442 .updateVlmLastModificationTime(licenseKeyGroup.getVendorLicenseModelId(), activeVersion);
444 vendorLicenseFacade.updateLicenseKeyGroup(licenseKeyGroup, user);
448 public LicenseKeyGroupEntity getLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup,
450 licenseKeyGroup.setVersion(VersioningUtil.resolveVersion(licenseKeyGroup.getVersion(),
451 getVersionInfo(licenseKeyGroup.getVendorLicenseModelId(), VersionableEntityAction.Read,
454 LicenseKeyGroupEntity retrieved = licenseKeyGroupDao.get(licenseKeyGroup);
456 .validateEntityExistence(retrieved, licenseKeyGroup, VendorLicenseModelEntity.ENTITY_TYPE);
461 public void deleteLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup, String user) {
462 Version activeVersion =
463 getVersionInfo(licenseKeyGroup.getVendorLicenseModelId(), VersionableEntityAction.Write,
464 user).getActiveVersion();
465 licenseKeyGroup.setVersion(activeVersion);
467 LicenseKeyGroupEntity retrieved = licenseKeyGroupDao.get(licenseKeyGroup);
469 .validateEntityExistence(retrieved, licenseKeyGroup, VendorLicenseModelEntity.ENTITY_TYPE);
471 licenseKeyGroupDao.delete(licenseKeyGroup);
472 for (String referencingFeatureGroupId : retrieved.getReferencingFeatureGroups()) {
473 featureGroupDao.removeLicenseKeyGroup(
474 new org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity(
475 licenseKeyGroup.getVendorLicenseModelId(), activeVersion,
476 referencingFeatureGroupId), licenseKeyGroup.getId());
478 UniqueValueUtil.deleteUniqueValue(VendorLicenseConstants.UniqueValues.LICENSE_KEY_GROUP_NAME,
479 retrieved.getVendorLicenseModelId(), retrieved.getVersion().toString(),
480 retrieved.getName());
482 vendorLicenseFacade.updateVlmLastModificationTime(licenseKeyGroup.getVendorLicenseModelId(),
483 licenseKeyGroup.getVersion());
486 private void addFeatureGroupsToLicenseAgreementRef(Set<String> featureGroupIds,
487 LicenseAgreementEntity licenseAgreement) {
488 if (featureGroupIds != null) {
489 for (String featureGroupId : featureGroupIds) {
490 featureGroupDao.addReferencingLicenseAgreement(
491 new org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity(
492 licenseAgreement.getVendorLicenseModelId(),
493 licenseAgreement.getVersion(), featureGroupId), licenseAgreement.getId());
498 private void removeFeatureGroupsToLicenseAgreementRef(Set<String> featureGroupIds,
499 LicenseAgreementEntity licenseAgreement) {
500 if (featureGroupIds != null) {
501 for (String featureGroupId : featureGroupIds) {
502 featureGroupDao.removeReferencingLicenseAgreement(
503 new org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity(
504 licenseAgreement.getVendorLicenseModelId(),
505 licenseAgreement.getVersion(), featureGroupId), licenseAgreement.getId());
510 private void addLicenseKeyGroupsToFeatureGroupsRef(Set<String> licenseKeyGroupIds,
511 org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity featureGroup) {
512 if (licenseKeyGroupIds != null) {
513 for (String licenseKeyGroupId : licenseKeyGroupIds) {
514 licenseKeyGroupDao.addReferencingFeatureGroup(
515 new LicenseKeyGroupEntity(featureGroup.getVendorLicenseModelId(),
516 featureGroup.getVersion(), licenseKeyGroupId), featureGroup.getId());
521 private void removeLicenseKeyGroupsToFeatureGroupsRef(Set<String> licenseKeyGroupIds,
522 org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity featureGroup) {
523 if (licenseKeyGroupIds != null) {
524 for (String licenseKeyGroupId : licenseKeyGroupIds) {
525 licenseKeyGroupDao.removeReferencingFeatureGroup(
526 new LicenseKeyGroupEntity(featureGroup.getVendorLicenseModelId(),
527 featureGroup.getVersion(), licenseKeyGroupId), featureGroup.getId());
532 private void addEntitlementPoolsToFeatureGroupsRef(Set<String> entitlementPoolIds,
533 org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity featureGroup) {
534 if (entitlementPoolIds != null) {
535 for (String entitlementPoolId : entitlementPoolIds) {
536 entitlementPoolDao.addReferencingFeatureGroup(
537 new EntitlementPoolEntity(featureGroup.getVendorLicenseModelId(),
538 featureGroup.getVersion(), entitlementPoolId), featureGroup.getId());
543 private void removeEntitlementPoolsToFeatureGroupsRef(Set<String> entitlementPoolIds,
544 org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity featureGroup) {
545 if (entitlementPoolIds != null) {
546 for (String entitlementPoolId : entitlementPoolIds) {
547 entitlementPoolDao.removeReferencingFeatureGroup(
548 new EntitlementPoolEntity(featureGroup.getVendorLicenseModelId(),
549 featureGroup.getVersion(), entitlementPoolId), featureGroup.getId());
554 private VersionInfo getVersionInfo(String vendorLicenseModelId, VersionableEntityAction action,
556 return vendorLicenseFacade.getVersionInfo(vendorLicenseModelId, action, user);