diff options
author | talig <talig@amdocs.com> | 2017-12-20 14:30:43 +0200 |
---|---|---|
committer | Vitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com> | 2017-12-21 11:12:33 +0000 |
commit | 8e9c0653dd6c6862123c9609ae34e1206d86456e (patch) | |
tree | 5eeef00ec0677133baa439ca8d7ffd7aca4804b6 /openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main | |
parent | 785ebcc95de3e064e843bec04ba7a209d854fc7c (diff) |
Add collaboration feature
Issue-ID: SDC-767
Change-Id: I14fb4c1f54086ed03a56a7ff7fab9ecd40381795
Signed-off-by: talig <talig@amdocs.com>
Diffstat (limited to 'openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main')
3 files changed, 292 insertions, 566 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/VendorLicenseManager.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/VendorLicenseManager.java index a76b9b865d..9184afe823 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/VendorLicenseManager.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/VendorLicenseManager.java @@ -28,8 +28,6 @@ import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementModel; import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity; import org.openecomp.sdc.vendorlicense.dao.types.LimitEntity; import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity; -import org.openecomp.sdc.vendorlicense.errors.LimitErrorBuilder; -import org.openecomp.sdc.vendorlicense.types.VersionedVendorLicenseModel; import org.openecomp.sdc.versioning.dao.types.Version; import java.util.Collection; @@ -37,88 +35,71 @@ import java.util.Set; public interface VendorLicenseManager { - void checkout(String vendorLicenseModelId, String user); + void validate(String vendorLicenseModelId, Version version); - void undoCheckout(String vendorLicenseModelId, String user); + VendorLicenseModelEntity createVendorLicenseModel(VendorLicenseModelEntity licenseModel); - void checkin(String vendorLicenseModelId, String user); + void updateVendorLicenseModel(VendorLicenseModelEntity licenseModel); - void submit(String vendorLicenseModelId, String user); + VendorLicenseModelEntity getVendorLicenseModel(String vlmId, Version version); - Collection<VersionedVendorLicenseModel> listVendorLicenseModels(String versionFilter, - String user); + void deleteVendorLicenseModel(String vlmId, Version version); - VendorLicenseModelEntity createVendorLicenseModel(VendorLicenseModelEntity licenseModel, - String user); - void updateVendorLicenseModel(VendorLicenseModelEntity licenseModel, String user); + Collection<LicenseAgreementEntity> listLicenseAgreements(String vlmId, Version version); - VersionedVendorLicenseModel getVendorLicenseModel(String vlmId, Version version, String user); - - void deleteVendorLicenseModel(String vlmId, String user); - - - Collection<LicenseAgreementEntity> listLicenseAgreements(String vlmId, Version version, - String user); - - LicenseAgreementEntity createLicenseAgreement(LicenseAgreementEntity licenseAgreement, - String user); + LicenseAgreementEntity createLicenseAgreement(LicenseAgreementEntity licenseAgreement); void updateLicenseAgreement(LicenseAgreementEntity licenseAgreement, - Set<String> addedFeatureGroupIds, Set<String> removedFeatureGroupIds, - String user); + Set<String> addedFeatureGroupIds, Set<String> removedFeatureGroupIds); LicenseAgreementModel getLicenseAgreementModel(String vlmId, Version version, - String licenseAgreementId, String user); + String licenseAgreementId); - void deleteLicenseAgreement(String vlmId, Version version, String licenseAgreementId, String user); + void deleteLicenseAgreement(String vlmId, Version version, String licenseAgreementId); - Collection<FeatureGroupEntity> listFeatureGroups(String vlmId, Version version, String user); + Collection<FeatureGroupEntity> listFeatureGroups(String vlmId, Version version); - FeatureGroupEntity createFeatureGroup(FeatureGroupEntity fg, String user); + FeatureGroupEntity createFeatureGroup(FeatureGroupEntity fg); void updateFeatureGroup(FeatureGroupEntity featureGroup, Set<String> addedLicenseKeyGroups, Set<String> removedLicenseKeyGroups, - Set<String> addedEntitlementPools, Set<String> removedEntitlementPools, - String user); - - FeatureGroupModel getFeatureGroupModel(FeatureGroupEntity featureGroup, String user); + Set<String> addedEntitlementPools, Set<String> removedEntitlementPools); - void deleteFeatureGroup(FeatureGroupEntity featureGroup, String user); + FeatureGroupModel getFeatureGroupModel(FeatureGroupEntity featureGroup); + void deleteFeatureGroup(FeatureGroupEntity featureGroup); - Collection<EntitlementPoolEntity> listEntitlementPools(String vlmId, Version version, - String user); - EntitlementPoolEntity createEntitlementPool(EntitlementPoolEntity entitlementPool, String user); + Collection<EntitlementPoolEntity> listEntitlementPools(String vlmId, Version version); - void updateEntitlementPool(EntitlementPoolEntity entitlementPool, String user); + EntitlementPoolEntity createEntitlementPool(EntitlementPoolEntity entitlementPool); - EntitlementPoolEntity getEntitlementPool(EntitlementPoolEntity entitlementPool, String user); + void updateEntitlementPool(EntitlementPoolEntity entitlementPool); - void deleteEntitlementPool(EntitlementPoolEntity entitlementPool, String user); + EntitlementPoolEntity getEntitlementPool(EntitlementPoolEntity entitlementPool); + void deleteEntitlementPool(EntitlementPoolEntity entitlementPool); - Collection<LicenseKeyGroupEntity> listLicenseKeyGroups(String vlmId, Version version, - String user); - LicenseKeyGroupEntity createLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup, String user); + Collection<LicenseKeyGroupEntity> listLicenseKeyGroups(String vlmId, Version version); - void updateLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup, String user); + LicenseKeyGroupEntity createLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup); - LicenseKeyGroupEntity getLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup, String user); + void updateLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup); - void deleteLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup, String user); + LicenseKeyGroupEntity getLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup); - LimitEntity createLimit(LimitEntity limitEntity, String user); + void deleteLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup); - Collection<LimitEntity> listLimits(String vlmId, Version version, String epLkgId, String user); + LimitEntity createLimit(LimitEntity limitEntity); - void deleteLimit(LimitEntity limitEntity, String user); + Collection<LimitEntity> listLimits(String vlmId, Version version, String epLkgId); - void updateLimit(LimitEntity limitEntity, String user); + void deleteLimit(LimitEntity limitEntity); - LimitEntity getLimit(LimitEntity entitlementPool, String user); + void updateLimit(LimitEntity limitEntity); + LimitEntity getLimit(LimitEntity entitlementPool); } diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseManagerFactoryImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseManagerFactoryImpl.java index 152ddd0e13..472473fdb0 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseManagerFactoryImpl.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseManagerFactoryImpl.java @@ -1,6 +1,5 @@ package org.openecomp.sdc.vendorlicense.impl; -import org.openecomp.sdc.activityLog.ActivityLogManagerFactory; import org.openecomp.sdc.vendorlicense.VendorLicenseManager; import org.openecomp.sdc.vendorlicense.VendorLicenseManagerFactory; import org.openecomp.sdc.vendorlicense.dao.EntitlementPoolDaoFactory; @@ -10,22 +9,19 @@ import org.openecomp.sdc.vendorlicense.dao.LicenseKeyGroupDaoFactory; import org.openecomp.sdc.vendorlicense.dao.LimitDaoFactory; import org.openecomp.sdc.vendorlicense.dao.VendorLicenseModelDaoFactory; import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacadeFactory; -import org.openecomp.sdc.versioning.VersioningManagerFactory; /** * Created by ayalaben on 8/3/2017 */ -public class VendorLicenseManagerFactoryImpl extends VendorLicenseManagerFactory { +public class VendorLicenseManagerFactoryImpl extends VendorLicenseManagerFactory { private static final VendorLicenseManager INSTANCE = new VendorLicenseManagerImpl( - VersioningManagerFactory.getInstance().createInterface(), VendorLicenseFacadeFactory.getInstance().createInterface(), VendorLicenseModelDaoFactory.getInstance().createInterface(), LicenseAgreementDaoFactory.getInstance().createInterface(), FeatureGroupDaoFactory.getInstance().createInterface(), EntitlementPoolDaoFactory.getInstance().createInterface(), LicenseKeyGroupDaoFactory.getInstance().createInterface(), - ActivityLogManagerFactory.getInstance().createInterface(), LimitDaoFactory.getInstance().createInterface()); @Override diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseManagerImpl.java index e07a13c2e8..2489b5a89b 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseManagerImpl.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseManagerImpl.java @@ -20,16 +20,10 @@ package org.openecomp.sdc.vendorlicense.impl; -import static org.openecomp.sdc.vendorlicense.VendorLicenseConstants.VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE; - import org.openecomp.core.util.UniqueValueUtil; -import org.openecomp.sdc.activityLog.ActivityLogManager; -import org.openecomp.sdc.activitylog.dao.type.ActivityLogEntity; import org.openecomp.sdc.common.errors.CoreException; import org.openecomp.sdc.common.errors.ErrorCode; import org.openecomp.sdc.datatypes.error.ErrorLevel; -import org.openecomp.sdc.logging.api.Logger; -import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage; import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage; import org.openecomp.sdc.logging.types.LoggerConstants; @@ -57,26 +51,16 @@ import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity; import org.openecomp.sdc.vendorlicense.errors.InvalidDateErrorBuilder; import org.openecomp.sdc.vendorlicense.errors.LimitErrorBuilder; import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade; -import org.openecomp.sdc.vendorlicense.types.VersionedVendorLicenseModel; -import org.openecomp.sdc.versioning.VersioningManager; import org.openecomp.sdc.versioning.VersioningUtil; import org.openecomp.sdc.versioning.dao.types.Version; -import org.openecomp.sdc.versioning.dao.types.VersionStatus; -import org.openecomp.sdc.versioning.types.VersionInfo; -import org.openecomp.sdc.versioning.types.VersionableEntityAction; -import org.openecomp.sdcrests.activitylog.types.ActivityType; import java.time.LocalDate; import java.time.format.DateTimeFormatter; -import java.util.ArrayList; import java.util.Collection; -import java.util.List; -import java.util.Map; import java.util.Optional; import java.util.Set; public class VendorLicenseManagerImpl implements VendorLicenseManager { - private VersioningManager versioningManager; private VendorLicenseFacade vendorLicenseFacade; private VendorLicenseModelDao vendorLicenseModelDao; private LicenseAgreementDao licenseAgreementDao; @@ -84,278 +68,134 @@ public class VendorLicenseManagerImpl implements VendorLicenseManager { private EntitlementPoolDao entitlementPoolDao; private LicenseKeyGroupDao licenseKeyGroupDao; private LimitDao limitDao; - private ActivityLogManager activityLogManager; private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); - private static final Logger logger = - LoggerFactory.getLogger(VendorLicenseManagerImpl.class); - public VendorLicenseManagerImpl(VersioningManager versioningManager, - VendorLicenseFacade vendorLicenseFacade, + public VendorLicenseManagerImpl(VendorLicenseFacade vendorLicenseFacade, VendorLicenseModelDao vendorLicenseModelDao, LicenseAgreementDao licenseAgreementDao, FeatureGroupDao featureGroupDao, EntitlementPoolDao entitlementPoolDao, LicenseKeyGroupDao licenseKeyGroupDao, - ActivityLogManager activityLogManager, LimitDao limitDao) { - this.versioningManager = versioningManager; this.vendorLicenseFacade = vendorLicenseFacade; this.vendorLicenseModelDao = vendorLicenseModelDao; this.licenseAgreementDao = licenseAgreementDao; this.featureGroupDao = featureGroupDao; this.entitlementPoolDao = entitlementPoolDao; this.licenseKeyGroupDao = licenseKeyGroupDao; - this.activityLogManager = activityLogManager; this.limitDao = limitDao; } - private static void sortVlmListByModificationTimeDescOrder( - List<VersionedVendorLicenseModel> vendorLicenseModels) { - vendorLicenseModels.sort((o1, o2) -> o2.getVendorLicenseModel().getWritetimeMicroSeconds() - .compareTo(o1.getVendorLicenseModel().getWritetimeMicroSeconds())); - } - @Override - public void checkout(String vendorLicenseModelId, String user) { - + public void validate(String vendorLicenseModelId, Version version) { mdcDataDebugMessage.debugEntryMessage("VLM id", vendorLicenseModelId); - Version newVersion = versioningManager - .checkout(VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE, vendorLicenseModelId, user); - - ActivityLogEntity activityLogEntity = new ActivityLogEntity(vendorLicenseModelId, String.valueOf(newVersion.getMajor()+1), - ActivityType.CHECKOUT.toString(), user, true, "", ""); - activityLogManager.addActionLog(activityLogEntity, user); - - newVersion.setStatus(VersionStatus.Locked); - vendorLicenseFacade.updateVlmLastModificationTime(vendorLicenseModelId, newVersion); + vendorLicenseFacade.validate(vendorLicenseModelId, version); mdcDataDebugMessage.debugExitMessage("VLM id", vendorLicenseModelId); } @Override - public void undoCheckout(String vendorLicenseModelId, String user) { - - mdcDataDebugMessage.debugEntryMessage("VLM id", vendorLicenseModelId); - - Version newVersion = versioningManager - .undoCheckout(VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE, vendorLicenseModelId, user); - - ActivityLogEntity activityLogEntity = - new ActivityLogEntity(vendorLicenseModelId, String.valueOf(newVersion.getMajor() + 1), - ActivityType.UNDO_CHECKOUT.toString(), user, true, "", ""); - activityLogManager.addActionLog(activityLogEntity, user); - - vendorLicenseFacade.updateVlmLastModificationTime(vendorLicenseModelId, newVersion); - - mdcDataDebugMessage.debugExitMessage("VLM id", vendorLicenseModelId); - } - - @Override - public void checkin(String vendorLicenseModelId, String user) { - - mdcDataDebugMessage.debugEntryMessage("VLM id", vendorLicenseModelId); - - Version newVersion = vendorLicenseFacade.checkin(vendorLicenseModelId, user); - - ActivityLogEntity activityLogEntity = new ActivityLogEntity(vendorLicenseModelId, - String.valueOf(newVersion.getMajor()+1), ActivityType.CHECKIN.toString(), user, true, "", ""); - activityLogManager.addActionLog(activityLogEntity, user); - - mdcDataDebugMessage.debugExitMessage("VLM id", vendorLicenseModelId); - } - - @Override - public void submit(String vendorLicenseModelId, String user) { - - mdcDataDebugMessage.debugEntryMessage("VLM id", vendorLicenseModelId); - - Version newVersion = vendorLicenseFacade.submit(vendorLicenseModelId, user); - - ActivityLogEntity activityLogEntity = new ActivityLogEntity(vendorLicenseModelId, String.valueOf(newVersion.getMajor()), - ActivityType.SUBMIT.toString(), user, true, "", ""); - activityLogManager.addActionLog(activityLogEntity, user); - - mdcDataDebugMessage.debugExitMessage("VLM id", vendorLicenseModelId); - } - - @Override - public Collection<VersionedVendorLicenseModel> listVendorLicenseModels(String versionFilter, - String user) { + public VendorLicenseModelEntity createVendorLicenseModel( + VendorLicenseModelEntity vendorLicenseModelEntity) { mdcDataDebugMessage.debugEntryMessage(null); - Map<String, VersionInfo> idToVersionsInfo = versioningManager - .listEntitiesVersionInfo(VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE, user, - VersionableEntityAction.Read); - - List<VersionedVendorLicenseModel> vendorLicenseModels = new ArrayList<>(); - for (Map.Entry<String, VersionInfo> entry : idToVersionsInfo.entrySet()) { - VersionInfo versionInfo = entry.getValue(); - if (versionFilter != null && versionFilter.equals(VersionStatus.Final.name())) { - if (versionInfo.getLatestFinalVersion() == null) { - continue; - } - versionInfo.setActiveVersion(versionInfo.getLatestFinalVersion()); - versionInfo.setStatus(VersionStatus.Final); - versionInfo.setLockingUser(null); - } - - Version version = versionInfo.getActiveVersion(); - if (user.equals(versionInfo.getLockingUser())) { - version.setStatus(VersionStatus.Locked); - } - - try { - VendorLicenseModelEntity vlm = - vendorLicenseModelDao.get(new VendorLicenseModelEntity(entry.getKey(), version)); - if (vlm != null) { - VersionedVendorLicenseModel versionedVlm = new VersionedVendorLicenseModel(); - versionedVlm.setVendorLicenseModel(vlm); - versionedVlm.setVersionInfo(versionInfo); - vendorLicenseModels.add(versionedVlm); - } - }catch(RuntimeException rte){ - logger.error("Error trying to retrieve vlm["+entry.getKey()+"] version["+version.toString - ()+"] " + - "message:"+rte - .getMessage()); - } - } - - sortVlmListByModificationTimeDescOrder(vendorLicenseModels); - + vendorLicenseModelDao.create(vendorLicenseModelEntity); mdcDataDebugMessage.debugExitMessage(null); - return vendorLicenseModels; - } - - @Override - public VendorLicenseModelEntity createVendorLicenseModel(VendorLicenseModelEntity vendorLicenseModelEntity, String user) { - - VendorLicenseModelEntity vendorLicenseModelCreated = vendorLicenseFacade.createVendorLicenseModel(vendorLicenseModelEntity, user); - - ActivityLogEntity activityLogEntity = new ActivityLogEntity(vendorLicenseModelCreated.getId(), - String.valueOf(vendorLicenseModelCreated.getVersion().getMajor()+1), - ActivityType.CREATE_NEW.toString(), user, true, "", ""); - activityLogManager.addActionLog(activityLogEntity, user); - return vendorLicenseModelCreated; + return vendorLicenseModelEntity; } @Override - public void updateVendorLicenseModel(VendorLicenseModelEntity vendorLicenseModelEntity, - String user) { + public void updateVendorLicenseModel(VendorLicenseModelEntity vendorLicenseModelEntity) { mdcDataDebugMessage.debugEntryMessage("VLM id", vendorLicenseModelEntity.getId()); - Version version = resloveVersion(vendorLicenseModelEntity.getId(),null, - getVersionInfo(vendorLicenseModelEntity.getId(), VersionableEntityAction.Write, user), - user); - vendorLicenseModelEntity.setVersion(version); - String existingVendorName = vendorLicenseModelDao.get(vendorLicenseModelEntity).getVendorName(); updateUniqueName(VendorLicenseConstants.UniqueValues.VENDOR_NAME, existingVendorName, - vendorLicenseModelEntity.getVendorName()); + vendorLicenseModelEntity.getVendorName()); vendorLicenseModelDao.update(vendorLicenseModelEntity); - vendorLicenseFacade - .updateVlmLastModificationTime(vendorLicenseModelEntity.getId(), version); - mdcDataDebugMessage.debugExitMessage("VLM id", vendorLicenseModelEntity.getId()); } @Override - public VersionedVendorLicenseModel getVendorLicenseModel(String vlmId, Version version, - String user) { - return vendorLicenseFacade.getVendorLicenseModel(vlmId, version, user); + public VendorLicenseModelEntity getVendorLicenseModel(String vlmId, Version version) { + return vendorLicenseFacade.getVendorLicenseModel(vlmId, version); } @Override - public void deleteVendorLicenseModel(String vlmId, String user) { + public void deleteVendorLicenseModel(String vlmId, Version version) { MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, - LoggerTragetServiceName.DELETE_ENTITY, ErrorLevel.ERROR.name(), - LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.UNSUPPORTED_OPERATION); + LoggerTragetServiceName.DELETE_ENTITY, ErrorLevel.ERROR.name(), + LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.UNSUPPORTED_OPERATION); throw new UnsupportedOperationException(VendorLicenseConstants.UNSUPPORTED_OPERATION_ERROR); } @Override - public Collection<LicenseAgreementEntity> listLicenseAgreements(String vlmId, Version version, - String user) { + public Collection<LicenseAgreementEntity> listLicenseAgreements(String vlmId, Version version) { mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId); mdcDataDebugMessage.debugExitMessage("VLM id", vlmId); - LicenseAgreementEntity licenseAgreementEntity = createLicenseAgreementForList(vlmId, version, - user); -// return licenseAgreementDao.list(new LicenseAgreementEntity(vlmId, VersioningUtil -// .resolveVersion(version, getVersionInfo(vlmId, VersionableEntityAction.Read, user), user), -// null)); - return licenseAgreementDao.list(licenseAgreementEntity); + return licenseAgreementDao.list(new LicenseAgreementEntity(vlmId, version, null)); } @Override - public LicenseAgreementEntity createLicenseAgreement(LicenseAgreementEntity licenseAgreement, - String user) { + public LicenseAgreementEntity createLicenseAgreement(LicenseAgreementEntity licenseAgreement) { mdcDataDebugMessage - .debugEntryMessage("VLM id", licenseAgreement.getVendorLicenseModelId()); + .debugEntryMessage("VLM id", licenseAgreement.getVendorLicenseModelId()); mdcDataDebugMessage - .debugExitMessage("VLM id", licenseAgreement.getVendorLicenseModelId()); - return vendorLicenseFacade.createLicenseAgreement(licenseAgreement, user); + .debugExitMessage("VLM id", licenseAgreement.getVendorLicenseModelId()); + return vendorLicenseFacade.createLicenseAgreement(licenseAgreement); } @Override public void updateLicenseAgreement(LicenseAgreementEntity licenseAgreement, Set<String> addedFeatureGroupIds, - Set<String> removedFeatureGroupIds, String user) { + Set<String> removedFeatureGroupIds) { mdcDataDebugMessage.debugEntryMessage("VLM id, LA id", licenseAgreement - .getVendorLicenseModelId(), licenseAgreement.getId()); + .getVendorLicenseModelId(), licenseAgreement.getId()); - Version version = VersioningUtil.resolveVersion(licenseAgreement.getVersion(), - getVersionInfo(licenseAgreement.getVendorLicenseModelId(), VersionableEntityAction.Write, - user), user); - licenseAgreement.setVersion(version); LicenseAgreementEntity retrieved = licenseAgreementDao.get(licenseAgreement); VersioningUtil - .validateEntityExistence(retrieved, licenseAgreement, VendorLicenseModelEntity.ENTITY_TYPE); + .validateEntityExistence(retrieved, licenseAgreement, VendorLicenseModelEntity.ENTITY_TYPE); VersioningUtil.validateContainedEntitiesExistence(new FeatureGroupEntity().getEntityType(), - removedFeatureGroupIds, retrieved, retrieved.getFeatureGroupIds()); + removedFeatureGroupIds, retrieved, retrieved.getFeatureGroupIds()); VersioningUtil.validateEntitiesExistence(addedFeatureGroupIds, - new FeatureGroupEntity(licenseAgreement.getVendorLicenseModelId(), version, null), - featureGroupDao, VendorLicenseModelEntity.ENTITY_TYPE); + new FeatureGroupEntity(licenseAgreement.getVendorLicenseModelId(), + licenseAgreement.getVersion(), + null), + featureGroupDao, VendorLicenseModelEntity.ENTITY_TYPE); updateUniqueName(VendorLicenseConstants.UniqueValues.LICENSE_AGREEMENT_NAME, - retrieved.getName(), licenseAgreement.getName(), licenseAgreement.getVendorLicenseModelId(), - licenseAgreement.getVersion().toString()); + retrieved.getName(), licenseAgreement.getName(), licenseAgreement.getVendorLicenseModelId(), + licenseAgreement.getVersion().getId()); licenseAgreementDao.updateColumnsAndDeltaFeatureGroupIds(licenseAgreement, addedFeatureGroupIds, - removedFeatureGroupIds); + removedFeatureGroupIds); addFeatureGroupsToLicenseAgreementRef(addedFeatureGroupIds, licenseAgreement); removeFeatureGroupsToLicenseAgreementRef(removedFeatureGroupIds, licenseAgreement); - vendorLicenseFacade - .updateVlmLastModificationTime(licenseAgreement.getVendorLicenseModelId(), version); - mdcDataDebugMessage.debugExitMessage("VLM id, LA id", licenseAgreement - .getVendorLicenseModelId(), licenseAgreement.getId()); + .getVendorLicenseModelId(), licenseAgreement.getId()); } @Override public LicenseAgreementModel getLicenseAgreementModel(String vlmId, Version version, - String licenseAgreementId, String user) { + String licenseAgreementId) { mdcDataDebugMessage.debugEntryMessage("VLM id, LA id", vlmId, licenseAgreementId); mdcDataDebugMessage.debugExitMessage("VLM id, LA id", vlmId, licenseAgreementId); - return vendorLicenseFacade.getLicenseAgreementModel(vlmId, version, licenseAgreementId, user); + return vendorLicenseFacade.getLicenseAgreementModel(vlmId, version, licenseAgreementId); } @Override - public void deleteLicenseAgreement(String vlmId, Version version, String licenseAgreementId, - String user) { + public void deleteLicenseAgreement(String vlmId, Version version, String licenseAgreementId) { mdcDataDebugMessage.debugEntryMessage("VLM id, LA id", vlmId, licenseAgreementId); - version = VersioningUtil - .resolveVersion(version, getVersionInfo(vlmId, VersionableEntityAction.Write, user), user); LicenseAgreementEntity input = - new LicenseAgreementEntity(vlmId, version, licenseAgreementId); + new LicenseAgreementEntity(vlmId, version, licenseAgreementId); LicenseAgreementEntity retrieved = licenseAgreementDao.get(input); VersioningUtil.validateEntityExistence(retrieved, input, VendorLicenseModelEntity.ENTITY_TYPE); @@ -364,29 +204,25 @@ public class VendorLicenseManagerImpl implements VendorLicenseManager { licenseAgreementDao.delete(retrieved); deleteUniqueName(VendorLicenseConstants.UniqueValues.LICENSE_AGREEMENT_NAME, - retrieved.getVendorLicenseModelId(), retrieved.getVersion().toString(), - retrieved.getName()); - - vendorLicenseFacade - .updateVlmLastModificationTime(input.getVendorLicenseModelId(), input.getVersion()); + retrieved.getVendorLicenseModelId(), retrieved.getVersion().toString(), + retrieved.getName()); mdcDataDebugMessage.debugExitMessage("VLM id, LA id", vlmId, licenseAgreementId); } @Override - public Collection<FeatureGroupEntity> listFeatureGroups(String vlmId, Version version, - String user) { + public Collection<FeatureGroupEntity> listFeatureGroups(String vlmId, Version version) { mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId); mdcDataDebugMessage.debugExitMessage("VLM id", vlmId); - return vendorLicenseFacade.listFeatureGroups(vlmId, version, user); + return vendorLicenseFacade.listFeatureGroups(vlmId, version); } @Override - public FeatureGroupEntity createFeatureGroup(FeatureGroupEntity featureGroup, String user) { + public FeatureGroupEntity createFeatureGroup(FeatureGroupEntity featureGroup) { mdcDataDebugMessage - .debugEntryMessage("VLM id", featureGroup.getVendorLicenseModelId()); + .debugEntryMessage("VLM id", featureGroup.getVendorLicenseModelId()); mdcDataDebugMessage.debugExitMessage("VLM id", featureGroup.getId()); - return vendorLicenseFacade.createFeatureGroup(featureGroup, user); + return vendorLicenseFacade.createFeatureGroup(featureGroup); } @Override @@ -394,35 +230,31 @@ public class VendorLicenseManagerImpl implements VendorLicenseManager { Set<String> addedLicenseKeyGroups, Set<String> removedLicenseKeyGroups, Set<String> addedEntitlementPools, - Set<String> removedEntitlementPools, - String user) { + Set<String> removedEntitlementPools) { mdcDataDebugMessage.debugEntryMessage("VLM id, FG id", featureGroup - .getVendorLicenseModelId(), featureGroup.getId()); - - Version version = VersioningUtil.resolveVersion(featureGroup.getVersion(), - getVersionInfo(featureGroup.getVendorLicenseModelId(), VersionableEntityAction.Write, user), - user); - featureGroup.setVersion(version); + .getVendorLicenseModelId(), featureGroup.getId()); FeatureGroupEntity retrieved = featureGroupDao.get(featureGroup); VersioningUtil - .validateEntityExistence(retrieved, featureGroup, VendorLicenseModelEntity.ENTITY_TYPE); + .validateEntityExistence(retrieved, featureGroup, VendorLicenseModelEntity.ENTITY_TYPE); VersioningUtil.validateContainedEntitiesExistence(new LicenseKeyGroupEntity().getEntityType(), - removedLicenseKeyGroups, retrieved, retrieved.getLicenseKeyGroupIds()); + removedLicenseKeyGroups, retrieved, retrieved.getLicenseKeyGroupIds()); VersioningUtil.validateContainedEntitiesExistence(new EntitlementPoolEntity().getEntityType(), - removedEntitlementPools, retrieved, retrieved.getEntitlementPoolIds()); + removedEntitlementPools, retrieved, retrieved.getEntitlementPoolIds()); VersioningUtil.validateEntitiesExistence(addedLicenseKeyGroups, - new LicenseKeyGroupEntity(featureGroup.getVendorLicenseModelId(), version, null), - licenseKeyGroupDao, VendorLicenseModelEntity.ENTITY_TYPE); + new LicenseKeyGroupEntity(featureGroup.getVendorLicenseModelId(), featureGroup.getVersion(), + null), + licenseKeyGroupDao, VendorLicenseModelEntity.ENTITY_TYPE); VersioningUtil.validateEntitiesExistence(addedEntitlementPools, - new EntitlementPoolEntity(featureGroup.getVendorLicenseModelId(), version, null), - entitlementPoolDao, VendorLicenseModelEntity.ENTITY_TYPE); + new EntitlementPoolEntity(featureGroup.getVendorLicenseModelId(), featureGroup.getVersion(), + null), + entitlementPoolDao, VendorLicenseModelEntity.ENTITY_TYPE); updateUniqueName(VendorLicenseConstants.UniqueValues.FEATURE_GROUP_NAME, - retrieved.getName(), featureGroup.getName(), featureGroup.getVendorLicenseModelId(), - featureGroup.getVersion().toString()); + retrieved.getName(), featureGroup.getName(), featureGroup.getVendorLicenseModelId(), + featureGroup.getVersion().getId()); addLicenseKeyGroupsToFeatureGroupsRef(addedLicenseKeyGroups, featureGroup); removeLicenseKeyGroupsToFeatureGroupsRef(removedLicenseKeyGroups, featureGroup); @@ -430,413 +262,364 @@ public class VendorLicenseManagerImpl implements VendorLicenseManager { removeEntitlementPoolsToFeatureGroupsRef(removedEntitlementPools, featureGroup); featureGroupDao.updateFeatureGroup(featureGroup, addedEntitlementPools, removedEntitlementPools, - addedLicenseKeyGroups, removedLicenseKeyGroups); - - vendorLicenseFacade - .updateVlmLastModificationTime(featureGroup.getVendorLicenseModelId(), version); + addedLicenseKeyGroups, removedLicenseKeyGroups); mdcDataDebugMessage.debugExitMessage("VLM id, FG id", featureGroup - .getVendorLicenseModelId(), featureGroup.getId()); + .getVendorLicenseModelId(), featureGroup.getId()); } @Override - public FeatureGroupModel getFeatureGroupModel(FeatureGroupEntity featureGroup, String user) { + public FeatureGroupModel getFeatureGroupModel(FeatureGroupEntity featureGroup) { mdcDataDebugMessage.debugEntryMessage("VLM id, FG id", - featureGroup.getVendorLicenseModelId(), featureGroup.getId()); + featureGroup.getVendorLicenseModelId(), featureGroup.getId()); mdcDataDebugMessage.debugExitMessage("VLM id, FG id", - featureGroup.getVendorLicenseModelId(), featureGroup.getId()); - return vendorLicenseFacade.getFeatureGroupModel(featureGroup, user); + featureGroup.getVendorLicenseModelId(), featureGroup.getId()); + return vendorLicenseFacade.getFeatureGroupModel(featureGroup); } @Override - public void deleteFeatureGroup(FeatureGroupEntity featureGroup, String user) { + public void deleteFeatureGroup(FeatureGroupEntity featureGroup) { mdcDataDebugMessage.debugEntryMessage("VLM id, FG id", - featureGroup.getVendorLicenseModelId(), featureGroup.getId()); + featureGroup.getVendorLicenseModelId(), featureGroup.getId()); - Version version = VersioningUtil.resolveVersion(featureGroup.getVersion(), - getVersionInfo(featureGroup.getVendorLicenseModelId(), VersionableEntityAction.Write, - user), user); - featureGroup.setVersion(version); FeatureGroupEntity retrieved = featureGroupDao.get(featureGroup); VersioningUtil - .validateEntityExistence(retrieved, featureGroup, VendorLicenseModelEntity.ENTITY_TYPE); + .validateEntityExistence(retrieved, featureGroup, VendorLicenseModelEntity.ENTITY_TYPE); removeLicenseKeyGroupsToFeatureGroupsRef(retrieved.getLicenseKeyGroupIds(), featureGroup); removeEntitlementPoolsToFeatureGroupsRef(retrieved.getEntitlementPoolIds(), featureGroup); for (String licenceAgreementId : retrieved.getReferencingLicenseAgreements()) { licenseAgreementDao.removeFeatureGroup( - new LicenseAgreementEntity(featureGroup.getVendorLicenseModelId(), version, - licenceAgreementId), featureGroup.getId()); + new LicenseAgreementEntity(featureGroup.getVendorLicenseModelId(), + featureGroup.getVersion(), + licenceAgreementId), featureGroup.getId()); } featureGroupDao.delete(featureGroup); deleteUniqueName(VendorLicenseConstants.UniqueValues.FEATURE_GROUP_NAME, - retrieved.getVendorLicenseModelId(), retrieved.getVersion().toString(), - retrieved.getName()); - - vendorLicenseFacade.updateVlmLastModificationTime(featureGroup.getVendorLicenseModelId(), - featureGroup.getVersion()); + retrieved.getVendorLicenseModelId(), retrieved.getVersion().toString(), + retrieved.getName()); mdcDataDebugMessage - .debugExitMessage("VLM id, FG id", - featureGroup.getVendorLicenseModelId(), featureGroup.getId()); + .debugExitMessage("VLM id, FG id", + featureGroup.getVendorLicenseModelId(), featureGroup.getId()); } @Override - public Collection<EntitlementPoolEntity> listEntitlementPools(String vlmId, Version version, - String user) { + public Collection<EntitlementPoolEntity> listEntitlementPools(String vlmId, Version version) { mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId); mdcDataDebugMessage.debugExitMessage("VLM id", vlmId); - return vendorLicenseFacade.listEntitlementPools(vlmId, version, user); + return vendorLicenseFacade.listEntitlementPools(vlmId, version); } @Override - public EntitlementPoolEntity createEntitlementPool(EntitlementPoolEntity entitlementPool, - String user) { + public EntitlementPoolEntity createEntitlementPool(EntitlementPoolEntity entitlementPool) { mdcDataDebugMessage - .debugEntryMessage("VLM id", entitlementPool.getVendorLicenseModelId()); + .debugEntryMessage("VLM id", entitlementPool.getVendorLicenseModelId()); mdcDataDebugMessage - .debugExitMessage("VLM id", entitlementPool.getVendorLicenseModelId()); + .debugExitMessage("VLM id", entitlementPool.getVendorLicenseModelId()); entitlementPool.setStartDate(entitlementPool.getStartDate() != null ? (entitlementPool - .getStartDate().trim().length() != 0 ? entitlementPool.getStartDate()+"T00:00:00Z" - : null) : null); + .getStartDate().trim().length() != 0 ? entitlementPool.getStartDate() + "T00:00:00Z" + : null) : null); entitlementPool.setExpiryDate(entitlementPool.getExpiryDate() != null ? (entitlementPool - .getExpiryDate().trim().length() != 0 ? entitlementPool.getExpiryDate()+"T23:59:59Z" - : null) : null); + .getExpiryDate().trim().length() != 0 ? entitlementPool.getExpiryDate() + "T23:59:59Z" + : null) : null); validateCreateDate(entitlementPool.getStartDate(), entitlementPool.getExpiryDate(), - entitlementPool.getVendorLicenseModelId()); - return vendorLicenseFacade.createEntitlementPool(entitlementPool, user); + entitlementPool.getVendorLicenseModelId()); + return vendorLicenseFacade.createEntitlementPool(entitlementPool); } - private void validateCreateDate(String startDate, String expiryDate, String vendorLicenseModelId){ + private void validateCreateDate(String startDate, String expiryDate, + String vendorLicenseModelId) { mdcDataDebugMessage.debugEntryMessage("Start date and end date", startDate - +" "+expiryDate); + + " " + expiryDate); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy'T'HH:mm:ss'Z'"); - if(startDate != null && expiryDate != null) { + if (startDate != null && expiryDate != null) { if (LocalDate.parse(startDate, formatter).atStartOfDay().isBefore - (LocalDate.now().atStartOfDay()) || LocalDate.parse(expiryDate, formatter).atStartOfDay() - .isEqual(LocalDate.parse(startDate, formatter).atStartOfDay()) || LocalDate - .parse(expiryDate, formatter).isBefore(LocalDate.parse(startDate, formatter))) { + (LocalDate.now().atStartOfDay()) || LocalDate.parse(expiryDate, formatter).atStartOfDay() + .isEqual(LocalDate.parse(startDate, formatter).atStartOfDay()) || LocalDate + .parse(expiryDate, formatter).isBefore(LocalDate.parse(startDate, formatter))) { MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, - LoggerTragetServiceName.VALIDATE_DATE_RANGE,ErrorLevel.ERROR.name(), - LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.INVALID_VALUE); + LoggerTragetServiceName.VALIDATE_DATE_RANGE, ErrorLevel.ERROR.name(), + LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.INVALID_VALUE); throw new CoreException( - new InvalidDateErrorBuilder(vendorLicenseModelId) - .build()); + new InvalidDateErrorBuilder(vendorLicenseModelId) + .build()); } } - if(startDate != null && expiryDate == null) { + if (startDate != null && expiryDate == null) { if (LocalDate.parse(startDate, formatter).atStartOfDay().isBefore - (LocalDate.now().atStartOfDay())) { + (LocalDate.now().atStartOfDay())) { MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, - LoggerTragetServiceName.VALIDATE_DATE_RANGE,ErrorLevel.ERROR.name(), - LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.INVALID_VALUE); + LoggerTragetServiceName.VALIDATE_DATE_RANGE, ErrorLevel.ERROR.name(), + LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.INVALID_VALUE); throw new CoreException( - new InvalidDateErrorBuilder(vendorLicenseModelId) - .build()); + new InvalidDateErrorBuilder(vendorLicenseModelId) + .build()); } } - if(startDate == null && expiryDate != null) { + if (startDate == null && expiryDate != null) { MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, - LoggerTragetServiceName.VALIDATE_DATE_RANGE,ErrorLevel.ERROR.name(), - LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.INVALID_VALUE); + LoggerTragetServiceName.VALIDATE_DATE_RANGE, ErrorLevel.ERROR.name(), + LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.INVALID_VALUE); throw new CoreException( - new InvalidDateErrorBuilder(vendorLicenseModelId) - .build()); + new InvalidDateErrorBuilder(vendorLicenseModelId) + .build()); } - mdcDataDebugMessage.debugExitMessage(null,null); + mdcDataDebugMessage.debugExitMessage(null); } - private void validateUpdateDate(String startDate, String expiryDate, String vendorLicenseModelId){ + private void validateUpdateDate(String startDate, String expiryDate, + String vendorLicenseModelId) { mdcDataDebugMessage.debugEntryMessage("Start date and end date", startDate - +" "+ expiryDate); + + " " + expiryDate); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy'T'HH:mm:ss'Z'"); - if(startDate != null && expiryDate != null) { + if (startDate != null && expiryDate != null) { if (LocalDate.parse(expiryDate, formatter).atStartOfDay() - .isEqual(LocalDate.parse(startDate, formatter).atStartOfDay()) || - LocalDate.parse(expiryDate, formatter).isBefore(LocalDate.parse(startDate, formatter))) { + .isEqual(LocalDate.parse(startDate, formatter).atStartOfDay()) || + LocalDate.parse(expiryDate, formatter).isBefore(LocalDate.parse(startDate, formatter))) { MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, - LoggerTragetServiceName.VALIDATE_DATE_RANGE,ErrorLevel.ERROR.name(), - LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.INVALID_VALUE); + LoggerTragetServiceName.VALIDATE_DATE_RANGE, ErrorLevel.ERROR.name(), + LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.INVALID_VALUE); throw new CoreException( - new InvalidDateErrorBuilder(vendorLicenseModelId) - .build()); + new InvalidDateErrorBuilder(vendorLicenseModelId) + .build()); } } - if(startDate == null && expiryDate != null) { + if (startDate == null && expiryDate != null) { MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, - LoggerTragetServiceName.VALIDATE_DATE_RANGE,ErrorLevel.ERROR.name(), - LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.INVALID_VALUE); + LoggerTragetServiceName.VALIDATE_DATE_RANGE, ErrorLevel.ERROR.name(), + LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.INVALID_VALUE); throw new CoreException( - new InvalidDateErrorBuilder(vendorLicenseModelId) - .build()); + new InvalidDateErrorBuilder(vendorLicenseModelId) + .build()); } - mdcDataDebugMessage.debugExitMessage(null,null); + mdcDataDebugMessage.debugExitMessage(null); } @Override - public void updateEntitlementPool(EntitlementPoolEntity entitlementPool, String user) { + public void updateEntitlementPool(EntitlementPoolEntity entitlementPool) { mdcDataDebugMessage.debugEntryMessage("VLM id, EP id", entitlementPool - .getVendorLicenseModelId(), entitlementPool.getId()); + .getVendorLicenseModelId(), entitlementPool.getId()); entitlementPool.setStartDate(entitlementPool.getStartDate() != null ? (entitlementPool - .getStartDate().trim().length() != 0 ? entitlementPool.getStartDate()+"T00:00:00Z" - : null) : null); + .getStartDate().trim().length() != 0 ? entitlementPool.getStartDate() + "T00:00:00Z" + : null) : null); entitlementPool.setExpiryDate(entitlementPool.getExpiryDate() != null ? (entitlementPool - .getExpiryDate().trim().length() != 0 ? entitlementPool.getExpiryDate()+"T23:59:59Z" - : null) : null); + .getExpiryDate().trim().length() != 0 ? entitlementPool.getExpiryDate() + "T23:59:59Z" + : null) : null); validateUpdateDate(entitlementPool.getStartDate(), entitlementPool.getExpiryDate(), - entitlementPool.getVendorLicenseModelId()); - Version version = VersioningUtil.resolveVersion(entitlementPool.getVersion(), - getVersionInfo(entitlementPool.getVendorLicenseModelId(), VersionableEntityAction.Write, - user), user); - vendorLicenseFacade - .updateVlmLastModificationTime(entitlementPool.getVendorLicenseModelId(), version); - vendorLicenseFacade.updateEntitlementPool(entitlementPool, user); + entitlementPool.getVendorLicenseModelId()); + vendorLicenseFacade.updateEntitlementPool(entitlementPool); mdcDataDebugMessage.debugExitMessage("VLM id, EP id", entitlementPool - .getVendorLicenseModelId(), entitlementPool.getId()); + .getVendorLicenseModelId(), entitlementPool.getId()); } @Override - public EntitlementPoolEntity getEntitlementPool(EntitlementPoolEntity entitlementPool, - String user) { + public EntitlementPoolEntity getEntitlementPool(EntitlementPoolEntity entitlementPool) { mdcDataDebugMessage.debugEntryMessage("VLM id, EP id", entitlementPool - .getVendorLicenseModelId(), entitlementPool.getId()); - - entitlementPool.setVersion(VersioningUtil.resolveVersion(entitlementPool.getVersion(), - getVersionInfo(entitlementPool.getVendorLicenseModelId(), VersionableEntityAction.Read, - user), user)); + .getVendorLicenseModelId(), entitlementPool.getId()); EntitlementPoolEntity retrieved = entitlementPoolDao.get(entitlementPool); VersioningUtil - .validateEntityExistence(retrieved, entitlementPool, VendorLicenseModelEntity.ENTITY_TYPE); + .validateEntityExistence(retrieved, entitlementPool, VendorLicenseModelEntity.ENTITY_TYPE); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy'T'HH:mm:ss'Z'"); DateTimeFormatter targetFormatter = DateTimeFormatter.ofPattern("MM/dd/yyyy"); - if(retrieved.getStartDate() != null){ - retrieved.setStartDate(LocalDate.parse(retrieved.getStartDate(),formatter).format - (targetFormatter)); + if (retrieved.getStartDate() != null) { + retrieved.setStartDate(LocalDate.parse(retrieved.getStartDate(), formatter).format + (targetFormatter)); } - if(retrieved.getExpiryDate() != null){ - retrieved.setExpiryDate(LocalDate.parse(retrieved.getExpiryDate(),formatter).format - (targetFormatter)); + if (retrieved.getExpiryDate() != null) { + retrieved.setExpiryDate(LocalDate.parse(retrieved.getExpiryDate(), formatter).format + (targetFormatter)); } mdcDataDebugMessage.debugExitMessage("VLM id, EP id", entitlementPool - .getVendorLicenseModelId(), entitlementPool.getId()); + .getVendorLicenseModelId(), entitlementPool.getId()); return retrieved; } @Override - public void deleteEntitlementPool(EntitlementPoolEntity entitlementPool, String user) { + public void deleteEntitlementPool(EntitlementPoolEntity entitlementPool) { mdcDataDebugMessage.debugEntryMessage("VLM id, EP id", entitlementPool - .getVendorLicenseModelId(), entitlementPool.getId()); - - Version version = VersioningUtil.resolveVersion(entitlementPool.getVersion(), - getVersionInfo(entitlementPool.getVendorLicenseModelId(), VersionableEntityAction.Write, - user), user); - entitlementPool.setVersion(version); + .getVendorLicenseModelId(), entitlementPool.getId()); EntitlementPoolEntity retrieved = entitlementPoolDao.get(entitlementPool); VersioningUtil - .validateEntityExistence(retrieved, entitlementPool, VendorLicenseModelEntity.ENTITY_TYPE); + .validateEntityExistence(retrieved, entitlementPool, VendorLicenseModelEntity.ENTITY_TYPE); for (String referencingFeatureGroupId : retrieved.getReferencingFeatureGroups()) { featureGroupDao.removeEntitlementPool( - new FeatureGroupEntity(entitlementPool.getVendorLicenseModelId(), version, - referencingFeatureGroupId), entitlementPool.getId()); + new FeatureGroupEntity(entitlementPool.getVendorLicenseModelId(), + entitlementPool.getVersion(), + referencingFeatureGroupId), entitlementPool.getId()); } - deleteChildLimits(entitlementPool.getVendorLicenseModelId(), entitlementPool.getVersion(), entitlementPool.getId(), user); + deleteChildLimits(entitlementPool.getVendorLicenseModelId(), entitlementPool.getVersion(), + entitlementPool.getId()); entitlementPoolDao.delete(entitlementPool); deleteUniqueName(VendorLicenseConstants.UniqueValues.ENTITLEMENT_POOL_NAME, - retrieved.getVendorLicenseModelId(), retrieved.getVersion().toString(), - retrieved.getName()); - - vendorLicenseFacade.updateVlmLastModificationTime(entitlementPool.getVendorLicenseModelId(), - entitlementPool.getVersion()); + retrieved.getVendorLicenseModelId(), retrieved.getVersion().toString(), + retrieved.getName()); mdcDataDebugMessage.debugExitMessage("VLM id, EP id", entitlementPool - .getVendorLicenseModelId(), entitlementPool.getId()); + .getVendorLicenseModelId(), entitlementPool.getId()); } - protected void deleteChildLimits(String vlmId, Version version, String epLkgId, String user) { + protected void deleteChildLimits(String vlmId, Version version, String epLkgId) { Optional<Collection<LimitEntity>> limitEntities = Optional.ofNullable( - listLimits(vlmId, version, epLkgId, user)); - limitEntities.ifPresent(entities-> - entities.forEach(entity-> - deleteLimit(entity, user))); + listLimits(vlmId, version, epLkgId)); + limitEntities.ifPresent(entities -> entities.forEach(this::deleteLimit)); } @Override - public Collection<LicenseKeyGroupEntity> listLicenseKeyGroups(String vlmId, Version version, - String user) { + public Collection<LicenseKeyGroupEntity> listLicenseKeyGroups(String vlmId, Version version) { mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId); mdcDataDebugMessage.debugExitMessage("VLM id", vlmId); - return vendorLicenseFacade.listLicenseKeyGroups(vlmId, version, user); + return vendorLicenseFacade.listLicenseKeyGroups(vlmId, version); } @Override - public LicenseKeyGroupEntity createLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup, - String user) { + public LicenseKeyGroupEntity createLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup) { mdcDataDebugMessage - .debugEntryMessage("VLM id", licenseKeyGroup.getVendorLicenseModelId()); + .debugEntryMessage("VLM id", licenseKeyGroup.getVendorLicenseModelId()); mdcDataDebugMessage.debugExitMessage("VLM id", licenseKeyGroup - .getVendorLicenseModelId()); + .getVendorLicenseModelId()); licenseKeyGroup.setStartDate(licenseKeyGroup.getStartDate() != null ? (licenseKeyGroup - .getStartDate().trim().length() != 0 ? licenseKeyGroup.getStartDate()+"T00:00:00Z" - : null) : null); + .getStartDate().trim().length() != 0 ? licenseKeyGroup.getStartDate() + "T00:00:00Z" + : null) : null); licenseKeyGroup.setExpiryDate(licenseKeyGroup.getExpiryDate() != null ? (licenseKeyGroup - .getExpiryDate().trim().length() != 0 ? licenseKeyGroup.getExpiryDate()+"T23:59:59Z" - : null) : null); + .getExpiryDate().trim().length() != 0 ? licenseKeyGroup.getExpiryDate() + "T23:59:59Z" + : null) : null); validateCreateDate(licenseKeyGroup.getStartDate(), licenseKeyGroup.getExpiryDate(), - licenseKeyGroup.getVendorLicenseModelId()); - return vendorLicenseFacade.createLicenseKeyGroup(licenseKeyGroup, user); + licenseKeyGroup.getVendorLicenseModelId()); + return vendorLicenseFacade.createLicenseKeyGroup(licenseKeyGroup); } @Override - public void updateLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup, String user) { + public void updateLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup) { mdcDataDebugMessage.debugEntryMessage("VLM id, LKG id", licenseKeyGroup - .getVendorLicenseModelId(), licenseKeyGroup.getId()); + .getVendorLicenseModelId(), licenseKeyGroup.getId()); licenseKeyGroup.setStartDate(licenseKeyGroup.getStartDate() != null ? (licenseKeyGroup - .getStartDate().trim().length() != 0 ? licenseKeyGroup.getStartDate()+"T00:00:00Z" - : null) : null); + .getStartDate().trim().length() != 0 ? licenseKeyGroup.getStartDate() + "T00:00:00Z" + : null) : null); licenseKeyGroup.setExpiryDate(licenseKeyGroup.getExpiryDate() != null ? (licenseKeyGroup - .getExpiryDate().trim().length() != 0 ? licenseKeyGroup.getExpiryDate()+"T23:59:59Z" - : null) : null); + .getExpiryDate().trim().length() != 0 ? licenseKeyGroup.getExpiryDate() + "T23:59:59Z" + : null) : null); validateUpdateDate(licenseKeyGroup.getStartDate(), licenseKeyGroup.getExpiryDate(), - licenseKeyGroup.getVendorLicenseModelId()); - - Version version = VersioningUtil.resolveVersion(licenseKeyGroup.getVersion(), - getVersionInfo(licenseKeyGroup.getVendorLicenseModelId(), VersionableEntityAction.Write, - user), user); - vendorLicenseFacade - .updateVlmLastModificationTime(licenseKeyGroup.getVendorLicenseModelId(), version); - - vendorLicenseFacade.updateLicenseKeyGroup(licenseKeyGroup, user); + licenseKeyGroup.getVendorLicenseModelId()); + vendorLicenseFacade.updateLicenseKeyGroup(licenseKeyGroup); mdcDataDebugMessage.debugExitMessage("VLM id, LKG id", licenseKeyGroup - .getVendorLicenseModelId(), licenseKeyGroup.getId()); + .getVendorLicenseModelId(), licenseKeyGroup.getId()); } @Override - public LicenseKeyGroupEntity getLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup, - String user) { + public LicenseKeyGroupEntity getLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup) { mdcDataDebugMessage.debugEntryMessage("VLM id, LKG id", licenseKeyGroup - .getVendorLicenseModelId(), licenseKeyGroup.getId()); - - licenseKeyGroup.setVersion(VersioningUtil.resolveVersion(licenseKeyGroup.getVersion(), - getVersionInfo(licenseKeyGroup.getVendorLicenseModelId(), VersionableEntityAction.Read, - user), user)); + .getVendorLicenseModelId(), licenseKeyGroup.getId()); LicenseKeyGroupEntity retrieved = licenseKeyGroupDao.get(licenseKeyGroup); VersioningUtil - .validateEntityExistence(retrieved, licenseKeyGroup, VendorLicenseModelEntity.ENTITY_TYPE); + .validateEntityExistence(retrieved, licenseKeyGroup, VendorLicenseModelEntity.ENTITY_TYPE); mdcDataDebugMessage.debugExitMessage("VLM id, LKG id", licenseKeyGroup - .getVendorLicenseModelId(), licenseKeyGroup.getId()); + .getVendorLicenseModelId(), licenseKeyGroup.getId()); return retrieved; } @Override - public void deleteLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup, String user) { + public void deleteLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup) { mdcDataDebugMessage.debugEntryMessage("VLM id, LKG id", licenseKeyGroup - .getVendorLicenseModelId(), licenseKeyGroup.getId()); - - Version version = VersioningUtil.resolveVersion(licenseKeyGroup.getVersion(), - getVersionInfo(licenseKeyGroup.getVendorLicenseModelId(), VersionableEntityAction.Write, - user), user); - licenseKeyGroup.setVersion(version); + .getVendorLicenseModelId(), licenseKeyGroup.getId()); LicenseKeyGroupEntity retrieved = licenseKeyGroupDao.get(licenseKeyGroup); VersioningUtil - .validateEntityExistence(retrieved, licenseKeyGroup, VendorLicenseModelEntity.ENTITY_TYPE); + .validateEntityExistence(retrieved, licenseKeyGroup, VendorLicenseModelEntity.ENTITY_TYPE); for (String referencingFeatureGroupId : retrieved.getReferencingFeatureGroups()) { featureGroupDao.removeLicenseKeyGroup( - new FeatureGroupEntity(licenseKeyGroup.getVendorLicenseModelId(), version, - referencingFeatureGroupId), licenseKeyGroup.getId()); + new FeatureGroupEntity(licenseKeyGroup.getVendorLicenseModelId(), + licenseKeyGroup.getVersion(), + referencingFeatureGroupId), licenseKeyGroup.getId()); } - deleteChildLimits(licenseKeyGroup.getVendorLicenseModelId(), licenseKeyGroup.getVersion(), licenseKeyGroup.getId(), user); + deleteChildLimits(licenseKeyGroup.getVendorLicenseModelId(), licenseKeyGroup.getVersion(), + licenseKeyGroup.getId()); licenseKeyGroupDao.delete(licenseKeyGroup); deleteUniqueName(VendorLicenseConstants.UniqueValues.LICENSE_KEY_GROUP_NAME, - retrieved.getVendorLicenseModelId(), retrieved.getVersion().toString(), - retrieved.getName()); - - vendorLicenseFacade.updateVlmLastModificationTime(licenseKeyGroup.getVendorLicenseModelId(), - licenseKeyGroup.getVersion()); + retrieved.getVendorLicenseModelId(), retrieved.getVersion().toString(), + retrieved.getName()); mdcDataDebugMessage.debugExitMessage("VLM id, LKG id", licenseKeyGroup - .getVendorLicenseModelId(), licenseKeyGroup.getId()); + .getVendorLicenseModelId(), licenseKeyGroup.getId()); } @Override - public LimitEntity createLimit(LimitEntity limit, String user) { + public LimitEntity createLimit(LimitEntity limit) { mdcDataDebugMessage - .debugEntryMessage("VLM id", limit.getVendorLicenseModelId(), "EP/LKGId", limit - .getEpLkgId()); + .debugEntryMessage("VLM id", limit.getVendorLicenseModelId(), "EP/LKGId", limit + .getEpLkgId()); mdcDataDebugMessage - .debugExitMessage("VLM id", limit.getVendorLicenseModelId(), "EP/LKGId", limit - .getEpLkgId()); - validateLimit(limit, user); - LimitEntity createdLimit = vendorLicenseFacade.createLimit(limit, user); - updateParentForLimit(limit,user); + .debugExitMessage("VLM id", limit.getVendorLicenseModelId(), "EP/LKGId", limit + .getEpLkgId()); + validateLimit(limit); + LimitEntity createdLimit = vendorLicenseFacade.createLimit(limit); + updateParentForLimit(limit); return createdLimit; } - private void validateLimit(LimitEntity limit, String user) { - Version version = VersioningUtil.resolveVersion(limit.getVersion(), - getVersionInfo(limit.getVendorLicenseModelId(), VersionableEntityAction.Write, - user), user); - Collection<LimitEntity> limitList = listLimits(limit.getVendorLicenseModelId(),version - ,limit.getEpLkgId(), user); + private void validateLimit(LimitEntity limit) { + Collection<LimitEntity> limitList = + listLimits(limit.getVendorLicenseModelId(), limit.getVersion() + , limit.getEpLkgId()); - if (!isLimitNameUnique(limitList,limit.getName(), limit.getType(), limit.getId())) { + if (!isLimitNameUnique(limitList, limit.getName(), limit.getType(), limit.getId())) { final ErrorCode duplicateLimitNameErrorBuilder = - LimitErrorBuilder.getDuplicateNameErrorbuilder(limit.getName(), limit.getType().name()); + LimitErrorBuilder.getDuplicateNameErrorbuilder(limit.getName(), limit.getType().name()); MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, - LoggerServiceName.Create_LIMIT.toString(), ErrorLevel.ERROR.name(), - LoggerErrorCode.DATA_ERROR.getErrorCode(), - duplicateLimitNameErrorBuilder.message()); + LoggerServiceName.Create_LIMIT.toString(), ErrorLevel.ERROR.name(), + LoggerErrorCode.DATA_ERROR.getErrorCode(), + duplicateLimitNameErrorBuilder.message()); throw new CoreException(duplicateLimitNameErrorBuilder); } } private boolean isLimitNameUnique(Collection<LimitEntity> limitList, String name, LimitType - type, String id) { + type, String id) { for (LimitEntity limit : limitList) { - if(limit.getName().equalsIgnoreCase(name) && - limit.getType().name().equalsIgnoreCase(type.name())) { - if(id != null && limit.getId().equals(id)){ + if (limit.getName().equalsIgnoreCase(name) && + limit.getType().name().equalsIgnoreCase(type.name())) { + if (id != null && limit.getId().equals(id)) { continue; } return false; @@ -846,54 +629,45 @@ public class VendorLicenseManagerImpl implements VendorLicenseManager { } @Override - public Collection<LimitEntity> listLimits(String vlmId, Version version, String epLkgId, - String user) { + public Collection<LimitEntity> listLimits(String vlmId, Version version, String epLkgId) { mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId, "EP/LKGId", epLkgId); mdcDataDebugMessage.debugExitMessage("VLM id", vlmId, "EP/LKGId", epLkgId); - return vendorLicenseFacade.listLimits(vlmId, version, epLkgId, user); + return vendorLicenseFacade.listLimits(vlmId, version, epLkgId); } @Override - public void deleteLimit(LimitEntity limitEntity, String user) { + public void deleteLimit(LimitEntity limitEntity) { mdcDataDebugMessage.debugEntryMessage("VLM id, EP id, Limit Id", limitEntity - .getVendorLicenseModelId(), limitEntity.getEpLkgId(), limitEntity.getId()); - - Version version = VersioningUtil.resolveVersion(limitEntity.getVersion(), - getVersionInfo(limitEntity.getVendorLicenseModelId(), VersionableEntityAction.Write, - user), user); - limitEntity.setVersion(version); + .getVendorLicenseModelId(), limitEntity.getEpLkgId(), limitEntity.getId()); - if ( !isLimitPresent(limitEntity)) { + if (!isLimitPresent(limitEntity)) { VersioningUtil - .validateEntityExistence(null, limitEntity, VendorLicenseModelEntity.ENTITY_TYPE); + .validateEntityExistence(null, limitEntity, VendorLicenseModelEntity.ENTITY_TYPE); } LimitEntity retrieved = limitDao.get(limitEntity); VersioningUtil - .validateEntityExistence(retrieved, limitEntity, VendorLicenseModelEntity.ENTITY_TYPE); + .validateEntityExistence(retrieved, limitEntity, VendorLicenseModelEntity.ENTITY_TYPE); limitDao.delete(limitEntity); - vendorLicenseFacade.updateVlmLastModificationTime(limitEntity.getVendorLicenseModelId(), - limitEntity.getVersion()); - - updateParentForLimit(limitEntity,user); + updateParentForLimit(limitEntity); mdcDataDebugMessage.debugExitMessage("VLM id, EP id, Limit Id", limitEntity - .getVendorLicenseModelId(), limitEntity.getEpLkgId(), limitEntity.getId()); + .getVendorLicenseModelId(), limitEntity.getEpLkgId(), limitEntity.getId()); } @Override - public void updateLimit(LimitEntity limit, String user) { + public void updateLimit(LimitEntity limit) { mdcDataDebugMessage - .debugEntryMessage("VLM id", limit.getVendorLicenseModelId(), "EP/LKGId", limit - .getEpLkgId()); - getLimit(limit,user); - validateLimit(limit, user); - vendorLicenseFacade.updateLimit(limit, user); - updateParentForLimit(limit,user); + .debugEntryMessage("VLM id", limit.getVendorLicenseModelId(), "EP/LKGId", limit + .getEpLkgId()); + getLimit(limit); + validateLimit(limit); + vendorLicenseFacade.updateLimit(limit); + updateParentForLimit(limit); mdcDataDebugMessage - .debugExitMessage("VLM id", limit.getVendorLicenseModelId(), "EP/LKGId", limit - .getEpLkgId()); + .debugExitMessage("VLM id", limit.getVendorLicenseModelId(), "EP/LKGId", limit + .getEpLkgId()); } private boolean isLimitPresent(LimitEntity limit) { @@ -901,52 +675,46 @@ public class VendorLicenseManagerImpl implements VendorLicenseManager { } @Override - public LimitEntity getLimit(LimitEntity limitEntity, - String user) { + public LimitEntity getLimit(LimitEntity limitEntity) { mdcDataDebugMessage.debugEntryMessage("VLM id", limitEntity.getVendorLicenseModelId(), - "EP/LKGId", limitEntity.getEpLkgId()); + "EP/LKGId", limitEntity.getEpLkgId()); - limitEntity.setVersion(VersioningUtil.resolveVersion(limitEntity.getVersion(), - getVersionInfo(limitEntity.getVendorLicenseModelId(), VersionableEntityAction.Read, - user), user)); - if(!isLimitPresent(limitEntity)){ + if (!isLimitPresent(limitEntity)) { VersioningUtil - .validateEntityExistence(null, limitEntity, VendorLicenseModelEntity.ENTITY_TYPE); + .validateEntityExistence(null, limitEntity, VendorLicenseModelEntity.ENTITY_TYPE); } LimitEntity retrieved = limitDao.get(limitEntity); VersioningUtil - .validateEntityExistence(retrieved, limitEntity, VendorLicenseModelEntity.ENTITY_TYPE); + .validateEntityExistence(retrieved, limitEntity, VendorLicenseModelEntity.ENTITY_TYPE); mdcDataDebugMessage.debugExitMessage("VLM id", limitEntity.getVendorLicenseModelId(), - "EP/LKGId", limitEntity.getEpLkgId()); + "EP/LKGId", limitEntity.getEpLkgId()); return retrieved; } /** * update Parent of limit (EP/LKG) versionuuid when limit is modified so that limit updates are * captured in VLM XML - * @param limit - * @param user */ - private void updateParentForLimit(LimitEntity limit, String user) { + private void updateParentForLimit(LimitEntity limit) { mdcDataDebugMessage.debugEntryMessage("VLM id", limit.getVendorLicenseModelId(), - "EP/LKGId", limit.getEpLkgId(), "Limit Parent ", limit.getParent()); - if ("EntitlementPool".equals(limit.getParent()) ) { + "EP/LKGId", limit.getEpLkgId(), "Limit Parent ", limit.getParent()); + if ("EntitlementPool".equals(limit.getParent())) { EntitlementPoolEntity entitlementPoolEntity = - entitlementPoolDao.get(new EntitlementPoolEntity(limit.getVendorLicenseModelId(), - limit.getVersion(), limit.getEpLkgId())); - vendorLicenseFacade.updateEntitlementPool(entitlementPoolEntity, user); + entitlementPoolDao.get(new EntitlementPoolEntity(limit.getVendorLicenseModelId(), + limit.getVersion(), limit.getEpLkgId())); + vendorLicenseFacade.updateEntitlementPool(entitlementPoolEntity); } if ("LicenseKeyGroup".equals(limit.getParent())) { LicenseKeyGroupEntity licenseKeyGroupEntity = licenseKeyGroupDao.get( - new LicenseKeyGroupEntity(limit.getVendorLicenseModelId(), limit.getVersion(), - limit.getEpLkgId())); - vendorLicenseFacade.updateLicenseKeyGroup(licenseKeyGroupEntity, user); + new LicenseKeyGroupEntity(limit.getVendorLicenseModelId(), limit.getVersion(), + limit.getEpLkgId())); + vendorLicenseFacade.updateLicenseKeyGroup(licenseKeyGroupEntity); } mdcDataDebugMessage.debugEntryMessage("VLM id", limit.getVendorLicenseModelId(), - "EP/LKGId", limit.getEpLkgId(), "Limit Parent ", limit.getParent()); + "EP/LKGId", limit.getEpLkgId(), "Limit Parent ", limit.getParent()); } protected void addFeatureGroupsToLicenseAgreementRef(Set<String> featureGroupIds, @@ -954,8 +722,8 @@ public class VendorLicenseManagerImpl implements VendorLicenseManager { if (featureGroupIds != null) { for (String featureGroupId : featureGroupIds) { featureGroupDao.addReferencingLicenseAgreement( - new FeatureGroupEntity(licenseAgreement.getVendorLicenseModelId(), - licenseAgreement.getVersion(), featureGroupId), licenseAgreement.getId()); + new FeatureGroupEntity(licenseAgreement.getVendorLicenseModelId(), + licenseAgreement.getVersion(), featureGroupId), licenseAgreement.getId()); } } } @@ -965,8 +733,8 @@ public class VendorLicenseManagerImpl implements VendorLicenseManager { if (featureGroupIds != null) { for (String featureGroupId : featureGroupIds) { featureGroupDao.removeReferencingLicenseAgreement( - new FeatureGroupEntity(licenseAgreement.getVendorLicenseModelId(), - licenseAgreement.getVersion(), featureGroupId), licenseAgreement.getId()); + new FeatureGroupEntity(licenseAgreement.getVendorLicenseModelId(), + licenseAgreement.getVersion(), featureGroupId), licenseAgreement.getId()); } } } @@ -976,8 +744,8 @@ public class VendorLicenseManagerImpl implements VendorLicenseManager { if (licenseKeyGroupIds != null) { for (String licenseKeyGroupId : licenseKeyGroupIds) { licenseKeyGroupDao.addReferencingFeatureGroup( - new LicenseKeyGroupEntity(featureGroup.getVendorLicenseModelId(), - featureGroup.getVersion(), licenseKeyGroupId), featureGroup.getId()); + new LicenseKeyGroupEntity(featureGroup.getVendorLicenseModelId(), + featureGroup.getVersion(), licenseKeyGroupId), featureGroup.getId()); } } } @@ -987,8 +755,8 @@ public class VendorLicenseManagerImpl implements VendorLicenseManager { if (licenseKeyGroupIds != null) { for (String licenseKeyGroupId : licenseKeyGroupIds) { licenseKeyGroupDao.removeReferencingFeatureGroup( - new LicenseKeyGroupEntity(featureGroup.getVendorLicenseModelId(), - featureGroup.getVersion(), licenseKeyGroupId), featureGroup.getId()); + new LicenseKeyGroupEntity(featureGroup.getVendorLicenseModelId(), + featureGroup.getVersion(), licenseKeyGroupId), featureGroup.getId()); } } } @@ -998,8 +766,8 @@ public class VendorLicenseManagerImpl implements VendorLicenseManager { if (entitlementPoolIds != null) { for (String entitlementPoolId : entitlementPoolIds) { entitlementPoolDao.addReferencingFeatureGroup( - new EntitlementPoolEntity(featureGroup.getVendorLicenseModelId(), - featureGroup.getVersion(), entitlementPoolId), featureGroup.getId()); + new EntitlementPoolEntity(featureGroup.getVendorLicenseModelId(), + featureGroup.getVersion(), entitlementPoolId), featureGroup.getId()); } } } @@ -1009,38 +777,19 @@ public class VendorLicenseManagerImpl implements VendorLicenseManager { if (entitlementPoolIds != null) { for (String entitlementPoolId : entitlementPoolIds) { entitlementPoolDao.removeReferencingFeatureGroup( - new EntitlementPoolEntity(featureGroup.getVendorLicenseModelId(), - featureGroup.getVersion(), entitlementPoolId), featureGroup.getId()); + new EntitlementPoolEntity(featureGroup.getVendorLicenseModelId(), + featureGroup.getVersion(), entitlementPoolId), featureGroup.getId()); } } } - protected VersionInfo getVersionInfo(String vendorLicenseModelId, VersionableEntityAction action, - String user) { - return vendorLicenseFacade.getVersionInfo(vendorLicenseModelId, action, user); - } - - protected LicenseAgreementEntity createLicenseAgreementForList(String vlmId, Version version, - String user) { - return new LicenseAgreementEntity(vlmId, VersioningUtil - .resolveVersion(version, getVersionInfo(vlmId, VersionableEntityAction.Read, user), user), - null); - } - - protected void updateUniqueName(String uniqueValueType ,String oldName, String newName,String ... - context) { + protected void updateUniqueName(String uniqueValueType, String oldName, String newName, String... + context) { UniqueValueUtil - .updateUniqueValue(uniqueValueType, oldName, newName,context); + .updateUniqueValue(uniqueValueType, oldName, newName, context); } - protected void deleteUniqueName(String uniqueValueType,String ... uniqueCombination) { + protected void deleteUniqueName(String uniqueValueType, String... uniqueCombination) { UniqueValueUtil.deleteUniqueValue(uniqueValueType, uniqueCombination); } - - protected Version resloveVersion(String vlmId,Version requestedVersion, VersionInfo versionInfo, - String user){ - return VersioningUtil.resolveVersion(null, - getVersionInfo(vlmId, VersionableEntityAction.Write, user), user); - } - } |