push addional code
[sdc.git] / openecomp-be / lib / openecomp-sdc-vendor-license-lib / openecomp-sdc-vendor-license-core / src / main / java / org / openecomp / sdc / vendorlicense / facade / impl / VendorLicenseFacadeImpl.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20
21 package org.openecomp.sdc.vendorlicense.facade.impl;
22
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.vendorlicense.VendorLicenseConstants;
28 import org.openecomp.sdc.vendorlicense.dao.EntitlementPoolDao;
29 import org.openecomp.sdc.vendorlicense.dao.EntitlementPoolDaoFactory;
30 import org.openecomp.sdc.vendorlicense.dao.FeatureGroupDao;
31 import org.openecomp.sdc.vendorlicense.dao.FeatureGroupDaoFactory;
32 import org.openecomp.sdc.vendorlicense.dao.LicenseAgreementDao;
33 import org.openecomp.sdc.vendorlicense.dao.LicenseAgreementDaoFactory;
34 import org.openecomp.sdc.vendorlicense.dao.LicenseKeyGroupDao;
35 import org.openecomp.sdc.vendorlicense.dao.LicenseKeyGroupDaoFactory;
36 import org.openecomp.sdc.vendorlicense.dao.VendorLicenseModelDao;
37 import org.openecomp.sdc.vendorlicense.dao.VendorLicenseModelDaoFactory;
38 import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity;
39 import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity;
40 import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupModel;
41 import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementEntity;
42 import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementModel;
43 import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity;
44 import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity;
45 import org.openecomp.sdc.vendorlicense.errors.SubmitUncompletedLicenseModelErrorBuilder;
46 import org.openecomp.sdc.vendorlicense.errors.VendorLicenseModelNotFoundErrorBuilder;
47 import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade;
48 import org.openecomp.sdc.vendorlicense.types.VersionedVendorLicenseModel;
49 import org.openecomp.sdc.versioning.VersioningManager;
50 import org.openecomp.sdc.versioning.VersioningManagerFactory;
51 import org.openecomp.sdc.versioning.VersioningUtil;
52 import org.openecomp.sdc.versioning.dao.types.Version;
53 import org.openecomp.sdc.versioning.errors.RequestedVersionInvalidErrorBuilder;
54 import org.openecomp.sdc.versioning.errors.VersionableSubEntityNotFoundErrorBuilder;
55 import org.openecomp.sdc.versioning.types.VersionInfo;
56 import org.openecomp.sdc.versioning.types.VersionableEntityAction;
57
58 import java.util.ArrayList;
59 import java.util.Collection;
60 import java.util.Collections;
61 import java.util.List;
62
63
64 public class VendorLicenseFacadeImpl
65     implements VendorLicenseFacade {
66
67
68   private static final VersioningManager versioningManager =
69       VersioningManagerFactory.getInstance().createInterface();
70
71   private static final VendorLicenseModelDao vendorLicenseModelDao =
72       VendorLicenseModelDaoFactory.getInstance().createInterface();
73   private static final LicenseAgreementDao licenseAgreementDao =
74       LicenseAgreementDaoFactory.getInstance().createInterface();
75   private static final FeatureGroupDao featureGroupDao =
76       FeatureGroupDaoFactory.getInstance().createInterface();
77   private static final EntitlementPoolDao entitlementPoolDao =
78       EntitlementPoolDaoFactory.getInstance().createInterface();
79   private static final LicenseKeyGroupDao licenseKeyGroupDao =
80       LicenseKeyGroupDaoFactory.getInstance().createInterface();
81
82   /**
83    * Instantiates a new Vendor license facade.
84    */
85   public VendorLicenseFacadeImpl() {
86     vendorLicenseModelDao
87         .registerVersioning(VendorLicenseConstants.VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE);
88     licenseAgreementDao
89         .registerVersioning(VendorLicenseConstants.VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE);
90     featureGroupDao
91         .registerVersioning(VendorLicenseConstants.VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE);
92     entitlementPoolDao
93         .registerVersioning(VendorLicenseConstants.VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE);
94     licenseKeyGroupDao
95         .registerVersioning(VendorLicenseConstants.VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE);
96   }
97
98   @Override
99   public void checkin(String vendorLicenseModelId, String user) {
100     Version newVersion = versioningManager
101         .checkin(VendorLicenseConstants
102             .VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE,
103             vendorLicenseModelId, user, null);
104     updateVlmLastModificationTime(vendorLicenseModelId, newVersion);
105   }
106
107   @Override
108   public void submit(String vendorLicenseModelId, String user) {
109     validateCompletedVendorLicenseModel(vendorLicenseModelId, user);
110     Version newVersion = versioningManager
111         .submit(VendorLicenseConstants
112             .VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE,
113             vendorLicenseModelId, user, null);
114     updateVlmLastModificationTime(vendorLicenseModelId, newVersion);
115   }
116
117   @Override
118   public FeatureGroupEntity getFeatureGroup(FeatureGroupEntity featureGroup, String user) {
119     Version version = VersioningUtil.resolveVersion(featureGroup.getVersion(),
120         getVersionInfo(featureGroup.getVendorLicenseModelId(), VersionableEntityAction.Read, user));
121     featureGroup.setVersion(version);
122     return getFeatureGroup(featureGroup);
123   }
124
125   private FeatureGroupEntity getFeatureGroup(FeatureGroupEntity featureGroup) {
126     FeatureGroupEntity retrieved = featureGroupDao.get(featureGroup);
127     VersioningUtil
128         .validateEntityExistence(retrieved, featureGroup, VendorLicenseModelEntity.ENTITY_TYPE);
129     return retrieved;
130   }
131
132   @Override
133   public FeatureGroupModel getFeatureGroupModel(FeatureGroupEntity featureGroup, String user) {
134     FeatureGroupEntity retrieved = getFeatureGroup(featureGroup, user);
135
136     FeatureGroupModel featureGroupModel = new FeatureGroupModel();
137     featureGroupModel.setFeatureGroup(retrieved);
138
139     for (String licenseKeyGroupId : retrieved.getLicenseKeyGroupIds()) {
140       featureGroupModel.getLicenseKeyGroups().add(licenseKeyGroupDao.get(
141           new LicenseKeyGroupEntity(retrieved.getVendorLicenseModelId(), retrieved.getVersion(),
142               licenseKeyGroupId)));
143     }
144     for (String entitlementPoolId : retrieved.getEntitlementPoolIds()) {
145       featureGroupModel.getEntitlementPools().add(entitlementPoolDao.get(
146           new EntitlementPoolEntity(retrieved.getVendorLicenseModelId(), retrieved.getVersion(),
147               entitlementPoolId)));
148     }
149
150     return featureGroupModel;
151   }
152
153   @Override
154   public LicenseAgreementEntity getLicenseAgreement(String vlmId, Version version,
155                                                     String licenseAgreementId, String user) {
156     return getLicenseAgreement(vlmId, licenseAgreementId, VersioningUtil
157         .resolveVersion(version, getVersionInfo(vlmId, VersionableEntityAction.Read, user)));
158   }
159
160   private LicenseAgreementEntity getLicenseAgreement(String vlmId, String licenseAgreementId,
161                                                      Version version) {
162     LicenseAgreementEntity input = new LicenseAgreementEntity(vlmId, version, licenseAgreementId);
163     LicenseAgreementEntity retrieved = licenseAgreementDao.get(input);
164     VersioningUtil.validateEntityExistence(retrieved, input, VendorLicenseModelEntity.ENTITY_TYPE);
165     return retrieved;
166   }
167
168   @Override
169   public LicenseAgreementModel getLicenseAgreementModel(String vlmId, Version version,
170                                                         String licenseAgreementId, String user) {
171     LicenseAgreementEntity retrieved =
172         getLicenseAgreement(vlmId, version, licenseAgreementId, user);
173
174     LicenseAgreementModel licenseAgreementModel = new LicenseAgreementModel();
175     licenseAgreementModel.setLicenseAgreement(retrieved);
176
177     for (String featureGroupId : retrieved.getFeatureGroupIds()) {
178       licenseAgreementModel.getFeatureGroups().add(featureGroupDao
179           .get(new FeatureGroupEntity(vlmId, retrieved.getVersion(), featureGroupId)));
180     }
181
182     return licenseAgreementModel;
183   }
184
185   @Override
186   public EntitlementPoolEntity createEntitlementPool(EntitlementPoolEntity entitlementPool,
187                                                      String user) {
188     entitlementPool.setVersion(
189         getVersionInfo(entitlementPool.getVendorLicenseModelId(), VersionableEntityAction.Write,
190             user).getActiveVersion());
191     entitlementPool.setId(CommonMethods.nextUuId());
192     entitlementPool.setVersionUuId(CommonMethods.nextUuId());
193     UniqueValueUtil.createUniqueValue(VendorLicenseConstants.UniqueValues.ENTITLEMENT_POOL_NAME,
194         entitlementPool.getVendorLicenseModelId(), entitlementPool.getVersion().toString(),
195         entitlementPool.getName());
196     entitlementPoolDao.create(entitlementPool);
197     updateVlmLastModificationTime(entitlementPool.getVendorLicenseModelId(),
198         entitlementPool.getVersion());
199     return entitlementPool;
200   }
201
202   @Override
203   public LicenseKeyGroupEntity createLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup,
204                                                      String user) {
205     licenseKeyGroup.setVersion(
206         getVersionInfo(licenseKeyGroup.getVendorLicenseModelId(), VersionableEntityAction.Write,
207             user).getActiveVersion());
208     licenseKeyGroup.setId(CommonMethods.nextUuId());
209     licenseKeyGroup.setVersionUuId(CommonMethods.nextUuId());
210     UniqueValueUtil.createUniqueValue(VendorLicenseConstants.UniqueValues.LICENSE_KEY_GROUP_NAME,
211         licenseKeyGroup.getVendorLicenseModelId(), licenseKeyGroup.getVersion().toString(),
212         licenseKeyGroup.getName());
213     licenseKeyGroupDao.create(licenseKeyGroup);
214     updateVlmLastModificationTime(licenseKeyGroup.getVendorLicenseModelId(),
215         licenseKeyGroup.getVersion());
216     return licenseKeyGroup;
217   }
218
219   @Override
220   public void updateEntitlementPool(EntitlementPoolEntity entitlementPool, String user) {
221     entitlementPool.setVersion(
222         getVersionInfo(entitlementPool.getVendorLicenseModelId(), VersionableEntityAction.Write,
223             user).getActiveVersion());
224     EntitlementPoolEntity retrieved = entitlementPoolDao.get(entitlementPool);
225     VersioningUtil
226         .validateEntityExistence(retrieved, entitlementPool, VendorLicenseModelEntity.ENTITY_TYPE);
227
228     UniqueValueUtil.updateUniqueValue(VendorLicenseConstants.UniqueValues.ENTITLEMENT_POOL_NAME,
229         retrieved.getName(), entitlementPool.getName(), entitlementPool.getVendorLicenseModelId(),
230         entitlementPool.getVersion().toString());
231     entitlementPool.setVersionUuId(CommonMethods.nextUuId());
232     entitlementPoolDao.update(entitlementPool);
233
234     updateVlmLastModificationTime(entitlementPool.getVendorLicenseModelId(),
235         entitlementPool.getVersion());
236
237   }
238
239   @Override
240   public Collection<LicenseKeyGroupEntity> listLicenseKeyGroups(String vlmId, Version version,
241                                                                 String user) {
242     return licenseKeyGroupDao.list(new LicenseKeyGroupEntity(vlmId, VersioningUtil
243         .resolveVersion(version, getVersionInfo(vlmId, VersionableEntityAction.Read, user)), null));
244   }
245
246   @Override
247   public Collection<EntitlementPoolEntity> listEntitlementPools(String vlmId, Version version,
248                                                                 String user) {
249     return entitlementPoolDao.list(new EntitlementPoolEntity(vlmId, VersioningUtil
250         .resolveVersion(version, getVersionInfo(vlmId, VersionableEntityAction.Read, user)), null));
251   }
252
253   @Override
254   public void updateLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup, String user) {
255     licenseKeyGroup.setVersion(
256         getVersionInfo(licenseKeyGroup.getVendorLicenseModelId(), VersionableEntityAction.Write,
257             user).getActiveVersion());
258     LicenseKeyGroupEntity retrieved = licenseKeyGroupDao.get(licenseKeyGroup);
259     licenseKeyGroup.setVersionUuId((CommonMethods.nextUuId()));
260     VersioningUtil
261         .validateEntityExistence(retrieved, licenseKeyGroup, VendorLicenseModelEntity.ENTITY_TYPE);
262     UniqueValueUtil.updateUniqueValue(VendorLicenseConstants.UniqueValues.LICENSE_KEY_GROUP_NAME,
263         retrieved.getName(), licenseKeyGroup.getName(), licenseKeyGroup.getVendorLicenseModelId(),
264         licenseKeyGroup.getVersion().toString());
265     licenseKeyGroupDao.update(licenseKeyGroup);
266
267     updateVlmLastModificationTime(licenseKeyGroup.getVendorLicenseModelId(),
268         licenseKeyGroup.getVersion());
269   }
270
271
272   @Override
273   public VersionInfo getVersionInfo(String vendorLicenseModelId, VersionableEntityAction action,
274                                     String user) {
275     return versioningManager
276         .getEntityVersionInfo(VendorLicenseConstants
277             .VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE,
278             vendorLicenseModelId, user,
279             action);
280   }
281
282   @Override
283   public VersionedVendorLicenseModel getVendorLicenseModel(String vlmId, Version version,
284                                                            String user) {
285     VersionInfo versionInfo = getVersionInfo(vlmId, VersionableEntityAction.Read, user);
286
287     VendorLicenseModelEntity vendorLicenseModel = vendorLicenseModelDao.get(
288         new VendorLicenseModelEntity(vlmId, VersioningUtil.resolveVersion(version, versionInfo)));
289     if (vendorLicenseModel == null) {
290       throw new CoreException(new VendorLicenseModelNotFoundErrorBuilder(vlmId).build());
291     }
292
293     return new VersionedVendorLicenseModel(vendorLicenseModel, versionInfo);
294   }
295
296   @Override
297   public VendorLicenseModelEntity createVendorLicenseModel(
298       VendorLicenseModelEntity vendorLicenseModelEntity, String user) {
299     UniqueValueUtil.validateUniqueValue(VendorLicenseConstants.UniqueValues.VENDOR_NAME,
300         vendorLicenseModelEntity.getVendorName());
301     vendorLicenseModelEntity.setId(CommonMethods.nextUuId());
302
303     Version version = versioningManager
304         .create(VendorLicenseConstants
305             .VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE,
306             vendorLicenseModelEntity.getId(), user);
307     vendorLicenseModelEntity.setVersion(version);
308
309     //        vendorLicenseModelEntity.setLastModificationTime(new Date());
310
311     vendorLicenseModelDao.create(vendorLicenseModelEntity);
312     UniqueValueUtil.createUniqueValue(VendorLicenseConstants.UniqueValues.VENDOR_NAME,
313         vendorLicenseModelEntity.getVendorName());
314
315     return vendorLicenseModelEntity;
316   }
317
318   @Override
319   public LicenseAgreementEntity createLicenseAgreement(LicenseAgreementEntity licenseAgreement,
320                                                        String user) {
321     Version activeVersion =
322         getVersionInfo(licenseAgreement.getVendorLicenseModelId(), VersionableEntityAction.Write,
323             user).getActiveVersion();
324     licenseAgreement.setVersion(activeVersion);
325     licenseAgreement.setId(CommonMethods.nextUuId());
326     VersioningUtil.validateEntitiesExistence(licenseAgreement.getFeatureGroupIds(),
327         new FeatureGroupEntity(licenseAgreement.getVendorLicenseModelId(), activeVersion, null),
328         featureGroupDao, VendorLicenseModelEntity.ENTITY_TYPE);
329     UniqueValueUtil.validateUniqueValue(VendorLicenseConstants.UniqueValues.LICENSE_AGREEMENT_NAME,
330         licenseAgreement.getVendorLicenseModelId(), licenseAgreement.getVersion().toString(),
331         licenseAgreement.getName());
332
333     if (licenseAgreement.getFeatureGroupIds() != null) {
334       for (String addedFgId : licenseAgreement.getFeatureGroupIds()) {
335         featureGroupDao.addReferencingLicenseAgreement(
336             new FeatureGroupEntity(licenseAgreement.getVendorLicenseModelId(), activeVersion,
337                 addedFgId), licenseAgreement.getId());
338       }
339     }
340
341     licenseAgreementDao.create(licenseAgreement);
342     UniqueValueUtil.createUniqueValue(VendorLicenseConstants.UniqueValues.LICENSE_AGREEMENT_NAME,
343         licenseAgreement.getVendorLicenseModelId(), licenseAgreement.getVersion().toString(),
344         licenseAgreement.getName());
345
346     updateVlmLastModificationTime(licenseAgreement.getVendorLicenseModelId(),
347         licenseAgreement.getVersion());
348
349     return licenseAgreement;
350   }
351
352   @Override
353   public FeatureGroupEntity createFeatureGroup(FeatureGroupEntity featureGroup, String user) {
354     Version activeVersion =
355         getVersionInfo(featureGroup.getVendorLicenseModelId(), VersionableEntityAction.Write, user)
356             .getActiveVersion();
357     featureGroup.setId(CommonMethods.nextUuId());
358     featureGroup.setVersion(activeVersion);
359     VersioningUtil.validateEntitiesExistence(featureGroup.getLicenseKeyGroupIds(),
360         new LicenseKeyGroupEntity(featureGroup.getVendorLicenseModelId(), activeVersion, null),
361         licenseKeyGroupDao, VendorLicenseModelEntity.ENTITY_TYPE);
362     VersioningUtil.validateEntitiesExistence(featureGroup.getEntitlementPoolIds(),
363         new EntitlementPoolEntity(featureGroup.getVendorLicenseModelId(), activeVersion, null),
364         entitlementPoolDao, VendorLicenseModelEntity.ENTITY_TYPE);
365     UniqueValueUtil.validateUniqueValue(VendorLicenseConstants.UniqueValues.FEATURE_GROUP_NAME,
366         featureGroup.getVendorLicenseModelId(), featureGroup.getVersion().toString(),
367         featureGroup.getName());
368
369     if (featureGroup.getLicenseKeyGroupIds() != null) {
370       for (String addedLkgId : featureGroup.getLicenseKeyGroupIds()) {
371         licenseKeyGroupDao.addReferencingFeatureGroup(
372             new LicenseKeyGroupEntity(featureGroup.getVendorLicenseModelId(), activeVersion,
373                 addedLkgId), featureGroup.getId());
374       }
375     }
376
377     if (featureGroup.getEntitlementPoolIds() != null) {
378       for (String addedEpId : featureGroup.getEntitlementPoolIds()) {
379         entitlementPoolDao.addReferencingFeatureGroup(
380             new EntitlementPoolEntity(featureGroup.getVendorLicenseModelId(), activeVersion,
381                 addedEpId), featureGroup.getId());
382       }
383     }
384
385     featureGroupDao.create(featureGroup);
386     UniqueValueUtil.createUniqueValue(VendorLicenseConstants.UniqueValues.FEATURE_GROUP_NAME,
387         featureGroup.getVendorLicenseModelId(), featureGroup.getVersion().toString(),
388         featureGroup.getName());
389
390     updateVlmLastModificationTime(featureGroup.getVendorLicenseModelId(),
391         featureGroup.getVersion());
392
393     return featureGroup;
394   }
395
396
397   @Override
398   public Collection<ErrorCode> validateLicensingData(String vlmId, Version version,
399                                                      String licenseAgreementId,
400                                                      Collection<String> featureGroupIds) {
401     try {
402       VersionInfo versionInfo = getVersionInfo(vlmId, VersionableEntityAction.Read, "");
403       if (version == null || !version.isFinal()
404           || !versionInfo.getViewableVersions().contains(version)) {
405         return Collections.singletonList(new RequestedVersionInvalidErrorBuilder().build());
406       }
407     } catch (CoreException coreException) {
408       return Collections.singletonList(coreException.code());
409     }
410
411     List<ErrorCode> errorMessages = new ArrayList<>();
412
413     try {
414       getLicenseAgreement(vlmId, licenseAgreementId, version);
415     } catch (CoreException coreException) {
416       errorMessages.add(coreException.code());
417     }
418
419     for (String featureGroupId : featureGroupIds) {
420       try {
421         FeatureGroupEntity featureGroup =
422             getFeatureGroup(new FeatureGroupEntity(vlmId, version, featureGroupId));
423         if (!featureGroup.getReferencingLicenseAgreements().contains(licenseAgreementId)) {
424           errorMessages.add(new VersionableSubEntityNotFoundErrorBuilder(
425               featureGroup.getEntityType(),
426               featureGroupId,
427               LicenseAgreementEntity.ENTITY_TYPE,
428               licenseAgreementId,
429               version).build());
430         }
431       } catch (CoreException coreException) {
432         errorMessages.add(coreException.code());
433       }
434     }
435
436     return errorMessages;
437   }
438
439   @Override
440   public void updateVlmLastModificationTime(String vendorLicenseModelId, Version version) {
441     VendorLicenseModelEntity retrieved =
442         vendorLicenseModelDao.get(new VendorLicenseModelEntity(vendorLicenseModelId, version));
443     vendorLicenseModelDao.update(retrieved);
444     //        entity.setLastModificationTime(new Date());
445     //
446     //        vendorLicenseModelDao.updateLastModificationTime(entity);
447   }
448
449   private void validateCompletedVendorLicenseModel(String vendorLicenseModelId, String user) {
450     Version activeVersion =
451         getVersionInfo(vendorLicenseModelId, VersionableEntityAction.Read, user).getActiveVersion();
452     Collection<LicenseAgreementEntity> licenseAgreements = licenseAgreementDao
453         .list(new LicenseAgreementEntity(vendorLicenseModelId, activeVersion, null));
454
455     if (licenseAgreements == null || licenseAgreements.isEmpty()) {
456       throw new CoreException(
457           new SubmitUncompletedLicenseModelErrorBuilder(vendorLicenseModelId).build());
458     }
459
460     for (LicenseAgreementEntity licenseAgreement : licenseAgreements) {
461       if (licenseAgreement.getFeatureGroupIds() == null
462           || licenseAgreement.getFeatureGroupIds().isEmpty()) {
463         throw new CoreException(
464             new SubmitUncompletedLicenseModelErrorBuilder(vendorLicenseModelId).build());
465       }
466     }
467
468     Collection<FeatureGroupEntity> featureGroupEntities = featureGroupDao
469         .list(new FeatureGroupEntity(vendorLicenseModelId, activeVersion, null));
470     for (FeatureGroupEntity featureGroupEntity : featureGroupEntities) {
471       if (featureGroupEntity.getEntitlementPoolIds() == null
472           || featureGroupEntity.getEntitlementPoolIds().isEmpty()) {
473         throw new CoreException(
474             new SubmitUncompletedLicenseModelErrorBuilder(vendorLicenseModelId).build());
475       }
476     }
477   }
478 }