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.sdc.common.errors.CoreException;
22 import org.openecomp.sdc.common.errors.ErrorCode;
23 import org.openecomp.sdc.vendorlicense.VendorLicenseConstants;
24 import org.openecomp.sdc.vendorlicense.VendorLicenseManager;
25 import org.openecomp.sdc.vendorlicense.dao.*;
26 import org.openecomp.sdc.vendorlicense.dao.types.*;
27 import org.openecomp.sdc.vendorlicense.errors.InvalidDateErrorBuilder;
28 import org.openecomp.sdc.vendorlicense.errors.LimitErrorBuilder;
29 import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade;
30 import org.openecomp.sdc.versioning.VersioningUtil;
31 import org.openecomp.sdc.versioning.dao.types.Version;
33 import java.time.LocalDate;
34 import java.time.format.DateTimeFormatter;
35 import java.util.Collection;
36 import java.util.Optional;
39 public class VendorLicenseManagerImpl implements VendorLicenseManager {
40 private final UniqueValueUtil uniqueValueUtil;
41 private final VendorLicenseFacade vendorLicenseFacade;
42 private final VendorLicenseModelDao vendorLicenseModelDao;
43 private final LicenseAgreementDao licenseAgreementDao;
44 private final FeatureGroupDao featureGroupDao;
45 private final EntitlementPoolDao entitlementPoolDao;
46 private final LicenseKeyGroupDao licenseKeyGroupDao;
47 private final LimitDao limitDao;
49 private static final String EP_POOL_START_TIME = "T00:00:00Z";
50 private static final String EP_POOL_EXPIRY_TIME = "T23:59:59Z";
51 private static final DateTimeFormatter FORMATTER
52 = DateTimeFormatter.ofPattern("MM/dd/yyyy'T'HH:mm:ss'Z'");
53 public VendorLicenseManagerImpl(VendorLicenseFacade vendorLicenseFacade,
54 VendorLicenseModelDao vendorLicenseModelDao,
55 LicenseAgreementDao licenseAgreementDao,
56 FeatureGroupDao featureGroupDao,
57 EntitlementPoolDao entitlementPoolDao,
58 LicenseKeyGroupDao licenseKeyGroupDao,
60 UniqueValueDao uniqueValueDao) {
61 this.vendorLicenseFacade = vendorLicenseFacade;
62 this.vendorLicenseModelDao = vendorLicenseModelDao;
63 this.licenseAgreementDao = licenseAgreementDao;
64 this.featureGroupDao = featureGroupDao;
65 this.entitlementPoolDao = entitlementPoolDao;
66 this.licenseKeyGroupDao = licenseKeyGroupDao;
67 this.limitDao = limitDao;
68 this.uniqueValueUtil = new UniqueValueUtil(uniqueValueDao);
73 public void validate(String vendorLicenseModelId, Version version) {
74 vendorLicenseFacade.validate(vendorLicenseModelId, version);
78 public VendorLicenseModelEntity createVendorLicenseModel(
79 VendorLicenseModelEntity vendorLicenseModelEntity) {
80 vendorLicenseModelDao.create(vendorLicenseModelEntity);
81 return vendorLicenseModelEntity;
85 public void updateVendorLicenseModel(VendorLicenseModelEntity vendorLicenseModelEntity) {
86 VendorLicenseModelEntity retrieved = vendorLicenseModelDao.get(vendorLicenseModelEntity);
87 if (retrieved == null){
88 throw new CoreException((new ErrorCode.ErrorCodeBuilder()
89 .withMessage(String.format("Vlm with id %s and version %s does not exist.",
90 vendorLicenseModelEntity.getId(), vendorLicenseModelEntity.getVersion().getId()))).build());
93 String existingVendorName = retrieved.getVendorName();
95 updateUniqueName(VendorLicenseConstants.UniqueValues.VENDOR_NAME, existingVendorName,
96 vendorLicenseModelEntity.getVendorName());
97 vendorLicenseModelDao.update(vendorLicenseModelEntity);
101 public VendorLicenseModelEntity getVendorLicenseModel(String vlmId, Version version) {
102 return vendorLicenseFacade.getVendorLicenseModel(vlmId, version);
106 public void deleteVendorLicenseModel(String vlmId, Version version) {
107 throw new UnsupportedOperationException(VendorLicenseConstants.UNSUPPORTED_OPERATION_ERROR);
111 public Collection<LicenseAgreementEntity> listLicenseAgreements(String vlmId, Version version) {
112 return licenseAgreementDao.list(new LicenseAgreementEntity(vlmId, version, null));
116 public LicenseAgreementEntity createLicenseAgreement(LicenseAgreementEntity licenseAgreement) {
117 return vendorLicenseFacade.createLicenseAgreement(licenseAgreement);
121 public void updateLicenseAgreement(LicenseAgreementEntity licenseAgreement,
122 Set<String> addedFeatureGroupIds,
123 Set<String> removedFeatureGroupIds) {
124 LicenseAgreementEntity retrieved = licenseAgreementDao.get(licenseAgreement);
126 .validateEntityExistence(retrieved, licenseAgreement, VendorLicenseModelEntity.ENTITY_TYPE);
127 VersioningUtil.validateContainedEntitiesExistence(new FeatureGroupEntity().getEntityType(),
128 removedFeatureGroupIds, retrieved, retrieved.getFeatureGroupIds());
129 VersioningUtil.validateEntitiesExistence(addedFeatureGroupIds,
130 new FeatureGroupEntity(licenseAgreement.getVendorLicenseModelId(),
131 licenseAgreement.getVersion(),
133 featureGroupDao, VendorLicenseModelEntity.ENTITY_TYPE);
135 updateUniqueName(VendorLicenseConstants.UniqueValues.LICENSE_AGREEMENT_NAME,
136 retrieved.getName(), licenseAgreement.getName(), licenseAgreement.getVendorLicenseModelId(),
137 licenseAgreement.getVersion().getId());
138 licenseAgreementDao.updateColumnsAndDeltaFeatureGroupIds(licenseAgreement, addedFeatureGroupIds,
139 removedFeatureGroupIds);
141 addFeatureGroupsToLicenseAgreementRef(addedFeatureGroupIds, licenseAgreement);
142 removeFeatureGroupsToLicenseAgreementRef(removedFeatureGroupIds, licenseAgreement);
146 public LicenseAgreementModel getLicenseAgreementModel(String vlmId, Version version,
147 String licenseAgreementId) {
148 return vendorLicenseFacade.getLicenseAgreementModel(vlmId, version, licenseAgreementId);
152 public void deleteLicenseAgreement(String vlmId, Version version, String licenseAgreementId) {
153 LicenseAgreementEntity input =
154 new LicenseAgreementEntity(vlmId, version, licenseAgreementId);
155 LicenseAgreementEntity retrieved = licenseAgreementDao.get(input);
156 VersioningUtil.validateEntityExistence(retrieved, input, VendorLicenseModelEntity.ENTITY_TYPE);
158 removeFeatureGroupsToLicenseAgreementRef(retrieved.getFeatureGroupIds(), retrieved);
160 licenseAgreementDao.delete(retrieved);
162 deleteUniqueName(VendorLicenseConstants.UniqueValues.LICENSE_AGREEMENT_NAME,
163 retrieved.getVendorLicenseModelId(), retrieved.getVersion().toString(),
164 retrieved.getName());
168 public Collection<FeatureGroupEntity> listFeatureGroups(String vlmId, Version version) {
169 return vendorLicenseFacade.listFeatureGroups(vlmId, version);
173 public FeatureGroupEntity createFeatureGroup(FeatureGroupEntity featureGroup) {
174 return vendorLicenseFacade.createFeatureGroup(featureGroup);
178 public void updateFeatureGroup(FeatureGroupEntity featureGroup,
179 Set<String> addedLicenseKeyGroups,
180 Set<String> removedLicenseKeyGroups,
181 Set<String> addedEntitlementPools,
182 Set<String> removedEntitlementPools) {
183 FeatureGroupEntity retrieved = featureGroupDao.get(featureGroup);
185 .validateEntityExistence(retrieved, featureGroup, VendorLicenseModelEntity.ENTITY_TYPE);
187 VersioningUtil.validateContainedEntitiesExistence(new LicenseKeyGroupEntity().getEntityType(),
188 removedLicenseKeyGroups, retrieved, retrieved.getLicenseKeyGroupIds());
189 VersioningUtil.validateContainedEntitiesExistence(new EntitlementPoolEntity().getEntityType(),
190 removedEntitlementPools, retrieved, retrieved.getEntitlementPoolIds());
192 VersioningUtil.validateEntitiesExistence(addedLicenseKeyGroups,
193 new LicenseKeyGroupEntity(featureGroup.getVendorLicenseModelId(), featureGroup.getVersion(),
195 licenseKeyGroupDao, VendorLicenseModelEntity.ENTITY_TYPE);
196 VersioningUtil.validateEntitiesExistence(addedEntitlementPools,
197 new EntitlementPoolEntity(featureGroup.getVendorLicenseModelId(), featureGroup.getVersion(),
199 entitlementPoolDao, VendorLicenseModelEntity.ENTITY_TYPE);
201 updateUniqueName(VendorLicenseConstants.UniqueValues.FEATURE_GROUP_NAME,
202 retrieved.getName(), featureGroup.getName(), featureGroup.getVendorLicenseModelId(),
203 featureGroup.getVersion().getId());
205 addLicenseKeyGroupsToFeatureGroupsRef(addedLicenseKeyGroups, featureGroup);
206 removeLicenseKeyGroupsToFeatureGroupsRef(removedLicenseKeyGroups, featureGroup);
207 addEntitlementPoolsToFeatureGroupsRef(addedEntitlementPools, featureGroup);
208 removeEntitlementPoolsToFeatureGroupsRef(removedEntitlementPools, featureGroup);
210 featureGroupDao.updateFeatureGroup(featureGroup, addedEntitlementPools, removedEntitlementPools,
211 addedLicenseKeyGroups, removedLicenseKeyGroups);
216 public FeatureGroupModel getFeatureGroupModel(FeatureGroupEntity featureGroup) {
217 return vendorLicenseFacade.getFeatureGroupModel(featureGroup);
221 public void deleteFeatureGroup(FeatureGroupEntity featureGroup) {
222 FeatureGroupEntity retrieved = featureGroupDao.get(featureGroup);
224 .validateEntityExistence(retrieved, featureGroup, VendorLicenseModelEntity.ENTITY_TYPE);
226 removeLicenseKeyGroupsToFeatureGroupsRef(retrieved.getLicenseKeyGroupIds(), featureGroup);
227 removeEntitlementPoolsToFeatureGroupsRef(retrieved.getEntitlementPoolIds(), featureGroup);
229 for (String licenceAgreementId : retrieved.getReferencingLicenseAgreements()) {
230 licenseAgreementDao.removeFeatureGroup(
231 new LicenseAgreementEntity(featureGroup.getVendorLicenseModelId(),
232 featureGroup.getVersion(),
233 licenceAgreementId), featureGroup.getId());
236 featureGroupDao.delete(featureGroup);
238 deleteUniqueName(VendorLicenseConstants.UniqueValues.FEATURE_GROUP_NAME,
239 retrieved.getVendorLicenseModelId(), retrieved.getVersion().toString(),
240 retrieved.getName());
244 public Collection<EntitlementPoolEntity> listEntitlementPools(String vlmId, Version version) {
245 return vendorLicenseFacade.listEntitlementPools(vlmId, version);
249 public EntitlementPoolEntity createEntitlementPool(EntitlementPoolEntity entitlementPool) {
250 entitlementPool.setStartDate(entitlementPool.getStartDate() != null ? (entitlementPool
251 .getStartDate().trim().length() != 0 ? entitlementPool.getStartDate() + EP_POOL_START_TIME
253 entitlementPool.setExpiryDate(entitlementPool.getExpiryDate() != null ? (entitlementPool
254 .getExpiryDate().trim().length() != 0 ? entitlementPool.getExpiryDate() + EP_POOL_EXPIRY_TIME
257 validateCreateDate(entitlementPool.getStartDate(), entitlementPool.getExpiryDate(),
258 entitlementPool.getVendorLicenseModelId());
259 return vendorLicenseFacade.createEntitlementPool(entitlementPool);
262 private void validateCreateDate(String startDate, String expiryDate,
263 String vendorLicenseModelId) {
264 LocalDate parsedStartDate = parseLocalDate(startDate);
265 LocalDate parsedExpiryDate = parseLocalDate(expiryDate);
268 validateIfStartAndExpiryDateIsNotNull(startDate, expiryDate,
269 vendorLicenseModelId, parsedStartDate, parsedExpiryDate);
271 if (startDate != null && expiryDate == null
272 && parsedStartDate.atStartOfDay().isBefore
273 (LocalDate.now().atStartOfDay())) {
274 throw new CoreException(
275 new InvalidDateErrorBuilder(vendorLicenseModelId)
279 if (startDate == null && expiryDate != null) {
280 throw new CoreException(
281 new InvalidDateErrorBuilder(vendorLicenseModelId)
287 private void validateIfStartAndExpiryDateIsNotNull(String startDate, String expiryDate,
288 String vendorLicenseModelId,
289 LocalDate parsedStartDate,
290 LocalDate parsedExpiryDate) {
291 if (startDate != null && expiryDate != null
292 && isValidatStartAndExpiryDate(parsedStartDate, parsedExpiryDate)) {
293 throw new CoreException(
294 new InvalidDateErrorBuilder(vendorLicenseModelId)
299 private boolean isValidatStartAndExpiryDate(LocalDate parsedStartDate,
300 LocalDate parsedExpiryDate) {
301 return parsedStartDate.atStartOfDay().isBefore(LocalDate.now().atStartOfDay())
302 || parsedExpiryDate.atStartOfDay().isEqual(parsedStartDate.atStartOfDay())
303 || parsedExpiryDate.isBefore(parsedStartDate);
306 private static LocalDate parseLocalDate(String date) {
307 if (date == null || date.isEmpty()) {
311 return LocalDate.parse(date, FORMATTER );
314 private void validateUpdateDate(String startDate, String expiryDate,
315 String vendorLicenseModelId) {
316 LocalDate parsedStartDate = parseLocalDate(startDate);
317 LocalDate parsedExpiryDate = parseLocalDate(expiryDate);
319 if (startDate != null && expiryDate != null
320 && (parsedExpiryDate.atStartOfDay()
321 .isEqual(parsedStartDate.atStartOfDay())
322 || parsedExpiryDate.isBefore(parsedStartDate ))) {
323 throw new CoreException(
324 new InvalidDateErrorBuilder(vendorLicenseModelId)
328 if (startDate == null && expiryDate != null) {
329 throw new CoreException(
330 new InvalidDateErrorBuilder(vendorLicenseModelId)
337 public void updateEntitlementPool(EntitlementPoolEntity entitlementPool) {
338 entitlementPool.setStartDate(entitlementPool.getStartDate() != null ? (entitlementPool
339 .getStartDate().trim().length() != 0 ? entitlementPool.getStartDate() + EP_POOL_START_TIME
341 entitlementPool.setExpiryDate(entitlementPool.getExpiryDate() != null ? (entitlementPool
342 .getExpiryDate().trim().length() != 0 ? entitlementPool.getExpiryDate() + EP_POOL_EXPIRY_TIME
345 validateUpdateDate(entitlementPool.getStartDate(), entitlementPool.getExpiryDate(),
346 entitlementPool.getVendorLicenseModelId());
347 vendorLicenseFacade.updateEntitlementPool(entitlementPool);
351 public EntitlementPoolEntity getEntitlementPool(EntitlementPoolEntity entitlementPool) {
352 EntitlementPoolEntity retrieved = entitlementPoolDao.get(entitlementPool);
354 .validateEntityExistence(retrieved, entitlementPool, VendorLicenseModelEntity.ENTITY_TYPE);
355 DateTimeFormatter targetFormatter = DateTimeFormatter.ofPattern("MM/dd/yyyy");
356 if (retrieved.getStartDate() != null) {
357 retrieved.setStartDate(LocalDate.parse(retrieved.getStartDate(), FORMATTER ).format
361 if (retrieved.getExpiryDate() != null) {
362 retrieved.setExpiryDate(LocalDate.parse(retrieved.getExpiryDate(), FORMATTER ).format
369 public void deleteEntitlementPool(EntitlementPoolEntity entitlementPool) {
370 EntitlementPoolEntity retrieved = entitlementPoolDao.get(entitlementPool);
372 .validateEntityExistence(retrieved, entitlementPool, VendorLicenseModelEntity.ENTITY_TYPE);
374 for (String referencingFeatureGroupId : retrieved.getReferencingFeatureGroups()) {
375 featureGroupDao.removeEntitlementPool(
376 new FeatureGroupEntity(entitlementPool.getVendorLicenseModelId(),
377 entitlementPool.getVersion(),
378 referencingFeatureGroupId), entitlementPool.getId());
381 deleteChildLimits(entitlementPool.getVendorLicenseModelId(), entitlementPool.getVersion(),
382 entitlementPool.getId());
384 entitlementPoolDao.delete(entitlementPool);
386 deleteUniqueName(VendorLicenseConstants.UniqueValues.ENTITLEMENT_POOL_NAME,
387 retrieved.getVendorLicenseModelId(), retrieved.getVersion().toString(),
388 retrieved.getName());
391 protected void deleteChildLimits(String vlmId, Version version, String epLkgId) {
392 Optional<Collection<LimitEntity>> limitEntities = Optional.ofNullable(
393 listLimits(vlmId, version, epLkgId));
394 limitEntities.ifPresent(entities -> entities.forEach(this::deleteLimit));
398 public Collection<LicenseKeyGroupEntity> listLicenseKeyGroups(String vlmId, Version version) {
399 return vendorLicenseFacade.listLicenseKeyGroups(vlmId, version);
403 public LicenseKeyGroupEntity createLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup) {
404 licenseKeyGroup.setStartDate(licenseKeyGroup.getStartDate() != null ? (licenseKeyGroup
405 .getStartDate().trim().length() != 0 ? licenseKeyGroup.getStartDate() + EP_POOL_START_TIME
407 licenseKeyGroup.setExpiryDate(licenseKeyGroup.getExpiryDate() != null ? (licenseKeyGroup
408 .getExpiryDate().trim().length() != 0 ? licenseKeyGroup.getExpiryDate() + EP_POOL_EXPIRY_TIME
411 validateCreateDate(licenseKeyGroup.getStartDate(), licenseKeyGroup.getExpiryDate(),
412 licenseKeyGroup.getVendorLicenseModelId());
413 return vendorLicenseFacade.createLicenseKeyGroup(licenseKeyGroup);
417 public void updateLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup) {
418 licenseKeyGroup.setStartDate(licenseKeyGroup.getStartDate() != null ? (licenseKeyGroup
419 .getStartDate().trim().length() != 0 ? licenseKeyGroup.getStartDate() + EP_POOL_START_TIME
421 licenseKeyGroup.setExpiryDate(licenseKeyGroup.getExpiryDate() != null ? (licenseKeyGroup
422 .getExpiryDate().trim().length() != 0 ? licenseKeyGroup.getExpiryDate() + EP_POOL_EXPIRY_TIME
425 validateUpdateDate(licenseKeyGroup.getStartDate(), licenseKeyGroup.getExpiryDate(),
426 licenseKeyGroup.getVendorLicenseModelId());
427 vendorLicenseFacade.updateLicenseKeyGroup(licenseKeyGroup);
431 public LicenseKeyGroupEntity getLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup) {
432 LicenseKeyGroupEntity retrieved = licenseKeyGroupDao.get(licenseKeyGroup);
434 .validateEntityExistence(retrieved, licenseKeyGroup, VendorLicenseModelEntity.ENTITY_TYPE);
439 public void deleteLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup) {
440 LicenseKeyGroupEntity retrieved = licenseKeyGroupDao.get(licenseKeyGroup);
442 .validateEntityExistence(retrieved, licenseKeyGroup, VendorLicenseModelEntity.ENTITY_TYPE);
444 for (String referencingFeatureGroupId : retrieved.getReferencingFeatureGroups()) {
445 featureGroupDao.removeLicenseKeyGroup(
446 new FeatureGroupEntity(licenseKeyGroup.getVendorLicenseModelId(),
447 licenseKeyGroup.getVersion(),
448 referencingFeatureGroupId), licenseKeyGroup.getId());
451 deleteChildLimits(licenseKeyGroup.getVendorLicenseModelId(), licenseKeyGroup.getVersion(),
452 licenseKeyGroup.getId());
454 licenseKeyGroupDao.delete(licenseKeyGroup);
456 deleteUniqueName(VendorLicenseConstants.UniqueValues.LICENSE_KEY_GROUP_NAME,
457 retrieved.getVendorLicenseModelId(), retrieved.getVersion().toString(),
458 retrieved.getName());
462 public LimitEntity createLimit(LimitEntity limit) {
463 validateLimit(limit);
464 LimitEntity createdLimit = vendorLicenseFacade.createLimit(limit);
465 updateParentForLimit(limit);
469 private void validateLimit(LimitEntity limit) {
470 Collection<LimitEntity> limitList =
471 listLimits(limit.getVendorLicenseModelId(), limit.getVersion()
472 , limit.getEpLkgId());
474 if (!isLimitNameUnique(limitList, limit.getName(), limit.getType(), limit.getId())) {
475 final ErrorCode duplicateLimitNameErrorBuilder =
476 LimitErrorBuilder.getDuplicateNameErrorbuilder(limit.getName(), limit.getType().name());
477 throw new CoreException(duplicateLimitNameErrorBuilder);
481 private boolean isLimitNameUnique(Collection<LimitEntity> limitList, String name, LimitType
483 for (LimitEntity limit : limitList) {
484 if (limit.getName().equalsIgnoreCase(name) &&
485 limit.getType().name().equalsIgnoreCase(type.name())) {
486 if (id != null && limit.getId().equals(id)) {
496 public Collection<LimitEntity> listLimits(String vlmId, Version version, String epLkgId) {
497 return vendorLicenseFacade.listLimits(vlmId, version, epLkgId);
501 public void deleteLimit(LimitEntity limitEntity) {
502 if (!isLimitPresent(limitEntity)) {
504 .validateEntityExistence(null, limitEntity, VendorLicenseModelEntity.ENTITY_TYPE);
506 LimitEntity retrieved = limitDao.get(limitEntity);
508 .validateEntityExistence(retrieved, limitEntity, VendorLicenseModelEntity.ENTITY_TYPE);
510 limitDao.delete(limitEntity);
512 updateParentForLimit(limitEntity);
516 public void updateLimit(LimitEntity limit) {
518 validateLimit(limit);
519 vendorLicenseFacade.updateLimit(limit);
520 updateParentForLimit(limit);
523 private boolean isLimitPresent(LimitEntity limit) {
524 return limitDao.isLimitPresent(limit);
528 public LimitEntity getLimit(LimitEntity limitEntity) {
529 if (!isLimitPresent(limitEntity)) {
531 .validateEntityExistence(null, limitEntity, VendorLicenseModelEntity.ENTITY_TYPE);
533 LimitEntity retrieved = limitDao.get(limitEntity);
535 .validateEntityExistence(retrieved, limitEntity, VendorLicenseModelEntity.ENTITY_TYPE);
540 * update Parent of limit (EP/LKG) versionuuid when limit is modified so that limit updates are
541 * captured in VLM XML
543 private void updateParentForLimit(LimitEntity limit) {
544 if ("EntitlementPool".equals(limit.getParent())) {
545 EntitlementPoolEntity entitlementPoolEntity =
546 entitlementPoolDao.get(new EntitlementPoolEntity(limit.getVendorLicenseModelId(),
547 limit.getVersion(), limit.getEpLkgId()));
548 vendorLicenseFacade.updateEntitlementPool(entitlementPoolEntity);
551 if ("LicenseKeyGroup".equals(limit.getParent())) {
552 LicenseKeyGroupEntity licenseKeyGroupEntity = licenseKeyGroupDao.get(
553 new LicenseKeyGroupEntity(limit.getVendorLicenseModelId(), limit.getVersion(),
554 limit.getEpLkgId()));
555 vendorLicenseFacade.updateLicenseKeyGroup(licenseKeyGroupEntity);
559 protected void addFeatureGroupsToLicenseAgreementRef(Set<String> featureGroupIds,
560 LicenseAgreementEntity licenseAgreement) {
561 if (featureGroupIds != null) {
562 for (String featureGroupId : featureGroupIds) {
563 featureGroupDao.addReferencingLicenseAgreement(
564 new FeatureGroupEntity(licenseAgreement.getVendorLicenseModelId(),
565 licenseAgreement.getVersion(), featureGroupId), licenseAgreement.getId());
570 protected void removeFeatureGroupsToLicenseAgreementRef(Set<String> featureGroupIds,
571 LicenseAgreementEntity licenseAgreement) {
572 if (featureGroupIds != null) {
573 for (String featureGroupId : featureGroupIds) {
574 featureGroupDao.removeReferencingLicenseAgreement(
575 new FeatureGroupEntity(licenseAgreement.getVendorLicenseModelId(),
576 licenseAgreement.getVersion(), featureGroupId), licenseAgreement.getId());
581 protected void addLicenseKeyGroupsToFeatureGroupsRef(Set<String> licenseKeyGroupIds,
582 FeatureGroupEntity featureGroup) {
583 if (licenseKeyGroupIds != null) {
584 for (String licenseKeyGroupId : licenseKeyGroupIds) {
585 licenseKeyGroupDao.addReferencingFeatureGroup(
586 new LicenseKeyGroupEntity(featureGroup.getVendorLicenseModelId(),
587 featureGroup.getVersion(), licenseKeyGroupId), featureGroup.getId());
592 protected void removeLicenseKeyGroupsToFeatureGroupsRef(Set<String> licenseKeyGroupIds,
593 FeatureGroupEntity featureGroup) {
594 if (licenseKeyGroupIds != null) {
595 for (String licenseKeyGroupId : licenseKeyGroupIds) {
596 licenseKeyGroupDao.removeReferencingFeatureGroup(
597 new LicenseKeyGroupEntity(featureGroup.getVendorLicenseModelId(),
598 featureGroup.getVersion(), licenseKeyGroupId), featureGroup.getId());
603 protected void addEntitlementPoolsToFeatureGroupsRef(Set<String> entitlementPoolIds,
604 FeatureGroupEntity featureGroup) {
605 if (entitlementPoolIds != null) {
606 for (String entitlementPoolId : entitlementPoolIds) {
607 entitlementPoolDao.addReferencingFeatureGroup(
608 new EntitlementPoolEntity(featureGroup.getVendorLicenseModelId(),
609 featureGroup.getVersion(), entitlementPoolId), featureGroup.getId());
614 protected void removeEntitlementPoolsToFeatureGroupsRef(Set<String> entitlementPoolIds,
615 FeatureGroupEntity featureGroup) {
616 if (entitlementPoolIds != null) {
617 for (String entitlementPoolId : entitlementPoolIds) {
618 entitlementPoolDao.removeReferencingFeatureGroup(
619 new EntitlementPoolEntity(featureGroup.getVendorLicenseModelId(),
620 featureGroup.getVersion(), entitlementPoolId), featureGroup.getId());
625 protected void updateUniqueName(String uniqueValueType, String oldName, String newName, String...
628 .updateUniqueValue(uniqueValueType, oldName, newName, context);
631 protected void deleteUniqueName(String uniqueValueType, String... uniqueCombination) {
632 uniqueValueUtil.deleteUniqueValue(uniqueValueType, uniqueCombination);