2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.sdc.vendorlicense.facade.impl;
23 import org.openecomp.core.util.UniqueValueUtil;
24 import org.openecomp.core.utilities.CommonMethods;
25 import org.openecomp.sdc.common.errors.CoreException;
26 import org.openecomp.sdc.common.errors.ErrorCode;
27 import org.openecomp.sdc.datatypes.error.ErrorLevel;
28 import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
29 import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage;
30 import org.openecomp.sdc.logging.types.LoggerConstants;
31 import org.openecomp.sdc.logging.types.LoggerErrorCode;
32 import org.openecomp.sdc.logging.types.LoggerErrorDescription;
33 import org.openecomp.sdc.logging.types.LoggerTragetServiceName;
34 import org.openecomp.sdc.vendorlicense.VendorLicenseConstants;
35 import org.openecomp.sdc.vendorlicense.dao.EntitlementPoolDao;
36 import org.openecomp.sdc.vendorlicense.dao.EntitlementPoolDaoFactory;
37 import org.openecomp.sdc.vendorlicense.dao.FeatureGroupDao;
38 import org.openecomp.sdc.vendorlicense.dao.FeatureGroupDaoFactory;
39 import org.openecomp.sdc.vendorlicense.dao.LicenseAgreementDao;
40 import org.openecomp.sdc.vendorlicense.dao.LicenseAgreementDaoFactory;
41 import org.openecomp.sdc.vendorlicense.dao.LicenseKeyGroupDao;
42 import org.openecomp.sdc.vendorlicense.dao.LicenseKeyGroupDaoFactory;
43 import org.openecomp.sdc.vendorlicense.dao.VendorLicenseModelDao;
44 import org.openecomp.sdc.vendorlicense.dao.VendorLicenseModelDaoFactory;
45 import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity;
46 import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity;
47 import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupModel;
48 import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementEntity;
49 import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementModel;
50 import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity;
51 import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity;
52 import org.openecomp.sdc.vendorlicense.errors.SubmitUncompletedLicenseModelErrorBuilder;
53 import org.openecomp.sdc.vendorlicense.errors.VendorLicenseModelNotFoundErrorBuilder;
54 import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade;
55 import org.openecomp.sdc.vendorlicense.types.VersionedVendorLicenseModel;
56 import org.openecomp.sdc.versioning.VersioningManager;
57 import org.openecomp.sdc.versioning.VersioningManagerFactory;
58 import org.openecomp.sdc.versioning.VersioningUtil;
59 import org.openecomp.sdc.versioning.dao.types.Version;
60 import org.openecomp.sdc.versioning.errors.RequestedVersionInvalidErrorBuilder;
61 import org.openecomp.sdc.versioning.errors.VersionableSubEntityNotFoundErrorBuilder;
62 import org.openecomp.sdc.versioning.types.VersionInfo;
63 import org.openecomp.sdc.versioning.types.VersionableEntityAction;
65 import java.util.ArrayList;
66 import java.util.Collection;
67 import java.util.Collections;
68 import java.util.List;
70 import static org.openecomp.sdc.vendorlicense.VendorLicenseConstants.VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE;
71 import static org.openecomp.sdc.vendorlicense.errors.UncompletedVendorLicenseModelErrorType.SUBMIT_UNCOMPLETED_VLM_MSG_FG_MISSING_EP;
72 import static org.openecomp.sdc.vendorlicense.errors.UncompletedVendorLicenseModelErrorType.SUBMIT_UNCOMPLETED_VLM_MSG_LA_MISSING_FG;
73 import static org.openecomp.sdc.vendorlicense.errors.UncompletedVendorLicenseModelErrorType.SUBMIT_UNCOMPLETED_VLM_MSG_MISSING_LA;
75 public class VendorLicenseFacadeImpl implements VendorLicenseFacade {
77 private static final VersioningManager versioningManager =
78 VersioningManagerFactory.getInstance().createInterface();
80 private static final VendorLicenseModelDao
81 vendorLicenseModelDao = VendorLicenseModelDaoFactory.getInstance().createInterface();
82 private static final LicenseAgreementDao
83 licenseAgreementDao = LicenseAgreementDaoFactory.getInstance().createInterface();
84 private static final FeatureGroupDao featureGroupDao =
85 FeatureGroupDaoFactory.getInstance().createInterface();
86 private static final EntitlementPoolDao
87 entitlementPoolDao = EntitlementPoolDaoFactory.getInstance().createInterface();
88 private static final LicenseKeyGroupDao
89 licenseKeyGroupDao = LicenseKeyGroupDaoFactory.getInstance().createInterface();
90 private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
93 * Instantiates a new Vendor license facade.
95 public VendorLicenseFacadeImpl() {
96 vendorLicenseModelDao.registerVersioning(VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE);
97 licenseAgreementDao.registerVersioning(VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE);
98 featureGroupDao.registerVersioning(VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE);
99 entitlementPoolDao.registerVersioning(VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE);
100 licenseKeyGroupDao.registerVersioning(VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE);
104 public Version checkin(String vendorLicenseModelId, String user) {
105 Version newVersion = versioningManager
106 .checkin(VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE, vendorLicenseModelId, user, null);
107 updateVlmLastModificationTime(vendorLicenseModelId, newVersion);
112 public Version submit(String vendorLicenseModelId, String user) {
113 validateCompletedVendorLicenseModel(vendorLicenseModelId, user);
114 Version newVersion = versioningManager
115 .submit(VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE, vendorLicenseModelId, user, null);
116 updateVlmLastModificationTime(vendorLicenseModelId, newVersion);
121 public FeatureGroupEntity getFeatureGroup(FeatureGroupEntity featureGroup, String user) {
122 Version version = VersioningUtil.resolveVersion(featureGroup.getVersion(),
123 getVersionInfo(featureGroup.getVendorLicenseModelId(), VersionableEntityAction.Read,
125 featureGroup.setVersion(version);
126 return getFeatureGroup(featureGroup);
129 private FeatureGroupEntity getFeatureGroup(FeatureGroupEntity featureGroup) {
130 FeatureGroupEntity retrieved = featureGroupDao.get(featureGroup);
132 .validateEntityExistence(retrieved, featureGroup, VendorLicenseModelEntity.ENTITY_TYPE);
137 public FeatureGroupModel getFeatureGroupModel(FeatureGroupEntity featureGroup, String user) {
138 FeatureGroupEntity retrieved = getFeatureGroup(featureGroup, user);
140 FeatureGroupModel featureGroupModel = new FeatureGroupModel();
141 featureGroupModel.setFeatureGroup(retrieved);
143 for (String licenseKeyGroupId : retrieved.getLicenseKeyGroupIds()) {
144 featureGroupModel.getLicenseKeyGroups().add(licenseKeyGroupDao.get(
145 new LicenseKeyGroupEntity(retrieved.getVendorLicenseModelId(), retrieved.getVersion(),
146 licenseKeyGroupId)));
148 for (String entitlementPoolId : retrieved.getEntitlementPoolIds()) {
149 featureGroupModel.getEntitlementPools().add(entitlementPoolDao.get(
150 new EntitlementPoolEntity(retrieved.getVendorLicenseModelId(), retrieved.getVersion(),
151 entitlementPoolId)));
154 return featureGroupModel;
158 public LicenseAgreementModel getLicenseAgreementModel(String vlmId, Version version,
159 String licenseAgreementId, String user) {
160 LicenseAgreementEntity retrieved =
161 getLicenseAgreement(vlmId, version, licenseAgreementId, user);
163 LicenseAgreementModel licenseAgreementModel = new LicenseAgreementModel();
164 licenseAgreementModel.setLicenseAgreement(retrieved);
166 for (String featureGroupId : retrieved.getFeatureGroupIds()) {
167 licenseAgreementModel.getFeatureGroups().add(featureGroupDao
168 .get(new FeatureGroupEntity(vlmId, retrieved.getVersion(), featureGroupId)));
171 return licenseAgreementModel;
175 public EntitlementPoolEntity createEntitlementPool(EntitlementPoolEntity entitlementPool,
177 entitlementPool.setVersion(VersioningUtil.resolveVersion(entitlementPool.getVersion(),
178 getVersionInfo(entitlementPool.getVendorLicenseModelId(), VersionableEntityAction.Write,
180 //entitlementPool.setId(CommonMethods.nextUuId());
181 entitlementPool.setVersionUuId(CommonMethods.nextUuId());
182 UniqueValueUtil.createUniqueValue(VendorLicenseConstants.UniqueValues.ENTITLEMENT_POOL_NAME,
183 entitlementPool.getVendorLicenseModelId(), entitlementPool.getVersion().toString(),
184 entitlementPool.getName());
185 entitlementPoolDao.create(entitlementPool);
186 updateVlmLastModificationTime(entitlementPool.getVendorLicenseModelId(),
187 entitlementPool.getVersion());
188 return entitlementPool;
192 public void updateEntitlementPool(EntitlementPoolEntity entitlementPool, String user) {
193 entitlementPool.setVersion(VersioningUtil.resolveVersion(entitlementPool.getVersion(),
194 getVersionInfo(entitlementPool.getVendorLicenseModelId(), VersionableEntityAction.Write,
196 EntitlementPoolEntity retrieved = entitlementPoolDao.get(entitlementPool);
198 .validateEntityExistence(retrieved, entitlementPool, VendorLicenseModelEntity.ENTITY_TYPE);
200 UniqueValueUtil.updateUniqueValue(VendorLicenseConstants.UniqueValues.ENTITLEMENT_POOL_NAME,
201 retrieved.getName(), entitlementPool.getName(), entitlementPool.getVendorLicenseModelId(),
202 entitlementPool.getVersion().toString());
203 entitlementPool.setVersionUuId(CommonMethods.nextUuId());
204 entitlementPoolDao.update(entitlementPool);
206 updateVlmLastModificationTime(entitlementPool.getVendorLicenseModelId(),
207 entitlementPool.getVersion());
212 public Collection<LicenseKeyGroupEntity> listLicenseKeyGroups(String vlmId, Version version,
214 return licenseKeyGroupDao.list(new LicenseKeyGroupEntity(vlmId, VersioningUtil
215 .resolveVersion(version, getVersionInfo(vlmId, VersionableEntityAction.Read, user), user),
220 public Collection<EntitlementPoolEntity> listEntitlementPools(String vlmId, Version version,
222 return entitlementPoolDao.list(new EntitlementPoolEntity(vlmId, VersioningUtil
223 .resolveVersion(version, getVersionInfo(vlmId, VersionableEntityAction.Read, user), user),
228 public void updateLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup, String user) {
229 licenseKeyGroup.setVersion(VersioningUtil.resolveVersion(licenseKeyGroup.getVersion(),
230 getVersionInfo(licenseKeyGroup.getVendorLicenseModelId(), VersionableEntityAction.Write,
232 LicenseKeyGroupEntity retrieved = licenseKeyGroupDao.get(licenseKeyGroup);
233 licenseKeyGroup.setVersionUuId((CommonMethods.nextUuId()));
235 .validateEntityExistence(retrieved, licenseKeyGroup, VendorLicenseModelEntity.ENTITY_TYPE);
236 UniqueValueUtil.updateUniqueValue(VendorLicenseConstants.UniqueValues.LICENSE_KEY_GROUP_NAME,
237 retrieved.getName(), licenseKeyGroup.getName(), licenseKeyGroup.getVendorLicenseModelId(),
238 licenseKeyGroup.getVersion().toString());
239 licenseKeyGroupDao.update(licenseKeyGroup);
241 updateVlmLastModificationTime(licenseKeyGroup.getVendorLicenseModelId(),
242 licenseKeyGroup.getVersion());
246 public LicenseKeyGroupEntity createLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup,
248 licenseKeyGroup.setVersion(VersioningUtil.resolveVersion(licenseKeyGroup.getVersion(),
249 getVersionInfo(licenseKeyGroup.getVendorLicenseModelId(), VersionableEntityAction.Write,
251 //licenseKeyGroup.setId(CommonMethods.nextUuId());
252 licenseKeyGroup.setVersionUuId(CommonMethods.nextUuId());
253 UniqueValueUtil.createUniqueValue(VendorLicenseConstants.UniqueValues.LICENSE_KEY_GROUP_NAME,
254 licenseKeyGroup.getVendorLicenseModelId(), licenseKeyGroup.getVersion().toString(),
255 licenseKeyGroup.getName());
256 licenseKeyGroupDao.create(licenseKeyGroup);
257 updateVlmLastModificationTime(licenseKeyGroup.getVendorLicenseModelId(),
258 licenseKeyGroup.getVersion());
259 return licenseKeyGroup;
263 public VersionedVendorLicenseModel getVendorLicenseModel(String vlmId, Version version,
265 mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId);
267 VersionInfo versionInfo = getVersionInfo(vlmId, VersionableEntityAction.Read, user);
269 VendorLicenseModelEntity vendorLicenseModel = vendorLicenseModelDao.get(
270 new VendorLicenseModelEntity(vlmId,
271 VersioningUtil.resolveVersion(version, versionInfo, user)));
272 if (vendorLicenseModel == null) {
273 MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
274 LoggerTragetServiceName.GET_VLM, ErrorLevel.ERROR.name(),
275 LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.ENTITY_NOT_FOUND);
276 throw new CoreException(new VendorLicenseModelNotFoundErrorBuilder(vlmId).build());
279 mdcDataDebugMessage.debugExitMessage("VLM id", vlmId);
280 return new VersionedVendorLicenseModel(vendorLicenseModel, versionInfo);
284 public VendorLicenseModelEntity createVendorLicenseModel(
285 VendorLicenseModelEntity vendorLicenseModelEntity, String user) {
287 mdcDataDebugMessage.debugEntryMessage(null, null);
289 UniqueValueUtil.validateUniqueValue(VendorLicenseConstants.UniqueValues.VENDOR_NAME,
290 vendorLicenseModelEntity.getVendorName());
291 //vendorLicenseModelEntity.setId(CommonMethods.nextUuId());
293 vendorLicenseModelDao.create(vendorLicenseModelEntity);
294 UniqueValueUtil.createUniqueValue(VendorLicenseConstants.UniqueValues.VENDOR_NAME,
295 vendorLicenseModelEntity.getVendorName());
297 Version version = versioningManager
298 .create(VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE, vendorLicenseModelEntity.getId(), user);
299 vendorLicenseModelEntity.setVersion(version);
301 mdcDataDebugMessage.debugExitMessage(null, null);
302 return vendorLicenseModelEntity;
306 public LicenseAgreementEntity createLicenseAgreement(LicenseAgreementEntity licenseAgreement,
308 Version version = VersioningUtil.resolveVersion(licenseAgreement.getVersion(),
309 getVersionInfo(licenseAgreement.getVendorLicenseModelId(), VersionableEntityAction.Write,
311 licenseAgreement.setVersion(version);
312 //licenseAgreement.setId(CommonMethods.nextUuId());
313 VersioningUtil.validateEntitiesExistence(licenseAgreement.getFeatureGroupIds(),
314 new FeatureGroupEntity(licenseAgreement.getVendorLicenseModelId(), version, null),
315 featureGroupDao, VendorLicenseModelEntity.ENTITY_TYPE);
317 UniqueValueUtil.validateUniqueValue(VendorLicenseConstants.UniqueValues.LICENSE_AGREEMENT_NAME,
318 licenseAgreement.getVendorLicenseModelId(), licenseAgreement.getVersion().toString(),
319 licenseAgreement.getName());
321 licenseAgreementDao.create(licenseAgreement);
322 UniqueValueUtil.createUniqueValue(VendorLicenseConstants.UniqueValues.LICENSE_AGREEMENT_NAME,
323 licenseAgreement.getVendorLicenseModelId(), licenseAgreement.getVersion().toString(),
324 licenseAgreement.getName());
325 if (licenseAgreement.getFeatureGroupIds() != null) {
326 for (String addedFgId : licenseAgreement.getFeatureGroupIds()) {
327 featureGroupDao.addReferencingLicenseAgreement(
328 new FeatureGroupEntity(licenseAgreement.getVendorLicenseModelId(), version,
329 addedFgId), licenseAgreement.getId());
332 updateVlmLastModificationTime(licenseAgreement.getVendorLicenseModelId(),
333 licenseAgreement.getVersion());
335 return licenseAgreement;
339 public FeatureGroupEntity createFeatureGroup(FeatureGroupEntity featureGroup, String user) {
340 Version version = VersioningUtil.resolveVersion(featureGroup.getVersion(),
341 getVersionInfo(featureGroup.getVendorLicenseModelId(), VersionableEntityAction.Write,
343 //featureGroup.setId(CommonMethods.nextUuId());
344 featureGroup.setVersion(version);
345 VersioningUtil.validateEntitiesExistence(featureGroup.getLicenseKeyGroupIds(),
346 new LicenseKeyGroupEntity(featureGroup.getVendorLicenseModelId(), version, null),
347 licenseKeyGroupDao, VendorLicenseModelEntity.ENTITY_TYPE);
348 VersioningUtil.validateEntitiesExistence(featureGroup.getEntitlementPoolIds(),
349 new EntitlementPoolEntity(featureGroup.getVendorLicenseModelId(), version, null),
350 entitlementPoolDao, VendorLicenseModelEntity.ENTITY_TYPE);
351 UniqueValueUtil.validateUniqueValue(VendorLicenseConstants.UniqueValues.FEATURE_GROUP_NAME,
352 featureGroup.getVendorLicenseModelId(), featureGroup.getVersion().toString(),
353 featureGroup.getName());
355 featureGroupDao.create(featureGroup);
356 UniqueValueUtil.createUniqueValue(VendorLicenseConstants.UniqueValues.FEATURE_GROUP_NAME,
357 featureGroup.getVendorLicenseModelId(), featureGroup.getVersion().toString(),
358 featureGroup.getName());
360 if (featureGroup.getLicenseKeyGroupIds() != null) {
361 for (String addedLkgId : featureGroup.getLicenseKeyGroupIds()) {
362 licenseKeyGroupDao.addReferencingFeatureGroup(
363 new LicenseKeyGroupEntity(featureGroup.getVendorLicenseModelId(), version, addedLkgId),
364 featureGroup.getId());
368 if (featureGroup.getEntitlementPoolIds() != null) {
369 for (String addedEpId : featureGroup.getEntitlementPoolIds()) {
370 entitlementPoolDao.addReferencingFeatureGroup(
371 new EntitlementPoolEntity(featureGroup.getVendorLicenseModelId(), version, addedEpId),
372 featureGroup.getId());
376 updateVlmLastModificationTime(featureGroup.getVendorLicenseModelId(),
377 featureGroup.getVersion());
383 public Collection<ErrorCode> validateLicensingData(String vlmId, Version version,
384 String licenseAgreementId,
385 Collection<String> featureGroupIds) {
387 VersionInfo versionInfo = getVersionInfo(vlmId, VersionableEntityAction.Read, "");
388 if (version == null || !version.isFinal()
389 || !versionInfo.getViewableVersions().contains(version)) {
390 return Collections.singletonList(new RequestedVersionInvalidErrorBuilder().build());
392 } catch (CoreException exception) {
393 return Collections.singletonList(exception.code());
396 List<ErrorCode> errorMessages = new ArrayList<>();
399 getLicenseAgreement(vlmId, licenseAgreementId, version);
400 } catch (CoreException exception) {
401 errorMessages.add(exception.code());
404 for (String featureGroupId : featureGroupIds) {
406 FeatureGroupEntity featureGroup =
407 getFeatureGroup(new FeatureGroupEntity(vlmId, version, featureGroupId));
408 if (!featureGroup.getReferencingLicenseAgreements().contains(licenseAgreementId)) {
409 errorMessages.add(new VersionableSubEntityNotFoundErrorBuilder(
410 featureGroup.getEntityType(),
412 LicenseAgreementEntity.ENTITY_TYPE,
416 } catch (CoreException exception) {
417 errorMessages.add(exception.code());
421 return errorMessages;
425 public VersionInfo getVersionInfo(String vendorLicenseModelId, VersionableEntityAction action,
427 return versioningManager
428 .getEntityVersionInfo(VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE, vendorLicenseModelId, user,
433 public void updateVlmLastModificationTime(String vendorLicenseModelId, Version version) {
434 VendorLicenseModelEntity retrieved =
435 vendorLicenseModelDao.get(new VendorLicenseModelEntity(vendorLicenseModelId, version));
436 vendorLicenseModelDao.update(retrieved);
440 public LicenseAgreementEntity getLicenseAgreement(String vlmId, Version version,
441 String licenseAgreementId, String user) {
442 return getLicenseAgreement(vlmId, licenseAgreementId, VersioningUtil
443 .resolveVersion(version, getVersionInfo(vlmId, VersionableEntityAction.Read, user), user));
446 private LicenseAgreementEntity getLicenseAgreement(String vlmId, String licenseAgreementId,
448 LicenseAgreementEntity input = new LicenseAgreementEntity(vlmId, version, licenseAgreementId);
449 LicenseAgreementEntity retrieved = licenseAgreementDao.get(input);
450 VersioningUtil.validateEntityExistence(retrieved, input, VendorLicenseModelEntity.ENTITY_TYPE);
454 private void validateCompletedVendorLicenseModel(String vendorLicenseModelId, String user) {
455 Version version = VersioningUtil.resolveVersion(null,
456 getVersionInfo(vendorLicenseModelId, VersionableEntityAction.Read, user), user);
457 Collection<LicenseAgreementEntity> licenseAgreements = licenseAgreementDao
458 .list(new LicenseAgreementEntity(vendorLicenseModelId, version, null));
460 if (licenseAgreements == null || licenseAgreements.isEmpty()) {
461 MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
462 LoggerTragetServiceName.SUBMIT_ENTITY, ErrorLevel.ERROR.name(),
463 LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.SUBMIT_ENTITY);
464 throw new CoreException(
465 new SubmitUncompletedLicenseModelErrorBuilder(SUBMIT_UNCOMPLETED_VLM_MSG_MISSING_LA).build());
468 for (LicenseAgreementEntity licenseAgreement : licenseAgreements) {
469 if (licenseAgreement.getFeatureGroupIds() == null || licenseAgreement.getFeatureGroupIds().isEmpty()) {
470 MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
471 LoggerTragetServiceName.SUBMIT_ENTITY, ErrorLevel.ERROR.name(),
472 LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.SUBMIT_ENTITY);
473 throw new CoreException(
474 new SubmitUncompletedLicenseModelErrorBuilder(SUBMIT_UNCOMPLETED_VLM_MSG_LA_MISSING_FG).build());
478 Collection<FeatureGroupEntity> featureGroupEntities =
479 featureGroupDao.list(new FeatureGroupEntity(vendorLicenseModelId, version, null));
480 for (FeatureGroupEntity featureGroupEntity : featureGroupEntities) {
481 if (featureGroupEntity.getEntitlementPoolIds() == null || featureGroupEntity.getEntitlementPoolIds().isEmpty()) {
482 MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
483 LoggerTragetServiceName.SUBMIT_ENTITY, ErrorLevel.ERROR.name(),
484 LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.SUBMIT_ENTITY);
485 throw new CoreException(
486 new SubmitUncompletedLicenseModelErrorBuilder(SUBMIT_UNCOMPLETED_VLM_MSG_FG_MISSING_EP).build());