2 * Copyright © 2016-2017 European Support Limited
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package org.openecomp.sdc.vendorlicense.impl;
19 import org.openecomp.core.dao.UniqueValueDao;
20 import org.openecomp.core.util.UniqueValueUtil;
21 import org.openecomp.core.utilities.CommonMethods;
22 import org.openecomp.sdc.common.errors.CoreException;
23 import org.openecomp.sdc.common.errors.ErrorCode;
24 import org.openecomp.sdc.vendorlicense.VendorLicenseConstants;
25 import org.openecomp.sdc.vendorlicense.VendorLicenseManager;
26 import org.openecomp.sdc.vendorlicense.dao.*;
27 import org.openecomp.sdc.vendorlicense.dao.types.*;
28 import org.openecomp.sdc.vendorlicense.errors.InvalidDateErrorBuilder;
29 import org.openecomp.sdc.vendorlicense.errors.LimitErrorBuilder;
30 import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade;
31 import org.openecomp.sdc.versioning.VersioningUtil;
32 import org.openecomp.sdc.versioning.dao.types.Version;
34 import java.time.LocalDate;
35 import java.time.format.DateTimeFormatter;
36 import java.util.Collection;
37 import java.util.Optional;
40 public class VendorLicenseManagerImpl implements VendorLicenseManager {
41 private final UniqueValueUtil uniqueValueUtil;
42 private final VendorLicenseFacade vendorLicenseFacade;
43 private final VendorLicenseModelDao vendorLicenseModelDao;
44 private final LicenseAgreementDao licenseAgreementDao;
45 private final FeatureGroupDao featureGroupDao;
46 private final EntitlementPoolDao entitlementPoolDao;
47 private final LicenseKeyGroupDao licenseKeyGroupDao;
48 private final LimitDao limitDao;
50 private static final String EP_POOL_START_TIME = "T00:00:00Z";
51 private static final String EP_POOL_EXPIRY_TIME = "T23:59:59Z";
52 private static final DateTimeFormatter FORMATTER
53 = DateTimeFormatter.ofPattern("MM/dd/yyyy'T'HH:mm:ss'Z'");
54 public VendorLicenseManagerImpl(VendorLicenseFacade vendorLicenseFacade,
55 VendorLicenseModelDao vendorLicenseModelDao,
56 LicenseAgreementDao licenseAgreementDao,
57 FeatureGroupDao featureGroupDao,
58 EntitlementPoolDao entitlementPoolDao,
59 LicenseKeyGroupDao licenseKeyGroupDao,
61 UniqueValueDao uniqueValueDao) {
62 this.vendorLicenseFacade = vendorLicenseFacade;
63 this.vendorLicenseModelDao = vendorLicenseModelDao;
64 this.licenseAgreementDao = licenseAgreementDao;
65 this.featureGroupDao = featureGroupDao;
66 this.entitlementPoolDao = entitlementPoolDao;
67 this.licenseKeyGroupDao = licenseKeyGroupDao;
68 this.limitDao = limitDao;
69 this.uniqueValueUtil = new UniqueValueUtil(uniqueValueDao);
74 public void validate(String vendorLicenseModelId, Version version) {
75 vendorLicenseFacade.validate(vendorLicenseModelId, version);
79 public VendorLicenseModelEntity createVendorLicenseModel(
80 VendorLicenseModelEntity vendorLicenseModelEntity) {
81 vendorLicenseModelDao.create(vendorLicenseModelEntity);
82 return vendorLicenseModelEntity;
86 public void updateVendorLicenseModel(VendorLicenseModelEntity vendorLicenseModelEntity) {
87 VendorLicenseModelEntity retrieved = vendorLicenseModelDao.get(vendorLicenseModelEntity);
88 if (retrieved == null){
89 throw new CoreException((new ErrorCode.ErrorCodeBuilder()
90 .withMessage(String.format("Vlm with id %s and version %s does not exist.",
91 vendorLicenseModelEntity.getId(), vendorLicenseModelEntity.getVersion().getId()))).build());
94 String existingVendorName = retrieved.getVendorName();
96 updateUniqueName(VendorLicenseConstants.UniqueValues.VENDOR_NAME, existingVendorName,
97 vendorLicenseModelEntity.getVendorName());
98 vendorLicenseModelDao.update(vendorLicenseModelEntity);
102 public VendorLicenseModelEntity getVendorLicenseModel(String vlmId, Version version) {
103 return vendorLicenseFacade.getVendorLicenseModel(vlmId, version);
107 public void deleteVendorLicenseModel(String vlmId, Version version) {
108 throw new UnsupportedOperationException(VendorLicenseConstants.UNSUPPORTED_OPERATION_ERROR);
112 public Collection<LicenseAgreementEntity> listLicenseAgreements(String vlmId, Version version) {
113 return licenseAgreementDao.list(new LicenseAgreementEntity(vlmId, version, null));
117 public LicenseAgreementEntity createLicenseAgreement(LicenseAgreementEntity licenseAgreement) {
118 return vendorLicenseFacade.createLicenseAgreement(licenseAgreement);
122 public void updateLicenseAgreement(LicenseAgreementEntity licenseAgreement,
123 Set<String> addedFeatureGroupIds,
124 Set<String> removedFeatureGroupIds) {
125 LicenseAgreementEntity retrieved = licenseAgreementDao.get(licenseAgreement);
127 .validateEntityExistence(retrieved, licenseAgreement, VendorLicenseModelEntity.ENTITY_TYPE);
128 VersioningUtil.validateContainedEntitiesExistence(new FeatureGroupEntity().getEntityType(),
129 removedFeatureGroupIds, retrieved, retrieved.getFeatureGroupIds());
130 VersioningUtil.validateEntitiesExistence(addedFeatureGroupIds,
131 new FeatureGroupEntity(licenseAgreement.getVendorLicenseModelId(),
132 licenseAgreement.getVersion(),
134 featureGroupDao, VendorLicenseModelEntity.ENTITY_TYPE);
136 updateUniqueName(VendorLicenseConstants.UniqueValues.LICENSE_AGREEMENT_NAME,
137 retrieved.getName(), licenseAgreement.getName(), licenseAgreement.getVendorLicenseModelId(),
138 licenseAgreement.getVersion().getId());
139 licenseAgreementDao.updateColumnsAndDeltaFeatureGroupIds(licenseAgreement, addedFeatureGroupIds,
140 removedFeatureGroupIds);
142 addFeatureGroupsToLicenseAgreementRef(addedFeatureGroupIds, licenseAgreement);
143 removeFeatureGroupsToLicenseAgreementRef(removedFeatureGroupIds, licenseAgreement);
147 public LicenseAgreementModel getLicenseAgreementModel(String vlmId, Version version,
148 String licenseAgreementId) {
149 return vendorLicenseFacade.getLicenseAgreementModel(vlmId, version, licenseAgreementId);
153 public void deleteLicenseAgreement(String vlmId, Version version, String licenseAgreementId) {
154 LicenseAgreementEntity input =
155 new LicenseAgreementEntity(vlmId, version, licenseAgreementId);
156 LicenseAgreementEntity retrieved = licenseAgreementDao.get(input);
157 VersioningUtil.validateEntityExistence(retrieved, input, VendorLicenseModelEntity.ENTITY_TYPE);
159 removeFeatureGroupsToLicenseAgreementRef(retrieved.getFeatureGroupIds(), retrieved);
161 licenseAgreementDao.delete(retrieved);
163 deleteUniqueName(VendorLicenseConstants.UniqueValues.LICENSE_AGREEMENT_NAME,
164 retrieved.getVendorLicenseModelId(), retrieved.getVersion().toString(),
165 retrieved.getName());
169 public Collection<FeatureGroupEntity> listFeatureGroups(String vlmId, Version version) {
170 return vendorLicenseFacade.listFeatureGroups(vlmId, version);
174 public FeatureGroupEntity createFeatureGroup(FeatureGroupEntity featureGroup) {
175 return vendorLicenseFacade.createFeatureGroup(featureGroup);
179 public void updateFeatureGroup(FeatureGroupEntity featureGroup,
180 Set<String> addedLicenseKeyGroups,
181 Set<String> removedLicenseKeyGroups,
182 Set<String> addedEntitlementPools,
183 Set<String> removedEntitlementPools) {
184 FeatureGroupEntity retrieved = featureGroupDao.get(featureGroup);
186 .validateEntityExistence(retrieved, featureGroup, VendorLicenseModelEntity.ENTITY_TYPE);
188 VersioningUtil.validateContainedEntitiesExistence(new LicenseKeyGroupEntity().getEntityType(),
189 removedLicenseKeyGroups, retrieved, retrieved.getLicenseKeyGroupIds());
190 VersioningUtil.validateContainedEntitiesExistence(new EntitlementPoolEntity().getEntityType(),
191 removedEntitlementPools, retrieved, retrieved.getEntitlementPoolIds());
193 VersioningUtil.validateEntitiesExistence(addedLicenseKeyGroups,
194 new LicenseKeyGroupEntity(featureGroup.getVendorLicenseModelId(), featureGroup.getVersion(),
196 licenseKeyGroupDao, VendorLicenseModelEntity.ENTITY_TYPE);
197 VersioningUtil.validateEntitiesExistence(addedEntitlementPools,
198 new EntitlementPoolEntity(featureGroup.getVendorLicenseModelId(), featureGroup.getVersion(),
200 entitlementPoolDao, VendorLicenseModelEntity.ENTITY_TYPE);
202 updateUniqueName(VendorLicenseConstants.UniqueValues.FEATURE_GROUP_NAME,
203 retrieved.getName(), featureGroup.getName(), featureGroup.getVendorLicenseModelId(),
204 featureGroup.getVersion().getId());
206 addLicenseKeyGroupsToFeatureGroupsRef(addedLicenseKeyGroups, featureGroup);
207 removeLicenseKeyGroupsToFeatureGroupsRef(removedLicenseKeyGroups, featureGroup);
208 addEntitlementPoolsToFeatureGroupsRef(addedEntitlementPools, featureGroup);
209 removeEntitlementPoolsToFeatureGroupsRef(removedEntitlementPools, featureGroup);
211 featureGroupDao.updateFeatureGroup(featureGroup, addedEntitlementPools, removedEntitlementPools,
212 addedLicenseKeyGroups, removedLicenseKeyGroups);
217 public FeatureGroupModel getFeatureGroupModel(FeatureGroupEntity featureGroup) {
218 return vendorLicenseFacade.getFeatureGroupModel(featureGroup);
222 public void deleteFeatureGroup(FeatureGroupEntity featureGroup) {
223 FeatureGroupEntity retrieved = featureGroupDao.get(featureGroup);
225 .validateEntityExistence(retrieved, featureGroup, VendorLicenseModelEntity.ENTITY_TYPE);
227 removeLicenseKeyGroupsToFeatureGroupsRef(retrieved.getLicenseKeyGroupIds(), featureGroup);
228 removeEntitlementPoolsToFeatureGroupsRef(retrieved.getEntitlementPoolIds(), featureGroup);
230 for (String licenceAgreementId : retrieved.getReferencingLicenseAgreements()) {
231 licenseAgreementDao.removeFeatureGroup(
232 new LicenseAgreementEntity(featureGroup.getVendorLicenseModelId(),
233 featureGroup.getVersion(),
234 licenceAgreementId), featureGroup.getId());
237 featureGroupDao.delete(featureGroup);
239 deleteUniqueName(VendorLicenseConstants.UniqueValues.FEATURE_GROUP_NAME,
240 retrieved.getVendorLicenseModelId(), retrieved.getVersion().toString(),
241 retrieved.getName());
245 public Collection<EntitlementPoolEntity> listEntitlementPools(String vlmId, Version version) {
246 return vendorLicenseFacade.listEntitlementPools(vlmId, version);
250 public EntitlementPoolEntity createEntitlementPool(EntitlementPoolEntity entitlementPool) {
251 entitlementPool.setStartDate(getDate(entitlementPool.getStartDate(), EP_POOL_START_TIME));
252 entitlementPool.setExpiryDate(getDate(entitlementPool.getExpiryDate(), EP_POOL_EXPIRY_TIME));
253 validateCreateDate(entitlementPool.getStartDate(), entitlementPool.getExpiryDate(),
254 entitlementPool.getVendorLicenseModelId());
255 return vendorLicenseFacade.createEntitlementPool(entitlementPool);
258 private String getDate(String date, String poolTime){
259 return date != null ? (!date.trim().isEmpty() ? date + poolTime: null) : null;
262 private void validateCreateDate(String startDate, String expiryDate,
263 String vendorLicenseModelId) {
264 if(isNull(startDate, expiryDate) || isEmpty(startDate, expiryDate) ||
265 isInvalidStartEndDate(startDate, expiryDate)){
266 throw new CoreException(
267 new InvalidDateErrorBuilder(vendorLicenseModelId)
272 private boolean isInvalidStartEndDate(String startDate, String expiryDate) {
273 LocalDate parsedStartDate = parseLocalDate(startDate);
274 LocalDate parsedExpiryDate = parseLocalDate(expiryDate);
276 return parsedStartDate.atStartOfDay().isBefore(LocalDate.now().atStartOfDay())
277 || parsedExpiryDate.atStartOfDay().isEqual(parsedStartDate.atStartOfDay())
278 || parsedExpiryDate.isBefore(parsedStartDate);
281 private boolean isEmpty(String startDate, String expiryDate) {
282 return startDate.isEmpty() || expiryDate.isEmpty();
285 private boolean isNull(String startDate, String expiryDate) {
286 return startDate == null || expiryDate == null;
289 private static LocalDate parseLocalDate(String date) {
290 return LocalDate.parse(date, FORMATTER );
293 private void validateUpdateDate(String startDate, String expiryDate,
294 String vendorLicenseModelId) {
296 if(isNull(startDate, expiryDate) || isEmpty(startDate, expiryDate)
297 || isInvalidUpdateDate(startDate, expiryDate)){
298 throw new CoreException(
299 new InvalidDateErrorBuilder(vendorLicenseModelId)
304 private boolean isInvalidUpdateDate(String startDate, String expiryDate) {
306 LocalDate parsedStartDate = parseLocalDate(startDate);
307 LocalDate parsedExpiryDate = parseLocalDate(expiryDate);
309 return parsedExpiryDate.atStartOfDay()
310 .isEqual(parsedStartDate.atStartOfDay())
311 || parsedExpiryDate.isBefore(parsedStartDate);
315 public void updateEntitlementPool(EntitlementPoolEntity entitlementPool) {
316 entitlementPool.setStartDate(getDate(entitlementPool.getStartDate(), EP_POOL_START_TIME));
317 entitlementPool.setExpiryDate(getDate(entitlementPool.getExpiryDate(), EP_POOL_EXPIRY_TIME));
318 validateUpdateDate(entitlementPool.getStartDate(), entitlementPool.getExpiryDate(),
319 entitlementPool.getVendorLicenseModelId());
320 vendorLicenseFacade.updateEntitlementPool(entitlementPool);
324 public EntitlementPoolEntity getEntitlementPool(EntitlementPoolEntity entitlementPool) {
325 EntitlementPoolEntity retrieved = entitlementPoolDao.get(entitlementPool);
327 .validateEntityExistence(retrieved, entitlementPool, VendorLicenseModelEntity.ENTITY_TYPE);
328 DateTimeFormatter targetFormatter = DateTimeFormatter.ofPattern("MM/dd/yyyy");
329 if (retrieved.getStartDate() != null) {
330 retrieved.setStartDate(LocalDate.parse(retrieved.getStartDate(), FORMATTER ).format
334 if (retrieved.getExpiryDate() != null) {
335 retrieved.setExpiryDate(LocalDate.parse(retrieved.getExpiryDate(), FORMATTER ).format
342 public void deleteEntitlementPool(EntitlementPoolEntity entitlementPool) {
343 EntitlementPoolEntity retrieved = entitlementPoolDao.get(entitlementPool);
345 .validateEntityExistence(retrieved, entitlementPool, VendorLicenseModelEntity.ENTITY_TYPE);
347 for (String referencingFeatureGroupId : retrieved.getReferencingFeatureGroups()) {
348 featureGroupDao.removeEntitlementPool(
349 new FeatureGroupEntity(entitlementPool.getVendorLicenseModelId(),
350 entitlementPool.getVersion(),
351 referencingFeatureGroupId), entitlementPool.getId());
354 deleteChildLimits(entitlementPool.getVendorLicenseModelId(), entitlementPool.getVersion(),
355 entitlementPool.getId());
357 entitlementPoolDao.delete(entitlementPool);
359 deleteUniqueName(VendorLicenseConstants.UniqueValues.ENTITLEMENT_POOL_NAME,
360 retrieved.getVendorLicenseModelId(), retrieved.getVersion().toString(),
361 retrieved.getName());
364 protected void deleteChildLimits(String vlmId, Version version, String epLkgId) {
365 Optional<Collection<LimitEntity>> limitEntities = Optional.ofNullable(
366 listLimits(vlmId, version, epLkgId));
367 limitEntities.ifPresent(entities -> entities.forEach(this::deleteLimit));
371 public Collection<LicenseKeyGroupEntity> listLicenseKeyGroups(String vlmId, Version version) {
372 return vendorLicenseFacade.listLicenseKeyGroups(vlmId, version);
376 public LicenseKeyGroupEntity createLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup) {
377 licenseKeyGroup.setStartDate(licenseKeyGroup.getStartDate() != null ? (licenseKeyGroup
378 .getStartDate().trim().length() != 0 ? licenseKeyGroup.getStartDate() + EP_POOL_START_TIME
380 licenseKeyGroup.setExpiryDate(licenseKeyGroup.getExpiryDate() != null ? (licenseKeyGroup
381 .getExpiryDate().trim().length() != 0 ? licenseKeyGroup.getExpiryDate() + EP_POOL_EXPIRY_TIME
384 validateCreateDate(licenseKeyGroup.getStartDate(), licenseKeyGroup.getExpiryDate(),
385 licenseKeyGroup.getVendorLicenseModelId());
386 return vendorLicenseFacade.createLicenseKeyGroup(licenseKeyGroup);
390 public void updateLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup) {
391 licenseKeyGroup.setStartDate(licenseKeyGroup.getStartDate() != null ? (licenseKeyGroup
392 .getStartDate().trim().length() != 0 ? licenseKeyGroup.getStartDate() + EP_POOL_START_TIME
394 licenseKeyGroup.setExpiryDate(licenseKeyGroup.getExpiryDate() != null ? (licenseKeyGroup
395 .getExpiryDate().trim().length() != 0 ? licenseKeyGroup.getExpiryDate() + EP_POOL_EXPIRY_TIME
398 validateUpdateDate(licenseKeyGroup.getStartDate(), licenseKeyGroup.getExpiryDate(),
399 licenseKeyGroup.getVendorLicenseModelId());
400 vendorLicenseFacade.updateLicenseKeyGroup(licenseKeyGroup);
404 public LicenseKeyGroupEntity getLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup) {
405 LicenseKeyGroupEntity retrieved = licenseKeyGroupDao.get(licenseKeyGroup);
407 .validateEntityExistence(retrieved, licenseKeyGroup, VendorLicenseModelEntity.ENTITY_TYPE);
412 public void deleteLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup) {
413 LicenseKeyGroupEntity retrieved = licenseKeyGroupDao.get(licenseKeyGroup);
415 .validateEntityExistence(retrieved, licenseKeyGroup, VendorLicenseModelEntity.ENTITY_TYPE);
417 for (String referencingFeatureGroupId : retrieved.getReferencingFeatureGroups()) {
418 featureGroupDao.removeLicenseKeyGroup(
419 new FeatureGroupEntity(licenseKeyGroup.getVendorLicenseModelId(),
420 licenseKeyGroup.getVersion(),
421 referencingFeatureGroupId), licenseKeyGroup.getId());
424 deleteChildLimits(licenseKeyGroup.getVendorLicenseModelId(), licenseKeyGroup.getVersion(),
425 licenseKeyGroup.getId());
427 licenseKeyGroupDao.delete(licenseKeyGroup);
429 deleteUniqueName(VendorLicenseConstants.UniqueValues.LICENSE_KEY_GROUP_NAME,
430 retrieved.getVendorLicenseModelId(), retrieved.getVersion().toString(),
431 retrieved.getName());
435 public LimitEntity createLimit(LimitEntity limit) {
436 validateLimit(limit);
437 LimitEntity createdLimit = vendorLicenseFacade.createLimit(limit);
438 updateParentForLimit(limit);
442 private void validateLimit(LimitEntity limit) {
443 Collection<LimitEntity> limitList =
444 listLimits(limit.getVendorLicenseModelId(), limit.getVersion()
445 , limit.getEpLkgId());
447 if (!isLimitNameUnique(limitList, limit.getName(), limit.getType(), limit.getId())) {
448 final ErrorCode duplicateLimitNameErrorBuilder =
449 LimitErrorBuilder.getDuplicateNameErrorbuilder(limit.getName(), limit.getType().name());
450 throw new CoreException(duplicateLimitNameErrorBuilder);
454 private boolean isLimitNameUnique(Collection<LimitEntity> limitList, String name, LimitType
456 for (LimitEntity limit : limitList) {
457 if (limit.getName().equalsIgnoreCase(name) &&
458 limit.getType().name().equalsIgnoreCase(type.name())) {
459 if (id != null && limit.getId().equals(id)) {
469 public Collection<LimitEntity> listLimits(String vlmId, Version version, String epLkgId) {
470 return vendorLicenseFacade.listLimits(vlmId, version, epLkgId);
474 public void deleteLimit(LimitEntity limitEntity) {
475 if (!isLimitPresent(limitEntity)) {
477 .validateEntityExistence(null, limitEntity, VendorLicenseModelEntity.ENTITY_TYPE);
479 LimitEntity retrieved = limitDao.get(limitEntity);
481 .validateEntityExistence(retrieved, limitEntity, VendorLicenseModelEntity.ENTITY_TYPE);
483 limitDao.delete(limitEntity);
485 updateParentForLimit(limitEntity);
489 public void updateLimit(LimitEntity limit) {
491 validateLimit(limit);
492 LimitEntity retrieved = limitDao.get(limit);
493 if(!retrieved.equals(limit)){
494 vendorLicenseFacade.updateLimit(limit);
495 updateParentForLimit(limit);
499 private boolean isLimitPresent(LimitEntity limit) {
500 return limitDao.isLimitPresent(limit);
504 public LimitEntity getLimit(LimitEntity limitEntity) {
505 if (!isLimitPresent(limitEntity)) {
507 .validateEntityExistence(null, limitEntity, VendorLicenseModelEntity.ENTITY_TYPE);
509 LimitEntity retrieved = limitDao.get(limitEntity);
511 .validateEntityExistence(retrieved, limitEntity, VendorLicenseModelEntity.ENTITY_TYPE);
516 * update Parent of limit (EP/LKG) versionuuid when limit is modified so that limit updates are
517 * captured in VLM XML
519 private void updateParentForLimit(LimitEntity limit) {
520 if ("EntitlementPool".equals(limit.getParent())) {
521 EntitlementPoolEntity entitlementPoolEntity =
522 entitlementPoolDao.get(new EntitlementPoolEntity(limit.getVendorLicenseModelId(),
523 limit.getVersion(), limit.getEpLkgId()));
524 entitlementPoolEntity.setVersionUuId(CommonMethods.nextUuId());
525 entitlementPoolDao.update(entitlementPoolEntity);
528 if ("LicenseKeyGroup".equals(limit.getParent())) {
529 LicenseKeyGroupEntity licenseKeyGroupEntity = licenseKeyGroupDao.get(
530 new LicenseKeyGroupEntity(limit.getVendorLicenseModelId(), limit.getVersion(),
531 limit.getEpLkgId()));
532 licenseKeyGroupEntity.setVersionUuId(CommonMethods.nextUuId());
533 licenseKeyGroupDao.update(licenseKeyGroupEntity);
537 protected void addFeatureGroupsToLicenseAgreementRef(Set<String> featureGroupIds,
538 LicenseAgreementEntity licenseAgreement) {
539 if (featureGroupIds != null) {
540 for (String featureGroupId : featureGroupIds) {
541 featureGroupDao.addReferencingLicenseAgreement(
542 new FeatureGroupEntity(licenseAgreement.getVendorLicenseModelId(),
543 licenseAgreement.getVersion(), featureGroupId), licenseAgreement.getId());
548 protected void removeFeatureGroupsToLicenseAgreementRef(Set<String> featureGroupIds,
549 LicenseAgreementEntity licenseAgreement) {
550 if (featureGroupIds != null) {
551 for (String featureGroupId : featureGroupIds) {
552 featureGroupDao.removeReferencingLicenseAgreement(
553 new FeatureGroupEntity(licenseAgreement.getVendorLicenseModelId(),
554 licenseAgreement.getVersion(), featureGroupId), licenseAgreement.getId());
559 protected void addLicenseKeyGroupsToFeatureGroupsRef(Set<String> licenseKeyGroupIds,
560 FeatureGroupEntity featureGroup) {
561 if (licenseKeyGroupIds != null) {
562 for (String licenseKeyGroupId : licenseKeyGroupIds) {
563 licenseKeyGroupDao.addReferencingFeatureGroup(
564 new LicenseKeyGroupEntity(featureGroup.getVendorLicenseModelId(),
565 featureGroup.getVersion(), licenseKeyGroupId), featureGroup.getId());
570 protected void removeLicenseKeyGroupsToFeatureGroupsRef(Set<String> licenseKeyGroupIds,
571 FeatureGroupEntity featureGroup) {
572 if (licenseKeyGroupIds != null) {
573 for (String licenseKeyGroupId : licenseKeyGroupIds) {
574 licenseKeyGroupDao.removeReferencingFeatureGroup(
575 new LicenseKeyGroupEntity(featureGroup.getVendorLicenseModelId(),
576 featureGroup.getVersion(), licenseKeyGroupId), featureGroup.getId());
581 protected void addEntitlementPoolsToFeatureGroupsRef(Set<String> entitlementPoolIds,
582 FeatureGroupEntity featureGroup) {
583 if (entitlementPoolIds != null) {
584 for (String entitlementPoolId : entitlementPoolIds) {
585 entitlementPoolDao.addReferencingFeatureGroup(
586 new EntitlementPoolEntity(featureGroup.getVendorLicenseModelId(),
587 featureGroup.getVersion(), entitlementPoolId), featureGroup.getId());
592 protected void removeEntitlementPoolsToFeatureGroupsRef(Set<String> entitlementPoolIds,
593 FeatureGroupEntity featureGroup) {
594 if (entitlementPoolIds != null) {
595 for (String entitlementPoolId : entitlementPoolIds) {
596 entitlementPoolDao.removeReferencingFeatureGroup(
597 new EntitlementPoolEntity(featureGroup.getVendorLicenseModelId(),
598 featureGroup.getVersion(), entitlementPoolId), featureGroup.getId());
603 protected void updateUniqueName(String uniqueValueType, String oldName, String newName, String...
606 .updateUniqueValue(uniqueValueType, oldName, newName, context);
609 protected void deleteUniqueName(String uniqueValueType, String... uniqueCombination) {
610 uniqueValueUtil.deleteUniqueValue(uniqueValueType, uniqueCombination);