aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-vendor-license-lib
diff options
context:
space:
mode:
authorvasraz <vasyl.razinkov@est.tech>2021-03-22 15:33:06 +0000
committerChristophe Closset <christophe.closset@intl.att.com>2021-03-24 06:59:47 +0000
commitd378c37fbd1ecec7b43394926f1ca32a695e07de (patch)
tree5c8a085f8732f980d871d966ac49361644efa698 /openecomp-be/lib/openecomp-sdc-vendor-license-lib
parenta6ae7294ecd336d7e88f915710b08e2658eaee00 (diff)
Reformat openecomp-be
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech> Issue-ID: SDC-3449 Change-Id: I13e02322f8e00820cc5a1d85752caaeda9bf10d1
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-vendor-license-lib')
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/HealingServiceFactory.java11
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/VendorLicenseArtifactServiceFactory.java14
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/VendorLicenseConstants.java36
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/VendorLicenseUtil.java17
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/EntitlementPoolDao.java19
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/EntitlementPoolDaoFactory.java15
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/FeatureGroupDao.java29
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/FeatureGroupDaoFactory.java14
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/LicenseAgreementDao.java56
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/LicenseAgreementDaoFactory.java15
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/LicenseKeyGroupDao.java26
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/LicenseKeyGroupDaoFactory.java15
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/LimitDao.java2
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/LimitDaoFactory.java7
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/VendorLicenseModelDao.java6
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/VendorLicenseModelDaoFactory.java14
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/AggregationFunction.java11
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/ChoiceOrOther.java203
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/EntitlementMetric.java5
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/EntitlementPoolEntity.java706
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/EntitlementPoolType.java7
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/EntitlementTime.java12
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/FeatureGroupEntity.java364
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/FeatureGroupModel.java81
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LicenseAgreementEntity.java302
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LicenseAgreementModel.java34
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LicenseKeyGroupEntity.java708
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LicenseKeyType.java11
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LicenseTerm.java12
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LimitEntity.java373
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LimitType.java6
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/MultiChoiceOrOther.java244
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/OperationalScope.java16
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/ThresholdUnit.java10
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/VendorLicenseModelEntity.java233
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/AggregationFunctionForXml.java20
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/EntitlementMetricForXml.java20
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/EntitlementTimeForXml.java20
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/LicenseKeyTypeForXml.java20
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/LimitForXml.java21
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/LimitXml.java39
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/OperationalScopeForXml.java19
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/ThresholdForXml.java34
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/InvalidDateErrorBuilder.java24
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/JsonErrorBuilder.java46
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/LicensingDataInvalidErrorBuilder.java39
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/SubmitUncompletedLicenseModelErrorBuilder.java8
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/UncompletedVendorLicenseModelErrorType.java11
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/VendorLicenseErrorCodes.java26
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/VendorLicenseModelNotFoundErrorBuilder.java36
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/facade/VendorLicenseFacade.java62
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/facade/VendorLicenseFacadeFactory.java14
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/healing/HealingService.java11
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/VendorLicenseArtifactsService.java11
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/types/VersionedVendorLicenseModel.java47
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/SimpleHealingServiceServiceFactoryImpl.java11
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/VendorLicenseArtifactServiceFactoryImpl.java11
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/EntitlementPoolDaoFactoryImpl.java14
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/FeatureGroupDaoFactoryImpl.java14
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/LicenseAgreementDaoFactoryImpl.java14
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/LicenseKeyGroupDaoFactoryImpl.java13
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/LimitDaoFactoryImpl.java11
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/VendorLicenseModelDaoFactoryImpl.java16
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/ElementPropertyName.java5
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/ElementType.java5
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/EntitlementPoolZusammenDaoImpl.java345
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/FeatureGroupDaoZusammenImpl.java439
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/LicenseAgreementDaoZusammenImpl.java288
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/LicenseKeyGroupZusammenDaoImpl.java315
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/LimitZusammenDaoImpl.java254
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/VendorLicenseModelDaoZusammenImpl.java206
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/VlmZusammenUtil.java59
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToEntitlementPoolConvertor.java135
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToFeatureGroupConvertor.java115
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToLicenseAgreementConvertor.java108
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToLicenseKeyGroupConvertor.java141
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToLimitConvertor.java56
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToVLMGeneralConvertor.java64
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/facade/impl/VendorLicenseFacadeFactoryImpl.java16
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/facade/impl/VendorLicenseFacadeImpl.java507
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/healing/impl/SimpleHealingServiceImpl.java66
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/VendorLicenseArtifactsServiceImpl.java249
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/VendorLicenseArtifact.java76
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/VnfLicenseArtifact.java98
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/XmlArtifact.java44
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinEntitlementPoolEntityForVendorLicenseArtifact.java130
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinEntitlementPoolEntityForVnfArtifact.java130
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinFeatureGroupEntity.java55
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinFeatureGroupModel.java50
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinLicenseKeyGroupEntityForVendorLicenseArtifact.java97
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinLicenseKeyGroupEntityForVnfArtifact.java103
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinLimitArtifact.java18
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/util/VendorLicenseArtifactsServiceUtils.java221
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/util/VersionableEntitySortByVlmMajorVersion.java17
94 files changed, 3911 insertions, 4767 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/HealingServiceFactory.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/HealingServiceFactory.java
index 19d664247b..9b76fe96db 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/HealingServiceFactory.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/HealingServiceFactory.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense;
import org.openecomp.core.factory.api.AbstractComponentFactory;
@@ -26,7 +25,7 @@ import org.openecomp.sdc.vendorlicense.healing.HealingService;
public abstract class HealingServiceFactory extends AbstractComponentFactory<HealingService> {
- public static HealingServiceFactory getInstance() {
- return AbstractFactory.getInstance(HealingServiceFactory.class);
- }
+ public static HealingServiceFactory getInstance() {
+ return AbstractFactory.getInstance(HealingServiceFactory.class);
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/VendorLicenseArtifactServiceFactory.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/VendorLicenseArtifactServiceFactory.java
index 0ce7484aa7..a79c01ae51 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/VendorLicenseArtifactServiceFactory.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/VendorLicenseArtifactServiceFactory.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,17 +17,15 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense;
import org.openecomp.core.factory.api.AbstractComponentFactory;
import org.openecomp.core.factory.api.AbstractFactory;
import org.openecomp.sdc.vendorlicense.licenseartifacts.VendorLicenseArtifactsService;
-public abstract class VendorLicenseArtifactServiceFactory
- extends AbstractComponentFactory<VendorLicenseArtifactsService> {
+public abstract class VendorLicenseArtifactServiceFactory extends AbstractComponentFactory<VendorLicenseArtifactsService> {
- public static VendorLicenseArtifactServiceFactory getInstance() {
- return AbstractFactory.getInstance(VendorLicenseArtifactServiceFactory.class);
- }
+ public static VendorLicenseArtifactServiceFactory getInstance() {
+ return AbstractFactory.getInstance(VendorLicenseArtifactServiceFactory.class);
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/VendorLicenseConstants.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/VendorLicenseConstants.java
index 82fdf045db..d43797e498 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/VendorLicenseConstants.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/VendorLicenseConstants.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,30 +17,26 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense;
import java.io.File;
public final class VendorLicenseConstants {
- public static final String VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE = "VendorLicenseModel";
- public static final String EXTERNAL_ARTIFACTS_DIR = "Artifacts";
- //todo change when separating external from internal artifacts
- public static final String VNF_ARTIFACT_NAME_WITH_PATH =
- EXTERNAL_ARTIFACTS_DIR + File.separator + "vf-license-model.xml";
- public static final String VENDOR_LICENSE_MODEL_ARTIFACT_NAME_WITH_PATH =
- EXTERNAL_ARTIFACTS_DIR + File.separator + "vendor-license-model.xml";
- public static final String VENDOR_LICENSE_MODEL_ARTIFACT_REGEX_REMOVE = " xmlns=\"\"";
- public static final String UNSUPPORTED_OPERATION_ERROR =
- "An error has occurred: Unsupported operation for 1707 release.";
+ public static final String VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE = "VendorLicenseModel";
+ public static final String EXTERNAL_ARTIFACTS_DIR = "Artifacts";
+ //todo change when separating external from internal artifacts
+ public static final String VNF_ARTIFACT_NAME_WITH_PATH = EXTERNAL_ARTIFACTS_DIR + File.separator + "vf-license-model.xml";
+ public static final String VENDOR_LICENSE_MODEL_ARTIFACT_NAME_WITH_PATH = EXTERNAL_ARTIFACTS_DIR + File.separator + "vendor-license-model.xml";
+ public static final String VENDOR_LICENSE_MODEL_ARTIFACT_REGEX_REMOVE = " xmlns=\"\"";
+ public static final String UNSUPPORTED_OPERATION_ERROR = "An error has occurred: Unsupported operation for 1707 release.";
- public final class UniqueValues {
- public static final String VENDOR_NAME = "Vendor name";
- public static final String LICENSE_AGREEMENT_NAME = "License Agreement name";
- public static final String FEATURE_GROUP_NAME = "Feature Group name";
- public static final String ENTITLEMENT_POOL_NAME = "Entitlement Pool name";
- public static final String LICENSE_KEY_GROUP_NAME = "License Key Group name";
+ public final class UniqueValues {
- }
+ public static final String VENDOR_NAME = "Vendor name";
+ public static final String LICENSE_AGREEMENT_NAME = "License Agreement name";
+ public static final String FEATURE_GROUP_NAME = "Feature Group name";
+ public static final String ENTITLEMENT_POOL_NAME = "Entitlement Pool name";
+ public static final String LICENSE_KEY_GROUP_NAME = "License Key Group name";
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/VendorLicenseUtil.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/VendorLicenseUtil.java
index 7d9aa27c46..3d30f5a8dc 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/VendorLicenseUtil.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/VendorLicenseUtil.java
@@ -19,19 +19,18 @@
*/
package org.openecomp.sdc.vendorlicense;
-
import java.text.ParseException;
import java.text.SimpleDateFormat;
public class VendorLicenseUtil {
- public static String getIsoFormatDate(String inputDate) {
- SimpleDateFormat isoDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
- SimpleDateFormat inputDateFormat = new SimpleDateFormat("MM/dd/yyyy'T'HH:mm:ss'Z'");
- try {
- return isoDateFormat.format(inputDateFormat.parse(inputDate));
- } catch (ParseException e) {
- return null;
+ public static String getIsoFormatDate(String inputDate) {
+ SimpleDateFormat isoDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
+ SimpleDateFormat inputDateFormat = new SimpleDateFormat("MM/dd/yyyy'T'HH:mm:ss'Z'");
+ try {
+ return isoDateFormat.format(inputDateFormat.parse(inputDate));
+ } catch (ParseException e) {
+ return null;
+ }
}
- }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/EntitlementPoolDao.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/EntitlementPoolDao.java
index b42f64de7c..15089bc655 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/EntitlementPoolDao.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/EntitlementPoolDao.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,16 +17,13 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.dao;
-
+import java.util.Collection;
import org.openecomp.core.dao.BaseDao;
import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity;
import org.openecomp.sdc.versioning.dao.VersionableDao;
-import java.util.Collection;
-
public interface EntitlementPoolDao extends VersionableDao, BaseDao<EntitlementPoolEntity> {
void create(EntitlementPoolEntity entitlementPool);
@@ -39,13 +36,11 @@ public interface EntitlementPoolDao extends VersionableDao, BaseDao<EntitlementP
Collection<EntitlementPoolEntity> list(EntitlementPoolEntity entitlementPool);
- long count(EntitlementPoolEntity entitlementPool);
+ long count(EntitlementPoolEntity entitlementPool);
- void deleteAll(EntitlementPoolEntity entitlementPool);
+ void deleteAll(EntitlementPoolEntity entitlementPool);
- void addReferencingFeatureGroup(EntitlementPoolEntity entitlementPool,
- String referencingFeatureGroupId);
+ void addReferencingFeatureGroup(EntitlementPoolEntity entitlementPool, String referencingFeatureGroupId);
- void removeReferencingFeatureGroup(EntitlementPoolEntity entitlementPool,
- String referencingFeatureGroupId);
+ void removeReferencingFeatureGroup(EntitlementPoolEntity entitlementPool, String referencingFeatureGroupId);
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/EntitlementPoolDaoFactory.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/EntitlementPoolDaoFactory.java
index e5bfcfa1cb..02d7b8e1d3 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/EntitlementPoolDaoFactory.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/EntitlementPoolDaoFactory.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,15 +17,14 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.dao;
import org.openecomp.core.factory.api.AbstractComponentFactory;
import org.openecomp.core.factory.api.AbstractFactory;
-public abstract class EntitlementPoolDaoFactory
- extends AbstractComponentFactory<EntitlementPoolDao> {
- public static EntitlementPoolDaoFactory getInstance() {
- return AbstractFactory.getInstance(EntitlementPoolDaoFactory.class);
- }
+public abstract class EntitlementPoolDaoFactory extends AbstractComponentFactory<EntitlementPoolDao> {
+
+ public static EntitlementPoolDaoFactory getInstance() {
+ return AbstractFactory.getInstance(EntitlementPoolDaoFactory.class);
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/FeatureGroupDao.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/FeatureGroupDao.java
index 3a7ce9ac04..7609c7e003 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/FeatureGroupDao.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/FeatureGroupDao.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,17 +17,14 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.dao;
+import java.util.Collection;
+import java.util.Set;
import org.openecomp.core.dao.BaseDao;
import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity;
import org.openecomp.sdc.versioning.dao.VersionableDao;
-import java.util.Collection;
-import java.util.Set;
-
-
public interface FeatureGroupDao extends VersionableDao, BaseDao<FeatureGroupEntity> {
void delete(FeatureGroupEntity featureGroup);
@@ -38,20 +35,18 @@ public interface FeatureGroupDao extends VersionableDao, BaseDao<FeatureGroupEnt
Collection<FeatureGroupEntity> list(FeatureGroupEntity entity);
- long count(FeatureGroupEntity featureGroup);
+ long count(FeatureGroupEntity featureGroup);
- void deleteAll(FeatureGroupEntity featureGroup);
+ void deleteAll(FeatureGroupEntity featureGroup);
- void updateFeatureGroup(FeatureGroupEntity entity, Set<String> addedEntitlementPools,
- Set<String> removedEntitlementPools, Set<String> addedLicenseKeyGroups,
- Set<String> removedLicenseKeyGroups);
+ void updateFeatureGroup(FeatureGroupEntity entity, Set<String> addedEntitlementPools, Set<String> removedEntitlementPools,
+ Set<String> addedLicenseKeyGroups, Set<String> removedLicenseKeyGroups);
- void addReferencingLicenseAgreement(FeatureGroupEntity featureGroup, String licenseAgreementId);
+ void addReferencingLicenseAgreement(FeatureGroupEntity featureGroup, String licenseAgreementId);
- void removeReferencingLicenseAgreement(FeatureGroupEntity featureGroup,
- String licenseAgreementId);
+ void removeReferencingLicenseAgreement(FeatureGroupEntity featureGroup, String licenseAgreementId);
- void removeEntitlementPool(FeatureGroupEntity featureGroup, String entitlementPoolId);
+ void removeEntitlementPool(FeatureGroupEntity featureGroup, String entitlementPoolId);
- void removeLicenseKeyGroup(FeatureGroupEntity featureGroup, String licenseKeyGroupId);
+ void removeLicenseKeyGroup(FeatureGroupEntity featureGroup, String licenseKeyGroupId);
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/FeatureGroupDaoFactory.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/FeatureGroupDaoFactory.java
index 5a32ee420a..e06d3dffb6 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/FeatureGroupDaoFactory.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/FeatureGroupDaoFactory.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,16 +17,14 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.dao;
import org.openecomp.core.factory.api.AbstractComponentFactory;
import org.openecomp.core.factory.api.AbstractFactory;
-
-
public abstract class FeatureGroupDaoFactory extends AbstractComponentFactory<FeatureGroupDao> {
- public static FeatureGroupDaoFactory getInstance() {
- return AbstractFactory.getInstance(FeatureGroupDaoFactory.class);
- }
+
+ public static FeatureGroupDaoFactory getInstance() {
+ return AbstractFactory.getInstance(FeatureGroupDaoFactory.class);
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/LicenseAgreementDao.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/LicenseAgreementDao.java
index c49af9c714..2242722ca5 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/LicenseAgreementDao.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/LicenseAgreementDao.java
@@ -1,45 +1,43 @@
/*-
-* Copyright (C) 2016-2017 European Support Limited
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (C) 2016-2017 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.openecomp.sdc.vendorlicense.dao;
+import java.util.Collection;
+import java.util.Set;
import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementEntity;
import org.openecomp.sdc.versioning.dao.VersionableDao;
-import java.util.Collection;
-import java.util.Set;
+public interface LicenseAgreementDao extends VersionableDao {
-public interface LicenseAgreementDao extends VersionableDao{
+ long count(LicenseAgreementEntity entity);
- long count(LicenseAgreementEntity entity);
+ void deleteAll(LicenseAgreementEntity entity);
- void deleteAll(LicenseAgreementEntity entity);
+ void removeFeatureGroup(LicenseAgreementEntity licenseAgreement, String featureGroupId);
- void removeFeatureGroup(LicenseAgreementEntity licenseAgreement, String featureGroupId);
+ void updateColumnsAndDeltaFeatureGroupIds(LicenseAgreementEntity licenseAgreement, Set<String> addedFeatureGroupIds,
+ Set<String> removedFeatureGroupIds);
- void updateColumnsAndDeltaFeatureGroupIds(LicenseAgreementEntity licenseAgreement,
- Set<String> addedFeatureGroupIds,
- Set<String> removedFeatureGroupIds);
- Collection<LicenseAgreementEntity> list(LicenseAgreementEntity entity);
+ Collection<LicenseAgreementEntity> list(LicenseAgreementEntity entity);
- void create(LicenseAgreementEntity entity);
+ void create(LicenseAgreementEntity entity);
- void update(LicenseAgreementEntity entity);
+ void update(LicenseAgreementEntity entity);
- LicenseAgreementEntity get(LicenseAgreementEntity entity);
+ LicenseAgreementEntity get(LicenseAgreementEntity entity);
- void delete(LicenseAgreementEntity entity);
+ void delete(LicenseAgreementEntity entity);
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/LicenseAgreementDaoFactory.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/LicenseAgreementDaoFactory.java
index 54c7b7bfea..324d83094c 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/LicenseAgreementDaoFactory.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/LicenseAgreementDaoFactory.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,15 +17,14 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.dao;
import org.openecomp.core.factory.api.AbstractComponentFactory;
import org.openecomp.core.factory.api.AbstractFactory;
-public abstract class LicenseAgreementDaoFactory
- extends AbstractComponentFactory<LicenseAgreementDao> {
- public static LicenseAgreementDaoFactory getInstance() {
- return AbstractFactory.getInstance(LicenseAgreementDaoFactory.class);
- }
+public abstract class LicenseAgreementDaoFactory extends AbstractComponentFactory<LicenseAgreementDao> {
+
+ public static LicenseAgreementDaoFactory getInstance() {
+ return AbstractFactory.getInstance(LicenseAgreementDaoFactory.class);
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/LicenseKeyGroupDao.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/LicenseKeyGroupDao.java
index 4e0ce93ed4..899d1c9a06 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/LicenseKeyGroupDao.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/LicenseKeyGroupDao.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,32 +17,28 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.dao;
-
+import java.util.Collection;
import org.openecomp.core.dao.BaseDao;
import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity;
import org.openecomp.sdc.versioning.dao.VersionableDao;
-import java.util.Collection;
-
-
public interface LicenseKeyGroupDao extends VersionableDao, BaseDao<LicenseKeyGroupEntity> {
- void create(LicenseKeyGroupEntity licenseKeyGroup);
+ void create(LicenseKeyGroupEntity licenseKeyGroup);
- void delete(LicenseKeyGroupEntity licenseKeyGroup);
+ void delete(LicenseKeyGroupEntity licenseKeyGroup);
- LicenseKeyGroupEntity get(LicenseKeyGroupEntity licenseKeyGroup);
+ LicenseKeyGroupEntity get(LicenseKeyGroupEntity licenseKeyGroup);
- Collection<LicenseKeyGroupEntity> list(LicenseKeyGroupEntity licenseKeyGroup);
+ Collection<LicenseKeyGroupEntity> list(LicenseKeyGroupEntity licenseKeyGroup);
- long count(LicenseKeyGroupEntity licenseKeyGroup);
+ long count(LicenseKeyGroupEntity licenseKeyGroup);
- void deleteAll(LicenseKeyGroupEntity licenseKeyGroup);
+ void deleteAll(LicenseKeyGroupEntity licenseKeyGroup);
- void addReferencingFeatureGroup(LicenseKeyGroupEntity licenseKeyGroup, String featureGroupId);
+ void addReferencingFeatureGroup(LicenseKeyGroupEntity licenseKeyGroup, String featureGroupId);
- void removeReferencingFeatureGroup(LicenseKeyGroupEntity licenseKeyGroup, String featureGroupId);
+ void removeReferencingFeatureGroup(LicenseKeyGroupEntity licenseKeyGroup, String featureGroupId);
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/LicenseKeyGroupDaoFactory.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/LicenseKeyGroupDaoFactory.java
index 8c76c46301..f5fece1e42 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/LicenseKeyGroupDaoFactory.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/LicenseKeyGroupDaoFactory.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,17 +17,14 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.dao;
import org.openecomp.core.factory.api.AbstractComponentFactory;
import org.openecomp.core.factory.api.AbstractFactory;
+public abstract class LicenseKeyGroupDaoFactory extends AbstractComponentFactory<LicenseKeyGroupDao> {
-public abstract class LicenseKeyGroupDaoFactory
- extends AbstractComponentFactory<LicenseKeyGroupDao> {
-
- public static LicenseKeyGroupDaoFactory getInstance() {
- return AbstractFactory.getInstance(LicenseKeyGroupDaoFactory.class);
- }
+ public static LicenseKeyGroupDaoFactory getInstance() {
+ return AbstractFactory.getInstance(LicenseKeyGroupDaoFactory.class);
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/LimitDao.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/LimitDao.java
index ab302b5982..b01649ecb6 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/LimitDao.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/LimitDao.java
@@ -25,5 +25,5 @@ import org.openecomp.sdc.versioning.dao.VersionableDao;
public interface LimitDao extends VersionableDao, BaseDao<LimitEntity> {
- boolean isLimitPresent(LimitEntity limitEntity);
+ boolean isLimitPresent(LimitEntity limitEntity);
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/LimitDaoFactory.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/LimitDaoFactory.java
index 2971d72507..3c3657e246 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/LimitDaoFactory.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/LimitDaoFactory.java
@@ -23,7 +23,8 @@ import org.openecomp.core.factory.api.AbstractComponentFactory;
import org.openecomp.core.factory.api.AbstractFactory;
public abstract class LimitDaoFactory extends AbstractComponentFactory<LimitDao> {
- public static LimitDaoFactory getInstance() {
- return AbstractFactory.getInstance(LimitDaoFactory.class);
- }
+
+ public static LimitDaoFactory getInstance() {
+ return AbstractFactory.getInstance(LimitDaoFactory.class);
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/VendorLicenseModelDao.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/VendorLicenseModelDao.java
index 0bb2e62b41..eedca41cdc 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/VendorLicenseModelDao.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/VendorLicenseModelDao.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.dao;
import org.openecomp.core.dao.BaseDao;
@@ -25,4 +24,5 @@ import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity;
import org.openecomp.sdc.versioning.dao.VersionableDao;
public interface VendorLicenseModelDao extends VersionableDao, BaseDao<VendorLicenseModelEntity> {
+
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/VendorLicenseModelDaoFactory.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/VendorLicenseModelDaoFactory.java
index b6d13a9027..cbfbb9ffa1 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/VendorLicenseModelDaoFactory.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/VendorLicenseModelDaoFactory.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,16 +17,14 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.dao;
import org.openecomp.core.factory.api.AbstractComponentFactory;
import org.openecomp.core.factory.api.AbstractFactory;
-public abstract class VendorLicenseModelDaoFactory
- extends AbstractComponentFactory<VendorLicenseModelDao> {
+public abstract class VendorLicenseModelDaoFactory extends AbstractComponentFactory<VendorLicenseModelDao> {
- public static VendorLicenseModelDaoFactory getInstance() {
- return AbstractFactory.getInstance(VendorLicenseModelDaoFactory.class);
- }
+ public static VendorLicenseModelDaoFactory getInstance() {
+ return AbstractFactory.getInstance(VendorLicenseModelDaoFactory.class);
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/AggregationFunction.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/AggregationFunction.java
index 5b5a97f92b..be27bc0fe0 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/AggregationFunction.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/AggregationFunction.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,11 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.dao.types;
-public enum AggregationFunction {
- Peak,
- Average,
- Other;
-}
+public enum AggregationFunction {Peak, Average, Other;}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/ChoiceOrOther.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/ChoiceOrOther.java
index 01699355f5..e4d58fad29 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/ChoiceOrOther.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/ChoiceOrOther.java
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorlicense.dao.types;
import com.datastax.driver.mapping.annotations.Transient;
@@ -24,126 +23,116 @@ import org.openecomp.sdc.common.errors.ErrorCode;
@UDT(keyspace = "dox", name = "choice_or_other")
public class ChoiceOrOther<E extends Enum<E>> {
- private static final String CHOICE_OR_OTHER_INVALID_ENUM_ERR_ID =
- "MULTI_CHOICE_OR_OTHER_INVALID_ENUM_ERR_ID";
- private static final String CHOICE_OR_OTHER_INVALID_ENUM_MSG =
- "Enum used as part of ChoiceOrOther type must contain the value 'Other'";
- public static final String OTHER_ENUM_VALUE = "Other";
-
- @Transient
- private E choice;
-
- @Transient
- private String other;
-
- private String result;
-
- public ChoiceOrOther() {
- // the default constructor is used to instantiate by reflection
- }
-
- /**
- * Instantiates a new Choice or other.
- *
- * @param choice the choice
- * @param other the other
- */
- public ChoiceOrOther(E choice, String other) {
- this.choice = choice;
- this.other = other;
- result = resolveResult();
- }
-
- public E getChoice() {
- return choice;
- }
-
- public void setChoice(E choice) {
-
- this.choice = choice;
- }
-
- public String getOther() {
- return other;
- }
-
- public void setOther(String other) {
- this.other = other;
- }
-
- public String getResult() {
- return result;
- }
+ public static final String OTHER_ENUM_VALUE = "Other";
+ private static final String CHOICE_OR_OTHER_INVALID_ENUM_ERR_ID = "MULTI_CHOICE_OR_OTHER_INVALID_ENUM_ERR_ID";
+ private static final String CHOICE_OR_OTHER_INVALID_ENUM_MSG = "Enum used as part of ChoiceOrOther type must contain the value 'Other'";
+ @Transient
+ private E choice;
+ @Transient
+ private String other;
+ private String result;
+
+ public ChoiceOrOther() {
+ // the default constructor is used to instantiate by reflection
+ }
- /**
- * Sets result.
- *
- * @param result the result
- */
- public void setResult(String result) {
- if (choice != null) {
- if (result == null) {
- this.result = resolveResult();
- }
- } else {
- this.result = result;
+ /**
+ * Instantiates a new Choice or other.
+ *
+ * @param choice the choice
+ * @param other the other
+ */
+ public ChoiceOrOther(E choice, String other) {
+ this.choice = choice;
+ this.other = other;
+ result = resolveResult();
}
- }
- private String resolveResult() {
- return OTHER_ENUM_VALUE.equals(choice.name()) ? other : choice.name();
- }
+ public E getChoice() {
+ return choice;
+ }
- /**
- * Resolve enum.
- *
- * @param enumClass the enum class
- */
- public void resolveEnum(Class<E> enumClass) {
- if (choice != null || result == null) {
- return;
+ public void setChoice(E choice) {
+ this.choice = choice;
}
- try {
- choice = E.valueOf(enumClass, result);
- } catch (IllegalArgumentException exception) {
- try {
- choice = E.valueOf(enumClass, OTHER_ENUM_VALUE);
- } catch (IllegalArgumentException ex) {
- throw new CoreException(new ErrorCode.ErrorCodeBuilder()
- .withId(CHOICE_OR_OTHER_INVALID_ENUM_ERR_ID)
- .withMessage(CHOICE_OR_OTHER_INVALID_ENUM_MSG).build());
- }
- other = result;
+ public String getOther() {
+ return other;
}
- }
- @Override
- public int hashCode() {
- int result1 = choice != null ? choice.hashCode() : 0;
- result1 = 31 * result1 + (other != null ? other.hashCode() : 0);
- result1 = 31 * result1 + (result != null ? result.hashCode() : 0);
- return result1;
- }
+ public void setOther(String other) {
+ this.other = other;
+ }
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
+ public String getResult() {
+ return result;
}
- if (obj == null || getClass() != obj.getClass()) {
- return false;
+
+ /**
+ * Sets result.
+ *
+ * @param result the result
+ */
+ public void setResult(String result) {
+ if (choice != null) {
+ if (result == null) {
+ this.result = resolveResult();
+ }
+ } else {
+ this.result = result;
+ }
}
- ChoiceOrOther<?> that = (ChoiceOrOther<?>) obj;
+ private String resolveResult() {
+ return OTHER_ENUM_VALUE.equals(choice.name()) ? other : choice.name();
+ }
- if (choice != null ? !choice.equals(that.choice) : that.choice != null) {
- return false;
+ /**
+ * Resolve enum.
+ *
+ * @param enumClass the enum class
+ */
+ public void resolveEnum(Class<E> enumClass) {
+ if (choice != null || result == null) {
+ return;
+ }
+ try {
+ choice = E.valueOf(enumClass, result);
+ } catch (IllegalArgumentException exception) {
+ try {
+ choice = E.valueOf(enumClass, OTHER_ENUM_VALUE);
+ } catch (IllegalArgumentException ex) {
+ throw new CoreException(
+ new ErrorCode.ErrorCodeBuilder().withId(CHOICE_OR_OTHER_INVALID_ENUM_ERR_ID).withMessage(CHOICE_OR_OTHER_INVALID_ENUM_MSG)
+ .build());
+ }
+ other = result;
+ }
}
- if (other != null ? !other.equals(that.other) : that.other != null) {
- return false;
+
+ @Override
+ public int hashCode() {
+ int result1 = choice != null ? choice.hashCode() : 0;
+ result1 = 31 * result1 + (other != null ? other.hashCode() : 0);
+ result1 = 31 * result1 + (result != null ? result.hashCode() : 0);
+ return result1;
}
- return result != null ? result.equals(that.result) : that.result == null;
- }
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null || getClass() != obj.getClass()) {
+ return false;
+ }
+ ChoiceOrOther<?> that = (ChoiceOrOther<?>) obj;
+ if (choice != null ? !choice.equals(that.choice) : that.choice != null) {
+ return false;
+ }
+ if (other != null ? !other.equals(that.other) : that.other != null) {
+ return false;
+ }
+ return result != null ? result.equals(that.result) : that.result == null;
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/EntitlementMetric.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/EntitlementMetric.java
index 23423dc241..331f8f7111 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/EntitlementMetric.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/EntitlementMetric.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.dao.types;
public enum EntitlementMetric {
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/EntitlementPoolEntity.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/EntitlementPoolEntity.java
index 4d3c1d63a7..74df63fba7 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/EntitlementPoolEntity.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/EntitlementPoolEntity.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.dao.types;
import com.datastax.driver.mapping.annotations.ClusteringColumn;
@@ -25,7 +24,10 @@ import com.datastax.driver.mapping.annotations.Column;
import com.datastax.driver.mapping.annotations.Frozen;
import com.datastax.driver.mapping.annotations.PartitionKey;
import com.datastax.driver.mapping.annotations.Table;
-
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Objects;
+import java.util.Set;
import org.apache.commons.lang3.StringUtils;
import org.openecomp.sdc.vendorlicense.VendorLicenseUtil;
import org.openecomp.sdc.vendorlicense.dao.types.xml.LimitForXml;
@@ -35,377 +37,335 @@ import org.openecomp.sdc.vendorlicense.dao.types.xml.ThresholdForXml;
import org.openecomp.sdc.versioning.dao.types.Version;
import org.openecomp.sdc.versioning.dao.types.VersionableEntity;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Objects;
-import java.util.Set;
-
@Table(keyspace = "dox", name = "entitlement_pool")
public class EntitlementPoolEntity implements VersionableEntity {
- private static final String ENTITY_TYPE = "Entitlement Pool";
-
- @PartitionKey
- @Column(name = "vlm_id")
- private String vendorLicenseModelId;
-
- @PartitionKey(value = 1)
- @Frozen
- private Version version;
-
- @ClusteringColumn
- @Column(name = "ep_id")
- private String id;
- private String name;
- private String description;
- private EntitlementPoolType type;
-
- @Column(name = "threshold")
- private Integer thresholdValue;
-
- @Column(name = "threshold_unit")
- private ThresholdUnit thresholdUnit;
-
- private String increments;
-
- @Column(name = "operational_scope")
- @Frozen
- private MultiChoiceOrOther<OperationalScope> operationalScope;
-
- @Column(name = "ref_fg_ids")
- private Set<String> referencingFeatureGroups = new HashSet<>();
-
- @Column(name = "version_uuid")
- private String versionUuId;
-
-
- private String startDate;
- private String expiryDate;
-
- private Collection<LimitEntity> limits;
-
- //Defined and used only for License Artifcat XMLs
- private String manufacturerReferenceNumber;
-
- /**
- * Every entity class must have a default constructor according to
- * <a href="http://docs.datastax.com/en/developer/java-driver/2.1/manual/object_mapper/creating/">
- * Definition of mapped classes</a>.
- */
- public EntitlementPoolEntity() {
- // Don't delete! Default constructor is required by DataStax driver
- }
-
- /**
- * Instantiates a new Entitlement pool entity.
- *
- * @param vlmId the vlm id
- * @param version the version
- * @param id the id
- */
- public EntitlementPoolEntity(String vlmId, Version version, String id) {
- this.vendorLicenseModelId = vlmId;
- this.version = version;
- this.id = id;
- }
-
- @Override
- public String getEntityType() {
- return ENTITY_TYPE;
- }
-
- @Override
- public String getFirstClassCitizenId() {
- return getVendorLicenseModelId();
- }
-
- @Override
- public String getId() {
- return id;
- }
-
- @Override
- public void setId(String id) {
- this.id = id;
- }
-
- @Override
- public Version getVersion() {
- return version;
- }
-
- @Override
- public void setVersion(Version version) {
- this.version = version;
- }
-
- @Override
- public String getVersionUuId() {
- return versionUuId;
- }
-
- @Override
- public void setVersionUuId(String uuId) {
- versionUuId = uuId;
- }
-
- public String getVendorLicenseModelId() {
- return vendorLicenseModelId;
- }
-
- public void setVendorLicenseModelId(String vendorLicenseModelId) {
- this.vendorLicenseModelId = vendorLicenseModelId;
- }
-
- public Set<String> getReferencingFeatureGroups() {
- return referencingFeatureGroups;
- }
-
- public void setReferencingFeatureGroups(Set<String> referencingFeatureGroups) {
- this.referencingFeatureGroups = referencingFeatureGroups;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public EntitlementPoolType getType() {
- return type;
- }
-
- public void setType(EntitlementPoolType type) {
- this.type = type;
- }
-
- public Integer getThresholdValue() {
- return thresholdValue;
- }
-
- public void setThresholdValue(Integer thresholdValue) {
- this.thresholdValue = thresholdValue;
- }
-
- public ThresholdUnit getThresholdUnit() {
- return thresholdUnit;
- }
-
- public void setThresholdUnit(ThresholdUnit thresholdUnits) {
- this.thresholdUnit = thresholdUnits;
- }
-
- public String getIncrements() {
- return increments;
- }
-
- public void setIncrements(String increments) {
- this.increments = increments;
- }
-
- public MultiChoiceOrOther<OperationalScope> getOperationalScope() {
- return operationalScope;
- }
-
- public void setOperationalScope(MultiChoiceOrOther<OperationalScope> operationalScope) {
- if (operationalScope != null) {
- operationalScope.resolveEnum(OperationalScope.class);
- }
- this.operationalScope = operationalScope;
- }
-
- /**
- * Gets threshold for artifact.
- *
- * @return the threshold for artifact
- */
- public ThresholdForXml getThresholdForArtifact() {
- ThresholdForXml threshold = new ThresholdForXml();
- threshold.setUnit(getThresholdUnit() == null ? null : getThresholdUnit().name());
- threshold.setValue(getThresholdValue());
- return threshold;
- }
-
- /**
- * Gets version for artifact.
- *
- * @return version in format suitable for artifact
- */
- public String getVersionForArtifact() {
- return version.toString();
- }
-
- public String getStartDate() {
- return startDate;
- }
-
- public void setStartDate(String startDate) {
- this.startDate = startDate;
- }
-
- public String getExpiryDate() {
- return expiryDate;
- }
-
- public void setExpiryDate(String expiryDate) {
- this.expiryDate = expiryDate;
- }
-
- public Collection<LimitEntity> getLimits() {
- return limits;
- }
-
- public void setLimits(Collection<LimitEntity> limits) {
- this.limits = limits;
- }
-
- public LimitForXml getSPLimits() {
- if (limits != null) {
- Set<LimitXml> hs = new HashSet<>();
- for (LimitEntity obj : limits) {
- if (obj.getType().equals(LimitType.ServiceProvider)) {
- LimitXml xmlObj = new LimitXml();
- xmlObj.setDescription(obj.getDescription());
- xmlObj.setMetric(obj.getMetric());
- xmlObj.setValues(obj.getValue());
- xmlObj.setUnit(obj.getUnit());
- xmlObj.setAggregationFunction(
- obj.getAggregationFunction() != null ? obj.getAggregationFunction().name() : null);
- xmlObj.setTime(obj.getTime());
- hs.add(xmlObj);
+
+ private static final String ENTITY_TYPE = "Entitlement Pool";
+ @PartitionKey
+ @Column(name = "vlm_id")
+ private String vendorLicenseModelId;
+ @PartitionKey(value = 1)
+ @Frozen
+ private Version version;
+ @ClusteringColumn
+ @Column(name = "ep_id")
+ private String id;
+ private String name;
+ private String description;
+ private EntitlementPoolType type;
+ @Column(name = "threshold")
+ private Integer thresholdValue;
+ @Column(name = "threshold_unit")
+ private ThresholdUnit thresholdUnit;
+ private String increments;
+ @Column(name = "operational_scope")
+ @Frozen
+ private MultiChoiceOrOther<OperationalScope> operationalScope;
+ @Column(name = "ref_fg_ids")
+ private Set<String> referencingFeatureGroups = new HashSet<>();
+ @Column(name = "version_uuid")
+ private String versionUuId;
+ private String startDate;
+ private String expiryDate;
+ private Collection<LimitEntity> limits;
+ //Defined and used only for License Artifcat XMLs
+ private String manufacturerReferenceNumber;
+
+ /**
+ * Every entity class must have a default constructor according to
+ * <a href="http://docs.datastax.com/en/developer/java-driver/2.1/manual/object_mapper/creating/">
+ * Definition of mapped classes</a>.
+ */
+ public EntitlementPoolEntity() {
+ // Don't delete! Default constructor is required by DataStax driver
+ }
+
+ /**
+ * Instantiates a new Entitlement pool entity.
+ *
+ * @param vlmId the vlm id
+ * @param version the version
+ * @param id the id
+ */
+ public EntitlementPoolEntity(String vlmId, Version version, String id) {
+ this.vendorLicenseModelId = vlmId;
+ this.version = version;
+ this.id = id;
+ }
+
+ @Override
+ public String getEntityType() {
+ return ENTITY_TYPE;
+ }
+
+ @Override
+ public String getFirstClassCitizenId() {
+ return getVendorLicenseModelId();
+ }
+
+ @Override
+ public String getId() {
+ return id;
+ }
+
+ @Override
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ @Override
+ public Version getVersion() {
+ return version;
+ }
+
+ @Override
+ public void setVersion(Version version) {
+ this.version = version;
+ }
+
+ @Override
+ public String getVersionUuId() {
+ return versionUuId;
+ }
+
+ @Override
+ public void setVersionUuId(String uuId) {
+ versionUuId = uuId;
+ }
+
+ public String getVendorLicenseModelId() {
+ return vendorLicenseModelId;
+ }
+
+ public void setVendorLicenseModelId(String vendorLicenseModelId) {
+ this.vendorLicenseModelId = vendorLicenseModelId;
+ }
+
+ public Set<String> getReferencingFeatureGroups() {
+ return referencingFeatureGroups;
+ }
+
+ public void setReferencingFeatureGroups(Set<String> referencingFeatureGroups) {
+ this.referencingFeatureGroups = referencingFeatureGroups;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public EntitlementPoolType getType() {
+ return type;
+ }
+
+ public void setType(EntitlementPoolType type) {
+ this.type = type;
+ }
+
+ public Integer getThresholdValue() {
+ return thresholdValue;
+ }
+
+ public void setThresholdValue(Integer thresholdValue) {
+ this.thresholdValue = thresholdValue;
+ }
+
+ public ThresholdUnit getThresholdUnit() {
+ return thresholdUnit;
+ }
+
+ public void setThresholdUnit(ThresholdUnit thresholdUnits) {
+ this.thresholdUnit = thresholdUnits;
+ }
+
+ public String getIncrements() {
+ return increments;
+ }
+
+ public void setIncrements(String increments) {
+ this.increments = increments;
+ }
+
+ public MultiChoiceOrOther<OperationalScope> getOperationalScope() {
+ return operationalScope;
+ }
+
+ public void setOperationalScope(MultiChoiceOrOther<OperationalScope> operationalScope) {
+ if (operationalScope != null) {
+ operationalScope.resolveEnum(OperationalScope.class);
+ }
+ this.operationalScope = operationalScope;
+ }
+
+ /**
+ * Gets threshold for artifact.
+ *
+ * @return the threshold for artifact
+ */
+ public ThresholdForXml getThresholdForArtifact() {
+ ThresholdForXml threshold = new ThresholdForXml();
+ threshold.setUnit(getThresholdUnit() == null ? null : getThresholdUnit().name());
+ threshold.setValue(getThresholdValue());
+ return threshold;
+ }
+
+ /**
+ * Gets version for artifact.
+ *
+ * @return version in format suitable for artifact
+ */
+ public String getVersionForArtifact() {
+ return version.toString();
+ }
+
+ public String getStartDate() {
+ return startDate;
+ }
+
+ public void setStartDate(String startDate) {
+ this.startDate = startDate;
+ }
+
+ public String getExpiryDate() {
+ return expiryDate;
+ }
+
+ public void setExpiryDate(String expiryDate) {
+ this.expiryDate = expiryDate;
+ }
+
+ public Collection<LimitEntity> getLimits() {
+ return limits;
+ }
+
+ public void setLimits(Collection<LimitEntity> limits) {
+ this.limits = limits;
+ }
+
+ public LimitForXml getSPLimits() {
+ if (limits != null) {
+ Set<LimitXml> hs = new HashSet<>();
+ for (LimitEntity obj : limits) {
+ if (obj.getType().equals(LimitType.ServiceProvider)) {
+ LimitXml xmlObj = new LimitXml();
+ xmlObj.setDescription(obj.getDescription());
+ xmlObj.setMetric(obj.getMetric());
+ xmlObj.setValues(obj.getValue());
+ xmlObj.setUnit(obj.getUnit());
+ xmlObj.setAggregationFunction(obj.getAggregationFunction() != null ? obj.getAggregationFunction().name() : null);
+ xmlObj.setTime(obj.getTime());
+ hs.add(xmlObj);
+ }
+ }
+ LimitForXml spLimitForXml = new LimitForXml();
+ spLimitForXml.setLimits(hs);
+ return spLimitForXml;
+ }
+ return null;
+ }
+
+ public LimitForXml getVendorLimits() {
+ if (limits != null) {
+ Set<LimitXml> hs = new HashSet<>();
+ for (LimitEntity obj : limits) {
+ if (obj.getType().equals(LimitType.Vendor)) {
+ LimitXml xmlObj = new LimitXml();
+ xmlObj.setDescription(obj.getDescription());
+ xmlObj.setMetric(obj.getMetric());
+ xmlObj.setValues(obj.getValue());
+ xmlObj.setUnit(obj.getUnit());
+ xmlObj.setAggregationFunction(obj.getAggregationFunction() != null ? obj.getAggregationFunction().name() : null);
+ xmlObj.setTime(obj.getTime());
+ hs.add(xmlObj);
+ }
+ }
+ LimitForXml vendorLimitForXml = new LimitForXml();
+ vendorLimitForXml.setLimits(hs);
+ return vendorLimitForXml;
+ }
+ return null;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(vendorLicenseModelId, version, id, name, description, type, thresholdValue, thresholdUnit, increments, operationalScope,
+ referencingFeatureGroups, startDate, expiryDate);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
}
- }
- LimitForXml spLimitForXml = new LimitForXml();
- spLimitForXml.setLimits(hs);
- return spLimitForXml;
- }
-
- return null;
- }
-
- public LimitForXml getVendorLimits() {
- if (limits != null) {
- Set<LimitXml> hs = new HashSet<>();
- for (LimitEntity obj : limits) {
- if (obj.getType().equals(LimitType.Vendor)) {
- LimitXml xmlObj = new LimitXml();
- xmlObj.setDescription(obj.getDescription());
- xmlObj.setMetric(obj.getMetric());
- xmlObj.setValues(obj.getValue());
- xmlObj.setUnit(obj.getUnit());
- xmlObj.setAggregationFunction(
- obj.getAggregationFunction() != null ? obj.getAggregationFunction().name() : null);
- xmlObj.setTime(obj.getTime());
- hs.add(xmlObj);
+ if (obj == null || getClass() != obj.getClass()) {
+ return false;
}
- }
- LimitForXml vendorLimitForXml = new LimitForXml();
- vendorLimitForXml.setLimits(hs);
- return vendorLimitForXml;
- }
-
- return null;
- }
-
-
- @Override
- public int hashCode() {
- return Objects
- .hash(vendorLicenseModelId, version, id, name, description, type, thresholdValue, thresholdUnit,
- increments, operationalScope, referencingFeatureGroups, startDate, expiryDate);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null || getClass() != obj.getClass()) {
- return false;
- }
- EntitlementPoolEntity that = (EntitlementPoolEntity) obj;
- return Objects.equals(that.thresholdValue, thresholdValue)
- && Objects.equals(vendorLicenseModelId, that.vendorLicenseModelId)
- && Objects.equals(id, that.id)
- && Objects.equals(name, that.name)
- && Objects.equals(description, that.description)
- && type == that.type
- && Objects.equals(thresholdUnit, that.thresholdUnit)
- && Objects.equals(increments, that.increments)
- && Objects.equals(that.operationalScope, operationalScope)
- && Objects.equals(startDate, that.startDate)
- && Objects.equals(expiryDate, that.expiryDate)
- && Objects.equals(manufacturerReferenceNumber, that.manufacturerReferenceNumber)
- && Objects.equals(version, that.version);
- }
-
- @Override
- public String toString() {
- return "EntitlementPoolEntity{"
- + "vendorLicenseModelId='" + vendorLicenseModelId + '\''
- + ", version=" + version
- + ", id='" + id + '\''
- + ", name='" + name + '\''
- + ", description='" + description + '\''
- + ", type=" + type
- + ", thresholdValue=" + thresholdValue
- + ", thresholdUnit='" + thresholdUnit + '\''
- + ", increments='" + increments + '\''
- + ", operationalScope=" + operationalScope
- + ", referencingFeatureGroups=" + referencingFeatureGroups
- + ", version_uuid=" + versionUuId
- + ", startDate=" + startDate
- + ", expiryDate=" + expiryDate
- + '}';
- }
-
- /**
- * Gets operational scope for artifact.
- *
- * @return the operational scope for artifact
- */
- public OperationalScopeForXml getOperationalScopeForArtifact() {
- OperationalScopeForXml obj = new OperationalScopeForXml();
- if (operationalScope != null) {
- if (operationalScope.getResults().size() > 0) {
- obj.setValue(operationalScope.getResults());
- }
- }
- return obj;
- }
-
- //Defined and used only for License Artifcat XMLs
- public void setManufacturerReferenceNumber(String manufacturerReferenceNumber) {
- this.manufacturerReferenceNumber = manufacturerReferenceNumber;
- }
-
- public String getManufacturerReferenceNumber() {
- return manufacturerReferenceNumber;
- }
-
- public String getIsoFormatStartDate() {
- String isoFormatStartDate = null;
- if (!StringUtils.isEmpty(startDate)) {
- isoFormatStartDate = VendorLicenseUtil.getIsoFormatDate(startDate);
- }
- return isoFormatStartDate;
- }
-
-
- public String getIsoFormatExpiryDate() {
- String isoFormatExpDate = null;
- if (!StringUtils.isEmpty(expiryDate)) {
- isoFormatExpDate = VendorLicenseUtil.getIsoFormatDate(expiryDate);
- }
- return isoFormatExpDate;
- }
+ EntitlementPoolEntity that = (EntitlementPoolEntity) obj;
+ return Objects.equals(that.thresholdValue, thresholdValue) && Objects.equals(vendorLicenseModelId, that.vendorLicenseModelId) && Objects
+ .equals(id, that.id) && Objects.equals(name, that.name) && Objects.equals(description, that.description) && type == that.type && Objects
+ .equals(thresholdUnit, that.thresholdUnit) && Objects.equals(increments, that.increments) && Objects
+ .equals(that.operationalScope, operationalScope) && Objects.equals(startDate, that.startDate) && Objects
+ .equals(expiryDate, that.expiryDate) && Objects.equals(manufacturerReferenceNumber, that.manufacturerReferenceNumber) && Objects
+ .equals(version, that.version);
+ }
+
+ @Override
+ public String toString() {
+ return "EntitlementPoolEntity{" + "vendorLicenseModelId='" + vendorLicenseModelId + '\'' + ", version=" + version + ", id='" + id + '\''
+ + ", name='" + name + '\'' + ", description='" + description + '\'' + ", type=" + type + ", thresholdValue=" + thresholdValue
+ + ", thresholdUnit='" + thresholdUnit + '\'' + ", increments='" + increments + '\'' + ", operationalScope=" + operationalScope
+ + ", referencingFeatureGroups=" + referencingFeatureGroups + ", version_uuid=" + versionUuId + ", startDate=" + startDate
+ + ", expiryDate=" + expiryDate + '}';
+ }
+
+ /**
+ * Gets operational scope for artifact.
+ *
+ * @return the operational scope for artifact
+ */
+ public OperationalScopeForXml getOperationalScopeForArtifact() {
+ OperationalScopeForXml obj = new OperationalScopeForXml();
+ if (operationalScope != null) {
+ if (operationalScope.getResults().size() > 0) {
+ obj.setValue(operationalScope.getResults());
+ }
+ }
+ return obj;
+ }
+
+ public String getManufacturerReferenceNumber() {
+ return manufacturerReferenceNumber;
+ }
+
+ //Defined and used only for License Artifcat XMLs
+ public void setManufacturerReferenceNumber(String manufacturerReferenceNumber) {
+ this.manufacturerReferenceNumber = manufacturerReferenceNumber;
+ }
+
+ public String getIsoFormatStartDate() {
+ String isoFormatStartDate = null;
+ if (!StringUtils.isEmpty(startDate)) {
+ isoFormatStartDate = VendorLicenseUtil.getIsoFormatDate(startDate);
+ }
+ return isoFormatStartDate;
+ }
+
+ public String getIsoFormatExpiryDate() {
+ String isoFormatExpDate = null;
+ if (!StringUtils.isEmpty(expiryDate)) {
+ isoFormatExpDate = VendorLicenseUtil.getIsoFormatDate(expiryDate);
+ }
+ return isoFormatExpDate;
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/EntitlementPoolType.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/EntitlementPoolType.java
index 1a851a54ac..f75351ff41 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/EntitlementPoolType.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/EntitlementPoolType.java
@@ -17,15 +17,12 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.dao.types;
public enum EntitlementPoolType {
- Universal,
- Unique,
- One_Time;
+ Universal, Unique, One_Time;
public static EntitlementPoolType permissiveValueOf(String name) {
return name == null ? Universal : EntitlementPoolType.valueOf(name);
}
-} \ No newline at end of file
+}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/EntitlementTime.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/EntitlementTime.java
index 78576d1e7d..91d95953a8 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/EntitlementTime.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/EntitlementTime.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,14 +17,8 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.dao.types;
public enum EntitlementTime { //TODO MetricTime ? ask Segev...
- Hour,
- Day,
- Month,
- Quarter,
- Year,
- Other;
+ Hour, Day, Month, Quarter, Year, Other;
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/FeatureGroupEntity.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/FeatureGroupEntity.java
index d19d780c7b..6fed37bf7b 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/FeatureGroupEntity.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/FeatureGroupEntity.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.dao.types;
import com.datastax.driver.mapping.annotations.ClusteringColumn;
@@ -25,198 +24,181 @@ import com.datastax.driver.mapping.annotations.Column;
import com.datastax.driver.mapping.annotations.Frozen;
import com.datastax.driver.mapping.annotations.PartitionKey;
import com.datastax.driver.mapping.annotations.Table;
-
-import org.openecomp.sdc.versioning.dao.types.Version;
-import org.openecomp.sdc.versioning.dao.types.VersionableEntity;
-
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdc.versioning.dao.types.VersionableEntity;
@Table(name = "feature_group", keyspace = "dox")
public class FeatureGroupEntity implements VersionableEntity {
- private static final String ENTITY_TYPE = "Feature Group";
-
- @PartitionKey
- @Column(name = "vlm_id")
- private String vendorLicenseModelId;
- @PartitionKey(value = 1)
- @Frozen
- private Version version;
- @ClusteringColumn
- @Column(name = "fg_id")
- private String id;
- private String name;
- private String description;
- @Column(name = "part_num")
- private String partNumber;
- @Column(name = "manufacturer_ref_num")
- private String manufacturerReferenceNumber;
- @Column(name = "lkg_ids")
- private Set<String> licenseKeyGroupIds = new HashSet<>();
- @Column(name = "ep_ids")
- private Set<String> entitlementPoolIds = new HashSet<>();
- @Column(name = "ref_la_ids")
- private Set<String> referencingLicenseAgreements = new HashSet<>();
-
- /**
- * Every entity class must have a default constructor according to
- * <a href="http://docs.datastax.com/en/developer/java-driver/2.1/manual/object_mapper/creating/">
- * Definition of mapped classes</a>.
- */
- public FeatureGroupEntity() {
- // Don't delete! Default constructor is required by DataStax driver
- }
-
- /**
- * Instantiates a new Feature group entity.
- *
- * @param vendorLicenseModelId the vendor license model id
- * @param version the version
- * @param id the id
- */
- public FeatureGroupEntity(String vendorLicenseModelId, Version version, String id) {
- this.vendorLicenseModelId = vendorLicenseModelId;
- this.version = version;
- this.id = id;
- }
-
- @Override
- public String getEntityType() {
- return ENTITY_TYPE;
- }
-
- @Override
- public String getFirstClassCitizenId() {
- return getVendorLicenseModelId();
- }
-
- @Override
- public String getId() {
- return id;
- }
-
- @Override
- public void setId(String id) {
- this.id = id;
- }
-
- @Override
- public Version getVersion() {
- return version;
- }
-
- @Override
- public void setVersion(Version version) {
- this.version = version;
- }
-
- public String getVendorLicenseModelId() {
- return vendorLicenseModelId;
- }
-
- public void setVendorLicenseModelId(String vendorLicenseModelId) {
- this.vendorLicenseModelId = vendorLicenseModelId;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getPartNumber() {
- return partNumber;
- }
-
- public void setPartNumber(String partNumber) {
- this.partNumber = partNumber;
- }
-
- public String getManufacturerReferenceNumber() {
- return manufacturerReferenceNumber;
- }
-
- public void setManufacturerReferenceNumber(String manufacturerReferenceNumber) {
- this.manufacturerReferenceNumber = manufacturerReferenceNumber;
- }
-
- public Set<String> getLicenseKeyGroupIds() {
- return licenseKeyGroupIds;
- }
-
- public void setLicenseKeyGroupIds(Set<String> licenseKeyGroupIds) {
- this.licenseKeyGroupIds = licenseKeyGroupIds;
- }
-
- public Set<String> getEntitlementPoolIds() {
- return entitlementPoolIds;
- }
-
- public void setEntitlementPoolIds(Set<String> entitlementPoolIds) {
- this.entitlementPoolIds = entitlementPoolIds;
- }
-
- public Set<String> getReferencingLicenseAgreements() {
- return referencingLicenseAgreements;
- }
-
- public void setReferencingLicenseAgreements(Set<String> referencingLicenseAgreements) {
- this.referencingLicenseAgreements = referencingLicenseAgreements;
- }
-
- @Override
- public int hashCode() {
- return Objects
- .hash(vendorLicenseModelId, version, id, name, description, partNumber,
- manufacturerReferenceNumber, licenseKeyGroupIds, entitlementPoolIds,
- referencingLicenseAgreements);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null || getClass() != obj.getClass()) {
- return false;
- }
- FeatureGroupEntity that = (FeatureGroupEntity) obj;
- return Objects.equals(vendorLicenseModelId, that.vendorLicenseModelId)
- && Objects.equals(version, that.version)
- && Objects.equals(id, that.id)
- && Objects.equals(name, that.name)
- && Objects.equals(description, that.description)
- && Objects.equals(partNumber, that.partNumber)
- && Objects.equals(manufacturerReferenceNumber, that.manufacturerReferenceNumber)
- && Objects.equals(licenseKeyGroupIds, that.licenseKeyGroupIds)
- && Objects.equals(entitlementPoolIds, that.entitlementPoolIds)
- && Objects.equals(referencingLicenseAgreements, that.referencingLicenseAgreements);
- }
-
- @Override
- public String toString() {
- return "FeatureGroupEntity{"
- + "vendorLicenseModelId='" + vendorLicenseModelId + '\''
- + ", version=" + version
- + ", id='" + id + '\''
- + ", name='" + name + '\''
- + ", description='" + description + '\''
- + ", partNumber='" + partNumber + '\''
- + ", manufacturerReferenceNumber='" + manufacturerReferenceNumber + '\''
- + ", licenseKeyGroupIds=" + licenseKeyGroupIds
- + ", entitlementPoolIds=" + entitlementPoolIds
- + ", referencingLicenseAgreements=" + referencingLicenseAgreements
- + '}';
- }
+
+ private static final String ENTITY_TYPE = "Feature Group";
+ @PartitionKey
+ @Column(name = "vlm_id")
+ private String vendorLicenseModelId;
+ @PartitionKey(value = 1)
+ @Frozen
+ private Version version;
+ @ClusteringColumn
+ @Column(name = "fg_id")
+ private String id;
+ private String name;
+ private String description;
+ @Column(name = "part_num")
+ private String partNumber;
+ @Column(name = "manufacturer_ref_num")
+ private String manufacturerReferenceNumber;
+ @Column(name = "lkg_ids")
+ private Set<String> licenseKeyGroupIds = new HashSet<>();
+ @Column(name = "ep_ids")
+ private Set<String> entitlementPoolIds = new HashSet<>();
+ @Column(name = "ref_la_ids")
+ private Set<String> referencingLicenseAgreements = new HashSet<>();
+
+ /**
+ * Every entity class must have a default constructor according to
+ * <a href="http://docs.datastax.com/en/developer/java-driver/2.1/manual/object_mapper/creating/">
+ * Definition of mapped classes</a>.
+ */
+ public FeatureGroupEntity() {
+ // Don't delete! Default constructor is required by DataStax driver
+ }
+
+ /**
+ * Instantiates a new Feature group entity.
+ *
+ * @param vendorLicenseModelId the vendor license model id
+ * @param version the version
+ * @param id the id
+ */
+ public FeatureGroupEntity(String vendorLicenseModelId, Version version, String id) {
+ this.vendorLicenseModelId = vendorLicenseModelId;
+ this.version = version;
+ this.id = id;
+ }
+
+ @Override
+ public String getEntityType() {
+ return ENTITY_TYPE;
+ }
+
+ @Override
+ public String getFirstClassCitizenId() {
+ return getVendorLicenseModelId();
+ }
+
+ @Override
+ public String getId() {
+ return id;
+ }
+
+ @Override
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ @Override
+ public Version getVersion() {
+ return version;
+ }
+
+ @Override
+ public void setVersion(Version version) {
+ this.version = version;
+ }
+
+ public String getVendorLicenseModelId() {
+ return vendorLicenseModelId;
+ }
+
+ public void setVendorLicenseModelId(String vendorLicenseModelId) {
+ this.vendorLicenseModelId = vendorLicenseModelId;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getPartNumber() {
+ return partNumber;
+ }
+
+ public void setPartNumber(String partNumber) {
+ this.partNumber = partNumber;
+ }
+
+ public String getManufacturerReferenceNumber() {
+ return manufacturerReferenceNumber;
+ }
+
+ public void setManufacturerReferenceNumber(String manufacturerReferenceNumber) {
+ this.manufacturerReferenceNumber = manufacturerReferenceNumber;
+ }
+
+ public Set<String> getLicenseKeyGroupIds() {
+ return licenseKeyGroupIds;
+ }
+
+ public void setLicenseKeyGroupIds(Set<String> licenseKeyGroupIds) {
+ this.licenseKeyGroupIds = licenseKeyGroupIds;
+ }
+
+ public Set<String> getEntitlementPoolIds() {
+ return entitlementPoolIds;
+ }
+
+ public void setEntitlementPoolIds(Set<String> entitlementPoolIds) {
+ this.entitlementPoolIds = entitlementPoolIds;
+ }
+
+ public Set<String> getReferencingLicenseAgreements() {
+ return referencingLicenseAgreements;
+ }
+
+ public void setReferencingLicenseAgreements(Set<String> referencingLicenseAgreements) {
+ this.referencingLicenseAgreements = referencingLicenseAgreements;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(vendorLicenseModelId, version, id, name, description, partNumber, manufacturerReferenceNumber, licenseKeyGroupIds,
+ entitlementPoolIds, referencingLicenseAgreements);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null || getClass() != obj.getClass()) {
+ return false;
+ }
+ FeatureGroupEntity that = (FeatureGroupEntity) obj;
+ return Objects.equals(vendorLicenseModelId, that.vendorLicenseModelId) && Objects.equals(version, that.version) && Objects.equals(id, that.id)
+ && Objects.equals(name, that.name) && Objects.equals(description, that.description) && Objects.equals(partNumber, that.partNumber)
+ && Objects.equals(manufacturerReferenceNumber, that.manufacturerReferenceNumber) && Objects
+ .equals(licenseKeyGroupIds, that.licenseKeyGroupIds) && Objects.equals(entitlementPoolIds, that.entitlementPoolIds) && Objects
+ .equals(referencingLicenseAgreements, that.referencingLicenseAgreements);
+ }
+
+ @Override
+ public String toString() {
+ return "FeatureGroupEntity{" + "vendorLicenseModelId='" + vendorLicenseModelId + '\'' + ", version=" + version + ", id='" + id + '\''
+ + ", name='" + name + '\'' + ", description='" + description + '\'' + ", partNumber='" + partNumber + '\''
+ + ", manufacturerReferenceNumber='" + manufacturerReferenceNumber + '\'' + ", licenseKeyGroupIds=" + licenseKeyGroupIds
+ + ", entitlementPoolIds=" + entitlementPoolIds + ", referencingLicenseAgreements=" + referencingLicenseAgreements + '}';
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/FeatureGroupModel.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/FeatureGroupModel.java
index 7e4ba8051e..93b953c52b 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/FeatureGroupModel.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/FeatureGroupModel.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,62 +17,59 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.dao.types;
import java.util.HashSet;
import java.util.Set;
public class FeatureGroupModel {
- private FeatureGroupEntity featureGroup;
- private Set<EntitlementPoolEntity> entitlementPools = new HashSet<>();
-
- private Set<LicenseKeyGroupEntity> licenseKeyGroups = new HashSet<>();
-
- public FeatureGroupEntity getFeatureGroup() {
- return featureGroup;
- }
- public void setFeatureGroup(FeatureGroupEntity featureGroup) {
- this.featureGroup = featureGroup;
- }
+ private FeatureGroupEntity featureGroup;
+ private Set<EntitlementPoolEntity> entitlementPools = new HashSet<>();
+ private Set<LicenseKeyGroupEntity> licenseKeyGroups = new HashSet<>();
- public Set<EntitlementPoolEntity> getEntitlementPools() {
- return entitlementPools;
- }
+ public FeatureGroupEntity getFeatureGroup() {
+ return featureGroup;
+ }
- public void setEntitlementPools(Set<EntitlementPoolEntity> entitlementPools) {
- this.entitlementPools = entitlementPools;
- }
+ public void setFeatureGroup(FeatureGroupEntity featureGroup) {
+ this.featureGroup = featureGroup;
+ }
- public Set<LicenseKeyGroupEntity> getLicenseKeyGroups() {
- return licenseKeyGroups;
- }
+ public Set<EntitlementPoolEntity> getEntitlementPools() {
+ return entitlementPools;
+ }
- public void setLicenseKeyGroups(Set<LicenseKeyGroupEntity> licenseKeyGroups) {
- this.licenseKeyGroups = licenseKeyGroups;
- }
+ public void setEntitlementPools(Set<EntitlementPoolEntity> entitlementPools) {
+ this.entitlementPools = entitlementPools;
+ }
- //for XML Artifact
- public String getEntityName() {
- return featureGroup.getName();
- }
+ public Set<LicenseKeyGroupEntity> getLicenseKeyGroups() {
+ return licenseKeyGroups;
+ }
- public String getEntityDesc() {
- return featureGroup.getDescription();
- }
+ public void setLicenseKeyGroups(Set<LicenseKeyGroupEntity> licenseKeyGroups) {
+ this.licenseKeyGroups = licenseKeyGroups;
+ }
- public String getEntityId() {
- return featureGroup.getId();
- }
+ //for XML Artifact
+ public String getEntityName() {
+ return featureGroup.getName();
+ }
- public String getEntityPartNumber() {
- return featureGroup.getPartNumber();
- }
+ public String getEntityDesc() {
+ return featureGroup.getDescription();
+ }
- public String getEntityManufacturerReferenceNumber(){
- return featureGroup.getManufacturerReferenceNumber();
- }
+ public String getEntityId() {
+ return featureGroup.getId();
+ }
+ public String getEntityPartNumber() {
+ return featureGroup.getPartNumber();
+ }
+ public String getEntityManufacturerReferenceNumber() {
+ return featureGroup.getManufacturerReferenceNumber();
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LicenseAgreementEntity.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LicenseAgreementEntity.java
index 43017e7757..1646ba9b61 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LicenseAgreementEntity.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LicenseAgreementEntity.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.dao.types;
import com.datastax.driver.mapping.annotations.ClusteringColumn;
@@ -25,165 +24,152 @@ import com.datastax.driver.mapping.annotations.Column;
import com.datastax.driver.mapping.annotations.Frozen;
import com.datastax.driver.mapping.annotations.PartitionKey;
import com.datastax.driver.mapping.annotations.Table;
-
-import org.openecomp.sdc.versioning.dao.types.Version;
-import org.openecomp.sdc.versioning.dao.types.VersionableEntity;
-
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdc.versioning.dao.types.VersionableEntity;
@Table(keyspace = "dox", name = "license_agreement")
public class LicenseAgreementEntity implements VersionableEntity {
- public static final String ENTITY_TYPE = "License Agreement";
-
- @PartitionKey(value = 0)
- @Column(name = "vlm_id")
- private String vendorLicenseModelId;
-
- @PartitionKey(value = 1)
- @Frozen
- private Version version;
-
- @ClusteringColumn
- @Column(name = "la_id")
- private String id;
- private String name;
- private String description;
-
- @Column(name = "lic_term")
- @Frozen
- private ChoiceOrOther<LicenseTerm> licenseTerm;
-
- @Column(name = "req_const")
- private String requirementsAndConstrains;
-
- @Column(name = "fg_ids")
- private Set<String> featureGroupIds = new HashSet<>();
-
- /**
- * Every entity class must have a default constructor according to
- * <a href="http://docs.datastax.com/en/developer/java-driver/2.1/manual/object_mapper/creating/">
- * Definition of mapped classes</a>.
- */
- public LicenseAgreementEntity() {
- // Don't delete! Default constructor is required by DataStax driver
- }
-
- /**
- * Instantiates a new License agreement entity.
- *
- * @param vlmId the vlm id
- * @param version the version
- * @param id the id
- */
- public LicenseAgreementEntity(String vlmId, Version version, String id) {
- this.vendorLicenseModelId = vlmId;
- this.id = id;
- this.version = version;
- }
-
- @Override
- public String getEntityType() {
- return ENTITY_TYPE;
- }
-
- @Override
- public String getFirstClassCitizenId() {
- return getVendorLicenseModelId();
- }
-
- @Override
- public String getId() {
- return id;
- }
-
- @Override
- public void setId(String id) {
- this.id = id;
- }
-
- @Override
- public Version getVersion() {
- return version;
- }
-
- @Override
- public void setVersion(Version version) {
- this.version = version;
- }
-
- public String getVendorLicenseModelId() {
- return vendorLicenseModelId;
- }
-
- public void setVendorLicenseModelId(String vendorLicenseModelId) {
- this.vendorLicenseModelId = vendorLicenseModelId;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public ChoiceOrOther<LicenseTerm> getLicenseTerm() {
- return licenseTerm;
- }
-
- public void setLicenseTerm(ChoiceOrOther<LicenseTerm> licenseTerm) {
- licenseTerm.resolveEnum(LicenseTerm.class);
- this.licenseTerm = licenseTerm;
- }
-
- public String getRequirementsAndConstrains() {
- return requirementsAndConstrains;
- }
-
- public void setRequirementsAndConstrains(String requirementsAndConstrains) {
- this.requirementsAndConstrains = requirementsAndConstrains;
- }
-
- public Set<String> getFeatureGroupIds() {
- return featureGroupIds;
- }
-
- public void setFeatureGroupIds(Set<String> featureGroupIds) {
- this.featureGroupIds = featureGroupIds;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(vendorLicenseModelId, version, id, name, description, licenseTerm,
- requirementsAndConstrains, featureGroupIds);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null || getClass() != obj.getClass()) {
- return false;
- }
- LicenseAgreementEntity that = (LicenseAgreementEntity) obj;
- return Objects.equals(vendorLicenseModelId, that.vendorLicenseModelId)
- && Objects.equals(version, that.version)
- && Objects.equals(id, that.id)
- && Objects.equals(name, that.name)
- && Objects.equals(description, that.description)
- && Objects.equals(licenseTerm, that.licenseTerm)
- && Objects.equals(requirementsAndConstrains, that.requirementsAndConstrains)
- && Objects.equals(featureGroupIds, that.featureGroupIds);
- }
+
+ public static final String ENTITY_TYPE = "License Agreement";
+ @PartitionKey(value = 0)
+ @Column(name = "vlm_id")
+ private String vendorLicenseModelId;
+ @PartitionKey(value = 1)
+ @Frozen
+ private Version version;
+ @ClusteringColumn
+ @Column(name = "la_id")
+ private String id;
+ private String name;
+ private String description;
+ @Column(name = "lic_term")
+ @Frozen
+ private ChoiceOrOther<LicenseTerm> licenseTerm;
+ @Column(name = "req_const")
+ private String requirementsAndConstrains;
+ @Column(name = "fg_ids")
+ private Set<String> featureGroupIds = new HashSet<>();
+
+ /**
+ * Every entity class must have a default constructor according to
+ * <a href="http://docs.datastax.com/en/developer/java-driver/2.1/manual/object_mapper/creating/">
+ * Definition of mapped classes</a>.
+ */
+ public LicenseAgreementEntity() {
+ // Don't delete! Default constructor is required by DataStax driver
+ }
+
+ /**
+ * Instantiates a new License agreement entity.
+ *
+ * @param vlmId the vlm id
+ * @param version the version
+ * @param id the id
+ */
+ public LicenseAgreementEntity(String vlmId, Version version, String id) {
+ this.vendorLicenseModelId = vlmId;
+ this.id = id;
+ this.version = version;
+ }
+
+ @Override
+ public String getEntityType() {
+ return ENTITY_TYPE;
+ }
+
+ @Override
+ public String getFirstClassCitizenId() {
+ return getVendorLicenseModelId();
+ }
+
+ @Override
+ public String getId() {
+ return id;
+ }
+
+ @Override
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ @Override
+ public Version getVersion() {
+ return version;
+ }
+
+ @Override
+ public void setVersion(Version version) {
+ this.version = version;
+ }
+
+ public String getVendorLicenseModelId() {
+ return vendorLicenseModelId;
+ }
+
+ public void setVendorLicenseModelId(String vendorLicenseModelId) {
+ this.vendorLicenseModelId = vendorLicenseModelId;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public ChoiceOrOther<LicenseTerm> getLicenseTerm() {
+ return licenseTerm;
+ }
+
+ public void setLicenseTerm(ChoiceOrOther<LicenseTerm> licenseTerm) {
+ licenseTerm.resolveEnum(LicenseTerm.class);
+ this.licenseTerm = licenseTerm;
+ }
+
+ public String getRequirementsAndConstrains() {
+ return requirementsAndConstrains;
+ }
+
+ public void setRequirementsAndConstrains(String requirementsAndConstrains) {
+ this.requirementsAndConstrains = requirementsAndConstrains;
+ }
+
+ public Set<String> getFeatureGroupIds() {
+ return featureGroupIds;
+ }
+
+ public void setFeatureGroupIds(Set<String> featureGroupIds) {
+ this.featureGroupIds = featureGroupIds;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(vendorLicenseModelId, version, id, name, description, licenseTerm, requirementsAndConstrains, featureGroupIds);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null || getClass() != obj.getClass()) {
+ return false;
+ }
+ LicenseAgreementEntity that = (LicenseAgreementEntity) obj;
+ return Objects.equals(vendorLicenseModelId, that.vendorLicenseModelId) && Objects.equals(version, that.version) && Objects.equals(id, that.id)
+ && Objects.equals(name, that.name) && Objects.equals(description, that.description) && Objects.equals(licenseTerm, that.licenseTerm)
+ && Objects.equals(requirementsAndConstrains, that.requirementsAndConstrains) && Objects.equals(featureGroupIds, that.featureGroupIds);
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LicenseAgreementModel.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LicenseAgreementModel.java
index 1e65f70cc0..f1923701fd 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LicenseAgreementModel.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LicenseAgreementModel.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,29 +17,29 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.dao.types;
import java.util.HashSet;
import java.util.Set;
public class LicenseAgreementModel {
- private LicenseAgreementEntity licenseAgreement;
- private Set<FeatureGroupEntity> featureGroups = new HashSet<>();
- public LicenseAgreementEntity getLicenseAgreement() {
- return licenseAgreement;
- }
+ private LicenseAgreementEntity licenseAgreement;
+ private Set<FeatureGroupEntity> featureGroups = new HashSet<>();
+
+ public LicenseAgreementEntity getLicenseAgreement() {
+ return licenseAgreement;
+ }
- public void setLicenseAgreement(LicenseAgreementEntity licenseAgreement) {
- this.licenseAgreement = licenseAgreement;
- }
+ public void setLicenseAgreement(LicenseAgreementEntity licenseAgreement) {
+ this.licenseAgreement = licenseAgreement;
+ }
- public Set<FeatureGroupEntity> getFeatureGroups() {
- return featureGroups;
- }
+ public Set<FeatureGroupEntity> getFeatureGroups() {
+ return featureGroups;
+ }
- public void setFeatureGroups(Set<FeatureGroupEntity> featureGroups) {
- this.featureGroups = featureGroups;
- }
+ public void setFeatureGroups(Set<FeatureGroupEntity> featureGroups) {
+ this.featureGroups = featureGroups;
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LicenseKeyGroupEntity.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LicenseKeyGroupEntity.java
index c84df9ca95..57849a890a 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LicenseKeyGroupEntity.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LicenseKeyGroupEntity.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.dao.types;
import com.datastax.driver.mapping.annotations.ClusteringColumn;
@@ -25,379 +24,354 @@ import com.datastax.driver.mapping.annotations.Column;
import com.datastax.driver.mapping.annotations.Frozen;
import com.datastax.driver.mapping.annotations.PartitionKey;
import com.datastax.driver.mapping.annotations.Table;
-
-import org.apache.commons.lang3.StringUtils;
-import org.openecomp.sdc.vendorlicense.VendorLicenseUtil;
-import org.openecomp.sdc.vendorlicense.dao.types.xml.*;
-import org.openecomp.sdc.versioning.dao.types.Version;
-import org.openecomp.sdc.versioning.dao.types.VersionableEntity;
-
import java.util.Collection;
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
+import org.apache.commons.lang3.StringUtils;
+import org.openecomp.sdc.vendorlicense.VendorLicenseUtil;
+import org.openecomp.sdc.vendorlicense.dao.types.xml.LicenseKeyTypeForXml;
+import org.openecomp.sdc.vendorlicense.dao.types.xml.LimitForXml;
+import org.openecomp.sdc.vendorlicense.dao.types.xml.LimitXml;
+import org.openecomp.sdc.vendorlicense.dao.types.xml.OperationalScopeForXml;
+import org.openecomp.sdc.vendorlicense.dao.types.xml.ThresholdForXml;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdc.versioning.dao.types.VersionableEntity;
@Table(keyspace = "dox", name = "license_key_group")
public class LicenseKeyGroupEntity implements VersionableEntity {
- private static final String ENTITY_TYPE = "License Key Group";
-
- @PartitionKey
- @Column(name = "vlm_id")
- private String vendorLicenseModelId;
- @PartitionKey(value = 1)
- @Frozen
- private Version version;
- @ClusteringColumn
- @Column(name = "lkg_id")
- private String id;
- private String name;
- private String description;
- private LicenseKeyType type;
- @Column(name = "operational_scope")
- @Frozen
- private MultiChoiceOrOther<OperationalScope> operationalScope;
- @Column(name = "ref_fg_ids")
- private Set<String> referencingFeatureGroups = new HashSet<>();
- @Column(name = "version_uuid")
- private String versionUuId;
- private Integer thresholdValue;
- private ThresholdUnit thresholdUnits;
- private String increments;
-
- private Collection<LimitEntity> limits;
- private String startDate;
- private String expiryDate;
-
- //Defined and used only for License Artifcat XMLs
- private String manufacturerReferenceNumber;
-
- /**
- * Every entity class must have a default constructor according to
- * <a href="http://docs.datastax.com/en/developer/java-driver/2.1/manual/object_mapper/creating/">
- * Definition of mapped classes</a>.
- */
- public LicenseKeyGroupEntity() {
- // Don't delete! Default constructor is required by DataStax driver
- }
-
- /**
- * Instantiates a new License key group entity.
- *
- * @param vendorLicenseModelId the vendor license model id
- * @param version the version
- * @param id the id
- */
- public LicenseKeyGroupEntity(String vendorLicenseModelId, Version version, String id) {
- this.vendorLicenseModelId = vendorLicenseModelId;
- this.version = version;
- this.id = id;
- }
-
- @Override
- public String getEntityType() {
- return ENTITY_TYPE;
- }
-
- @Override
- public String getFirstClassCitizenId() {
- return getVendorLicenseModelId();
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public Version getVersion() {
- return version;
- }
-
- public void setVersion(Version version) {
- this.version = version;
- }
-
- @Override
- public String getVersionUuId() {
- return versionUuId;
- }
-
- @Override
- public void setVersionUuId(String uuId) {
- versionUuId = uuId;
- }
-
- public String getVendorLicenseModelId() {
- return vendorLicenseModelId;
- }
-
- public void setVendorLicenseModelId(String vendorLicenseModelId) {
- this.vendorLicenseModelId = vendorLicenseModelId;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public LicenseKeyType getType() {
- return type;
- }
-
- public void setType(LicenseKeyType type) {
- this.type = type;
- }
-
- public MultiChoiceOrOther<OperationalScope> getOperationalScope() {
- return operationalScope;
- }
-
- public void setOperationalScope(MultiChoiceOrOther<OperationalScope> operationalScope) {
- if (operationalScope != null) {
- operationalScope.resolveEnum(OperationalScope.class);
- }
- this.operationalScope = operationalScope;
- }
-
- public Set<String> getReferencingFeatureGroups() {
- return referencingFeatureGroups;
- }
-
- public void setReferencingFeatureGroups(Set<String> referencingFeatureGroups) {
- this.referencingFeatureGroups = referencingFeatureGroups;
- }
-
- public Integer getThresholdValue() {
- return thresholdValue;
- }
-
- public void setThresholdValue(Integer thresholdValue) {
- this.thresholdValue = thresholdValue;
- }
-
- public ThresholdUnit getThresholdUnits() {
- return thresholdUnits;
- }
-
- public void setThresholdUnits(ThresholdUnit thresholdUnit) {
- this.thresholdUnits = thresholdUnit;
- }
-
- public String getIncrements() {
- return increments;
- }
-
- public void setIncrements(String increments) {
- this.increments = increments;
- }
-
- public ThresholdForXml getThresholdForArtifact() {
- ThresholdForXml threshold = new ThresholdForXml();
- threshold.setUnit(getThresholdUnits() == null ? null : getThresholdUnits().name());
- threshold.setValue(getThresholdValue());
- return threshold;
- }
-
- public Collection<LimitEntity> getLimits() {
- return limits;
- }
-
- public void setLimits(Collection<LimitEntity> limits) {
- this.limits = limits;
- }
-
- public LimitForXml getSPLimits() {
- if (limits != null) {
- Set<LimitXml> hs = new HashSet<>();
- for (LimitEntity obj : limits) {
- if (obj.getType().equals(LimitType.ServiceProvider)) {
- LimitXml xmlObj = new LimitXml();
- xmlObj.setDescription(obj.getDescription());
- xmlObj.setMetric(obj.getMetric());
- xmlObj.setValues(obj.getValue());
- xmlObj.setUnit(obj.getUnit());
- xmlObj.setAggregationFunction(
- obj.getAggregationFunction() != null ? obj.getAggregationFunction().name() : null);
- xmlObj.setTime(obj.getTime());
- hs.add(xmlObj);
+
+ private static final String ENTITY_TYPE = "License Key Group";
+ @PartitionKey
+ @Column(name = "vlm_id")
+ private String vendorLicenseModelId;
+ @PartitionKey(value = 1)
+ @Frozen
+ private Version version;
+ @ClusteringColumn
+ @Column(name = "lkg_id")
+ private String id;
+ private String name;
+ private String description;
+ private LicenseKeyType type;
+ @Column(name = "operational_scope")
+ @Frozen
+ private MultiChoiceOrOther<OperationalScope> operationalScope;
+ @Column(name = "ref_fg_ids")
+ private Set<String> referencingFeatureGroups = new HashSet<>();
+ @Column(name = "version_uuid")
+ private String versionUuId;
+ private Integer thresholdValue;
+ private ThresholdUnit thresholdUnits;
+ private String increments;
+ private Collection<LimitEntity> limits;
+ private String startDate;
+ private String expiryDate;
+ //Defined and used only for License Artifcat XMLs
+ private String manufacturerReferenceNumber;
+
+ /**
+ * Every entity class must have a default constructor according to
+ * <a href="http://docs.datastax.com/en/developer/java-driver/2.1/manual/object_mapper/creating/">
+ * Definition of mapped classes</a>.
+ */
+ public LicenseKeyGroupEntity() {
+ // Don't delete! Default constructor is required by DataStax driver
+ }
+
+ /**
+ * Instantiates a new License key group entity.
+ *
+ * @param vendorLicenseModelId the vendor license model id
+ * @param version the version
+ * @param id the id
+ */
+ public LicenseKeyGroupEntity(String vendorLicenseModelId, Version version, String id) {
+ this.vendorLicenseModelId = vendorLicenseModelId;
+ this.version = version;
+ this.id = id;
+ }
+
+ @Override
+ public String getEntityType() {
+ return ENTITY_TYPE;
+ }
+
+ @Override
+ public String getFirstClassCitizenId() {
+ return getVendorLicenseModelId();
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public Version getVersion() {
+ return version;
+ }
+
+ public void setVersion(Version version) {
+ this.version = version;
+ }
+
+ @Override
+ public String getVersionUuId() {
+ return versionUuId;
+ }
+
+ @Override
+ public void setVersionUuId(String uuId) {
+ versionUuId = uuId;
+ }
+
+ public String getVendorLicenseModelId() {
+ return vendorLicenseModelId;
+ }
+
+ public void setVendorLicenseModelId(String vendorLicenseModelId) {
+ this.vendorLicenseModelId = vendorLicenseModelId;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public LicenseKeyType getType() {
+ return type;
+ }
+
+ public void setType(LicenseKeyType type) {
+ this.type = type;
+ }
+
+ public MultiChoiceOrOther<OperationalScope> getOperationalScope() {
+ return operationalScope;
+ }
+
+ public void setOperationalScope(MultiChoiceOrOther<OperationalScope> operationalScope) {
+ if (operationalScope != null) {
+ operationalScope.resolveEnum(OperationalScope.class);
+ }
+ this.operationalScope = operationalScope;
+ }
+
+ public Set<String> getReferencingFeatureGroups() {
+ return referencingFeatureGroups;
+ }
+
+ public void setReferencingFeatureGroups(Set<String> referencingFeatureGroups) {
+ this.referencingFeatureGroups = referencingFeatureGroups;
+ }
+
+ public Integer getThresholdValue() {
+ return thresholdValue;
+ }
+
+ public void setThresholdValue(Integer thresholdValue) {
+ this.thresholdValue = thresholdValue;
+ }
+
+ public ThresholdUnit getThresholdUnits() {
+ return thresholdUnits;
+ }
+
+ public void setThresholdUnits(ThresholdUnit thresholdUnit) {
+ this.thresholdUnits = thresholdUnit;
+ }
+
+ public String getIncrements() {
+ return increments;
+ }
+
+ public void setIncrements(String increments) {
+ this.increments = increments;
+ }
+
+ public ThresholdForXml getThresholdForArtifact() {
+ ThresholdForXml threshold = new ThresholdForXml();
+ threshold.setUnit(getThresholdUnits() == null ? null : getThresholdUnits().name());
+ threshold.setValue(getThresholdValue());
+ return threshold;
+ }
+
+ public Collection<LimitEntity> getLimits() {
+ return limits;
+ }
+
+ public void setLimits(Collection<LimitEntity> limits) {
+ this.limits = limits;
+ }
+
+ public LimitForXml getSPLimits() {
+ if (limits != null) {
+ Set<LimitXml> hs = new HashSet<>();
+ for (LimitEntity obj : limits) {
+ if (obj.getType().equals(LimitType.ServiceProvider)) {
+ LimitXml xmlObj = new LimitXml();
+ xmlObj.setDescription(obj.getDescription());
+ xmlObj.setMetric(obj.getMetric());
+ xmlObj.setValues(obj.getValue());
+ xmlObj.setUnit(obj.getUnit());
+ xmlObj.setAggregationFunction(obj.getAggregationFunction() != null ? obj.getAggregationFunction().name() : null);
+ xmlObj.setTime(obj.getTime());
+ hs.add(xmlObj);
+ }
+ }
+ LimitForXml spLimitForXml = new LimitForXml();
+ spLimitForXml.setLimits(hs);
+ return spLimitForXml;
}
- }
- LimitForXml spLimitForXml = new LimitForXml();
- spLimitForXml.setLimits(hs);
- return spLimitForXml;
- }
-
- return null;
- }
-
- public LimitForXml getVendorLimits() {
- if (limits != null) {
- Set<LimitXml> hs = new HashSet<>();
- for (LimitEntity obj : limits) {
- if (obj.getType().equals(LimitType.Vendor)) {
- LimitXml xmlObj = new LimitXml();
- xmlObj.setDescription(obj.getDescription());
- xmlObj.setMetric(obj.getMetric());
- xmlObj.setValues(obj.getValue());
- xmlObj.setUnit(obj.getUnit());
- xmlObj.setAggregationFunction(
- obj.getAggregationFunction() != null ? obj.getAggregationFunction().name() : null);
- xmlObj.setTime(obj.getTime());
- hs.add(xmlObj);
+ return null;
+ }
+
+ public LimitForXml getVendorLimits() {
+ if (limits != null) {
+ Set<LimitXml> hs = new HashSet<>();
+ for (LimitEntity obj : limits) {
+ if (obj.getType().equals(LimitType.Vendor)) {
+ LimitXml xmlObj = new LimitXml();
+ xmlObj.setDescription(obj.getDescription());
+ xmlObj.setMetric(obj.getMetric());
+ xmlObj.setValues(obj.getValue());
+ xmlObj.setUnit(obj.getUnit());
+ xmlObj.setAggregationFunction(obj.getAggregationFunction() != null ? obj.getAggregationFunction().name() : null);
+ xmlObj.setTime(obj.getTime());
+ hs.add(xmlObj);
+ }
+ }
+ LimitForXml vendorLimitForXml = new LimitForXml();
+ vendorLimitForXml.setLimits(hs);
+ return vendorLimitForXml;
}
- }
- LimitForXml vendorLimitForXml = new LimitForXml();
- vendorLimitForXml.setLimits(hs);
- return vendorLimitForXml;
- }
-
- return null;
- }
-
- public String getStartDate() {
- return startDate;
- }
-
- public void setStartDate(String startDate) {
- this.startDate = startDate;
- }
-
- public String getExpiryDate() {
- return expiryDate;
- }
-
- public void setExpiryDate(String expiryDate) {
- this.expiryDate = expiryDate;
- }
-
- @Override
- public int hashCode() {
- return Objects
- .hash(vendorLicenseModelId, version, id, name, description, type, operationalScope,
- referencingFeatureGroups, startDate, expiryDate,
- thresholdValue, thresholdUnits, increments);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null || getClass() != obj.getClass()) {
- return false;
- }
- LicenseKeyGroupEntity that = (LicenseKeyGroupEntity) obj;
- return Objects.equals(vendorLicenseModelId, that.vendorLicenseModelId)
- && Objects.equals(version, that.version)
- && Objects.equals(id, that.id)
- && Objects.equals(name, that.name)
- && Objects.equals(description, that.description)
- && type == that.type
- && Objects.equals(that.operationalScope, operationalScope)
- && Objects.equals(startDate, that.startDate)
- && Objects.equals(expiryDate, that.expiryDate)
- && Objects.equals(thresholdValue, that.thresholdValue)
- && Objects.equals(thresholdUnits, that.thresholdUnits)
- && Objects.equals(increments, that.increments)
- && Objects.equals(manufacturerReferenceNumber, that.manufacturerReferenceNumber);
- }
-
- @Override
- public String toString() {
- return "LicenseKeyGroupEntity{" + "vendorLicenseModelId='" + vendorLicenseModelId + '\''
- + ", version=" + version
- + ", id='" + id + '\''
- + ", name='" + name + '\''
- + ", description='" + description + '\''
- + ", type=" + type
- + ", operationalScope=" + operationalScope
- + ", referencingFeatureGroups=" + referencingFeatureGroups
- + ", versionUuId='" + versionUuId + '\''
- + ", startDate=" + startDate
- + ", expiryDate=" + expiryDate
- + ", thresholdValue='" + thresholdValue + '\''
- + ", thresholdUnits='" + thresholdUnits + '\''
- + ", increments='" + increments + '\''
- + '}';
- }
-
- /**
- * Gets operational scope for artifact.
- *
- * @return the operational scope for artifact
- */
- public OperationalScopeForXml getOperationalScopeForArtifact() {
- OperationalScopeForXml obj = new OperationalScopeForXml();
- if (operationalScope != null) {
- if (operationalScope.getResults().size() > 0) {
- obj.setValue(operationalScope.getResults());
- }
- }
- return obj;
- }
-
- /**
- * Gets version for artifact.
- *
- * @return version in format suitable for artifact
- */
- public String getVersionForArtifact() {
- return version.toString();
- }
-
- /**
- * Gets type for artifact.
- *
- * @return the type for artifact
- */
- public LicenseKeyTypeForXml getTypeForArtifact() {
- LicenseKeyTypeForXml typeXml = new LicenseKeyTypeForXml();
- if (type != null) {
- typeXml.setValue(type.toString());
- } else {
- typeXml.setValue(null);
- }
- return typeXml;
- }
-
- //Defined and used only for License Artifcat XMLs
- public String getManufacturerReferenceNumber() {
- return manufacturerReferenceNumber;
- }
-
- public void setManufacturerReferenceNumber(String manufacturerReferenceNumber) {
- this.manufacturerReferenceNumber = manufacturerReferenceNumber;
- }
-
- public String getIsoFormatStartDate() {
- String isoFormatStartDate = null;
- if (!StringUtils.isEmpty(startDate)) {
- isoFormatStartDate = VendorLicenseUtil.getIsoFormatDate(startDate);
- }
- return isoFormatStartDate;
- }
-
-
- public String getIsoFormatExpiryDate() {
- String isoFormatExpDate = null;
- if (!StringUtils.isEmpty(expiryDate)) {
- isoFormatExpDate = VendorLicenseUtil.getIsoFormatDate(expiryDate);
- }
- return isoFormatExpDate;
- }
+ return null;
+ }
+
+ public String getStartDate() {
+ return startDate;
+ }
+ public void setStartDate(String startDate) {
+ this.startDate = startDate;
+ }
+
+ public String getExpiryDate() {
+ return expiryDate;
+ }
+ public void setExpiryDate(String expiryDate) {
+ this.expiryDate = expiryDate;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects
+ .hash(vendorLicenseModelId, version, id, name, description, type, operationalScope, referencingFeatureGroups, startDate, expiryDate,
+ thresholdValue, thresholdUnits, increments);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null || getClass() != obj.getClass()) {
+ return false;
+ }
+ LicenseKeyGroupEntity that = (LicenseKeyGroupEntity) obj;
+ return Objects.equals(vendorLicenseModelId, that.vendorLicenseModelId) && Objects.equals(version, that.version) && Objects.equals(id, that.id)
+ && Objects.equals(name, that.name) && Objects.equals(description, that.description) && type == that.type && Objects
+ .equals(that.operationalScope, operationalScope) && Objects.equals(startDate, that.startDate) && Objects
+ .equals(expiryDate, that.expiryDate) && Objects.equals(thresholdValue, that.thresholdValue) && Objects
+ .equals(thresholdUnits, that.thresholdUnits) && Objects.equals(increments, that.increments) && Objects
+ .equals(manufacturerReferenceNumber, that.manufacturerReferenceNumber);
+ }
+
+ @Override
+ public String toString() {
+ return "LicenseKeyGroupEntity{" + "vendorLicenseModelId='" + vendorLicenseModelId + '\'' + ", version=" + version + ", id='" + id + '\''
+ + ", name='" + name + '\'' + ", description='" + description + '\'' + ", type=" + type + ", operationalScope=" + operationalScope
+ + ", referencingFeatureGroups=" + referencingFeatureGroups + ", versionUuId='" + versionUuId + '\'' + ", startDate=" + startDate
+ + ", expiryDate=" + expiryDate + ", thresholdValue='" + thresholdValue + '\'' + ", thresholdUnits='" + thresholdUnits + '\''
+ + ", increments='" + increments + '\'' + '}';
+ }
+
+ /**
+ * Gets operational scope for artifact.
+ *
+ * @return the operational scope for artifact
+ */
+ public OperationalScopeForXml getOperationalScopeForArtifact() {
+ OperationalScopeForXml obj = new OperationalScopeForXml();
+ if (operationalScope != null) {
+ if (operationalScope.getResults().size() > 0) {
+ obj.setValue(operationalScope.getResults());
+ }
+ }
+ return obj;
+ }
+
+ /**
+ * Gets version for artifact.
+ *
+ * @return version in format suitable for artifact
+ */
+ public String getVersionForArtifact() {
+ return version.toString();
+ }
+
+ /**
+ * Gets type for artifact.
+ *
+ * @return the type for artifact
+ */
+ public LicenseKeyTypeForXml getTypeForArtifact() {
+ LicenseKeyTypeForXml typeXml = new LicenseKeyTypeForXml();
+ if (type != null) {
+ typeXml.setValue(type.toString());
+ } else {
+ typeXml.setValue(null);
+ }
+ return typeXml;
+ }
+
+ //Defined and used only for License Artifcat XMLs
+ public String getManufacturerReferenceNumber() {
+ return manufacturerReferenceNumber;
+ }
+
+ public void setManufacturerReferenceNumber(String manufacturerReferenceNumber) {
+ this.manufacturerReferenceNumber = manufacturerReferenceNumber;
+ }
+
+ public String getIsoFormatStartDate() {
+ String isoFormatStartDate = null;
+ if (!StringUtils.isEmpty(startDate)) {
+ isoFormatStartDate = VendorLicenseUtil.getIsoFormatDate(startDate);
+ }
+ return isoFormatStartDate;
+ }
+
+ public String getIsoFormatExpiryDate() {
+ String isoFormatExpDate = null;
+ if (!StringUtils.isEmpty(expiryDate)) {
+ isoFormatExpDate = VendorLicenseUtil.getIsoFormatDate(expiryDate);
+ }
+ return isoFormatExpDate;
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LicenseKeyType.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LicenseKeyType.java
index 35e6f217e8..4046d209f4 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LicenseKeyType.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LicenseKeyType.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,11 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.dao.types;
-public enum LicenseKeyType {
- Universal,
- Unique,
- One_Time;
-}
+public enum LicenseKeyType {Universal, Unique, One_Time;}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LicenseTerm.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LicenseTerm.java
index b8a7f9d09b..0374f7616b 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LicenseTerm.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LicenseTerm.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,12 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.dao.types;
-public enum LicenseTerm {
- Fixed_Term,
- Perpetual,
- Unlimited,
- Other;
-}
+public enum LicenseTerm {Fixed_Term, Perpetual, Unlimited, Other;}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LimitEntity.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LimitEntity.java
index fb9ea5a763..c4b169b3d3 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LimitEntity.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LimitEntity.java
@@ -19,207 +19,184 @@
*/
package org.openecomp.sdc.vendorlicense.dao.types;
+import java.util.Objects;
import org.openecomp.sdc.versioning.dao.types.Version;
import org.openecomp.sdc.versioning.dao.types.VersionableEntity;
-import java.util.Objects;
-
public class LimitEntity implements VersionableEntity {
- private static final String ENTITY_TYPE = "Limit";
-
- private String id;
- private String vendorLicenseModelId;
- private String epLkgId;
- private String name;
- private LimitType type;
- private String description;
- private String metric;
- private Version version;
- private String value;
- private String unit;
- private AggregationFunction aggregationFunction;
- private String time;
- //Defined and used only to find parent(EP/LKG) of Limit. Not to be persisted in DB and License
- // Xmls
- private String parent;
-
- public LimitEntity() {
- }
-
- public LimitEntity(String vlmId, Version version, String epLkgId, String id) {
- this.vendorLicenseModelId = vlmId;
- this.version = version;
- this.epLkgId = epLkgId;
- this.id = id;
- }
-
- public String getUnit() {
- return unit;
- }
-
- public void setUnit(String unit) {
- this.unit = unit;
- }
-
- public AggregationFunction getAggregationFunction() {
- return aggregationFunction;
- }
-
- public void setAggregationFunction(
- AggregationFunction aggregationFunction) {
- this.aggregationFunction = aggregationFunction;
- }
-
- public String getTime() {
- return time;
- }
-
- public void setTime(String time) {
- this.time = time;
- }
-
-
- @Override
- public String getEntityType() {
- return ENTITY_TYPE;
- }
-
- @Override
- public String getFirstClassCitizenId() {
- return getVendorLicenseModelId();
- }
-
- @Override
- public String getId() {
- return id;
- }
-
- @Override
- public void setId(String id) {
- this.id = id;
- }
-
- @Override
- public Version getVersion() {
- return version;
- }
-
- public String getEpLkgId() {
- return epLkgId;
- }
-
- public void setEpLkgId(String epLkgId) {
- this.epLkgId = epLkgId;
- }
-
- @Override
- public void setVersion(Version version) {
- this.version = version;
- }
-
- public String getVendorLicenseModelId() {
- return vendorLicenseModelId;
- }
-
- public void setVendorLicenseModelId(String vendorLicenseModelId) {
- this.vendorLicenseModelId = vendorLicenseModelId;
- }
-
- public LimitType getType() {
- return type;
- }
-
- public void setType(LimitType type) {
- this.type = type;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getMetric() {
- return metric;
- }
-
- public void setMetric(String metric) {
- this.metric = metric;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-
- //Defined and used only to find parent(EP/LKG) of Limit. Not to be persisted in DB and License
- // Xmls
- public String getParent() {
- return parent;
- }
-
- public void setParent(String parent) {
- this.parent = parent;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(vendorLicenseModelId, version, epLkgId, id, name, description, type,
- metric, unit, time, aggregationFunction, value);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null || getClass() != obj.getClass()) {
- return false;
- }
- LimitEntity that = (LimitEntity) obj;
- return Objects.equals(that.unit, unit)
- && Objects.equals(that.value, value)
- && Objects.equals(vendorLicenseModelId, that.vendorLicenseModelId)
- && Objects.equals(epLkgId, that.epLkgId)
- && Objects.equals(id, that.id)
- && Objects.equals(name, that.name)
- && Objects.equals(description, that.description)
- && Objects.equals(type, that.type)
- && Objects.equals(metric, that.metric)
- && Objects.equals(aggregationFunction, that.aggregationFunction);
-
- }
-
- @Override
- public String toString() {
- return "LimitEntity{"
- + "vendorLicenseModelId='" + vendorLicenseModelId + '\''
- + ", version=" + version
- + ", epLkgId=" + epLkgId
- + ", id='" + id + '\''
- + ", name='" + name + '\''
- + ", description='" + description + '\''
- + ", type=" + type
- + ", metric=" + metric
- + ", value='" + value + '\''
- + ", unit='" + unit + '\''
- + ", aggregationFunction=" + aggregationFunction
- + ", time=" + time
-
- + '}';
- }
+ private static final String ENTITY_TYPE = "Limit";
+ private String id;
+ private String vendorLicenseModelId;
+ private String epLkgId;
+ private String name;
+ private LimitType type;
+ private String description;
+ private String metric;
+ private Version version;
+ private String value;
+ private String unit;
+ private AggregationFunction aggregationFunction;
+ private String time;
+ //Defined and used only to find parent(EP/LKG) of Limit. Not to be persisted in DB and License
+
+ // Xmls
+ private String parent;
+
+ public LimitEntity() {
+ }
+
+ public LimitEntity(String vlmId, Version version, String epLkgId, String id) {
+ this.vendorLicenseModelId = vlmId;
+ this.version = version;
+ this.epLkgId = epLkgId;
+ this.id = id;
+ }
+
+ public String getUnit() {
+ return unit;
+ }
+
+ public void setUnit(String unit) {
+ this.unit = unit;
+ }
+
+ public AggregationFunction getAggregationFunction() {
+ return aggregationFunction;
+ }
+
+ public void setAggregationFunction(AggregationFunction aggregationFunction) {
+ this.aggregationFunction = aggregationFunction;
+ }
+
+ public String getTime() {
+ return time;
+ }
+
+ public void setTime(String time) {
+ this.time = time;
+ }
+
+ @Override
+ public String getEntityType() {
+ return ENTITY_TYPE;
+ }
+
+ @Override
+ public String getFirstClassCitizenId() {
+ return getVendorLicenseModelId();
+ }
+
+ @Override
+ public String getId() {
+ return id;
+ }
+
+ @Override
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ @Override
+ public Version getVersion() {
+ return version;
+ }
+
+ @Override
+ public void setVersion(Version version) {
+ this.version = version;
+ }
+
+ public String getEpLkgId() {
+ return epLkgId;
+ }
+
+ public void setEpLkgId(String epLkgId) {
+ this.epLkgId = epLkgId;
+ }
+
+ public String getVendorLicenseModelId() {
+ return vendorLicenseModelId;
+ }
+
+ public void setVendorLicenseModelId(String vendorLicenseModelId) {
+ this.vendorLicenseModelId = vendorLicenseModelId;
+ }
+
+ public LimitType getType() {
+ return type;
+ }
+
+ public void setType(LimitType type) {
+ this.type = type;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getMetric() {
+ return metric;
+ }
+
+ public void setMetric(String metric) {
+ this.metric = metric;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+ //Defined and used only to find parent(EP/LKG) of Limit. Not to be persisted in DB and License
+
+ // Xmls
+ public String getParent() {
+ return parent;
+ }
+
+ public void setParent(String parent) {
+ this.parent = parent;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(vendorLicenseModelId, version, epLkgId, id, name, description, type, metric, unit, time, aggregationFunction, value);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null || getClass() != obj.getClass()) {
+ return false;
+ }
+ LimitEntity that = (LimitEntity) obj;
+ return Objects.equals(that.unit, unit) && Objects.equals(that.value, value) && Objects.equals(vendorLicenseModelId, that.vendorLicenseModelId)
+ && Objects.equals(epLkgId, that.epLkgId) && Objects.equals(id, that.id) && Objects.equals(name, that.name) && Objects
+ .equals(description, that.description) && Objects.equals(type, that.type) && Objects.equals(metric, that.metric) && Objects
+ .equals(aggregationFunction, that.aggregationFunction);
+ }
+
+ @Override
+ public String toString() {
+ return "LimitEntity{" + "vendorLicenseModelId='" + vendorLicenseModelId + '\'' + ", version=" + version + ", epLkgId=" + epLkgId + ", id='"
+ + id + '\'' + ", name='" + name + '\'' + ", description='" + description + '\'' + ", type=" + type + ", metric=" + metric + ", value='"
+ + value + '\'' + ", unit='" + unit + '\'' + ", aggregationFunction=" + aggregationFunction + ", time=" + time + '}';
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LimitType.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LimitType.java
index 20bc3640bf..6c7231ac51 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LimitType.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LimitType.java
@@ -19,8 +19,4 @@
*/
package org.openecomp.sdc.vendorlicense.dao.types;
-public enum LimitType {
- ServiceProvider,
- Vendor;
-
-}
+public enum LimitType {ServiceProvider, Vendor;}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/MultiChoiceOrOther.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/MultiChoiceOrOther.java
index d70bc426e1..d46f815226 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/MultiChoiceOrOther.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/MultiChoiceOrOther.java
@@ -13,165 +13,149 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorlicense.dao.types;
import com.datastax.driver.mapping.annotations.Transient;
import com.datastax.driver.mapping.annotations.UDT;
+import java.util.HashSet;
+import java.util.Set;
import org.apache.commons.collections4.CollectionUtils;
import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.common.errors.ErrorCode;
-import java.util.HashSet;
-import java.util.Set;
-
@UDT(keyspace = "dox", name = "multi_choice_or_other")
public class MultiChoiceOrOther<E extends Enum<E>> {
- private static final String MULTI_CHOICE_OR_OTHER_INVALID_ENUM_ERR_ID =
- "MULTI_CHOICE_OR_OTHER_INVALID_ENUM_ERR_ID";
-
- private static final String MULTI_CHOICE_OR_OTHER_INVALID_ENUM_MSG =
- "Enum used as part of MultiChoiceOrOther type must contain the value 'Other'";
-
- public static final String OTHER_ENUM_VALUE = "Other";
-
- @Transient
- private Set<E> choices;
- @Transient
- private String other;
-
-
- private Set<String> results;
-
- public MultiChoiceOrOther() {
- // Default constructor
- }
-
- /**
- * Instantiates a new Multi choice or other.
- *
- * @param choices the choices
- * @param other the other
- */
- public MultiChoiceOrOther(Set<E> choices, String other) {
- this.choices = choices;
- this.other = other;
- results = resolveResult();
- }
+ public static final String OTHER_ENUM_VALUE = "Other";
+ private static final String MULTI_CHOICE_OR_OTHER_INVALID_ENUM_ERR_ID = "MULTI_CHOICE_OR_OTHER_INVALID_ENUM_ERR_ID";
+ private static final String MULTI_CHOICE_OR_OTHER_INVALID_ENUM_MSG = "Enum used as part of MultiChoiceOrOther type must contain the value 'Other'";
+ @Transient
+ private Set<E> choices;
+ @Transient
+ private String other;
+ private Set<String> results;
+
+ public MultiChoiceOrOther() {
+ // Default constructor
+ }
- public Set<E> getChoices() {
- return choices;
- }
+ /**
+ * Instantiates a new Multi choice or other.
+ *
+ * @param choices the choices
+ * @param other the other
+ */
+ public MultiChoiceOrOther(Set<E> choices, String other) {
+ this.choices = choices;
+ this.other = other;
+ results = resolveResult();
+ }
- public void setChoices(Set<E> choices) {
- this.choices = choices;
- }
+ public Set<E> getChoices() {
+ return choices;
+ }
- public String getOther() {
- return other;
- }
+ public void setChoices(Set<E> choices) {
+ this.choices = choices;
+ }
- public void setOther(String other) {
- this.other = other;
- }
+ public String getOther() {
+ return other;
+ }
- public Set<String> getResults() {
- return results;
- }
+ public void setOther(String other) {
+ this.other = other;
+ }
- /**
- * Sets results.
- *
- * @param results the results
- */
- public void setResults(Set<String> results) {
- if (choices != null) {
- if (results == null) {
- this.results = resolveResult();
- }
- } else {
- this.results = results;
+ public Set<String> getResults() {
+ return results;
}
- }
- private Set<String> resolveResult() {
- if (choices != null) {
- results = new HashSet<>();
- if (choices.size() == 1 && OTHER_ENUM_VALUE.equals(choices.iterator().next().name())) {
- results.add(other);
- } else {
- for (E choice : choices) {
- results.add(choice.name());
+ /**
+ * Sets results.
+ *
+ * @param results the results
+ */
+ public void setResults(Set<String> results) {
+ if (choices != null) {
+ if (results == null) {
+ this.results = resolveResult();
}
+ } else {
+ this.results = results;
}
}
- return results;
- }
-
- /**
- * Resolve enum.
- *
- * @param enumClass the enum class
- */
- public void resolveEnum(Class<E> enumClass) {
- if (choices != null || CollectionUtils.isEmpty(results)) {
- return;
- }
-
- choices = new HashSet<>();
- if (results.size() > 1) {
- for (String result : results) {
- choices.add(E.valueOf(enumClass, result));
- }
- } else {
- String result = results.iterator().next();
- try {
- choices.add(E.valueOf(enumClass, result));
- } catch (IllegalArgumentException exception) {
- try {
- choices.add(E.valueOf(enumClass, OTHER_ENUM_VALUE));
- } catch (IllegalArgumentException ex) {
- throw new CoreException(new ErrorCode.ErrorCodeBuilder()
- .withId(MULTI_CHOICE_OR_OTHER_INVALID_ENUM_ERR_ID)
- .withMessage(MULTI_CHOICE_OR_OTHER_INVALID_ENUM_MSG).build());
+ private Set<String> resolveResult() {
+ if (choices != null) {
+ results = new HashSet<>();
+ if (choices.size() == 1 && OTHER_ENUM_VALUE.equals(choices.iterator().next().name())) {
+ results.add(other);
+ } else {
+ for (E choice : choices) {
+ results.add(choice.name());
+ }
+ }
}
- other = result;
- }
+ return results;
}
- }
- @Override
- public int hashCode() {
- int result = choices != null ? choices.hashCode() : 0;
- result = 31 * result + (other != null ? other.hashCode() : 0);
- result = 31 * result + (results != null ? results.hashCode() : 0);
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null && choices == null && other == null && results == null ) {
- return true;
+ /**
+ * Resolve enum.
+ *
+ * @param enumClass the enum class
+ */
+ public void resolveEnum(Class<E> enumClass) {
+ if (choices != null || CollectionUtils.isEmpty(results)) {
+ return;
+ }
+ choices = new HashSet<>();
+ if (results.size() > 1) {
+ for (String result : results) {
+ choices.add(E.valueOf(enumClass, result));
+ }
+ } else {
+ String result = results.iterator().next();
+ try {
+ choices.add(E.valueOf(enumClass, result));
+ } catch (IllegalArgumentException exception) {
+ try {
+ choices.add(E.valueOf(enumClass, OTHER_ENUM_VALUE));
+ } catch (IllegalArgumentException ex) {
+ throw new CoreException(new ErrorCode.ErrorCodeBuilder().withId(MULTI_CHOICE_OR_OTHER_INVALID_ENUM_ERR_ID)
+ .withMessage(MULTI_CHOICE_OR_OTHER_INVALID_ENUM_MSG).build());
+ }
+ other = result;
+ }
+ }
}
- if (obj == null || getClass() != obj.getClass()) {
- return false;
+ @Override
+ public int hashCode() {
+ int result = choices != null ? choices.hashCode() : 0;
+ result = 31 * result + (other != null ? other.hashCode() : 0);
+ result = 31 * result + (results != null ? results.hashCode() : 0);
+ return result;
}
- MultiChoiceOrOther<?> that = (MultiChoiceOrOther<?>) obj;
-
- if (choices != null ? !choices.equals(that.choices) : that.choices != null) {
- return false;
- }
- if (other != null ? !other.equals(that.other) : that.other != null) {
- return false;
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null && choices == null && other == null && results == null) {
+ return true;
+ }
+ if (obj == null || getClass() != obj.getClass()) {
+ return false;
+ }
+ MultiChoiceOrOther<?> that = (MultiChoiceOrOther<?>) obj;
+ if (choices != null ? !choices.equals(that.choices) : that.choices != null) {
+ return false;
+ }
+ if (other != null ? !other.equals(that.other) : that.other != null) {
+ return false;
+ }
+ return results != null ? results.equals(that.results) : that.results == null;
}
- return results != null ? results.equals(that.results) : that.results == null;
-
- }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/OperationalScope.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/OperationalScope.java
index 69cdb2dabb..ffebbe8b52 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/OperationalScope.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/OperationalScope.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,16 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.dao.types;
-public enum OperationalScope {
- Network_Wide,
- Availability_Zone,
- Data_Center,
- Tenant,
- VM,
- CPU,
- Core,
- Other;
-}
+public enum OperationalScope {Network_Wide, Availability_Zone, Data_Center, Tenant, VM, CPU, Core, Other;}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/ThresholdUnit.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/ThresholdUnit.java
index bd0fa41073..be7e02078e 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/ThresholdUnit.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/ThresholdUnit.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,10 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.dao.types;
-public enum ThresholdUnit {
- Absolute,
- Percentage
-}
+public enum ThresholdUnit {Absolute, Percentage}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/VendorLicenseModelEntity.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/VendorLicenseModelEntity.java
index cef444bc76..f6e155b0a2 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/VendorLicenseModelEntity.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/VendorLicenseModelEntity.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.dao.types;
import com.datastax.driver.mapping.annotations.Column;
@@ -25,128 +24,118 @@ import com.datastax.driver.mapping.annotations.Computed;
import com.datastax.driver.mapping.annotations.Frozen;
import com.datastax.driver.mapping.annotations.PartitionKey;
import com.datastax.driver.mapping.annotations.Table;
-
-
+import java.util.Objects;
import org.openecomp.sdc.versioning.dao.types.Version;
import org.openecomp.sdc.versioning.dao.types.VersionableEntity;
-import java.util.Objects;
-
@Table(keyspace = "dox", name = "vendor_license_model")
public class VendorLicenseModelEntity implements VersionableEntity {
- public static final String ENTITY_TYPE = "Vendor License Model";
-
- @PartitionKey
- @Column(name = "vlm_id")
- private String id;
-
- @PartitionKey(value = 1)
- @Frozen
- private Version version;
-
- @Column(name = "vendor_name")
- private String vendorName;
- private String description;
- private String oldVersion;
- @Column(name = "icon")
- private String iconRef;
-
- @Computed("writetime(vendor_name)")
- private Long writetimeMicroSeconds;
-
- /**
- * Every entity class must have a default constructor according to
- * <a href="http://docs.datastax.com/en/developer/java-driver/2.1/manual/object_mapper/creating/">
- * Definition of mapped classes</a>.
- */
- public VendorLicenseModelEntity() {
- // Don't delete! Default constructor is required by DataStax driver
- }
-
- public VendorLicenseModelEntity(String id, Version version) {
- this.id = id;
- this.version = version;
- }
-
- @Override
- public String getEntityType() {
- return ENTITY_TYPE;
- }
-
- @Override
- public String getFirstClassCitizenId() {
- return getId();
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- @Override
- public Version getVersion() {
- return version;
- }
-
- @Override
- public void setVersion(Version version) {
- this.version = version;
- }
-
- public String getVendorName() {
- return vendorName;
- }
-
- public void setVendorName(String vendorName) {
- this.vendorName = vendorName;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getIconRef() {
- return iconRef;
- }
-
- public void setIconRef(String iconRef) {
- this.iconRef = iconRef;
- }
-
- public void setOldVersion(String oldVersion) {
- this.oldVersion = oldVersion;
- }
-
- public String getOldVersion() {
- return oldVersion;
- }
-
-
- @Override
- public int hashCode() {
- return Objects.hash(id, version, vendorName, description, iconRef);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null || getClass() != obj.getClass()) {
- return false;
- }
- VendorLicenseModelEntity that = (VendorLicenseModelEntity) obj;
- return Objects.equals(id, that.id)
- && Objects.equals(version, that.version)
- && Objects.equals(vendorName, that.vendorName)
- && Objects.equals(description, that.description)
- && Objects.equals(iconRef, that.iconRef);
- }
+
+ public static final String ENTITY_TYPE = "Vendor License Model";
+ @PartitionKey
+ @Column(name = "vlm_id")
+ private String id;
+ @PartitionKey(value = 1)
+ @Frozen
+ private Version version;
+ @Column(name = "vendor_name")
+ private String vendorName;
+ private String description;
+ private String oldVersion;
+ @Column(name = "icon")
+ private String iconRef;
+ @Computed("writetime(vendor_name)")
+ private Long writetimeMicroSeconds;
+
+ /**
+ * Every entity class must have a default constructor according to
+ * <a href="http://docs.datastax.com/en/developer/java-driver/2.1/manual/object_mapper/creating/">
+ * Definition of mapped classes</a>.
+ */
+ public VendorLicenseModelEntity() {
+ // Don't delete! Default constructor is required by DataStax driver
+ }
+
+ public VendorLicenseModelEntity(String id, Version version) {
+ this.id = id;
+ this.version = version;
+ }
+
+ @Override
+ public String getEntityType() {
+ return ENTITY_TYPE;
+ }
+
+ @Override
+ public String getFirstClassCitizenId() {
+ return getId();
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ @Override
+ public Version getVersion() {
+ return version;
+ }
+
+ @Override
+ public void setVersion(Version version) {
+ this.version = version;
+ }
+
+ public String getVendorName() {
+ return vendorName;
+ }
+
+ public void setVendorName(String vendorName) {
+ this.vendorName = vendorName;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getIconRef() {
+ return iconRef;
+ }
+
+ public void setIconRef(String iconRef) {
+ this.iconRef = iconRef;
+ }
+
+ public String getOldVersion() {
+ return oldVersion;
+ }
+
+ public void setOldVersion(String oldVersion) {
+ this.oldVersion = oldVersion;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(id, version, vendorName, description, iconRef);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null || getClass() != obj.getClass()) {
+ return false;
+ }
+ VendorLicenseModelEntity that = (VendorLicenseModelEntity) obj;
+ return Objects.equals(id, that.id) && Objects.equals(version, that.version) && Objects.equals(vendorName, that.vendorName) && Objects
+ .equals(description, that.description) && Objects.equals(iconRef, that.iconRef);
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/AggregationFunctionForXml.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/AggregationFunctionForXml.java
index e2a6be6b9e..b3c1cafcad 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/AggregationFunctionForXml.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/AggregationFunctionForXml.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,17 +17,17 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.dao.types.xml;
public class AggregationFunctionForXml {
- private String value;
- public String getValue() {
- return value;
- }
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
- public void setValue(String value) {
- this.value = value;
- }
+ public void setValue(String value) {
+ this.value = value;
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/EntitlementMetricForXml.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/EntitlementMetricForXml.java
index 8a449446ec..5134e73536 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/EntitlementMetricForXml.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/EntitlementMetricForXml.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,17 +17,17 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.dao.types.xml;
public class EntitlementMetricForXml {
- private String value;
- public String getValue() {
- return value;
- }
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
- public void setValue(String value) {
- this.value = value;
- }
+ public void setValue(String value) {
+ this.value = value;
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/EntitlementTimeForXml.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/EntitlementTimeForXml.java
index c78a2d6d91..7ebf1367bb 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/EntitlementTimeForXml.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/EntitlementTimeForXml.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,17 +17,17 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.dao.types.xml;
public class EntitlementTimeForXml {
- private String value;
- public String getValue() {
- return value;
- }
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
- public void setValue(String value) {
- this.value = value;
- }
+ public void setValue(String value) {
+ this.value = value;
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/LicenseKeyTypeForXml.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/LicenseKeyTypeForXml.java
index c8c0d3067e..bfe047a213 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/LicenseKeyTypeForXml.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/LicenseKeyTypeForXml.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,17 +17,17 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.dao.types.xml;
public class LicenseKeyTypeForXml {
- private String value;
- public String getValue() {
- return value;
- }
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
- public void setValue(String value) {
- this.value = value;
- }
+ public void setValue(String value) {
+ this.value = value;
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/LimitForXml.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/LimitForXml.java
index 0a3680b719..f57d48595a 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/LimitForXml.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/LimitForXml.java
@@ -17,26 +17,23 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.dao.types.xml;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
-
import java.util.Set;
public class LimitForXml {
- Set<LimitXml> limits;
+ Set<LimitXml> limits;
- @JacksonXmlProperty(isAttribute = false, localName = "limit")
- @JacksonXmlElementWrapper(localName = "limits", useWrapping = false)
- public Set<LimitXml> getLimits() {
- return limits;
- }
+ @JacksonXmlProperty(isAttribute = false, localName = "limit")
+ @JacksonXmlElementWrapper(localName = "limits", useWrapping = false)
+ public Set<LimitXml> getLimits() {
+ return limits;
+ }
- public void setLimits(
- Set<LimitXml> limits) {
- this.limits = limits;
- }
+ public void setLimits(Set<LimitXml> limits) {
+ this.limits = limits;
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/LimitXml.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/LimitXml.java
index 0c989cb3f9..e175ab4070 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/LimitXml.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/LimitXml.java
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.dao.types.xml;
import lombok.Getter;
@@ -26,27 +25,27 @@ import lombok.Setter;
@Getter
@Setter
public class LimitXml {
- String description;
- String metric;
- String values;
- String unit;
- String time;
- String aggregationFunction;
- public EntitlementTimeForXml getTimeForArtifact() {
- EntitlementTimeForXml timeForXml = new EntitlementTimeForXml();
- if (time != null) {
- timeForXml.setValue(time);
- }
+ String description;
+ String metric;
+ String values;
+ String unit;
+ String time;
+ String aggregationFunction;
- return timeForXml;
- }
+ public EntitlementTimeForXml getTimeForArtifact() {
+ EntitlementTimeForXml timeForXml = new EntitlementTimeForXml();
+ if (time != null) {
+ timeForXml.setValue(time);
+ }
+ return timeForXml;
+ }
- public AggregationFunctionForXml getAggregationFunctionForArtifact() {
- AggregationFunctionForXml aggregationFunctionForXml = new AggregationFunctionForXml();
- if (aggregationFunction != null) {
- aggregationFunctionForXml.setValue(aggregationFunction);
+ public AggregationFunctionForXml getAggregationFunctionForArtifact() {
+ AggregationFunctionForXml aggregationFunctionForXml = new AggregationFunctionForXml();
+ if (aggregationFunction != null) {
+ aggregationFunctionForXml.setValue(aggregationFunction);
+ }
+ return aggregationFunctionForXml;
}
- return aggregationFunctionForXml;
- }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/OperationalScopeForXml.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/OperationalScopeForXml.java
index f51a4127c0..55de51370b 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/OperationalScopeForXml.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/OperationalScopeForXml.java
@@ -17,22 +17,21 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.dao.types.xml;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
-
import java.util.Set;
public class OperationalScopeForXml {
- Set<String> value;
- @JacksonXmlElementWrapper(localName = "value", useWrapping = false)
- public Set<String> getValue() {
- return value;
- }
+ Set<String> value;
+
+ @JacksonXmlElementWrapper(localName = "value", useWrapping = false)
+ public Set<String> getValue() {
+ return value;
+ }
- public void setValue(Set<String> value) {
- this.value = value;
- }
+ public void setValue(Set<String> value) {
+ this.value = value;
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/ThresholdForXml.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/ThresholdForXml.java
index a50b815069..ceeee10490 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/ThresholdForXml.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/ThresholdForXml.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,26 +17,26 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.dao.types.xml;
public class ThresholdForXml {
- String unit;
- Integer value;
- public String getUnit() {
- return unit;
- }
+ String unit;
+ Integer value;
+
+ public String getUnit() {
+ return unit;
+ }
- public void setUnit(String unit) {
- this.unit = unit;
- }
+ public void setUnit(String unit) {
+ this.unit = unit;
+ }
- public Integer getValue() {
- return value;
- }
+ public Integer getValue() {
+ return value;
+ }
- public void setValue(Integer value) {
- this.value = value;
- }
+ public void setValue(Integer value) {
+ this.value = value;
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/InvalidDateErrorBuilder.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/InvalidDateErrorBuilder.java
index e1857532a8..9aeef8b470 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/InvalidDateErrorBuilder.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/InvalidDateErrorBuilder.java
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.errors;
import org.openecomp.sdc.common.errors.ErrorCategory;
@@ -25,19 +24,16 @@ import org.openecomp.sdc.common.errors.ErrorCode;
public class InvalidDateErrorBuilder {
- private static final String DATE_RANGE_INVALID = "Vendor license model with id %s has invalid " +
- "date range.";
-
- private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
-
- public InvalidDateErrorBuilder(String vendorLicenseModelId){
- builder.withId(VendorLicenseErrorCodes.DATE_RANGE_INVALID);
- builder.withCategory(ErrorCategory.APPLICATION);
- builder.withMessage(String.format(DATE_RANGE_INVALID, vendorLicenseModelId));
- }
+ private static final String DATE_RANGE_INVALID = "Vendor license model with id %s has invalid " + "date range.";
+ private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
- public ErrorCode build() {
- return builder.build();
- }
+ public InvalidDateErrorBuilder(String vendorLicenseModelId) {
+ builder.withId(VendorLicenseErrorCodes.DATE_RANGE_INVALID);
+ builder.withCategory(ErrorCategory.APPLICATION);
+ builder.withMessage(String.format(DATE_RANGE_INVALID, vendorLicenseModelId));
+ }
+ public ErrorCode build() {
+ return builder.build();
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/JsonErrorBuilder.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/JsonErrorBuilder.java
index a11092bbe3..6164d5eb5a 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/JsonErrorBuilder.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/JsonErrorBuilder.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.errors;
import org.openecomp.sdc.common.errors.ErrorCategory;
@@ -25,27 +24,22 @@ import org.openecomp.sdc.common.errors.ErrorCode;
public class JsonErrorBuilder {
- private static final String JSON_ERROR_OCCURED_DURING_ARTIFACT_GENERATION_ERR_ID =
- "JSON_ERROR_OCCURED_DURING_ARTIFACT_GENERATION_ERR_ID";
- private static final String JSON_ERROR_OCCURED_DURING_ARTIFACT_GENERATION_ERR_ID_MSG =
- "Json error occured during artifact generation:%s.";
-
- private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
-
- /**
- * Instantiates a new Json error builder.
- *
- * @param exceptionMessage the exception message
- */
- public JsonErrorBuilder(String exceptionMessage) {
- builder.withId(JSON_ERROR_OCCURED_DURING_ARTIFACT_GENERATION_ERR_ID);
- builder.withCategory(ErrorCategory.APPLICATION);
- builder.withMessage(
- String.format(JSON_ERROR_OCCURED_DURING_ARTIFACT_GENERATION_ERR_ID_MSG, exceptionMessage));
- }
-
- public ErrorCode build() {
- return builder.build();
- }
-
+ private static final String JSON_ERROR_OCCURED_DURING_ARTIFACT_GENERATION_ERR_ID = "JSON_ERROR_OCCURED_DURING_ARTIFACT_GENERATION_ERR_ID";
+ private static final String JSON_ERROR_OCCURED_DURING_ARTIFACT_GENERATION_ERR_ID_MSG = "Json error occured during artifact generation:%s.";
+ private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+
+ /**
+ * Instantiates a new Json error builder.
+ *
+ * @param exceptionMessage the exception message
+ */
+ public JsonErrorBuilder(String exceptionMessage) {
+ builder.withId(JSON_ERROR_OCCURED_DURING_ARTIFACT_GENERATION_ERR_ID);
+ builder.withCategory(ErrorCategory.APPLICATION);
+ builder.withMessage(String.format(JSON_ERROR_OCCURED_DURING_ARTIFACT_GENERATION_ERR_ID_MSG, exceptionMessage));
+ }
+
+ public ErrorCode build() {
+ return builder.build();
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/LicensingDataInvalidErrorBuilder.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/LicensingDataInvalidErrorBuilder.java
index dfc9a93751..0a9839a0e4 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/LicensingDataInvalidErrorBuilder.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/LicensingDataInvalidErrorBuilder.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,33 +17,30 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.errors;
+import java.util.List;
import org.openecomp.core.utilities.CommonMethods;
import org.openecomp.sdc.common.errors.ErrorCategory;
import org.openecomp.sdc.common.errors.ErrorCode;
-import java.util.List;
-
public class LicensingDataInvalidErrorBuilder {
- private static final String LICENSING_DATA_INVALID_MSG = "Invalid licensing data: %s";
- private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
- /**
- * Instantiates a new Licensing data invalid error builder.
- *
- * @param licensingDataErrors the licensing data errors
- */
- public LicensingDataInvalidErrorBuilder(List<String> licensingDataErrors) {
- builder.withId(VendorLicenseErrorCodes.LICENSING_DATA_INVALID);
- builder.withCategory(ErrorCategory.APPLICATION);
- builder.withMessage(String.format(LICENSING_DATA_INVALID_MSG,
- CommonMethods.listToSeparatedString(licensingDataErrors, ',')));
- }
+ private static final String LICENSING_DATA_INVALID_MSG = "Invalid licensing data: %s";
+ private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
- public ErrorCode build() {
- return builder.build();
- }
+ /**
+ * Instantiates a new Licensing data invalid error builder.
+ *
+ * @param licensingDataErrors the licensing data errors
+ */
+ public LicensingDataInvalidErrorBuilder(List<String> licensingDataErrors) {
+ builder.withId(VendorLicenseErrorCodes.LICENSING_DATA_INVALID);
+ builder.withCategory(ErrorCategory.APPLICATION);
+ builder.withMessage(String.format(LICENSING_DATA_INVALID_MSG, CommonMethods.listToSeparatedString(licensingDataErrors, ',')));
+ }
+ public ErrorCode build() {
+ return builder.build();
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/SubmitUncompletedLicenseModelErrorBuilder.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/SubmitUncompletedLicenseModelErrorBuilder.java
index 1b25421052..1686078911 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/SubmitUncompletedLicenseModelErrorBuilder.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/SubmitUncompletedLicenseModelErrorBuilder.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,14 +17,12 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.errors;
import org.openecomp.sdc.common.errors.ErrorCode;
public class SubmitUncompletedLicenseModelErrorBuilder {
-
private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
/**
@@ -38,6 +36,4 @@ public class SubmitUncompletedLicenseModelErrorBuilder {
public ErrorCode build() {
return builder.build();
}
-
-
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/UncompletedVendorLicenseModelErrorType.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/UncompletedVendorLicenseModelErrorType.java
index fa35553ecc..cfc1997413 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/UncompletedVendorLicenseModelErrorType.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/UncompletedVendorLicenseModelErrorType.java
@@ -23,16 +23,14 @@ package org.openecomp.sdc.vendorlicense.errors;
* Created by ayalaben on 5/8/2017
*/
public enum UncompletedVendorLicenseModelErrorType {
-
+ // @formatter:off
SUBMIT_UNCOMPLETED_VLM_MSG_MISSING_LA("Uncompleted vendor license model - cannot be submitted. \n"
- + "It must contain a license agreement(s)."),
-
+ + "It must contain a license agreement(s)."),
SUBMIT_UNCOMPLETED_VLM_MSG_LA_MISSING_FG("Uncompleted vendor license model - cannot be submitted. \n"
- + "The license agreement(s) must contain at least one feature group."),
-
+ + "The license agreement(s) must contain at least one feature group."),
SUBMIT_UNCOMPLETED_VLM_MSG_FG_MISSING_EP("Uncompleted vendor license model - cannot be submitted. \n"
+ "The feature group(s) must contain at least one entitlement pool.");
-
+ // @formatter:on
private String errorMessage;
@@ -44,4 +42,3 @@ public enum UncompletedVendorLicenseModelErrorType {
return errorMessage;
}
}
-
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/VendorLicenseErrorCodes.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/VendorLicenseErrorCodes.java
index e8c252f7be..62ea84b48b 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/VendorLicenseErrorCodes.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/VendorLicenseErrorCodes.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,21 +17,17 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.errors;
-
public class VendorLicenseErrorCodes {
- public static final String VENDOR_LICENSE_MODEL_NOT_FOUND = "VENDOR_LICENSE_MODEL_NOT_FOUND";
- public static final String SUBMIT_UNCOMPLETED_LICENSE_MODEL = "SUBMIT_UNCOMPLETED_LICENSE_MODEL";
- public static final String LICENSING_DATA_INVALID = "LICENSING_DATA_INVALID";
-
- public static final String LIMIT_INVALID_TYPE = "LIMIT_INVALID_TYPE";
- public static final String LIMIT_INVALID_METRIC = "LIMIT_INVALID_METRIC";
- public static final String LIMIT_INVALID_AGGREGATIONFUNCTION = "LIMIT_INVALID_AGGREGATIONFUNCTION";
- public static final String LIMIT_INVALID_TIME = "LIMIT_INVALID_TIME";
- public static final String DUPLICATE_LIMIT_NAME_NOT_ALLOWED =
- "DUPLICATE_LIMIT_NAME_NOT_ALLOWED";
- public static final String DATE_RANGE_INVALID = "DATE_RANGE_INVALID";
+ public static final String VENDOR_LICENSE_MODEL_NOT_FOUND = "VENDOR_LICENSE_MODEL_NOT_FOUND";
+ public static final String SUBMIT_UNCOMPLETED_LICENSE_MODEL = "SUBMIT_UNCOMPLETED_LICENSE_MODEL";
+ public static final String LICENSING_DATA_INVALID = "LICENSING_DATA_INVALID";
+ public static final String LIMIT_INVALID_TYPE = "LIMIT_INVALID_TYPE";
+ public static final String LIMIT_INVALID_METRIC = "LIMIT_INVALID_METRIC";
+ public static final String LIMIT_INVALID_AGGREGATIONFUNCTION = "LIMIT_INVALID_AGGREGATIONFUNCTION";
+ public static final String LIMIT_INVALID_TIME = "LIMIT_INVALID_TIME";
+ public static final String DUPLICATE_LIMIT_NAME_NOT_ALLOWED = "DUPLICATE_LIMIT_NAME_NOT_ALLOWED";
+ public static final String DATE_RANGE_INVALID = "DATE_RANGE_INVALID";
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/VendorLicenseModelNotFoundErrorBuilder.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/VendorLicenseModelNotFoundErrorBuilder.java
index e3eb27f342..da95e437c6 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/VendorLicenseModelNotFoundErrorBuilder.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/VendorLicenseModelNotFoundErrorBuilder.java
@@ -13,30 +13,26 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorlicense.errors;
import org.openecomp.sdc.common.errors.ErrorCode;
public class VendorLicenseModelNotFoundErrorBuilder {
- private static final String VENDOR_LICENSE_MODEL_NOT_FOUND_MSG =
- "Vendor license model with id %s not found.";
- private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
-
- /**
- * Instantiates a new Vendor license model not found error builder.
- *
- * @param vendorLicenseModelId the vendor license model id
- */
- public VendorLicenseModelNotFoundErrorBuilder(String vendorLicenseModelId) {
- builder.withId(VendorLicenseErrorCodes.VENDOR_LICENSE_MODEL_NOT_FOUND);
- builder.withMessage(String.format(VENDOR_LICENSE_MODEL_NOT_FOUND_MSG, vendorLicenseModelId));
- }
-
- public ErrorCode build() {
- return builder.build();
- }
-
-
+ private static final String VENDOR_LICENSE_MODEL_NOT_FOUND_MSG = "Vendor license model with id %s not found.";
+ private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+
+ /**
+ * Instantiates a new Vendor license model not found error builder.
+ *
+ * @param vendorLicenseModelId the vendor license model id
+ */
+ public VendorLicenseModelNotFoundErrorBuilder(String vendorLicenseModelId) {
+ builder.withId(VendorLicenseErrorCodes.VENDOR_LICENSE_MODEL_NOT_FOUND);
+ builder.withMessage(String.format(VENDOR_LICENSE_MODEL_NOT_FOUND_MSG, vendorLicenseModelId));
+ }
+
+ public ErrorCode build() {
+ return builder.build();
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/facade/VendorLicenseFacade.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/facade/VendorLicenseFacade.java
index d25a18909e..aab0aa89a8 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/facade/VendorLicenseFacade.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/facade/VendorLicenseFacade.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,60 +17,60 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.facade;
+import java.util.Collection;
import java.util.Optional;
import org.openecomp.sdc.common.errors.ErrorCode;
-import org.openecomp.sdc.vendorlicense.dao.types.*;
+import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity;
+import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity;
+import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupModel;
+import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementEntity;
+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.versioning.dao.types.Version;
-import java.util.Collection;
-
public interface VendorLicenseFacade {
- LicenseAgreementEntity getLicenseAgreement(String vlmId, Version version,
- String licenseAgreementId);
-
- LicenseAgreementModel getLicenseAgreementModel(String vlmId, Version version,
- String licenseAgreementId);
+ LicenseAgreementEntity getLicenseAgreement(String vlmId, Version version, String licenseAgreementId);
- LicenseAgreementEntity createLicenseAgreement(LicenseAgreementEntity licenseAgreement);
+ LicenseAgreementModel getLicenseAgreementModel(String vlmId, Version version, String licenseAgreementId);
- Collection<FeatureGroupEntity> listFeatureGroups(String vlmId, Version version);
+ LicenseAgreementEntity createLicenseAgreement(LicenseAgreementEntity licenseAgreement);
- FeatureGroupEntity getFeatureGroup(FeatureGroupEntity featureGroup);
+ Collection<FeatureGroupEntity> listFeatureGroups(String vlmId, Version version);
- FeatureGroupModel getFeatureGroupModel(FeatureGroupEntity featureGroup);
+ FeatureGroupEntity getFeatureGroup(FeatureGroupEntity featureGroup);
- FeatureGroupEntity createFeatureGroup(FeatureGroupEntity featureGroup);
+ FeatureGroupModel getFeatureGroupModel(FeatureGroupEntity featureGroup);
- Collection<EntitlementPoolEntity> listEntitlementPools(String vlmId, Version version);
+ FeatureGroupEntity createFeatureGroup(FeatureGroupEntity featureGroup);
- EntitlementPoolEntity createEntitlementPool(EntitlementPoolEntity entitlementPool);
+ Collection<EntitlementPoolEntity> listEntitlementPools(String vlmId, Version version);
- void updateEntitlementPool(EntitlementPoolEntity entitlementPool);
+ EntitlementPoolEntity createEntitlementPool(EntitlementPoolEntity entitlementPool);
- Collection<LicenseKeyGroupEntity> listLicenseKeyGroups(String vlmId, Version version);
+ void updateEntitlementPool(EntitlementPoolEntity entitlementPool);
- LicenseKeyGroupEntity createLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup);
+ Collection<LicenseKeyGroupEntity> listLicenseKeyGroups(String vlmId, Version version);
- void updateLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup);
+ LicenseKeyGroupEntity createLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup);
- Collection<LimitEntity> listLimits(String vlmId, Version version, String epLkgId);
+ void updateLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup);
- LimitEntity createLimit(LimitEntity limit);
+ Collection<LimitEntity> listLimits(String vlmId, Version version, String epLkgId);
- void updateLimit(LimitEntity limit);
+ LimitEntity createLimit(LimitEntity limit);
- VendorLicenseModelEntity getVendorLicenseModel(String vlmId, Version version);
+ void updateLimit(LimitEntity limit);
+ VendorLicenseModelEntity getVendorLicenseModel(String vlmId, Version version);
- Collection<ErrorCode> validateLicensingData(String vlmId, Version vlmVersion,
- String licenseAgreementId,
- Collection<String> featureGroupIds);
+ Collection<ErrorCode> validateLicensingData(String vlmId, Version vlmVersion, String licenseAgreementId, Collection<String> featureGroupIds);
- Optional<ErrorCode> validateVendorForUsage(String vlmId, Version version);
+ Optional<ErrorCode> validateVendorForUsage(String vlmId, Version version);
- void validate(String vendorLicenseModelId, Version version);
+ void validate(String vendorLicenseModelId, Version version);
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/facade/VendorLicenseFacadeFactory.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/facade/VendorLicenseFacadeFactory.java
index 540cc5ba66..114680c83b 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/facade/VendorLicenseFacadeFactory.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/facade/VendorLicenseFacadeFactory.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,16 +17,14 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.facade;
import org.openecomp.core.factory.api.AbstractComponentFactory;
import org.openecomp.core.factory.api.AbstractFactory;
-public abstract class VendorLicenseFacadeFactory
- extends AbstractComponentFactory<VendorLicenseFacade> {
+public abstract class VendorLicenseFacadeFactory extends AbstractComponentFactory<VendorLicenseFacade> {
- public static VendorLicenseFacadeFactory getInstance() {
- return AbstractFactory.getInstance(VendorLicenseFacadeFactory.class);
- }
+ public static VendorLicenseFacadeFactory getInstance() {
+ return AbstractFactory.getInstance(VendorLicenseFacadeFactory.class);
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/healing/HealingService.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/healing/HealingService.java
index a3a5b7263f..d06b04a820 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/healing/HealingService.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/healing/HealingService.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,16 +17,13 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.healing;
import org.openecomp.sdc.versioning.dao.types.VersionableEntity;
public interface HealingService {
- VersionableEntity heal(VersionableEntity toHeal);
+ VersionableEntity heal(VersionableEntity toHeal);
- void persistNoHealing(VersionableEntity alreadyHealed);
+ void persistNoHealing(VersionableEntity alreadyHealed);
}
-
-
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/VendorLicenseArtifactsService.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/VendorLicenseArtifactsService.java
index 66ac7ab33f..6482178dec 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/VendorLicenseArtifactsService.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/VendorLicenseArtifactsService.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,16 +17,13 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.licenseartifacts;
+import java.util.List;
import org.openecomp.core.utilities.file.FileContentHandler;
import org.openecomp.sdc.versioning.dao.types.Version;
-import java.util.List;
-
public interface VendorLicenseArtifactsService {
- FileContentHandler createLicenseArtifacts(String vspId, String vlmId, Version vlmVersion,
- List<String> featureGroups);
+ FileContentHandler createLicenseArtifacts(String vspId, String vlmId, Version vlmVersion, List<String> featureGroups);
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/types/VersionedVendorLicenseModel.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/types/VersionedVendorLicenseModel.java
index deb321f14e..89d952c976 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/types/VersionedVendorLicenseModel.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/types/VersionedVendorLicenseModel.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,38 +17,37 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.types;
import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity;
import org.openecomp.sdc.versioning.types.VersionInfo;
public class VersionedVendorLicenseModel {
- private VendorLicenseModelEntity vendorLicenseModel;
- private VersionInfo versionInfo;
- public VersionedVendorLicenseModel() {
- }
+ private VendorLicenseModelEntity vendorLicenseModel;
+ private VersionInfo versionInfo;
+
+ public VersionedVendorLicenseModel() {
+ }
- public VersionedVendorLicenseModel(VendorLicenseModelEntity vendorLicenseModel,
- VersionInfo versionInfo) {
- this.vendorLicenseModel = vendorLicenseModel;
- this.versionInfo = versionInfo;
- }
+ public VersionedVendorLicenseModel(VendorLicenseModelEntity vendorLicenseModel, VersionInfo versionInfo) {
+ this.vendorLicenseModel = vendorLicenseModel;
+ this.versionInfo = versionInfo;
+ }
- public VendorLicenseModelEntity getVendorLicenseModel() {
- return vendorLicenseModel;
- }
+ public VendorLicenseModelEntity getVendorLicenseModel() {
+ return vendorLicenseModel;
+ }
- public void setVendorLicenseModel(VendorLicenseModelEntity vendorLicenseModel) {
- this.vendorLicenseModel = vendorLicenseModel;
- }
+ public void setVendorLicenseModel(VendorLicenseModelEntity vendorLicenseModel) {
+ this.vendorLicenseModel = vendorLicenseModel;
+ }
- public VersionInfo getVersionInfo() {
- return versionInfo;
- }
+ public VersionInfo getVersionInfo() {
+ return versionInfo;
+ }
- public void setVersionInfo(VersionInfo versionInfo) {
- this.versionInfo = versionInfo;
- }
+ public void setVersionInfo(VersionInfo versionInfo) {
+ this.versionInfo = versionInfo;
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/SimpleHealingServiceServiceFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/SimpleHealingServiceServiceFactoryImpl.java
index 987e8f41d5..1eae03d3df 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/SimpleHealingServiceServiceFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/SimpleHealingServiceServiceFactoryImpl.java
@@ -13,18 +13,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorlicense;
import org.openecomp.sdc.vendorlicense.healing.HealingService;
import org.openecomp.sdc.vendorlicense.healing.impl.SimpleHealingServiceImpl;
public class SimpleHealingServiceServiceFactoryImpl extends HealingServiceFactory {
- private static final HealingService INSTANCE = new SimpleHealingServiceImpl();
- @Override
- public HealingService createInterface() {
- return INSTANCE;
- }
+ private static final HealingService INSTANCE = new SimpleHealingServiceImpl();
+ @Override
+ public HealingService createInterface() {
+ return INSTANCE;
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/VendorLicenseArtifactServiceFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/VendorLicenseArtifactServiceFactoryImpl.java
index 558c32f79c..162af148ae 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/VendorLicenseArtifactServiceFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/VendorLicenseArtifactServiceFactoryImpl.java
@@ -13,18 +13,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorlicense;
import org.openecomp.sdc.vendorlicense.licenseartifacts.VendorLicenseArtifactsService;
import org.openecomp.sdc.vendorlicense.licenseartifacts.impl.VendorLicenseArtifactsServiceImpl;
public class VendorLicenseArtifactServiceFactoryImpl extends VendorLicenseArtifactServiceFactory {
- private static final VendorLicenseArtifactsService INSTANCE = new VendorLicenseArtifactsServiceImpl();
- @Override
- public VendorLicenseArtifactsService createInterface() {
- return INSTANCE;
- }
+ private static final VendorLicenseArtifactsService INSTANCE = new VendorLicenseArtifactsServiceImpl();
+ @Override
+ public VendorLicenseArtifactsService createInterface() {
+ return INSTANCE;
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/EntitlementPoolDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/EntitlementPoolDaoFactoryImpl.java
index bcabffb4cd..c456fc5339 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/EntitlementPoolDaoFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/EntitlementPoolDaoFactoryImpl.java
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorlicense.dao.impl;
import org.openecomp.core.zusammen.api.ZusammenAdaptorFactory;
@@ -21,13 +20,12 @@ import org.openecomp.sdc.vendorlicense.dao.EntitlementPoolDao;
import org.openecomp.sdc.vendorlicense.dao.EntitlementPoolDaoFactory;
import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.EntitlementPoolZusammenDaoImpl;
-
public class EntitlementPoolDaoFactoryImpl extends EntitlementPoolDaoFactory {
- private static EntitlementPoolDao instance = new EntitlementPoolZusammenDaoImpl(
- ZusammenAdaptorFactory.getInstance().createInterface());
- @Override
- public EntitlementPoolDao createInterface() {
- return instance;
- }
+ private static EntitlementPoolDao instance = new EntitlementPoolZusammenDaoImpl(ZusammenAdaptorFactory.getInstance().createInterface());
+
+ @Override
+ public EntitlementPoolDao createInterface() {
+ return instance;
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/FeatureGroupDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/FeatureGroupDaoFactoryImpl.java
index ca0e090567..295f3c82a1 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/FeatureGroupDaoFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/FeatureGroupDaoFactoryImpl.java
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorlicense.dao.impl;
import org.openecomp.core.zusammen.api.ZusammenAdaptorFactory;
@@ -21,13 +20,12 @@ import org.openecomp.sdc.vendorlicense.dao.FeatureGroupDao;
import org.openecomp.sdc.vendorlicense.dao.FeatureGroupDaoFactory;
import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.FeatureGroupDaoZusammenImpl;
-
public class FeatureGroupDaoFactoryImpl extends FeatureGroupDaoFactory {
- private static FeatureGroupDao instance = new FeatureGroupDaoZusammenImpl(
- ZusammenAdaptorFactory.getInstance().createInterface());
- @Override
- public FeatureGroupDao createInterface() {
- return instance;
- }
+ private static FeatureGroupDao instance = new FeatureGroupDaoZusammenImpl(ZusammenAdaptorFactory.getInstance().createInterface());
+
+ @Override
+ public FeatureGroupDao createInterface() {
+ return instance;
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/LicenseAgreementDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/LicenseAgreementDaoFactoryImpl.java
index 25a5f69f02..3a18f6a92e 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/LicenseAgreementDaoFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/LicenseAgreementDaoFactoryImpl.java
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorlicense.dao.impl;
import org.openecomp.core.zusammen.api.ZusammenAdaptorFactory;
@@ -22,12 +21,11 @@ import org.openecomp.sdc.vendorlicense.dao.LicenseAgreementDaoFactory;
import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.LicenseAgreementDaoZusammenImpl;
public class LicenseAgreementDaoFactoryImpl extends LicenseAgreementDaoFactory {
-
- private static final LicenseAgreementDao INSTANCE = new LicenseAgreementDaoZusammenImpl(
- ZusammenAdaptorFactory.getInstance().createInterface());
- @Override
- public LicenseAgreementDao createInterface() {
- return INSTANCE;
- }
+ private static final LicenseAgreementDao INSTANCE = new LicenseAgreementDaoZusammenImpl(ZusammenAdaptorFactory.getInstance().createInterface());
+
+ @Override
+ public LicenseAgreementDao createInterface() {
+ return INSTANCE;
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/LicenseKeyGroupDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/LicenseKeyGroupDaoFactoryImpl.java
index fbe7dd517e..fe614d8d28 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/LicenseKeyGroupDaoFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/LicenseKeyGroupDaoFactoryImpl.java
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorlicense.dao.impl;
import org.openecomp.core.zusammen.api.ZusammenAdaptorFactory;
@@ -22,11 +21,11 @@ import org.openecomp.sdc.vendorlicense.dao.LicenseKeyGroupDaoFactory;
import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.LicenseKeyGroupZusammenDaoImpl;
public class LicenseKeyGroupDaoFactoryImpl extends LicenseKeyGroupDaoFactory {
- private static final LicenseKeyGroupDao INSTANCE = new LicenseKeyGroupZusammenDaoImpl(
- ZusammenAdaptorFactory.getInstance().createInterface());
- @Override
- public LicenseKeyGroupDao createInterface() {
- return INSTANCE;
- }
+ private static final LicenseKeyGroupDao INSTANCE = new LicenseKeyGroupZusammenDaoImpl(ZusammenAdaptorFactory.getInstance().createInterface());
+
+ @Override
+ public LicenseKeyGroupDao createInterface() {
+ return INSTANCE;
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/LimitDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/LimitDaoFactoryImpl.java
index bad6d3299f..980fc557a2 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/LimitDaoFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/LimitDaoFactoryImpl.java
@@ -26,11 +26,10 @@ import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.LimitZusammenDaoImpl;
public class LimitDaoFactoryImpl extends LimitDaoFactory {
- private static final LimitDao INSTANCE = new LimitZusammenDaoImpl(
- ZusammenAdaptorFactory.getInstance().createInterface());
+ private static final LimitDao INSTANCE = new LimitZusammenDaoImpl(ZusammenAdaptorFactory.getInstance().createInterface());
- @Override
- public LimitDao createInterface() {
- return INSTANCE;
- }
+ @Override
+ public LimitDao createInterface() {
+ return INSTANCE;
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/VendorLicenseModelDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/VendorLicenseModelDaoFactoryImpl.java
index 79d0677da7..6cdec701c1 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/VendorLicenseModelDaoFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/VendorLicenseModelDaoFactoryImpl.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.dao.impl;
import org.openecomp.core.zusammen.api.ZusammenAdaptorFactory;
@@ -27,11 +26,10 @@ import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.VendorLicenseModelDaoZu
public class VendorLicenseModelDaoFactoryImpl extends VendorLicenseModelDaoFactory {
- private static VendorLicenseModelDao INSTANCE = new VendorLicenseModelDaoZusammenImpl(
- ZusammenAdaptorFactory.getInstance().createInterface());
+ private static VendorLicenseModelDao INSTANCE = new VendorLicenseModelDaoZusammenImpl(ZusammenAdaptorFactory.getInstance().createInterface());
- @Override
- public VendorLicenseModelDao createInterface() {
- return INSTANCE;
- }
+ @Override
+ public VendorLicenseModelDao createInterface() {
+ return INSTANCE;
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/ElementPropertyName.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/ElementPropertyName.java
index 4b81cfcd87..540bf50362 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/ElementPropertyName.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/ElementPropertyName.java
@@ -19,7 +19,4 @@
*/
package org.openecomp.sdc.vendorlicense.dao.impl.zusammen;
-public enum ElementPropertyName {
- type,
- compositionData
-}
+public enum ElementPropertyName {type, compositionData}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/ElementType.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/ElementType.java
index 6807476605..4dd9ac22e5 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/ElementType.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/ElementType.java
@@ -19,7 +19,4 @@
*/
package org.openecomp.sdc.vendorlicense.dao.impl.zusammen;
-public enum ElementType {
- Limit
-
-}
+public enum ElementType {Limit}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/EntitlementPoolZusammenDaoImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/EntitlementPoolZusammenDaoImpl.java
index e084cf1c1b..aa90df8389 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/EntitlementPoolZusammenDaoImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/EntitlementPoolZusammenDaoImpl.java
@@ -19,6 +19,8 @@
*/
package org.openecomp.sdc.vendorlicense.dao.impl.zusammen;
+import static org.openecomp.core.zusammen.api.ZusammenUtil.buildElement;
+
import com.amdocs.zusammen.adaptor.inbound.api.types.item.Element;
import com.amdocs.zusammen.adaptor.inbound.api.types.item.ElementInfo;
import com.amdocs.zusammen.adaptor.inbound.api.types.item.ZusammenElement;
@@ -27,6 +29,11 @@ import com.amdocs.zusammen.datatypes.SessionContext;
import com.amdocs.zusammen.datatypes.item.Action;
import com.amdocs.zusammen.datatypes.item.ElementContext;
import com.amdocs.zusammen.datatypes.item.Info;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Map;
+import java.util.Optional;
+import java.util.stream.Collectors;
import org.openecomp.core.zusammen.api.ZusammenAdaptor;
import org.openecomp.core.zusammen.api.ZusammenUtil;
import org.openecomp.sdc.datatypes.model.ElementType;
@@ -35,228 +42,162 @@ import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.convertor.ElementToEnti
import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity;
import org.openecomp.types.ElementPropertyName;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Map;
-import java.util.Optional;
-import java.util.stream.Collectors;
-
-import static org.openecomp.core.zusammen.api.ZusammenUtil.buildElement;
-
public class EntitlementPoolZusammenDaoImpl implements EntitlementPoolDao {
- private ZusammenAdaptor zusammenAdaptor;
-
- public EntitlementPoolZusammenDaoImpl(ZusammenAdaptor zusammenAdaptor) {
- this.zusammenAdaptor = zusammenAdaptor;
- }
-
- @Override
- public void registerVersioning(String versionableEntityType) {
- //no need
- }
-
- @Override
- public void create(EntitlementPoolEntity entitlementPool) {
- ZusammenElement entitlementPoolElement =
- buildEntitlementPoolElement(entitlementPool, Action.CREATE);
-
- ZusammenElement entitlementPoolsElement =
- ZusammenUtil.buildStructuralElement(ElementType.EntitlementPools, Action.IGNORE);
-
- ZusammenElement limitsElement =
- ZusammenUtil.buildStructuralElement(ElementType.Limits, Action.CREATE);
-
- entitlementPoolElement.addSubElement(limitsElement);
- entitlementPoolsElement.addSubElement(entitlementPoolElement);
-
- SessionContext context = ZusammenUtil.createSessionContext();
- Element epsSavedElement = zusammenAdaptor.saveElement(context,
- new ElementContext(entitlementPool.getVendorLicenseModelId(),
- entitlementPool.getVersion().getId()),
- entitlementPoolsElement, "Create entitlement pool");
+ private ZusammenAdaptor zusammenAdaptor;
- entitlementPool
- .setId(epsSavedElement.getSubElements().iterator().next().getElementId().getValue());
- }
-
- @Override
- public void update(EntitlementPoolEntity entitlementPool) {
- ZusammenElement entitlmentpoolElement =
- buildEntitlementPoolElement(entitlementPool, Action.UPDATE);
-
- SessionContext context = ZusammenUtil.createSessionContext();
- ElementContext elementContext = new ElementContext(entitlementPool.getVendorLicenseModelId(),
- entitlementPool.getVersion().getId());
-
- Optional<ElementInfo> epFromDb = zusammenAdaptor.getElementInfo(context, elementContext,
- new Id(entitlementPool.getId()));
+ public EntitlementPoolZusammenDaoImpl(ZusammenAdaptor zusammenAdaptor) {
+ this.zusammenAdaptor = zusammenAdaptor;
+ }
- if (epFromDb.isPresent()) {
- if (entitlmentpoolElement.getRelations() == null) {
- entitlmentpoolElement.setRelations(new ArrayList<>());
- }
- if (epFromDb.get().getRelations() != null && !epFromDb.get().getRelations().isEmpty()) {
- entitlmentpoolElement.getRelations().addAll(epFromDb.get().getRelations());
- }
+ @Override
+ public void registerVersioning(String versionableEntityType) {
+ //no need
}
- zusammenAdaptor.saveElement(context, elementContext, entitlmentpoolElement,
- String.format("Update entitlement pool with id %s", entitlementPool.getId()));
- }
+ @Override
+ public void create(EntitlementPoolEntity entitlementPool) {
+ ZusammenElement entitlementPoolElement = buildEntitlementPoolElement(entitlementPool, Action.CREATE);
+ ZusammenElement entitlementPoolsElement = ZusammenUtil.buildStructuralElement(ElementType.EntitlementPools, Action.IGNORE);
+ ZusammenElement limitsElement = ZusammenUtil.buildStructuralElement(ElementType.Limits, Action.CREATE);
+ entitlementPoolElement.addSubElement(limitsElement);
+ entitlementPoolsElement.addSubElement(entitlementPoolElement);
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Element epsSavedElement = zusammenAdaptor
+ .saveElement(context, new ElementContext(entitlementPool.getVendorLicenseModelId(), entitlementPool.getVersion().getId()),
+ entitlementPoolsElement, "Create entitlement pool");
+ entitlementPool.setId(epsSavedElement.getSubElements().iterator().next().getElementId().getValue());
+ }
- @Override
- public EntitlementPoolEntity get(EntitlementPoolEntity entitlementPool) {
- SessionContext context = ZusammenUtil.createSessionContext();
- ElementContext elementContext = new ElementContext(entitlementPool.getVendorLicenseModelId(),
- entitlementPool.getVersion().getId());
- ElementToEntitlementPoolConvertor convertor = new ElementToEntitlementPoolConvertor();
- return zusammenAdaptor.getElementInfo(context, elementContext, new Id(entitlementPool.getId()))
- .map(elementInfo -> {
- EntitlementPoolEntity entity = convertor.convert(elementInfo);
- entity.setVendorLicenseModelId(entitlementPool.getVendorLicenseModelId());
- entity.setVersion(entitlementPool.getVersion());
- return entity;
- })
- .orElse(null);
- }
+ @Override
+ public void update(EntitlementPoolEntity entitlementPool) {
+ ZusammenElement entitlmentpoolElement = buildEntitlementPoolElement(entitlementPool, Action.UPDATE);
+ SessionContext context = ZusammenUtil.createSessionContext();
+ ElementContext elementContext = new ElementContext(entitlementPool.getVendorLicenseModelId(), entitlementPool.getVersion().getId());
+ Optional<ElementInfo> epFromDb = zusammenAdaptor.getElementInfo(context, elementContext, new Id(entitlementPool.getId()));
+ if (epFromDb.isPresent()) {
+ if (entitlmentpoolElement.getRelations() == null) {
+ entitlmentpoolElement.setRelations(new ArrayList<>());
+ }
+ if (epFromDb.get().getRelations() != null && !epFromDb.get().getRelations().isEmpty()) {
+ entitlmentpoolElement.getRelations().addAll(epFromDb.get().getRelations());
+ }
+ }
+ zusammenAdaptor.saveElement(context, elementContext, entitlmentpoolElement,
+ String.format("Update entitlement pool with id %s", entitlementPool.getId()));
+ }
- @Override
- public void delete(EntitlementPoolEntity entitlementPool) {
- ZusammenElement zusammenElement = buildElement(new Id(entitlementPool.getId()), Action.DELETE);
+ @Override
+ public EntitlementPoolEntity get(EntitlementPoolEntity entitlementPool) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ ElementContext elementContext = new ElementContext(entitlementPool.getVendorLicenseModelId(), entitlementPool.getVersion().getId());
+ ElementToEntitlementPoolConvertor convertor = new ElementToEntitlementPoolConvertor();
+ return zusammenAdaptor.getElementInfo(context, elementContext, new Id(entitlementPool.getId())).map(elementInfo -> {
+ EntitlementPoolEntity entity = convertor.convert(elementInfo);
+ entity.setVendorLicenseModelId(entitlementPool.getVendorLicenseModelId());
+ entity.setVersion(entitlementPool.getVersion());
+ return entity;
+ }).orElse(null);
+ }
- SessionContext context = ZusammenUtil.createSessionContext();
- ElementContext elementContext = new ElementContext(entitlementPool.getVendorLicenseModelId(),
- entitlementPool.getVersion().getId());
- zusammenAdaptor.saveElement(context, elementContext, zusammenElement,
- "delete entitlement pool. id:" + entitlementPool.getId() + ".");
- }
+ @Override
+ public void delete(EntitlementPoolEntity entitlementPool) {
+ ZusammenElement zusammenElement = buildElement(new Id(entitlementPool.getId()), Action.DELETE);
+ SessionContext context = ZusammenUtil.createSessionContext();
+ ElementContext elementContext = new ElementContext(entitlementPool.getVendorLicenseModelId(), entitlementPool.getVersion().getId());
+ zusammenAdaptor.saveElement(context, elementContext, zusammenElement, "delete entitlement pool. id:" + entitlementPool.getId() + ".");
+ }
- @Override
- public Collection<EntitlementPoolEntity> list(EntitlementPoolEntity entitlementPool) {
- SessionContext context = ZusammenUtil.createSessionContext();
- ElementContext elementContext = new ElementContext(entitlementPool.getVendorLicenseModelId(),
- entitlementPool.getVersion().getId());
- ElementToEntitlementPoolConvertor convertor = new ElementToEntitlementPoolConvertor();
- return zusammenAdaptor
- .listElementsByName(context, elementContext, null, ElementType.EntitlementPools.name())
- .stream().map(elementInfo -> {
- EntitlementPoolEntity entity = convertor.convert(elementInfo);
- entity.setVendorLicenseModelId(entitlementPool.getVendorLicenseModelId());
- entity.setVersion(entitlementPool.getVersion());
- return entity;
+ @Override
+ public Collection<EntitlementPoolEntity> list(EntitlementPoolEntity entitlementPool) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ ElementContext elementContext = new ElementContext(entitlementPool.getVendorLicenseModelId(), entitlementPool.getVersion().getId());
+ ElementToEntitlementPoolConvertor convertor = new ElementToEntitlementPoolConvertor();
+ return zusammenAdaptor.listElementsByName(context, elementContext, null, ElementType.EntitlementPools.name()).stream().map(elementInfo -> {
+ EntitlementPoolEntity entity = convertor.convert(elementInfo);
+ entity.setVendorLicenseModelId(entitlementPool.getVendorLicenseModelId());
+ entity.setVersion(entitlementPool.getVersion());
+ return entity;
}).collect(Collectors.toList());
- }
-
- @Override
- public long count(EntitlementPoolEntity entitlementPool) {
- SessionContext context = ZusammenUtil.createSessionContext();
- ElementContext elementContext = new ElementContext(entitlementPool.getVendorLicenseModelId(),
- entitlementPool.getVersion().getId());
-
- return zusammenAdaptor
- .listElementsByName(context, elementContext, null, ElementType.EntitlementPools.name())
- .size();
- }
-
- @Override
- public void removeReferencingFeatureGroup(EntitlementPoolEntity entitlementPool,
- String referencingFeatureGroupId) {
- SessionContext context = ZusammenUtil.createSessionContext();
- ElementContext elementContext = new ElementContext(entitlementPool.getVendorLicenseModelId(),
- entitlementPool.getVersion().getId());
-
- Optional<ElementInfo> elementInfo =
- zusammenAdaptor.getElementInfo(context, elementContext, new Id(entitlementPool.getId()));
-
- if (elementInfo.isPresent()) {
- ZusammenElement zusammenElement = VlmZusammenUtil.getZusammenElement(elementInfo.get());
- zusammenElement.setAction(Action.UPDATE);
- zusammenElement.setRelations(elementInfo.get().getRelations().stream()
- .filter(relation -> !referencingFeatureGroupId
- .equals(relation.getEdge2().getElementId().getValue()))
- .collect(Collectors.toList()));
-
- zusammenAdaptor.saveElement(context, elementContext, zusammenElement,
- "remove referencing feature group");
}
- }
- @Override
- public void addReferencingFeatureGroup(EntitlementPoolEntity entitlementPool,
- String referencingFeatureGroupId) {
- SessionContext context = ZusammenUtil.createSessionContext();
- ElementContext elementContext = new ElementContext(entitlementPool.getVendorLicenseModelId(),
- entitlementPool.getVersion().getId());
+ @Override
+ public long count(EntitlementPoolEntity entitlementPool) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ ElementContext elementContext = new ElementContext(entitlementPool.getVendorLicenseModelId(), entitlementPool.getVersion().getId());
+ return zusammenAdaptor.listElementsByName(context, elementContext, null, ElementType.EntitlementPools.name()).size();
+ }
- Optional<ElementInfo> elementInfo =
- zusammenAdaptor.getElementInfo(context, elementContext, new Id(entitlementPool.getId()));
+ @Override
+ public void removeReferencingFeatureGroup(EntitlementPoolEntity entitlementPool, String referencingFeatureGroupId) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ ElementContext elementContext = new ElementContext(entitlementPool.getVendorLicenseModelId(), entitlementPool.getVersion().getId());
+ Optional<ElementInfo> elementInfo = zusammenAdaptor.getElementInfo(context, elementContext, new Id(entitlementPool.getId()));
+ if (elementInfo.isPresent()) {
+ ZusammenElement zusammenElement = VlmZusammenUtil.getZusammenElement(elementInfo.get());
+ zusammenElement.setAction(Action.UPDATE);
+ zusammenElement.setRelations(elementInfo.get().getRelations().stream()
+ .filter(relation -> !referencingFeatureGroupId.equals(relation.getEdge2().getElementId().getValue())).collect(Collectors.toList()));
+ zusammenAdaptor.saveElement(context, elementContext, zusammenElement, "remove referencing feature group");
+ }
+ }
- if (elementInfo.isPresent()) {
- ZusammenElement zusammenElement = VlmZusammenUtil.getZusammenElement(elementInfo.get());
- zusammenElement.setAction(Action.UPDATE);
- if (zusammenElement.getRelations() == null) {
- zusammenElement.setRelations(new ArrayList<>());
- }
- zusammenElement.getRelations().add(VlmZusammenUtil
- .createRelation(RelationType.EntitlmentPoolToReferencingFeatureGroup,
- referencingFeatureGroupId));
- zusammenAdaptor
- .saveElement(context, elementContext, zusammenElement, "add referencing feature group");
+ @Override
+ public void addReferencingFeatureGroup(EntitlementPoolEntity entitlementPool, String referencingFeatureGroupId) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ ElementContext elementContext = new ElementContext(entitlementPool.getVendorLicenseModelId(), entitlementPool.getVersion().getId());
+ Optional<ElementInfo> elementInfo = zusammenAdaptor.getElementInfo(context, elementContext, new Id(entitlementPool.getId()));
+ if (elementInfo.isPresent()) {
+ ZusammenElement zusammenElement = VlmZusammenUtil.getZusammenElement(elementInfo.get());
+ zusammenElement.setAction(Action.UPDATE);
+ if (zusammenElement.getRelations() == null) {
+ zusammenElement.setRelations(new ArrayList<>());
+ }
+ zusammenElement.getRelations()
+ .add(VlmZusammenUtil.createRelation(RelationType.EntitlmentPoolToReferencingFeatureGroup, referencingFeatureGroupId));
+ zusammenAdaptor.saveElement(context, elementContext, zusammenElement, "add referencing feature group");
+ }
}
- }
- @Override
- public void deleteAll(EntitlementPoolEntity entitlementPool) {
- //not supported
- }
+ @Override
+ public void deleteAll(EntitlementPoolEntity entitlementPool) {
+ //not supported
+ }
- @Override
- public String getManufacturerReferenceNumber(EntitlementPoolEntity entitlementPoolEntity) {
- SessionContext context = ZusammenUtil.createSessionContext();
- ElementContext elementContext =
- new ElementContext(entitlementPoolEntity.getVendorLicenseModelId(),
+ @Override
+ public String getManufacturerReferenceNumber(EntitlementPoolEntity entitlementPoolEntity) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ ElementContext elementContext = new ElementContext(entitlementPoolEntity.getVendorLicenseModelId(),
entitlementPoolEntity.getVersion().getId());
-
- Optional<ElementInfo> elementInfo1 = zusammenAdaptor
- .getElementInfo(context, elementContext, new Id(entitlementPoolEntity.getId()));
- Map<String, Object> properties = elementInfo1.get().getInfo().getProperties();
- String manufacturerReferenceNumber = null;
- if (properties != null && properties.containsKey("manufacturerReferenceNumber")) {
- manufacturerReferenceNumber = (String) properties.get("manufacturerReferenceNumber");
+ Optional<ElementInfo> elementInfo1 = zusammenAdaptor.getElementInfo(context, elementContext, new Id(entitlementPoolEntity.getId()));
+ Map<String, Object> properties = elementInfo1.get().getInfo().getProperties();
+ String manufacturerReferenceNumber = null;
+ if (properties != null && properties.containsKey("manufacturerReferenceNumber")) {
+ manufacturerReferenceNumber = (String) properties.get("manufacturerReferenceNumber");
+ }
+ return manufacturerReferenceNumber;
}
- return manufacturerReferenceNumber;
- }
-
- private ZusammenElement buildEntitlementPoolElement(EntitlementPoolEntity entitlementPool,
- Action action) {
- ZusammenElement entitlementPoolElement =
- buildElement(entitlementPool.getId() == null ? null : new Id(entitlementPool.getId()),
- action);
- Info info = new Info();
- info.setName(entitlementPool.getName());
- info.setDescription(entitlementPool.getDescription());
- info.addProperty(ElementPropertyName.elementType.name(), ElementType.EntitlementPool);
- info.addProperty("version_uuid", entitlementPool.getVersionUuId());
- info.addProperty("EntitlementPoolType", entitlementPool.getType());
- info.addProperty("thresholdValue", entitlementPool.getThresholdValue());
- info.addProperty("threshold_unit", entitlementPool.getThresholdUnit());
- info.addProperty("increments", entitlementPool.getIncrements());
- info.addProperty("operational_scope", entitlementPool.getOperationalScope());
- info.addProperty("startDate", entitlementPool.getStartDate());
- info.addProperty("expiryDate", entitlementPool.getExpiryDate());
- info.addProperty("manufacturerReferenceNumber", entitlementPool.getManufacturerReferenceNumber());
- entitlementPoolElement.setInfo(info);
- if (entitlementPool.getReferencingFeatureGroups() != null
- && !entitlementPool.getReferencingFeatureGroups().isEmpty()) {
- entitlementPoolElement.setRelations(entitlementPool.getReferencingFeatureGroups().stream()
- .map(rel -> VlmZusammenUtil
- .createRelation(RelationType.EntitlmentPoolToReferencingFeatureGroup, rel))
- .collect(Collectors.toList()));
+ private ZusammenElement buildEntitlementPoolElement(EntitlementPoolEntity entitlementPool, Action action) {
+ ZusammenElement entitlementPoolElement = buildElement(entitlementPool.getId() == null ? null : new Id(entitlementPool.getId()), action);
+ Info info = new Info();
+ info.setName(entitlementPool.getName());
+ info.setDescription(entitlementPool.getDescription());
+ info.addProperty(ElementPropertyName.elementType.name(), ElementType.EntitlementPool);
+ info.addProperty("version_uuid", entitlementPool.getVersionUuId());
+ info.addProperty("EntitlementPoolType", entitlementPool.getType());
+ info.addProperty("thresholdValue", entitlementPool.getThresholdValue());
+ info.addProperty("threshold_unit", entitlementPool.getThresholdUnit());
+ info.addProperty("increments", entitlementPool.getIncrements());
+ info.addProperty("operational_scope", entitlementPool.getOperationalScope());
+ info.addProperty("startDate", entitlementPool.getStartDate());
+ info.addProperty("expiryDate", entitlementPool.getExpiryDate());
+ info.addProperty("manufacturerReferenceNumber", entitlementPool.getManufacturerReferenceNumber());
+ entitlementPoolElement.setInfo(info);
+ if (entitlementPool.getReferencingFeatureGroups() != null && !entitlementPool.getReferencingFeatureGroups().isEmpty()) {
+ entitlementPoolElement.setRelations(entitlementPool.getReferencingFeatureGroups().stream()
+ .map(rel -> VlmZusammenUtil.createRelation(RelationType.EntitlmentPoolToReferencingFeatureGroup, rel)).collect(Collectors.toList()));
+ }
+ return entitlementPoolElement;
}
- return entitlementPoolElement;
- }
-
-
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/FeatureGroupDaoZusammenImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/FeatureGroupDaoZusammenImpl.java
index fce2722e63..aacb10982d 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/FeatureGroupDaoZusammenImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/FeatureGroupDaoZusammenImpl.java
@@ -19,6 +19,10 @@
*/
package org.openecomp.sdc.vendorlicense.dao.impl.zusammen;
+import static org.openecomp.core.zusammen.api.ZusammenUtil.buildElement;
+import static org.openecomp.core.zusammen.api.ZusammenUtil.buildStructuralElement;
+import static org.openecomp.core.zusammen.api.ZusammenUtil.createSessionContext;
+
import com.amdocs.zusammen.adaptor.inbound.api.types.item.Element;
import com.amdocs.zusammen.adaptor.inbound.api.types.item.ElementInfo;
import com.amdocs.zusammen.adaptor.inbound.api.types.item.ZusammenElement;
@@ -28,6 +32,11 @@ import com.amdocs.zusammen.datatypes.item.Action;
import com.amdocs.zusammen.datatypes.item.ElementContext;
import com.amdocs.zusammen.datatypes.item.Info;
import com.amdocs.zusammen.datatypes.item.Relation;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Optional;
+import java.util.Set;
+import java.util.stream.Collectors;
import org.openecomp.core.zusammen.api.ZusammenAdaptor;
import org.openecomp.sdc.datatypes.model.ElementType;
import org.openecomp.sdc.vendorlicense.dao.FeatureGroupDao;
@@ -35,289 +44,199 @@ import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.convertor.ElementToFeat
import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity;
import org.openecomp.types.ElementPropertyName;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Optional;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-import static org.openecomp.core.zusammen.api.ZusammenUtil.*;
-
public class FeatureGroupDaoZusammenImpl implements FeatureGroupDao {
- private ZusammenAdaptor zusammenAdaptor;
-
- public FeatureGroupDaoZusammenImpl(ZusammenAdaptor zusammenAdaptor) {
- this.zusammenAdaptor = zusammenAdaptor;
- }
-
- @Override
- public void registerVersioning(String versionableEntityType) {
- //no need
- }
-
- @Override
- public void create(FeatureGroupEntity featureGroup) {
- ZusammenElement featureGroupElement = buildFeatureGroupElement(featureGroup, Action.CREATE);
-
- ZusammenElement featureGroupsElement =
- buildStructuralElement(ElementType.FeatureGroups, Action.IGNORE);
-
- featureGroupsElement.addSubElement(featureGroupElement);
-
- SessionContext context = createSessionContext();
- Element featureGroupsSavedElement = zusammenAdaptor.saveElement(context,
- new ElementContext(featureGroup.getVendorLicenseModelId(),
- featureGroup.getVersion().getId()), featureGroupsElement, "Create feature group");
-
- featureGroup.setId(
- featureGroupsSavedElement.getSubElements().iterator().next().getElementId().getValue());
- }
-
- @Override
- public void update(FeatureGroupEntity featureGroup) {
- ZusammenElement featureGroupElement = buildFeatureGroupElement(featureGroup, Action.UPDATE);
-
- SessionContext context = createSessionContext();
- zusammenAdaptor.saveElement(context, new ElementContext(featureGroup.getVendorLicenseModelId(),
- featureGroup.getVersion().getId()), featureGroupElement,
- String.format("Update feature group with id %s", featureGroup.getId()));
- }
-
- @Override
- public FeatureGroupEntity get(FeatureGroupEntity featureGroup) {
- SessionContext context = createSessionContext();
- ElementContext elementContext = new ElementContext(featureGroup.getVendorLicenseModelId(),
- featureGroup.getVersion().getId());
-
- return zusammenAdaptor.getElementInfo(context, elementContext, new Id(featureGroup.getId()))
- .map(elementInfo -> {
- FeatureGroupEntity entity = new ElementToFeatureGroupConvertor().convert(elementInfo);
- entity.setVendorLicenseModelId(featureGroup.getVendorLicenseModelId());
- entity.setVersion(featureGroup.getVersion());
- return entity;
- })
- .orElse(null);
- }
+ private ZusammenAdaptor zusammenAdaptor;
- @Override
- public void delete(FeatureGroupEntity featureGroup) {
- ZusammenElement zusammenElement = buildElement(new Id(featureGroup.getId()), Action.DELETE);
-
- SessionContext context = createSessionContext();
- ElementContext elementContext = new ElementContext(featureGroup.getVendorLicenseModelId(),
- featureGroup.getVersion().getId());
- zusammenAdaptor.saveElement(context, elementContext, zusammenElement,
- "delete feature group. id:" + featureGroup.getId() + ".");
- }
-
- @Override
- public Collection<FeatureGroupEntity> list(FeatureGroupEntity featureGroup) {
- SessionContext context = createSessionContext();
- ElementContext elementContext = new ElementContext(featureGroup.getVendorLicenseModelId(),
- featureGroup.getVersion().getId());
-
- ElementToFeatureGroupConvertor convertor = new ElementToFeatureGroupConvertor();
- return zusammenAdaptor
- .listElementsByName(context, elementContext, null, ElementType.FeatureGroups.name())
- .stream().map(elementInfo -> {
- FeatureGroupEntity entity = convertor.convert(
- elementInfo);
- entity.setVendorLicenseModelId(featureGroup.getVendorLicenseModelId());
- entity.setVersion(featureGroup.getVersion());
- return entity;
- })
- .collect(Collectors.toList());
- }
-
- @Override
- public long count(FeatureGroupEntity featureGroup) {
- SessionContext context = createSessionContext();
- ElementContext elementContext = new ElementContext(featureGroup.getVendorLicenseModelId(),
- featureGroup.getVersion().getId());
-
- return zusammenAdaptor
- .listElementsByName(context, elementContext, null, ElementType.FeatureGroups.name())
- .size();
- }
-
- @Override
- public void removeEntitlementPool(FeatureGroupEntity featureGroup, String entitlementPoolId) {
- removeRelationToContainedEntity(featureGroup, entitlementPoolId, "entitlement pool");
- }
-
- @Override
- public void removeLicenseKeyGroup(FeatureGroupEntity featureGroup, String licenseKeyGroupId) {
- removeRelationToContainedEntity(featureGroup, licenseKeyGroupId, "license Key Group");
- }
-
- private void removeRelationToContainedEntity(FeatureGroupEntity featureGroup,
- String containedEntityId,
- String containedEntityType) {
- SessionContext context = createSessionContext();
- ElementContext elementContext = new ElementContext(featureGroup.getVendorLicenseModelId(),
- featureGroup.getVersion().getId());
-
- Optional<ElementInfo> elementInfo = zusammenAdaptor.getElementInfo(context,
- elementContext, new Id(featureGroup.getId()));
- if (elementInfo.isPresent()) {
- ZusammenElement zusammenElement = VlmZusammenUtil.getZusammenElement(elementInfo.get());
- zusammenElement.setAction(Action.UPDATE);
- zusammenElement.setRelations(elementInfo.get().getRelations().stream()
- .filter(
- relation -> !containedEntityId.equals(relation.getEdge2().getElementId().getValue()))
- .collect(Collectors.toList()));
- zusammenAdaptor.saveElement(context, elementContext, zusammenElement,
- String.format("remove %s", containedEntityType));
+ public FeatureGroupDaoZusammenImpl(ZusammenAdaptor zusammenAdaptor) {
+ this.zusammenAdaptor = zusammenAdaptor;
}
- }
-
- @Override
- public void updateFeatureGroup(FeatureGroupEntity featureGroup,
- Set<String> addedEntitlementPools,
- Set<String> removedEntitlementPools,
- Set<String> addedLicenseKeyGroups,
- Set<String> removedLicenseKeyGroups) {
- ZusammenElement featureGroupElement = buildFeatureGroupElement(featureGroup, Action.UPDATE);
- SessionContext context = createSessionContext();
- ElementContext elementContext = new ElementContext(featureGroup.getVendorLicenseModelId(),
- featureGroup.getVersion().getId());
- ElementToFeatureGroupConvertor convertor = new ElementToFeatureGroupConvertor();
- Optional<ElementInfo> elementInfo = zusammenAdaptor.getElementInfo(context,
- elementContext, new Id(featureGroup.getId()));
- if (elementInfo.isPresent()) {
- FeatureGroupEntity currentFeatureGroup = convertor.convert(elementInfo.get());
- currentFeatureGroup.setVendorLicenseModelId(featureGroup.getVendorLicenseModelId());
- currentFeatureGroup.setVersion(featureGroup.getVersion());
- if (!(removedEntitlementPools == null)) {
- currentFeatureGroup.getEntitlementPoolIds().removeAll(removedEntitlementPools);
- }
- if (!(addedEntitlementPools == null)) {
- currentFeatureGroup.getEntitlementPoolIds().addAll(addedEntitlementPools);
- }
-
- if (featureGroupElement.getRelations() == null) {
- featureGroupElement.setRelations(new ArrayList<>());
- }
- featureGroupElement.getRelations()
- .addAll(currentFeatureGroup.getEntitlementPoolIds().stream()
- .map(relation -> VlmZusammenUtil
- .createRelation(RelationType.FeatureGroupToEntitlmentPool, relation))
- .collect(Collectors.toList()));
- if (!(removedLicenseKeyGroups == null)) {
- currentFeatureGroup.getLicenseKeyGroupIds().removeAll(removedLicenseKeyGroups);
- }
- if (!(addedLicenseKeyGroups == null)) {
- currentFeatureGroup.getLicenseKeyGroupIds().addAll(addedLicenseKeyGroups);
- }
-
- featureGroupElement.getRelations()
- .addAll(currentFeatureGroup.getLicenseKeyGroupIds().stream()
- .map(relation -> VlmZusammenUtil
- .createRelation(RelationType.FeatureGroupToLicenseKeyGroup, relation))
- .collect(Collectors.toList()));
-
- Collection<Relation> laRelations = elementInfo.get().getRelations().stream().filter
- (rel -> rel.getType()
- .equals(RelationType.FeatureGroupToReferencingLicenseAgreement.name()))
- .map(rel -> VlmZusammenUtil.createRelation(RelationType
- .FeatureGroupToReferencingLicenseAgreement, rel.getEdge2().getElementId().toString()))
- .collect(Collectors.toList());
+ @Override
+ public void registerVersioning(String versionableEntityType) {
+ //no need
+ }
- featureGroupElement.getRelations().addAll(laRelations);
+ @Override
+ public void create(FeatureGroupEntity featureGroup) {
+ ZusammenElement featureGroupElement = buildFeatureGroupElement(featureGroup, Action.CREATE);
+ ZusammenElement featureGroupsElement = buildStructuralElement(ElementType.FeatureGroups, Action.IGNORE);
+ featureGroupsElement.addSubElement(featureGroupElement);
+ SessionContext context = createSessionContext();
+ Element featureGroupsSavedElement = zusammenAdaptor
+ .saveElement(context, new ElementContext(featureGroup.getVendorLicenseModelId(), featureGroup.getVersion().getId()), featureGroupsElement,
+ "Create feature group");
+ featureGroup.setId(featureGroupsSavedElement.getSubElements().iterator().next().getElementId().getValue());
+ }
- zusammenAdaptor
- .saveElement(context, elementContext, featureGroupElement, "update feature group");
+ @Override
+ public void update(FeatureGroupEntity featureGroup) {
+ ZusammenElement featureGroupElement = buildFeatureGroupElement(featureGroup, Action.UPDATE);
+ SessionContext context = createSessionContext();
+ zusammenAdaptor
+ .saveElement(context, new ElementContext(featureGroup.getVendorLicenseModelId(), featureGroup.getVersion().getId()), featureGroupElement,
+ String.format("Update feature group with id %s", featureGroup.getId()));
}
- }
- @Override
- public void deleteAll(FeatureGroupEntity featureGroup) {
- //not supported
- }
+ @Override
+ public FeatureGroupEntity get(FeatureGroupEntity featureGroup) {
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(featureGroup.getVendorLicenseModelId(), featureGroup.getVersion().getId());
+ return zusammenAdaptor.getElementInfo(context, elementContext, new Id(featureGroup.getId())).map(elementInfo -> {
+ FeatureGroupEntity entity = new ElementToFeatureGroupConvertor().convert(elementInfo);
+ entity.setVendorLicenseModelId(featureGroup.getVendorLicenseModelId());
+ entity.setVersion(featureGroup.getVersion());
+ return entity;
+ }).orElse(null);
+ }
+ @Override
+ public void delete(FeatureGroupEntity featureGroup) {
+ ZusammenElement zusammenElement = buildElement(new Id(featureGroup.getId()), Action.DELETE);
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(featureGroup.getVendorLicenseModelId(), featureGroup.getVersion().getId());
+ zusammenAdaptor.saveElement(context, elementContext, zusammenElement, "delete feature group. id:" + featureGroup.getId() + ".");
+ }
- @Override
- public void addReferencingLicenseAgreement(FeatureGroupEntity featureGroup,
- String licenseAgreementId) {
- SessionContext context = createSessionContext();
- ElementContext elementContext = new ElementContext(featureGroup.getVendorLicenseModelId(),
- featureGroup.getVersion().getId());
+ @Override
+ public Collection<FeatureGroupEntity> list(FeatureGroupEntity featureGroup) {
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(featureGroup.getVendorLicenseModelId(), featureGroup.getVersion().getId());
+ ElementToFeatureGroupConvertor convertor = new ElementToFeatureGroupConvertor();
+ return zusammenAdaptor.listElementsByName(context, elementContext, null, ElementType.FeatureGroups.name()).stream().map(elementInfo -> {
+ FeatureGroupEntity entity = convertor.convert(elementInfo);
+ entity.setVendorLicenseModelId(featureGroup.getVendorLicenseModelId());
+ entity.setVersion(featureGroup.getVersion());
+ return entity;
+ }).collect(Collectors.toList());
+ }
- Optional<ElementInfo> elementInfo =
- zusammenAdaptor.getElementInfo(context, elementContext, new Id(featureGroup.getId()));
- if (elementInfo.isPresent()) {
- ZusammenElement zusammenElement = VlmZusammenUtil.getZusammenElement(elementInfo.get());
- zusammenElement.setAction(Action.UPDATE);
- zusammenElement.getRelations().add(VlmZusammenUtil
- .createRelation(RelationType.FeatureGroupToReferencingLicenseAgreement,
- licenseAgreementId));
- zusammenAdaptor.saveElement(context, elementContext, zusammenElement,
- "add referencing license agreement");
+ @Override
+ public long count(FeatureGroupEntity featureGroup) {
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(featureGroup.getVendorLicenseModelId(), featureGroup.getVersion().getId());
+ return zusammenAdaptor.listElementsByName(context, elementContext, null, ElementType.FeatureGroups.name()).size();
}
- }
- @Override
- public void removeReferencingLicenseAgreement(FeatureGroupEntity featureGroup,
- String licenseAgreementId) {
- SessionContext context = createSessionContext();
- ElementContext elementContext = new ElementContext(featureGroup.getVendorLicenseModelId(),
- featureGroup.getVersion().getId());
+ @Override
+ public void removeEntitlementPool(FeatureGroupEntity featureGroup, String entitlementPoolId) {
+ removeRelationToContainedEntity(featureGroup, entitlementPoolId, "entitlement pool");
+ }
- Optional<ElementInfo> elementInfo =
- zusammenAdaptor.getElementInfo(context, elementContext, new Id(featureGroup.getId()));
- if (elementInfo.isPresent()) {
- ZusammenElement zusammenElement = VlmZusammenUtil.getZusammenElement(elementInfo.get());
- zusammenElement.setAction(Action.UPDATE);
- zusammenElement.setRelations(elementInfo.get().getRelations().stream()
- .filter(
- relation -> !licenseAgreementId.equals(relation.getEdge2().getElementId().getValue()))
- .collect(Collectors.toList()));
+ @Override
+ public void removeLicenseKeyGroup(FeatureGroupEntity featureGroup, String licenseKeyGroupId) {
+ removeRelationToContainedEntity(featureGroup, licenseKeyGroupId, "license Key Group");
+ }
- zusammenAdaptor.saveElement(context, elementContext, zusammenElement,
- "remove referencing license agreement");
+ private void removeRelationToContainedEntity(FeatureGroupEntity featureGroup, String containedEntityId, String containedEntityType) {
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(featureGroup.getVendorLicenseModelId(), featureGroup.getVersion().getId());
+ Optional<ElementInfo> elementInfo = zusammenAdaptor.getElementInfo(context, elementContext, new Id(featureGroup.getId()));
+ if (elementInfo.isPresent()) {
+ ZusammenElement zusammenElement = VlmZusammenUtil.getZusammenElement(elementInfo.get());
+ zusammenElement.setAction(Action.UPDATE);
+ zusammenElement.setRelations(
+ elementInfo.get().getRelations().stream().filter(relation -> !containedEntityId.equals(relation.getEdge2().getElementId().getValue()))
+ .collect(Collectors.toList()));
+ zusammenAdaptor.saveElement(context, elementContext, zusammenElement, String.format("remove %s", containedEntityType));
+ }
}
- }
- private ZusammenElement buildFeatureGroupElement(FeatureGroupEntity featureGroup, Action action) {
- ZusammenElement featureGroupElement =
- buildElement(featureGroup.getId() == null ? null : new Id(featureGroup.getId()), action);
- Info info = new Info();
- info.setName(featureGroup.getName());
- info.setDescription(featureGroup.getDescription());
- info.addProperty(ElementPropertyName.elementType.name(), ElementType.FeatureGroup);
- info.addProperty("partNumber", featureGroup.getPartNumber());
- featureGroupElement.setInfo(info);
+ @Override
+ public void updateFeatureGroup(FeatureGroupEntity featureGroup, Set<String> addedEntitlementPools, Set<String> removedEntitlementPools,
+ Set<String> addedLicenseKeyGroups, Set<String> removedLicenseKeyGroups) {
+ ZusammenElement featureGroupElement = buildFeatureGroupElement(featureGroup, Action.UPDATE);
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(featureGroup.getVendorLicenseModelId(), featureGroup.getVersion().getId());
+ ElementToFeatureGroupConvertor convertor = new ElementToFeatureGroupConvertor();
+ Optional<ElementInfo> elementInfo = zusammenAdaptor.getElementInfo(context, elementContext, new Id(featureGroup.getId()));
+ if (elementInfo.isPresent()) {
+ FeatureGroupEntity currentFeatureGroup = convertor.convert(elementInfo.get());
+ currentFeatureGroup.setVendorLicenseModelId(featureGroup.getVendorLicenseModelId());
+ currentFeatureGroup.setVersion(featureGroup.getVersion());
+ if (!(removedEntitlementPools == null)) {
+ currentFeatureGroup.getEntitlementPoolIds().removeAll(removedEntitlementPools);
+ }
+ if (!(addedEntitlementPools == null)) {
+ currentFeatureGroup.getEntitlementPoolIds().addAll(addedEntitlementPools);
+ }
+ if (featureGroupElement.getRelations() == null) {
+ featureGroupElement.setRelations(new ArrayList<>());
+ }
+ featureGroupElement.getRelations().addAll(currentFeatureGroup.getEntitlementPoolIds().stream()
+ .map(relation -> VlmZusammenUtil.createRelation(RelationType.FeatureGroupToEntitlmentPool, relation)).collect(Collectors.toList()));
+ if (!(removedLicenseKeyGroups == null)) {
+ currentFeatureGroup.getLicenseKeyGroupIds().removeAll(removedLicenseKeyGroups);
+ }
+ if (!(addedLicenseKeyGroups == null)) {
+ currentFeatureGroup.getLicenseKeyGroupIds().addAll(addedLicenseKeyGroups);
+ }
+ featureGroupElement.getRelations().addAll(currentFeatureGroup.getLicenseKeyGroupIds().stream()
+ .map(relation -> VlmZusammenUtil.createRelation(RelationType.FeatureGroupToLicenseKeyGroup, relation)).collect(Collectors.toList()));
+ Collection<Relation> laRelations = elementInfo.get().getRelations().stream()
+ .filter(rel -> rel.getType().equals(RelationType.FeatureGroupToReferencingLicenseAgreement.name())).map(rel -> VlmZusammenUtil
+ .createRelation(RelationType.FeatureGroupToReferencingLicenseAgreement, rel.getEdge2().getElementId().toString()))
+ .collect(Collectors.toList());
+ featureGroupElement.getRelations().addAll(laRelations);
+ zusammenAdaptor.saveElement(context, elementContext, featureGroupElement, "update feature group");
+ }
+ }
- featureGroupElement.setRelations(new ArrayList<>());
+ @Override
+ public void deleteAll(FeatureGroupEntity featureGroup) {
+ //not supported
+ }
- if (featureGroup.getEntitlementPoolIds() != null &&
- !featureGroup.getEntitlementPoolIds().isEmpty()) {
- featureGroupElement.getRelations().addAll(featureGroup.getEntitlementPoolIds().stream()
- .map(rel -> VlmZusammenUtil
- .createRelation(RelationType.FeatureGroupToEntitlmentPool, rel))
- .collect(Collectors.toList()));
+ @Override
+ public void addReferencingLicenseAgreement(FeatureGroupEntity featureGroup, String licenseAgreementId) {
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(featureGroup.getVendorLicenseModelId(), featureGroup.getVersion().getId());
+ Optional<ElementInfo> elementInfo = zusammenAdaptor.getElementInfo(context, elementContext, new Id(featureGroup.getId()));
+ if (elementInfo.isPresent()) {
+ ZusammenElement zusammenElement = VlmZusammenUtil.getZusammenElement(elementInfo.get());
+ zusammenElement.setAction(Action.UPDATE);
+ zusammenElement.getRelations()
+ .add(VlmZusammenUtil.createRelation(RelationType.FeatureGroupToReferencingLicenseAgreement, licenseAgreementId));
+ zusammenAdaptor.saveElement(context, elementContext, zusammenElement, "add referencing license agreement");
+ }
}
- if (featureGroup.getLicenseKeyGroupIds() != null &&
- !featureGroup.getLicenseKeyGroupIds().isEmpty()) {
- featureGroupElement.getRelations()
- .addAll(featureGroup.getLicenseKeyGroupIds().stream()
- .map(rel -> VlmZusammenUtil
- .createRelation(RelationType.FeatureGroupToLicenseKeyGroup, rel))
- .collect(Collectors.toList()));
+ @Override
+ public void removeReferencingLicenseAgreement(FeatureGroupEntity featureGroup, String licenseAgreementId) {
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(featureGroup.getVendorLicenseModelId(), featureGroup.getVersion().getId());
+ Optional<ElementInfo> elementInfo = zusammenAdaptor.getElementInfo(context, elementContext, new Id(featureGroup.getId()));
+ if (elementInfo.isPresent()) {
+ ZusammenElement zusammenElement = VlmZusammenUtil.getZusammenElement(elementInfo.get());
+ zusammenElement.setAction(Action.UPDATE);
+ zusammenElement.setRelations(elementInfo.get().getRelations().stream()
+ .filter(relation -> !licenseAgreementId.equals(relation.getEdge2().getElementId().getValue())).collect(Collectors.toList()));
+ zusammenAdaptor.saveElement(context, elementContext, zusammenElement, "remove referencing license agreement");
+ }
}
- if (featureGroup.getReferencingLicenseAgreements() != null &&
- !featureGroup.getReferencingLicenseAgreements().isEmpty()) {
- featureGroupElement.getRelations()
- .addAll(featureGroup.getReferencingLicenseAgreements().stream()
- .map(rel -> VlmZusammenUtil
- .createRelation(RelationType.FeatureGroupToReferencingLicenseAgreement,
- rel))
- .collect(Collectors.toList()));
+ private ZusammenElement buildFeatureGroupElement(FeatureGroupEntity featureGroup, Action action) {
+ ZusammenElement featureGroupElement = buildElement(featureGroup.getId() == null ? null : new Id(featureGroup.getId()), action);
+ Info info = new Info();
+ info.setName(featureGroup.getName());
+ info.setDescription(featureGroup.getDescription());
+ info.addProperty(ElementPropertyName.elementType.name(), ElementType.FeatureGroup);
+ info.addProperty("partNumber", featureGroup.getPartNumber());
+ featureGroupElement.setInfo(info);
+ featureGroupElement.setRelations(new ArrayList<>());
+ if (featureGroup.getEntitlementPoolIds() != null && !featureGroup.getEntitlementPoolIds().isEmpty()) {
+ featureGroupElement.getRelations().addAll(featureGroup.getEntitlementPoolIds().stream()
+ .map(rel -> VlmZusammenUtil.createRelation(RelationType.FeatureGroupToEntitlmentPool, rel)).collect(Collectors.toList()));
+ }
+ if (featureGroup.getLicenseKeyGroupIds() != null && !featureGroup.getLicenseKeyGroupIds().isEmpty()) {
+ featureGroupElement.getRelations().addAll(featureGroup.getLicenseKeyGroupIds().stream()
+ .map(rel -> VlmZusammenUtil.createRelation(RelationType.FeatureGroupToLicenseKeyGroup, rel)).collect(Collectors.toList()));
+ }
+ if (featureGroup.getReferencingLicenseAgreements() != null && !featureGroup.getReferencingLicenseAgreements().isEmpty()) {
+ featureGroupElement.getRelations().addAll(featureGroup.getReferencingLicenseAgreements().stream()
+ .map(rel -> VlmZusammenUtil.createRelation(RelationType.FeatureGroupToReferencingLicenseAgreement, rel))
+ .collect(Collectors.toList()));
+ }
+ return featureGroupElement;
}
- return featureGroupElement;
- }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/LicenseAgreementDaoZusammenImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/LicenseAgreementDaoZusammenImpl.java
index d30931c8c7..1e4f7ce29c 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/LicenseAgreementDaoZusammenImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/LicenseAgreementDaoZusammenImpl.java
@@ -13,9 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorlicense.dao.impl.zusammen;
+import static org.openecomp.core.zusammen.api.ZusammenUtil.buildElement;
+import static org.openecomp.core.zusammen.api.ZusammenUtil.buildStructuralElement;
+import static org.openecomp.core.zusammen.api.ZusammenUtil.createSessionContext;
+
import com.amdocs.zusammen.adaptor.inbound.api.types.item.Element;
import com.amdocs.zusammen.adaptor.inbound.api.types.item.ElementInfo;
import com.amdocs.zusammen.adaptor.inbound.api.types.item.ZusammenElement;
@@ -24,6 +27,10 @@ import com.amdocs.zusammen.datatypes.SessionContext;
import com.amdocs.zusammen.datatypes.item.Action;
import com.amdocs.zusammen.datatypes.item.ElementContext;
import com.amdocs.zusammen.datatypes.item.Info;
+import java.util.Collection;
+import java.util.Optional;
+import java.util.Set;
+import java.util.stream.Collectors;
import lombok.AllArgsConstructor;
import org.openecomp.core.zusammen.api.ZusammenAdaptor;
import org.openecomp.sdc.datatypes.model.ElementType;
@@ -32,187 +39,134 @@ import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.convertor.ElementToLice
import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementEntity;
import org.openecomp.types.ElementPropertyName;
-import java.util.Collection;
-import java.util.Optional;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-import static org.openecomp.core.zusammen.api.ZusammenUtil.*;
-
@AllArgsConstructor
public class LicenseAgreementDaoZusammenImpl implements LicenseAgreementDao {
- private ZusammenAdaptor zusammenAdaptor;
-
- @Override
- public void registerVersioning(String versionableEntityType) {
- //no need
- }
-
- @Override
- public void create(LicenseAgreementEntity licenseAgreement) {
- ZusammenElement licenseAgreementElement =
- buildLicenseAgreementElement(licenseAgreement, Action.CREATE);
- ZusammenElement licenseAgreementsElement =
- buildStructuralElement(ElementType.LicenseAgreements, Action.IGNORE);
- licenseAgreementsElement.addSubElement(licenseAgreementElement);
-
- SessionContext context = createSessionContext();
- Element licenseAgreementsSavedElement = zusammenAdaptor.saveElement(context,
- new ElementContext(licenseAgreement.getVendorLicenseModelId(),
- licenseAgreement.getVersion().getId()), licenseAgreementsElement,
- "Create license agreement");
- licenseAgreement
- .setId(licenseAgreementsSavedElement.getSubElements().iterator().next().getElementId()
- .getValue());
- }
+ private ZusammenAdaptor zusammenAdaptor;
- @Override
- public void update(LicenseAgreementEntity licenseAgreement) {
- ZusammenElement licenseAgreementElement =
- buildLicenseAgreementElement(licenseAgreement, Action.UPDATE);
-
- SessionContext context = createSessionContext();
- zusammenAdaptor.saveElement(context,
- new ElementContext(licenseAgreement.getVendorLicenseModelId(),
- licenseAgreement.getVersion().getId()), licenseAgreementElement,
- String.format("Update license agreement with id %s", licenseAgreement.getId()));
- }
-
- @Override
- public LicenseAgreementEntity get(LicenseAgreementEntity licenseAgreement) {
- SessionContext context = createSessionContext();
- ElementContext elementContext = new ElementContext(licenseAgreement.getVendorLicenseModelId(),
- licenseAgreement.getVersion().getId());
- ElementToLicenseAgreementConvertor convertor = new ElementToLicenseAgreementConvertor();
- return zusammenAdaptor.getElementInfo(context, elementContext, new Id(licenseAgreement.getId()))
- .map(elementInfo -> {
- LicenseAgreementEntity entity = convertor.convert(elementInfo);
- entity.setVendorLicenseModelId(licenseAgreement.getVendorLicenseModelId());
- entity.setVersion(licenseAgreement.getVersion());
- return entity;
- })
- .orElse(null);
- }
-
- @Override
- public void delete(LicenseAgreementEntity licenseAgreement) {
- ZusammenElement zusammenElement = buildElement(new Id(licenseAgreement.getId()), Action.DELETE);
-
- SessionContext context = createSessionContext();
- ElementContext elementContext = new ElementContext(licenseAgreement.getVendorLicenseModelId(),
- licenseAgreement.getVersion().getId());
- zusammenAdaptor.saveElement(context, elementContext, zusammenElement,
- "delete license agreement. id:" + licenseAgreement.getId() + ".");
- }
-
-
- @Override
- public Collection<LicenseAgreementEntity> list(LicenseAgreementEntity licenseAgreement) {
- SessionContext context = createSessionContext();
- ElementContext elementContext = new ElementContext(licenseAgreement.getVendorLicenseModelId(),
- licenseAgreement.getVersion().getId());
- ElementToLicenseAgreementConvertor convertor = new ElementToLicenseAgreementConvertor();
- return zusammenAdaptor
- .listElementsByName(context, elementContext, null,
- ElementType.LicenseAgreements.name())
- .stream().map(elementInfo -> {
- LicenseAgreementEntity entity = convertor.convert(elementInfo);
- entity.setVendorLicenseModelId(licenseAgreement.getVendorLicenseModelId());
- entity.setVersion(licenseAgreement.getVersion());
- return entity;
- })
- .collect(Collectors.toList());
- }
+ @Override
+ public void registerVersioning(String versionableEntityType) {
+ //no need
+ }
- @Override
- public long count(LicenseAgreementEntity licenseAgreement) {
- SessionContext context = createSessionContext();
- ElementContext elementContext = new ElementContext(licenseAgreement.getVendorLicenseModelId(),
- licenseAgreement.getVersion().getId());
+ @Override
+ public void create(LicenseAgreementEntity licenseAgreement) {
+ ZusammenElement licenseAgreementElement = buildLicenseAgreementElement(licenseAgreement, Action.CREATE);
+ ZusammenElement licenseAgreementsElement = buildStructuralElement(ElementType.LicenseAgreements, Action.IGNORE);
+ licenseAgreementsElement.addSubElement(licenseAgreementElement);
+ SessionContext context = createSessionContext();
+ Element licenseAgreementsSavedElement = zusammenAdaptor
+ .saveElement(context, new ElementContext(licenseAgreement.getVendorLicenseModelId(), licenseAgreement.getVersion().getId()),
+ licenseAgreementsElement, "Create license agreement");
+ licenseAgreement.setId(licenseAgreementsSavedElement.getSubElements().iterator().next().getElementId().getValue());
+ }
- return zusammenAdaptor.listElementsByName(context, elementContext, null,
- ElementType.LicenseAgreements.name())
- .size();
- }
+ @Override
+ public void update(LicenseAgreementEntity licenseAgreement) {
+ ZusammenElement licenseAgreementElement = buildLicenseAgreementElement(licenseAgreement, Action.UPDATE);
+ SessionContext context = createSessionContext();
+ zusammenAdaptor.saveElement(context, new ElementContext(licenseAgreement.getVendorLicenseModelId(), licenseAgreement.getVersion().getId()),
+ licenseAgreementElement, String.format("Update license agreement with id %s", licenseAgreement.getId()));
+ }
- @Override
- public void deleteAll(LicenseAgreementEntity entity) {
- //not supported
- }
+ @Override
+ public LicenseAgreementEntity get(LicenseAgreementEntity licenseAgreement) {
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(licenseAgreement.getVendorLicenseModelId(), licenseAgreement.getVersion().getId());
+ ElementToLicenseAgreementConvertor convertor = new ElementToLicenseAgreementConvertor();
+ return zusammenAdaptor.getElementInfo(context, elementContext, new Id(licenseAgreement.getId())).map(elementInfo -> {
+ LicenseAgreementEntity entity = convertor.convert(elementInfo);
+ entity.setVendorLicenseModelId(licenseAgreement.getVendorLicenseModelId());
+ entity.setVersion(licenseAgreement.getVersion());
+ return entity;
+ }).orElse(null);
+ }
- @Override
- public void removeFeatureGroup(LicenseAgreementEntity licenseAgreement, String featureGroupId) {
- SessionContext context = createSessionContext();
- ElementContext elementContext = new ElementContext(licenseAgreement.getVendorLicenseModelId(),
- licenseAgreement.getVersion().getId());
+ @Override
+ public void delete(LicenseAgreementEntity licenseAgreement) {
+ ZusammenElement zusammenElement = buildElement(new Id(licenseAgreement.getId()), Action.DELETE);
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(licenseAgreement.getVendorLicenseModelId(), licenseAgreement.getVersion().getId());
+ zusammenAdaptor.saveElement(context, elementContext, zusammenElement, "delete license agreement. id:" + licenseAgreement.getId() + ".");
+ }
- Optional<ElementInfo> elementInfo = zusammenAdaptor.getElementInfo(context,
- elementContext, new Id(licenseAgreement.getId()));
- if (elementInfo.isPresent()) {
- ZusammenElement zusammenElement = VlmZusammenUtil.getZusammenElement(elementInfo.get());
- zusammenElement.setAction(Action.UPDATE);
- zusammenElement.setRelations(elementInfo.get().getRelations().stream()
- .filter(relation -> !featureGroupId.equals(relation.getEdge2().getElementId().getValue()))
- .collect(Collectors.toList()));
- zusammenAdaptor.saveElement(context, elementContext, zusammenElement, "remove feature group");
+ @Override
+ public Collection<LicenseAgreementEntity> list(LicenseAgreementEntity licenseAgreement) {
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(licenseAgreement.getVendorLicenseModelId(), licenseAgreement.getVersion().getId());
+ ElementToLicenseAgreementConvertor convertor = new ElementToLicenseAgreementConvertor();
+ return zusammenAdaptor.listElementsByName(context, elementContext, null, ElementType.LicenseAgreements.name()).stream().map(elementInfo -> {
+ LicenseAgreementEntity entity = convertor.convert(elementInfo);
+ entity.setVendorLicenseModelId(licenseAgreement.getVendorLicenseModelId());
+ entity.setVersion(licenseAgreement.getVersion());
+ return entity;
+ }).collect(Collectors.toList());
}
- }
- @Override
- public void updateColumnsAndDeltaFeatureGroupIds(LicenseAgreementEntity licenseAgreement,
- Set<String> addedFeatureGroupIds,
- Set<String> removedFeatureGroupIds) {
- ZusammenElement licenseAgreementElement =
- buildLicenseAgreementElement(licenseAgreement, Action.UPDATE);
+ @Override
+ public long count(LicenseAgreementEntity licenseAgreement) {
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(licenseAgreement.getVendorLicenseModelId(), licenseAgreement.getVersion().getId());
+ return zusammenAdaptor.listElementsByName(context, elementContext, null, ElementType.LicenseAgreements.name()).size();
+ }
- SessionContext context = createSessionContext();
- ElementContext elementContext = new ElementContext(licenseAgreement.getVendorLicenseModelId(),
- licenseAgreement.getVersion().getId());
- ElementToLicenseAgreementConvertor convertor = new ElementToLicenseAgreementConvertor();
- Optional<ElementInfo> elementInfo =
- zusammenAdaptor.getElementInfo(context, elementContext, new Id(licenseAgreement.getId()));
- if (elementInfo.isPresent()) {
- LicenseAgreementEntity currentLicenseAgreement =
- convertor.convert(elementInfo.get());
- currentLicenseAgreement.setVendorLicenseModelId(licenseAgreement.getVendorLicenseModelId());
- currentLicenseAgreement.setVersion(licenseAgreement.getVersion());
- if (!(removedFeatureGroupIds == null)) {
- currentLicenseAgreement.getFeatureGroupIds().removeAll(removedFeatureGroupIds);
- }
+ @Override
+ public void deleteAll(LicenseAgreementEntity entity) {
+ //not supported
+ }
- if (!(addedFeatureGroupIds == null)) {
- currentLicenseAgreement.getFeatureGroupIds().addAll(addedFeatureGroupIds);
- }
- licenseAgreementElement.setRelations(currentLicenseAgreement.getFeatureGroupIds().stream()
- .map(relation -> VlmZusammenUtil
- .createRelation(RelationType.LicenseAgreementToFeatureGroup, relation))
- .collect(Collectors.toList()));
- zusammenAdaptor.saveElement(context, elementContext, licenseAgreementElement,
- "update license agreement");
+ @Override
+ public void removeFeatureGroup(LicenseAgreementEntity licenseAgreement, String featureGroupId) {
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(licenseAgreement.getVendorLicenseModelId(), licenseAgreement.getVersion().getId());
+ Optional<ElementInfo> elementInfo = zusammenAdaptor.getElementInfo(context, elementContext, new Id(licenseAgreement.getId()));
+ if (elementInfo.isPresent()) {
+ ZusammenElement zusammenElement = VlmZusammenUtil.getZusammenElement(elementInfo.get());
+ zusammenElement.setAction(Action.UPDATE);
+ zusammenElement.setRelations(
+ elementInfo.get().getRelations().stream().filter(relation -> !featureGroupId.equals(relation.getEdge2().getElementId().getValue()))
+ .collect(Collectors.toList()));
+ zusammenAdaptor.saveElement(context, elementContext, zusammenElement, "remove feature group");
+ }
}
- }
- private ZusammenElement buildLicenseAgreementElement(LicenseAgreementEntity licenseAgreement,
- Action action) {
- ZusammenElement licenseAgreementElement =
- buildElement(licenseAgreement.getId() == null ? null : new Id(licenseAgreement.getId()),
- action);
- Info info = new Info();
- info.setName(licenseAgreement.getName());
- info.setDescription(licenseAgreement.getDescription());
- info.addProperty(ElementPropertyName.elementType.name(), ElementType.LicenseAgreement);
- info.addProperty("licenseTerm", licenseAgreement.getLicenseTerm());
- info.addProperty("requirementsAndConstrains", licenseAgreement.getRequirementsAndConstrains());
- licenseAgreementElement.setInfo(info);
+ @Override
+ public void updateColumnsAndDeltaFeatureGroupIds(LicenseAgreementEntity licenseAgreement, Set<String> addedFeatureGroupIds,
+ Set<String> removedFeatureGroupIds) {
+ ZusammenElement licenseAgreementElement = buildLicenseAgreementElement(licenseAgreement, Action.UPDATE);
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(licenseAgreement.getVendorLicenseModelId(), licenseAgreement.getVersion().getId());
+ ElementToLicenseAgreementConvertor convertor = new ElementToLicenseAgreementConvertor();
+ Optional<ElementInfo> elementInfo = zusammenAdaptor.getElementInfo(context, elementContext, new Id(licenseAgreement.getId()));
+ if (elementInfo.isPresent()) {
+ LicenseAgreementEntity currentLicenseAgreement = convertor.convert(elementInfo.get());
+ currentLicenseAgreement.setVendorLicenseModelId(licenseAgreement.getVendorLicenseModelId());
+ currentLicenseAgreement.setVersion(licenseAgreement.getVersion());
+ if (!(removedFeatureGroupIds == null)) {
+ currentLicenseAgreement.getFeatureGroupIds().removeAll(removedFeatureGroupIds);
+ }
+ if (!(addedFeatureGroupIds == null)) {
+ currentLicenseAgreement.getFeatureGroupIds().addAll(addedFeatureGroupIds);
+ }
+ licenseAgreementElement.setRelations(currentLicenseAgreement.getFeatureGroupIds().stream()
+ .map(relation -> VlmZusammenUtil.createRelation(RelationType.LicenseAgreementToFeatureGroup, relation)).collect(Collectors.toList()));
+ zusammenAdaptor.saveElement(context, elementContext, licenseAgreementElement, "update license agreement");
+ }
+ }
- if (licenseAgreement.getFeatureGroupIds() != null &&
- !licenseAgreement.getFeatureGroupIds().isEmpty()) {
- licenseAgreementElement.setRelations(licenseAgreement.getFeatureGroupIds().stream()
- .map(rel -> VlmZusammenUtil
- .createRelation(RelationType.LicenseAgreementToFeatureGroup, rel))
- .collect(Collectors.toList()));
+ private ZusammenElement buildLicenseAgreementElement(LicenseAgreementEntity licenseAgreement, Action action) {
+ ZusammenElement licenseAgreementElement = buildElement(licenseAgreement.getId() == null ? null : new Id(licenseAgreement.getId()), action);
+ Info info = new Info();
+ info.setName(licenseAgreement.getName());
+ info.setDescription(licenseAgreement.getDescription());
+ info.addProperty(ElementPropertyName.elementType.name(), ElementType.LicenseAgreement);
+ info.addProperty("licenseTerm", licenseAgreement.getLicenseTerm());
+ info.addProperty("requirementsAndConstrains", licenseAgreement.getRequirementsAndConstrains());
+ licenseAgreementElement.setInfo(info);
+ if (licenseAgreement.getFeatureGroupIds() != null && !licenseAgreement.getFeatureGroupIds().isEmpty()) {
+ licenseAgreementElement.setRelations(licenseAgreement.getFeatureGroupIds().stream()
+ .map(rel -> VlmZusammenUtil.createRelation(RelationType.LicenseAgreementToFeatureGroup, rel)).collect(Collectors.toList()));
+ }
+ return licenseAgreementElement;
}
- return licenseAgreementElement;
- }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/LicenseKeyGroupZusammenDaoImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/LicenseKeyGroupZusammenDaoImpl.java
index e5a08ae93a..6d44d1a66a 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/LicenseKeyGroupZusammenDaoImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/LicenseKeyGroupZusammenDaoImpl.java
@@ -19,6 +19,10 @@
*/
package org.openecomp.sdc.vendorlicense.dao.impl.zusammen;
+import static org.openecomp.core.zusammen.api.ZusammenUtil.buildElement;
+import static org.openecomp.core.zusammen.api.ZusammenUtil.buildStructuralElement;
+import static org.openecomp.core.zusammen.api.ZusammenUtil.createSessionContext;
+
import com.amdocs.zusammen.adaptor.inbound.api.types.item.Element;
import com.amdocs.zusammen.adaptor.inbound.api.types.item.ElementInfo;
import com.amdocs.zusammen.adaptor.inbound.api.types.item.ZusammenElement;
@@ -27,6 +31,10 @@ import com.amdocs.zusammen.datatypes.SessionContext;
import com.amdocs.zusammen.datatypes.item.Action;
import com.amdocs.zusammen.datatypes.item.ElementContext;
import com.amdocs.zusammen.datatypes.item.Info;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Optional;
+import java.util.stream.Collectors;
import lombok.AllArgsConstructor;
import org.openecomp.core.zusammen.api.ZusammenAdaptor;
import org.openecomp.sdc.datatypes.model.ElementType;
@@ -35,206 +43,145 @@ import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.convertor.ElementToLice
import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity;
import org.openecomp.types.ElementPropertyName;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Optional;
-import java.util.stream.Collectors;
-
-import static org.openecomp.core.zusammen.api.ZusammenUtil.*;
-
@AllArgsConstructor
public class LicenseKeyGroupZusammenDaoImpl implements LicenseKeyGroupDao {
- private ZusammenAdaptor zusammenAdaptor;
-
- @Override
- public void registerVersioning(String versionableEntityType) {
- //no need
- }
-
- @Override
- public void create(LicenseKeyGroupEntity licenseKeyGroup) {
- ZusammenElement licenseKeyGroupElement =
- buildLicenseKeyGroupElement(licenseKeyGroup, Action.CREATE);
-
- ZusammenElement limitsElement = buildStructuralElement(ElementType.Limits, Action.CREATE);
- licenseKeyGroupElement.addSubElement(limitsElement);
-
- ZusammenElement lkgsElement =
- buildStructuralElement(ElementType.LicenseKeyGroups, Action.IGNORE);
- lkgsElement.addSubElement(licenseKeyGroupElement);
-
- SessionContext context = createSessionContext();
- Element lkgsSavedElement = zusammenAdaptor.saveElement(context,
- new ElementContext(licenseKeyGroup.getVendorLicenseModelId(),
- licenseKeyGroup.getVersion().getId()), lkgsElement, "Create license Key Group");
-
- licenseKeyGroup
- .setId(lkgsSavedElement.getSubElements().iterator().next().getElementId().getValue());
- }
-
- @Override
- public void update(LicenseKeyGroupEntity licenseKeyGroup) {
- ZusammenElement licenseKeyGroupElement =
- buildLicenseKeyGroupElement(licenseKeyGroup, Action.UPDATE);
-
- SessionContext context = createSessionContext();
- ElementContext elementContext = new ElementContext(licenseKeyGroup.getVendorLicenseModelId(),
- licenseKeyGroup.getVersion().getId());
- Optional<ElementInfo> lkgFromDb = zusammenAdaptor.getElementInfo(context, elementContext,
- new Id(licenseKeyGroup.getId()));
+ private ZusammenAdaptor zusammenAdaptor;
- if (lkgFromDb.isPresent()) {
-
- if (licenseKeyGroupElement.getRelations() == null) {
- licenseKeyGroupElement.setRelations(new ArrayList<>());
- }
-
- if (lkgFromDb.get().getRelations() != null && !lkgFromDb.get().getRelations().isEmpty()) {
- licenseKeyGroupElement.getRelations().addAll(lkgFromDb.get().getRelations());
- }
+ @Override
+ public void registerVersioning(String versionableEntityType) {
+ //no need
}
- zusammenAdaptor.saveElement(context, elementContext, licenseKeyGroupElement,
- String.format("Update license key group with id %s", licenseKeyGroup.getId()));
- }
-
- @Override
- public LicenseKeyGroupEntity get(LicenseKeyGroupEntity licenseKeyGroup) {
- SessionContext context = createSessionContext();
- ElementContext elementContext = new ElementContext(licenseKeyGroup.getVendorLicenseModelId(),
- licenseKeyGroup.getVersion().getId());
- ElementToLicenseKeyGroupConvertor convertor = new ElementToLicenseKeyGroupConvertor();
- return zusammenAdaptor.getElementInfo(context, elementContext, new Id(licenseKeyGroup.getId()))
- .map(elementInfo -> {
- LicenseKeyGroupEntity entity = convertor.convert(elementInfo);
- entity.setVendorLicenseModelId(licenseKeyGroup.getVendorLicenseModelId());
- entity.setVersion(licenseKeyGroup.getVersion());
- return entity;
- })
- .orElse(null);
- }
-
- @Override
- public void delete(LicenseKeyGroupEntity licenseKeyGroup) {
- ZusammenElement zusammenElement = buildElement(new Id(licenseKeyGroup.getId()), Action.DELETE);
-
- SessionContext context = createSessionContext();
- ElementContext elementContext = new ElementContext(licenseKeyGroup.getVendorLicenseModelId(),
- licenseKeyGroup.getVersion().getId());
-
- zusammenAdaptor.saveElement(context, elementContext, zusammenElement,
- "delete license key group. id:" + licenseKeyGroup.getId() + ".");
- }
-
- @Override
- public Collection<LicenseKeyGroupEntity> list(LicenseKeyGroupEntity licenseKeyGroup) {
- SessionContext context = createSessionContext();
- ElementContext elementContext = new ElementContext(licenseKeyGroup.getVendorLicenseModelId(),
- licenseKeyGroup.getVersion().getId());
- ElementToLicenseKeyGroupConvertor convertor = new ElementToLicenseKeyGroupConvertor();
- return zusammenAdaptor
- .listElementsByName(context, elementContext, null, ElementType.LicenseKeyGroups.name())
- .stream().map(elementInfo -> {
- LicenseKeyGroupEntity entity = convertor.convert(elementInfo);
- entity.setVendorLicenseModelId(licenseKeyGroup.getVendorLicenseModelId());
- entity.setVersion(licenseKeyGroup.getVersion());
- return entity;
- })
- .collect(Collectors.toList());
- }
-
- @Override
- public long count(LicenseKeyGroupEntity licenseKeyGroup) {
- SessionContext context = createSessionContext();
- ElementContext elementContext = new ElementContext(licenseKeyGroup.getVendorLicenseModelId(),
- licenseKeyGroup.getVersion().getId());
-
- return zusammenAdaptor
- .listElementsByName(context, elementContext, null, ElementType.LicenseKeyGroups.name())
- .size();
- }
- @Override
- public void deleteAll(LicenseKeyGroupEntity licenseKeyGroup) {
- //not supported
- }
-
- @Override
- public void removeReferencingFeatureGroup(LicenseKeyGroupEntity licenseKeyGroup,
- String featureGroupId) {
- SessionContext context = createSessionContext();
- ElementContext elementContext = new ElementContext(licenseKeyGroup.getVendorLicenseModelId(),
- licenseKeyGroup.getVersion().getId());
-
- Optional<ElementInfo> elementInfo =
- zusammenAdaptor.getElementInfo(context, elementContext, new Id(licenseKeyGroup.getId()));
+ @Override
+ public void create(LicenseKeyGroupEntity licenseKeyGroup) {
+ ZusammenElement licenseKeyGroupElement = buildLicenseKeyGroupElement(licenseKeyGroup, Action.CREATE);
+ ZusammenElement limitsElement = buildStructuralElement(ElementType.Limits, Action.CREATE);
+ licenseKeyGroupElement.addSubElement(limitsElement);
+ ZusammenElement lkgsElement = buildStructuralElement(ElementType.LicenseKeyGroups, Action.IGNORE);
+ lkgsElement.addSubElement(licenseKeyGroupElement);
+ SessionContext context = createSessionContext();
+ Element lkgsSavedElement = zusammenAdaptor
+ .saveElement(context, new ElementContext(licenseKeyGroup.getVendorLicenseModelId(), licenseKeyGroup.getVersion().getId()), lkgsElement,
+ "Create license Key Group");
+ licenseKeyGroup.setId(lkgsSavedElement.getSubElements().iterator().next().getElementId().getValue());
+ }
- if (elementInfo.isPresent()) {
- ZusammenElement zusammenElement = VlmZusammenUtil.getZusammenElement(elementInfo.get());
- zusammenElement.setAction(Action.UPDATE);
- zusammenElement.setRelations(elementInfo.get().getRelations().stream()
- .filter(relation -> !featureGroupId
- .equals(relation.getEdge2().getElementId().getValue()))
- .collect(Collectors.toList()));
+ @Override
+ public void update(LicenseKeyGroupEntity licenseKeyGroup) {
+ ZusammenElement licenseKeyGroupElement = buildLicenseKeyGroupElement(licenseKeyGroup, Action.UPDATE);
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(licenseKeyGroup.getVendorLicenseModelId(), licenseKeyGroup.getVersion().getId());
+ Optional<ElementInfo> lkgFromDb = zusammenAdaptor.getElementInfo(context, elementContext, new Id(licenseKeyGroup.getId()));
+ if (lkgFromDb.isPresent()) {
+ if (licenseKeyGroupElement.getRelations() == null) {
+ licenseKeyGroupElement.setRelations(new ArrayList<>());
+ }
+ if (lkgFromDb.get().getRelations() != null && !lkgFromDb.get().getRelations().isEmpty()) {
+ licenseKeyGroupElement.getRelations().addAll(lkgFromDb.get().getRelations());
+ }
+ }
+ zusammenAdaptor.saveElement(context, elementContext, licenseKeyGroupElement,
+ String.format("Update license key group with id %s", licenseKeyGroup.getId()));
+ }
- zusammenAdaptor.saveElement(context, elementContext, zusammenElement,
- "remove referencing feature group");
+ @Override
+ public LicenseKeyGroupEntity get(LicenseKeyGroupEntity licenseKeyGroup) {
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(licenseKeyGroup.getVendorLicenseModelId(), licenseKeyGroup.getVersion().getId());
+ ElementToLicenseKeyGroupConvertor convertor = new ElementToLicenseKeyGroupConvertor();
+ return zusammenAdaptor.getElementInfo(context, elementContext, new Id(licenseKeyGroup.getId())).map(elementInfo -> {
+ LicenseKeyGroupEntity entity = convertor.convert(elementInfo);
+ entity.setVendorLicenseModelId(licenseKeyGroup.getVendorLicenseModelId());
+ entity.setVersion(licenseKeyGroup.getVersion());
+ return entity;
+ }).orElse(null);
}
- }
- @Override
- public void addReferencingFeatureGroup(LicenseKeyGroupEntity licenseKeyGroup,
- String featureGroupId) {
- SessionContext context = createSessionContext();
- ElementContext elementContext = new ElementContext(licenseKeyGroup.getVendorLicenseModelId(),
- licenseKeyGroup.getVersion().getId());
+ @Override
+ public void delete(LicenseKeyGroupEntity licenseKeyGroup) {
+ ZusammenElement zusammenElement = buildElement(new Id(licenseKeyGroup.getId()), Action.DELETE);
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(licenseKeyGroup.getVendorLicenseModelId(), licenseKeyGroup.getVersion().getId());
+ zusammenAdaptor.saveElement(context, elementContext, zusammenElement, "delete license key group. id:" + licenseKeyGroup.getId() + ".");
+ }
- Optional<ElementInfo> elementInfo =
- zusammenAdaptor.getElementInfo(context, elementContext, new Id(licenseKeyGroup.getId()));
+ @Override
+ public Collection<LicenseKeyGroupEntity> list(LicenseKeyGroupEntity licenseKeyGroup) {
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(licenseKeyGroup.getVendorLicenseModelId(), licenseKeyGroup.getVersion().getId());
+ ElementToLicenseKeyGroupConvertor convertor = new ElementToLicenseKeyGroupConvertor();
+ return zusammenAdaptor.listElementsByName(context, elementContext, null, ElementType.LicenseKeyGroups.name()).stream().map(elementInfo -> {
+ LicenseKeyGroupEntity entity = convertor.convert(elementInfo);
+ entity.setVendorLicenseModelId(licenseKeyGroup.getVendorLicenseModelId());
+ entity.setVersion(licenseKeyGroup.getVersion());
+ return entity;
+ }).collect(Collectors.toList());
+ }
- if (elementInfo.isPresent()) {
- ZusammenElement zusammenElement = VlmZusammenUtil.getZusammenElement(elementInfo.get());
- zusammenElement.setAction(Action.UPDATE);
- if (zusammenElement.getRelations() == null) {
- zusammenElement.setRelations(new ArrayList<>());
- }
- zusammenElement.getRelations().add(VlmZusammenUtil
- .createRelation(RelationType.LicenseKeyGroupToReferencingFeatureGroup,
- featureGroupId));
- zusammenAdaptor
- .saveElement(context, elementContext, zusammenElement, "add referencing feature group");
+ @Override
+ public long count(LicenseKeyGroupEntity licenseKeyGroup) {
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(licenseKeyGroup.getVendorLicenseModelId(), licenseKeyGroup.getVersion().getId());
+ return zusammenAdaptor.listElementsByName(context, elementContext, null, ElementType.LicenseKeyGroups.name()).size();
}
- }
- private ZusammenElement buildLicenseKeyGroupElement(LicenseKeyGroupEntity licenseKeyGroup,
- Action action) {
- ZusammenElement lkgElement =
- buildElement(licenseKeyGroup.getId() == null ? null : new Id(licenseKeyGroup.getId()),
- action);
- Info info = new Info();
- info.setName(licenseKeyGroup.getName());
- info.setDescription(licenseKeyGroup.getDescription());
- info.addProperty(ElementPropertyName.elementType.name(), ElementType.LicenseKeyGroup);
- info.addProperty("version_uuid", licenseKeyGroup.getVersionUuId());
- info.addProperty("LicenseKeyType", licenseKeyGroup.getType());
- info.addProperty("operational_scope", licenseKeyGroup.getOperationalScope());
- info.addProperty("startDate", licenseKeyGroup.getStartDate());
- info.addProperty("expiryDate", licenseKeyGroup.getExpiryDate());
- info.addProperty("thresholdValue", licenseKeyGroup.getThresholdValue());
- info.addProperty("thresholdUnits", licenseKeyGroup.getThresholdUnits());
- info.addProperty("increments", licenseKeyGroup.getIncrements());
- info.addProperty("manufacturerReferenceNumber", licenseKeyGroup.getManufacturerReferenceNumber());
- lkgElement.setInfo(info);
+ @Override
+ public void deleteAll(LicenseKeyGroupEntity licenseKeyGroup) {
+ //not supported
+ }
- if (licenseKeyGroup.getReferencingFeatureGroups() != null
- && !licenseKeyGroup.getReferencingFeatureGroups().isEmpty()) {
- lkgElement.setRelations(licenseKeyGroup.getReferencingFeatureGroups().stream()
- .map(rel -> VlmZusammenUtil
- .createRelation(RelationType.LicenseKeyGroupToReferencingFeatureGroup, rel))
- .collect(Collectors.toList()));
+ @Override
+ public void removeReferencingFeatureGroup(LicenseKeyGroupEntity licenseKeyGroup, String featureGroupId) {
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(licenseKeyGroup.getVendorLicenseModelId(), licenseKeyGroup.getVersion().getId());
+ Optional<ElementInfo> elementInfo = zusammenAdaptor.getElementInfo(context, elementContext, new Id(licenseKeyGroup.getId()));
+ if (elementInfo.isPresent()) {
+ ZusammenElement zusammenElement = VlmZusammenUtil.getZusammenElement(elementInfo.get());
+ zusammenElement.setAction(Action.UPDATE);
+ zusammenElement.setRelations(
+ elementInfo.get().getRelations().stream().filter(relation -> !featureGroupId.equals(relation.getEdge2().getElementId().getValue()))
+ .collect(Collectors.toList()));
+ zusammenAdaptor.saveElement(context, elementContext, zusammenElement, "remove referencing feature group");
+ }
}
- return lkgElement;
- }
+ @Override
+ public void addReferencingFeatureGroup(LicenseKeyGroupEntity licenseKeyGroup, String featureGroupId) {
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(licenseKeyGroup.getVendorLicenseModelId(), licenseKeyGroup.getVersion().getId());
+ Optional<ElementInfo> elementInfo = zusammenAdaptor.getElementInfo(context, elementContext, new Id(licenseKeyGroup.getId()));
+ if (elementInfo.isPresent()) {
+ ZusammenElement zusammenElement = VlmZusammenUtil.getZusammenElement(elementInfo.get());
+ zusammenElement.setAction(Action.UPDATE);
+ if (zusammenElement.getRelations() == null) {
+ zusammenElement.setRelations(new ArrayList<>());
+ }
+ zusammenElement.getRelations().add(VlmZusammenUtil.createRelation(RelationType.LicenseKeyGroupToReferencingFeatureGroup, featureGroupId));
+ zusammenAdaptor.saveElement(context, elementContext, zusammenElement, "add referencing feature group");
+ }
+ }
+ private ZusammenElement buildLicenseKeyGroupElement(LicenseKeyGroupEntity licenseKeyGroup, Action action) {
+ ZusammenElement lkgElement = buildElement(licenseKeyGroup.getId() == null ? null : new Id(licenseKeyGroup.getId()), action);
+ Info info = new Info();
+ info.setName(licenseKeyGroup.getName());
+ info.setDescription(licenseKeyGroup.getDescription());
+ info.addProperty(ElementPropertyName.elementType.name(), ElementType.LicenseKeyGroup);
+ info.addProperty("version_uuid", licenseKeyGroup.getVersionUuId());
+ info.addProperty("LicenseKeyType", licenseKeyGroup.getType());
+ info.addProperty("operational_scope", licenseKeyGroup.getOperationalScope());
+ info.addProperty("startDate", licenseKeyGroup.getStartDate());
+ info.addProperty("expiryDate", licenseKeyGroup.getExpiryDate());
+ info.addProperty("thresholdValue", licenseKeyGroup.getThresholdValue());
+ info.addProperty("thresholdUnits", licenseKeyGroup.getThresholdUnits());
+ info.addProperty("increments", licenseKeyGroup.getIncrements());
+ info.addProperty("manufacturerReferenceNumber", licenseKeyGroup.getManufacturerReferenceNumber());
+ lkgElement.setInfo(info);
+ if (licenseKeyGroup.getReferencingFeatureGroups() != null && !licenseKeyGroup.getReferencingFeatureGroups().isEmpty()) {
+ lkgElement.setRelations(licenseKeyGroup.getReferencingFeatureGroups().stream()
+ .map(rel -> VlmZusammenUtil.createRelation(RelationType.LicenseKeyGroupToReferencingFeatureGroup, rel)).collect(Collectors.toList()));
+ }
+ return lkgElement;
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/LimitZusammenDaoImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/LimitZusammenDaoImpl.java
index 9fe3b38565..7b90a270bf 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/LimitZusammenDaoImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/LimitZusammenDaoImpl.java
@@ -19,6 +19,10 @@
*/
package org.openecomp.sdc.vendorlicense.dao.impl.zusammen;
+import static org.openecomp.core.zusammen.api.ZusammenUtil.buildElement;
+import static org.openecomp.core.zusammen.api.ZusammenUtil.buildStructuralElement;
+import static org.openecomp.core.zusammen.api.ZusammenUtil.createSessionContext;
+
import com.amdocs.zusammen.adaptor.inbound.api.types.item.Element;
import com.amdocs.zusammen.adaptor.inbound.api.types.item.ElementInfo;
import com.amdocs.zusammen.adaptor.inbound.api.types.item.ZusammenElement;
@@ -27,6 +31,9 @@ import com.amdocs.zusammen.datatypes.SessionContext;
import com.amdocs.zusammen.datatypes.item.Action;
import com.amdocs.zusammen.datatypes.item.ElementContext;
import com.amdocs.zusammen.datatypes.item.Info;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.stream.Collectors;
import org.openecomp.core.zusammen.api.ZusammenAdaptor;
import org.openecomp.sdc.datatypes.model.ElementType;
import org.openecomp.sdc.vendorlicense.dao.LimitDao;
@@ -36,163 +43,120 @@ import org.openecomp.sdc.vendorlicense.dao.types.LimitType;
import org.openecomp.sdc.versioning.dao.types.Version;
import org.openecomp.types.ElementPropertyName;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.stream.Collectors;
-
-import static org.openecomp.core.zusammen.api.ZusammenUtil.*;
-
public class LimitZusammenDaoImpl implements LimitDao {
- private static final String LIMT_TYPE = "type";
- private static final String METRIC = "metric";
- private static final String AGGREGATIONFUNCTION = "aggregationfunction";
- private static final String TIME = "time";
- private static final String UNIT = "unit";
- private static final String VALUE = "value";
- private ZusammenAdaptor zusammenAdaptor;
-
- public LimitZusammenDaoImpl(ZusammenAdaptor zusammenAdaptor) {
- this.zusammenAdaptor = zusammenAdaptor;
- }
-
- @Override
- public void create(LimitEntity limitEntity) {
- ZusammenElement limitElement = limitToZusammen(limitEntity, Action.CREATE);
-
- ZusammenElement limitsElement = buildStructuralElement(ElementType.Limits, null);
- limitsElement.setSubElements(Collections.singletonList(limitElement));
-
- ZusammenElement epLkgElement = buildElement(new Id(limitEntity.getEpLkgId()), Action.IGNORE);
- epLkgElement.setSubElements(Collections.singletonList(limitsElement));
-
- SessionContext context = createSessionContext();
- ElementContext elementContext =
- new ElementContext(limitEntity.getVendorLicenseModelId(), limitEntity.getVersion().getId());
-
- Element savedElement =
- zusammenAdaptor.saveElement(context, elementContext, epLkgElement, "Create limit");
- limitEntity.setId(savedElement.getSubElements().iterator().next()
- .getSubElements().iterator().next().getElementId().getValue());
- }
-
- @Override
- public boolean isLimitPresent(LimitEntity limitEntity) {
- SessionContext context = createSessionContext();
- ElementContext elementContext =
- new ElementContext(limitEntity.getVendorLicenseModelId(), limitEntity.getVersion().getId());
-
- Collection<ElementInfo> elementInfos = zusammenAdaptor.listElementsByName(context,
- elementContext, new Id(limitEntity.getEpLkgId()), ElementType.Limits.name());
+ private static final String LIMT_TYPE = "type";
+ private static final String METRIC = "metric";
+ private static final String AGGREGATIONFUNCTION = "aggregationfunction";
+ private static final String TIME = "time";
+ private static final String UNIT = "unit";
+ private static final String VALUE = "value";
+ private ZusammenAdaptor zusammenAdaptor;
- for (ElementInfo elementInfo : elementInfos) {
- if (elementInfo.getId().getValue().equals(limitEntity.getId())) {
- return true;
- }
+ public LimitZusammenDaoImpl(ZusammenAdaptor zusammenAdaptor) {
+ this.zusammenAdaptor = zusammenAdaptor;
}
- return false;
- }
-
- @Override
- public Collection<LimitEntity> list(LimitEntity limitEntity) {
- SessionContext context = createSessionContext();
- ElementContext elementContext =
- new ElementContext(limitEntity.getVendorLicenseModelId(), limitEntity.getVersion().getId());
-
- return listLimits(context, elementContext, limitEntity);
- }
-
- private Collection<LimitEntity> listLimits(SessionContext context, ElementContext elementContext,
- LimitEntity limitEntity) {
- return zusammenAdaptor
- .listElementsByName(context, elementContext, new Id(limitEntity.getEpLkgId()),
- ElementType.Limits.name())
- .stream().map(elementInfo -> mapElementInfoToLimit(
- limitEntity.getVendorLicenseModelId(), limitEntity.getVersion(),
- limitEntity.getEpLkgId(), elementInfo))
- .collect(Collectors.toList());
- }
-
- private LimitEntity mapElementInfoToLimit(String vlmId, Version version,
- String epLkgId, ElementInfo elementInfo) {
- LimitEntity limitEntity =
- new LimitEntity(vlmId, version, epLkgId, elementInfo.getId().getValue());
-
- limitEntity.setName(elementInfo.getInfo().getName());
- limitEntity.setDescription(elementInfo.getInfo().getDescription());
- limitEntity.setType(elementInfo.getInfo().getProperties().get(LIMT_TYPE) != null ?
- LimitType.valueOf((String) elementInfo.getInfo().getProperties().get(LIMT_TYPE)) :
- null);
- limitEntity.setTime((String) elementInfo.getInfo().getProperties().get(TIME));
- limitEntity.setMetric((String) elementInfo.getInfo().getProperties().get(METRIC));
- limitEntity.setAggregationFunction(elementInfo.getInfo().getProperties().get
- (AGGREGATIONFUNCTION) != null ?
- AggregationFunction.valueOf((String) elementInfo.getInfo().getProperties()
- .get(AGGREGATIONFUNCTION)) : null);
- Object unit = elementInfo.getInfo().getProperties().get(UNIT);
- limitEntity.setUnit((String) unit);
- Object value = elementInfo.getInfo().getProperties().get(VALUE);
- limitEntity.setValue((String) value);
-
- return limitEntity;
- }
+ @Override
+ public void create(LimitEntity limitEntity) {
+ ZusammenElement limitElement = limitToZusammen(limitEntity, Action.CREATE);
+ ZusammenElement limitsElement = buildStructuralElement(ElementType.Limits, null);
+ limitsElement.setSubElements(Collections.singletonList(limitElement));
+ ZusammenElement epLkgElement = buildElement(new Id(limitEntity.getEpLkgId()), Action.IGNORE);
+ epLkgElement.setSubElements(Collections.singletonList(limitsElement));
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(limitEntity.getVendorLicenseModelId(), limitEntity.getVersion().getId());
+ Element savedElement = zusammenAdaptor.saveElement(context, elementContext, epLkgElement, "Create limit");
+ limitEntity.setId(savedElement.getSubElements().iterator().next().getSubElements().iterator().next().getElementId().getValue());
+ }
- @Override
- public void update(LimitEntity limitEntity) {
- ZusammenElement limitElement = limitToZusammen(limitEntity, Action.UPDATE);
+ @Override
+ public boolean isLimitPresent(LimitEntity limitEntity) {
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(limitEntity.getVendorLicenseModelId(), limitEntity.getVersion().getId());
+ Collection<ElementInfo> elementInfos = zusammenAdaptor
+ .listElementsByName(context, elementContext, new Id(limitEntity.getEpLkgId()), ElementType.Limits.name());
+ for (ElementInfo elementInfo : elementInfos) {
+ if (elementInfo.getId().getValue().equals(limitEntity.getId())) {
+ return true;
+ }
+ }
+ return false;
+ }
- SessionContext context = createSessionContext();
- ElementContext elementContext =
- new ElementContext(limitEntity.getVendorLicenseModelId(), limitEntity.getVersion().getId());
+ @Override
+ public Collection<LimitEntity> list(LimitEntity limitEntity) {
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(limitEntity.getVendorLicenseModelId(), limitEntity.getVersion().getId());
+ return listLimits(context, elementContext, limitEntity);
+ }
- zusammenAdaptor.saveElement(context, elementContext, limitElement,
- String.format("Update limit with id %s", limitEntity.getId()));
- }
+ private Collection<LimitEntity> listLimits(SessionContext context, ElementContext elementContext, LimitEntity limitEntity) {
+ return zusammenAdaptor.listElementsByName(context, elementContext, new Id(limitEntity.getEpLkgId()), ElementType.Limits.name()).stream().map(
+ elementInfo -> mapElementInfoToLimit(limitEntity.getVendorLicenseModelId(), limitEntity.getVersion(), limitEntity.getEpLkgId(),
+ elementInfo)).collect(Collectors.toList());
+ }
- @Override
- public LimitEntity get(LimitEntity limitEntity) {
- SessionContext context = createSessionContext();
- ElementContext elementContext =
- new ElementContext(limitEntity.getVendorLicenseModelId(), limitEntity.getVersion().getId());
+ private LimitEntity mapElementInfoToLimit(String vlmId, Version version, String epLkgId, ElementInfo elementInfo) {
+ LimitEntity limitEntity = new LimitEntity(vlmId, version, epLkgId, elementInfo.getId().getValue());
+ limitEntity.setName(elementInfo.getInfo().getName());
+ limitEntity.setDescription(elementInfo.getInfo().getDescription());
+ limitEntity.setType(elementInfo.getInfo().getProperties().get(LIMT_TYPE) != null ? LimitType
+ .valueOf((String) elementInfo.getInfo().getProperties().get(LIMT_TYPE)) : null);
+ limitEntity.setTime((String) elementInfo.getInfo().getProperties().get(TIME));
+ limitEntity.setMetric((String) elementInfo.getInfo().getProperties().get(METRIC));
+ limitEntity.setAggregationFunction(elementInfo.getInfo().getProperties().get(AGGREGATIONFUNCTION) != null ? AggregationFunction
+ .valueOf((String) elementInfo.getInfo().getProperties().get(AGGREGATIONFUNCTION)) : null);
+ Object unit = elementInfo.getInfo().getProperties().get(UNIT);
+ limitEntity.setUnit((String) unit);
+ Object value = elementInfo.getInfo().getProperties().get(VALUE);
+ limitEntity.setValue((String) value);
+ return limitEntity;
+ }
- return zusammenAdaptor.getElementInfo(context, elementContext, new Id(limitEntity.getId()))
- .map(elementInfo -> mapElementInfoToLimit(
- limitEntity.getVendorLicenseModelId(), limitEntity.getVersion(), limitEntity
- .getEpLkgId(), elementInfo))
- .orElse(null);
- }
+ @Override
+ public void update(LimitEntity limitEntity) {
+ ZusammenElement limitElement = limitToZusammen(limitEntity, Action.UPDATE);
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(limitEntity.getVendorLicenseModelId(), limitEntity.getVersion().getId());
+ zusammenAdaptor.saveElement(context, elementContext, limitElement, String.format("Update limit with id %s", limitEntity.getId()));
+ }
- @Override
- public void delete(LimitEntity limitEntity) {
- ZusammenElement zusammenElement = buildElement(new Id(limitEntity.getId()), Action.DELETE);
+ @Override
+ public LimitEntity get(LimitEntity limitEntity) {
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(limitEntity.getVendorLicenseModelId(), limitEntity.getVersion().getId());
+ return zusammenAdaptor.getElementInfo(context, elementContext, new Id(limitEntity.getId())).map(
+ elementInfo -> mapElementInfoToLimit(limitEntity.getVendorLicenseModelId(), limitEntity.getVersion(), limitEntity.getEpLkgId(),
+ elementInfo)).orElse(null);
+ }
- SessionContext context = createSessionContext();
- ElementContext elementContext =
- new ElementContext(limitEntity.getVendorLicenseModelId(), limitEntity.getVersion().getId());
- zusammenAdaptor.saveElement(context, elementContext, zusammenElement,
- "delete limit Id:" + limitEntity.getId() + ".");
- }
+ @Override
+ public void delete(LimitEntity limitEntity) {
+ ZusammenElement zusammenElement = buildElement(new Id(limitEntity.getId()), Action.DELETE);
+ SessionContext context = createSessionContext();
+ ElementContext elementContext = new ElementContext(limitEntity.getVendorLicenseModelId(), limitEntity.getVersion().getId());
+ zusammenAdaptor.saveElement(context, elementContext, zusammenElement, "delete limit Id:" + limitEntity.getId() + ".");
+ }
- @Override
- public void registerVersioning(String versionableEntityType) {
- //registerVersioning not implemented for LimitZusammenDaoImpl
- }
+ @Override
+ public void registerVersioning(String versionableEntityType) {
+ //registerVersioning not implemented for LimitZusammenDaoImpl
+ }
- private ZusammenElement limitToZusammen(LimitEntity limit, Action action) {
- ZusammenElement limitElement =
- buildElement(limit.getId() == null ? null : new Id(limit.getId()), action);
- Info info = new Info();
- info.setName(limit.getName());
- info.setDescription(limit.getDescription());
- info.addProperty(ElementPropertyName.elementType.name(), ElementType.Limit);
- info.addProperty(LIMT_TYPE, limit.getType());
- info.addProperty(METRIC, limit.getMetric());
- info.addProperty(AGGREGATIONFUNCTION, limit.getAggregationFunction());
- info.addProperty(TIME, limit.getTime());
- info.addProperty(VALUE, limit.getValue());
- info.addProperty(UNIT, limit.getUnit());
- limitElement.setInfo(info);
- return limitElement;
- }
+ private ZusammenElement limitToZusammen(LimitEntity limit, Action action) {
+ ZusammenElement limitElement = buildElement(limit.getId() == null ? null : new Id(limit.getId()), action);
+ Info info = new Info();
+ info.setName(limit.getName());
+ info.setDescription(limit.getDescription());
+ info.addProperty(ElementPropertyName.elementType.name(), ElementType.Limit);
+ info.addProperty(LIMT_TYPE, limit.getType());
+ info.addProperty(METRIC, limit.getMetric());
+ info.addProperty(AGGREGATIONFUNCTION, limit.getAggregationFunction());
+ info.addProperty(TIME, limit.getTime());
+ info.addProperty(VALUE, limit.getValue());
+ info.addProperty(UNIT, limit.getUnit());
+ limitElement.setInfo(info);
+ return limitElement;
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/VendorLicenseModelDaoZusammenImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/VendorLicenseModelDaoZusammenImpl.java
index 031d415127..2c4702aec1 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/VendorLicenseModelDaoZusammenImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/VendorLicenseModelDaoZusammenImpl.java
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorlicense.dao.impl.zusammen;
import com.amdocs.zusammen.adaptor.inbound.api.types.item.ZusammenElement;
@@ -21,6 +20,8 @@ import com.amdocs.zusammen.datatypes.SessionContext;
import com.amdocs.zusammen.datatypes.item.Action;
import com.amdocs.zusammen.datatypes.item.ElementContext;
import com.amdocs.zusammen.datatypes.item.Info;
+import java.util.Collection;
+import java.util.stream.Collectors;
import org.openecomp.core.zusammen.api.ZusammenAdaptor;
import org.openecomp.core.zusammen.api.ZusammenUtil;
import org.openecomp.sdc.datatypes.model.ElementType;
@@ -31,130 +32,85 @@ import org.openecomp.sdc.versioning.ActionVersioningManagerFactory;
import org.openecomp.sdc.versioning.types.VersionableEntityMetadata;
import org.openecomp.sdc.versioning.types.VersionableEntityStoreType;
-import java.util.Collection;
-import java.util.stream.Collectors;
-
public class VendorLicenseModelDaoZusammenImpl implements VendorLicenseModelDao {
- private ZusammenAdaptor zusammenAdaptor;
-
- public VendorLicenseModelDaoZusammenImpl(ZusammenAdaptor zusammenAdaptor) {
- this.zusammenAdaptor = zusammenAdaptor;
- }
-
- @Override
- public void registerVersioning(String versionableEntityType) {
- VersionableEntityMetadata metadata =
- new VersionableEntityMetadata(VersionableEntityStoreType.Zusammen, "VendorLicenseModel",
- null, null);
-
- ActionVersioningManagerFactory.getInstance().createInterface()
- .register(versionableEntityType, metadata);
- }
-
- @Override
- public Collection<VendorLicenseModelEntity> list(
- VendorLicenseModelEntity vendorLicenseModelEntity) {
-
- ElementToVLMGeneralConvertor convertor = new ElementToVLMGeneralConvertor();
- return zusammenAdaptor.listItems(ZusammenUtil.createSessionContext()).stream()
- .filter(item -> "VendorLicenseModel".equals(item.getInfo().getProperty("item_type")))
- .map(item -> {
- VendorLicenseModelEntity entity = convertor.convert(item);
- entity.setId(item.getId().getValue());
- entity.setVersion(null);
- return entity;
- })
- .collect(Collectors.toList());
- }
-
- @Override
- public void create(VendorLicenseModelEntity vendorLicenseModel) {
-
- SessionContext context = ZusammenUtil.createSessionContext();
-
- ElementContext elementContext = new ElementContext(vendorLicenseModel.getId(),
- vendorLicenseModel.getVersion().getId());
-
- ZusammenElement generalElement = mapVlmToZusammenElement(vendorLicenseModel, Action.CREATE);
-
- zusammenAdaptor.saveElement(context, elementContext, generalElement,
- "Create VLM General Info Element");
-
- ZusammenElement licenseAgreementsElement =
- ZusammenUtil.buildStructuralElement(ElementType.LicenseAgreements, Action.CREATE);
-
- zusammenAdaptor.saveElement(context, elementContext, licenseAgreementsElement,
- "Create VLM licenseAgreementsElement");
-
- ZusammenElement featureGroupsElement =
- ZusammenUtil.buildStructuralElement(ElementType.FeatureGroups, Action.CREATE);
-
- zusammenAdaptor.saveElement(context, elementContext, featureGroupsElement,
- "Create VLM featureGroupsElement");
-
- ZusammenElement lkgsElement =
- ZusammenUtil.buildStructuralElement(ElementType.LicenseKeyGroups, Action.CREATE);
-
- zusammenAdaptor.saveElement(context, elementContext, lkgsElement,
- "Create VLM lkgsElement");
-
- ZusammenElement entitlementPoolsElement =
- ZusammenUtil.buildStructuralElement(ElementType.EntitlementPools, Action.CREATE);
-
- zusammenAdaptor.saveElement(context, elementContext, entitlementPoolsElement,
- "Create VLM entitlementPoolsElement");
- }
-
- @Override
- public void update(VendorLicenseModelEntity vendorLicenseModel) {
- ZusammenElement generalElement = mapVlmToZusammenElement(vendorLicenseModel, Action.UPDATE);
-
- SessionContext context = ZusammenUtil.createSessionContext();
- zusammenAdaptor.saveElement(context,
- new ElementContext(vendorLicenseModel.getId(), vendorLicenseModel.getVersion().getId()),
- generalElement, "Update VSP General Info Element");
- }
-
- @Override
- public VendorLicenseModelEntity get(VendorLicenseModelEntity vendorLicenseModel) {
- SessionContext context = ZusammenUtil.createSessionContext();
- ElementContext elementContext =
- new ElementContext(vendorLicenseModel.getId(), vendorLicenseModel.getVersion().getId());
- ElementToVLMGeneralConvertor convertor = new ElementToVLMGeneralConvertor();
- return zusammenAdaptor
- .getElementInfoByName(context, elementContext, null, ElementType.VendorLicenseModel.name())
- .map(generalElementInfo -> {
- VendorLicenseModelEntity entity = convertor.convert(generalElementInfo);
- entity.setId(vendorLicenseModel.getId());
- entity.setVersion(vendorLicenseModel.getVersion());
- return entity;
- })
- .orElse(null);
- }
-
- @Override
- public void delete(VendorLicenseModelEntity entity) {
- throw new UnsupportedOperationException("Delete vlm version is done using versioning manager");
- }
-
- private ZusammenElement mapVlmToZusammenElement(VendorLicenseModelEntity vendorLicenseModel,
- Action action) {
- ZusammenElement generalElement =
- ZusammenUtil.buildStructuralElement(ElementType.VendorLicenseModel, action);
- addVlmToInfo(generalElement.getInfo(), vendorLicenseModel);
- return generalElement;
- }
-
- private void addVlmToInfo(Info info, VendorLicenseModelEntity vendorLicenseModel) {
- info.addProperty(InfoPropertyName.name.name(), vendorLicenseModel.getVendorName());
- info.addProperty(InfoPropertyName.description.name(), vendorLicenseModel.getDescription());
- info.addProperty(InfoPropertyName.iconRef.name(), vendorLicenseModel.getIconRef());
- }
-
- public enum InfoPropertyName {
- name,
- description,
- iconRef,
- }
+ private ZusammenAdaptor zusammenAdaptor;
+
+ public VendorLicenseModelDaoZusammenImpl(ZusammenAdaptor zusammenAdaptor) {
+ this.zusammenAdaptor = zusammenAdaptor;
+ }
+
+ @Override
+ public void registerVersioning(String versionableEntityType) {
+ VersionableEntityMetadata metadata = new VersionableEntityMetadata(VersionableEntityStoreType.Zusammen, "VendorLicenseModel", null, null);
+ ActionVersioningManagerFactory.getInstance().createInterface().register(versionableEntityType, metadata);
+ }
+
+ @Override
+ public Collection<VendorLicenseModelEntity> list(VendorLicenseModelEntity vendorLicenseModelEntity) {
+ ElementToVLMGeneralConvertor convertor = new ElementToVLMGeneralConvertor();
+ return zusammenAdaptor.listItems(ZusammenUtil.createSessionContext()).stream()
+ .filter(item -> "VendorLicenseModel".equals(item.getInfo().getProperty("item_type"))).map(item -> {
+ VendorLicenseModelEntity entity = convertor.convert(item);
+ entity.setId(item.getId().getValue());
+ entity.setVersion(null);
+ return entity;
+ }).collect(Collectors.toList());
+ }
+
+ @Override
+ public void create(VendorLicenseModelEntity vendorLicenseModel) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ ElementContext elementContext = new ElementContext(vendorLicenseModel.getId(), vendorLicenseModel.getVersion().getId());
+ ZusammenElement generalElement = mapVlmToZusammenElement(vendorLicenseModel, Action.CREATE);
+ zusammenAdaptor.saveElement(context, elementContext, generalElement, "Create VLM General Info Element");
+ ZusammenElement licenseAgreementsElement = ZusammenUtil.buildStructuralElement(ElementType.LicenseAgreements, Action.CREATE);
+ zusammenAdaptor.saveElement(context, elementContext, licenseAgreementsElement, "Create VLM licenseAgreementsElement");
+ ZusammenElement featureGroupsElement = ZusammenUtil.buildStructuralElement(ElementType.FeatureGroups, Action.CREATE);
+ zusammenAdaptor.saveElement(context, elementContext, featureGroupsElement, "Create VLM featureGroupsElement");
+ ZusammenElement lkgsElement = ZusammenUtil.buildStructuralElement(ElementType.LicenseKeyGroups, Action.CREATE);
+ zusammenAdaptor.saveElement(context, elementContext, lkgsElement, "Create VLM lkgsElement");
+ ZusammenElement entitlementPoolsElement = ZusammenUtil.buildStructuralElement(ElementType.EntitlementPools, Action.CREATE);
+ zusammenAdaptor.saveElement(context, elementContext, entitlementPoolsElement, "Create VLM entitlementPoolsElement");
+ }
+
+ @Override
+ public void update(VendorLicenseModelEntity vendorLicenseModel) {
+ ZusammenElement generalElement = mapVlmToZusammenElement(vendorLicenseModel, Action.UPDATE);
+ SessionContext context = ZusammenUtil.createSessionContext();
+ zusammenAdaptor.saveElement(context, new ElementContext(vendorLicenseModel.getId(), vendorLicenseModel.getVersion().getId()), generalElement,
+ "Update VSP General Info Element");
+ }
+
+ @Override
+ public VendorLicenseModelEntity get(VendorLicenseModelEntity vendorLicenseModel) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ ElementContext elementContext = new ElementContext(vendorLicenseModel.getId(), vendorLicenseModel.getVersion().getId());
+ ElementToVLMGeneralConvertor convertor = new ElementToVLMGeneralConvertor();
+ return zusammenAdaptor.getElementInfoByName(context, elementContext, null, ElementType.VendorLicenseModel.name()).map(generalElementInfo -> {
+ VendorLicenseModelEntity entity = convertor.convert(generalElementInfo);
+ entity.setId(vendorLicenseModel.getId());
+ entity.setVersion(vendorLicenseModel.getVersion());
+ return entity;
+ }).orElse(null);
+ }
+
+ @Override
+ public void delete(VendorLicenseModelEntity entity) {
+ throw new UnsupportedOperationException("Delete vlm version is done using versioning manager");
+ }
+
+ private ZusammenElement mapVlmToZusammenElement(VendorLicenseModelEntity vendorLicenseModel, Action action) {
+ ZusammenElement generalElement = ZusammenUtil.buildStructuralElement(ElementType.VendorLicenseModel, action);
+ addVlmToInfo(generalElement.getInfo(), vendorLicenseModel);
+ return generalElement;
+ }
+
+ private void addVlmToInfo(Info info, VendorLicenseModelEntity vendorLicenseModel) {
+ info.addProperty(InfoPropertyName.name.name(), vendorLicenseModel.getVendorName());
+ info.addProperty(InfoPropertyName.description.name(), vendorLicenseModel.getDescription());
+ info.addProperty(InfoPropertyName.iconRef.name(), vendorLicenseModel.getIconRef());
+ }
+
+ public enum InfoPropertyName {name, description, iconRef,}
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/VlmZusammenUtil.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/VlmZusammenUtil.java
index 01a15304a9..96c9e2ff83 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/VlmZusammenUtil.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/VlmZusammenUtil.java
@@ -24,42 +24,39 @@ import com.amdocs.zusammen.adaptor.inbound.api.types.item.ZusammenElement;
import com.amdocs.zusammen.datatypes.Id;
import com.amdocs.zusammen.datatypes.item.Relation;
import com.amdocs.zusammen.datatypes.item.RelationEdge;
-
import java.util.stream.Collectors;
public class VlmZusammenUtil {
- static ZusammenElement getZusammenElement(ElementInfo elementInfo) {
- ZusammenElement zusammenElement = new ZusammenElement();
- zusammenElement.setElementId(elementInfo.getId());
- zusammenElement.setInfo(elementInfo.getInfo());
- zusammenElement.setRelations(elementInfo.getRelations());
- zusammenElement.setSubElements(elementInfo.getSubElements().stream()
- .map(VlmZusammenUtil::getZusammenElement)
- .collect(Collectors.toList()));
- return zusammenElement;
- }
-
- public static Relation createRelation(RelationType type, String to) {
- Relation relation = new Relation();
- relation.setType(type.name());
- RelationEdge edge2 = new RelationEdge();
- edge2.setElementId(new Id(to));
- relation.setEdge2(edge2);
- return relation;
- }
+ static ZusammenElement getZusammenElement(ElementInfo elementInfo) {
+ ZusammenElement zusammenElement = new ZusammenElement();
+ zusammenElement.setElementId(elementInfo.getId());
+ zusammenElement.setInfo(elementInfo.getInfo());
+ zusammenElement.setRelations(elementInfo.getRelations());
+ zusammenElement.setSubElements(elementInfo.getSubElements().stream().map(VlmZusammenUtil::getZusammenElement).collect(Collectors.toList()));
+ return zusammenElement;
+ }
- public static Integer toInteger(Object val) {
- if (val == null) {
- return null;
+ public static Relation createRelation(RelationType type, String to) {
+ Relation relation = new Relation();
+ relation.setType(type.name());
+ RelationEdge edge2 = new RelationEdge();
+ edge2.setElementId(new Id(to));
+ relation.setEdge2(edge2);
+ return relation;
}
- if (val instanceof Double) {
- return ((Double) val).intValue();
- } else if (val instanceof String) {
- return new Integer((String) val);
- } else if (val instanceof Integer) {
- return (Integer) val;
+
+ public static Integer toInteger(Object val) {
+ if (val == null) {
+ return null;
+ }
+ if (val instanceof Double) {
+ return ((Double) val).intValue();
+ } else if (val instanceof String) {
+ return new Integer((String) val);
+ } else if (val instanceof Integer) {
+ return (Integer) val;
+ }
+ throw new RuntimeException("invalid value for integer:" + val.getClass());
}
- throw new RuntimeException("invalid value for integer:" + val.getClass());
- }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToEntitlementPoolConvertor.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToEntitlementPoolConvertor.java
index 2f06b9b0d0..202e0eac68 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToEntitlementPoolConvertor.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToEntitlementPoolConvertor.java
@@ -19,99 +19,88 @@
*/
package org.openecomp.sdc.vendorlicense.dao.impl.zusammen.convertor;
+import static org.openecomp.sdc.vendorlicense.dao.impl.zusammen.VlmZusammenUtil.toInteger;
+
import com.amdocs.zusammen.adaptor.inbound.api.types.item.Element;
import com.amdocs.zusammen.adaptor.inbound.api.types.item.ElementInfo;
import com.amdocs.zusammen.datatypes.item.Info;
import com.amdocs.zusammen.datatypes.item.Relation;
-import org.openecomp.convertor.ElementConvertor;
-import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity;
-import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolType;
-import org.openecomp.sdc.vendorlicense.dao.types.MultiChoiceOrOther;
-import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope;
-import org.openecomp.sdc.vendorlicense.dao.types.ThresholdUnit;
-
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
-
-import static org.openecomp.sdc.vendorlicense.dao.impl.zusammen.VlmZusammenUtil.toInteger;
-
+import org.openecomp.convertor.ElementConvertor;
+import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity;
+import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolType;
+import org.openecomp.sdc.vendorlicense.dao.types.MultiChoiceOrOther;
+import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope;
+import org.openecomp.sdc.vendorlicense.dao.types.ThresholdUnit;
public class ElementToEntitlementPoolConvertor extends ElementConvertor {
- @Override
- public EntitlementPoolEntity convert(Element element) {
- if (element == null) {
- return null;
- }
- return mapElementToEntitlementPoolEntity(element);
- }
- @Override
- public EntitlementPoolEntity convert(ElementInfo elementInfo) {
- if (elementInfo == null) {
- return null;
+ @Override
+ public EntitlementPoolEntity convert(Element element) {
+ if (element == null) {
+ return null;
+ }
+ return mapElementToEntitlementPoolEntity(element);
}
- return mapElementInfoToEntitlementPoolEntity(elementInfo);
- }
-
- private EntitlementPoolEntity mapElementToEntitlementPoolEntity(Element element) {
- EntitlementPoolEntity entitlementPool =
- new EntitlementPoolEntity();
- entitlementPool.setId(element.getElementId().getValue());
- mapInfoToEntitlementPoolEntity(entitlementPool, element.getInfo());
- mapRelationsToEntitlementPoolEntity(entitlementPool, element.getRelations());
- return entitlementPool;
- }
- private EntitlementPoolEntity mapElementInfoToEntitlementPoolEntity(ElementInfo elementInfo) {
- EntitlementPoolEntity entitlementPool =
- new EntitlementPoolEntity();
- entitlementPool.setId(elementInfo.getId().getValue());
- mapInfoToEntitlementPoolEntity(entitlementPool, elementInfo.getInfo());
- mapRelationsToEntitlementPoolEntity(entitlementPool, elementInfo.getRelations());
- return entitlementPool;
- }
+ @Override
+ public EntitlementPoolEntity convert(ElementInfo elementInfo) {
+ if (elementInfo == null) {
+ return null;
+ }
+ return mapElementInfoToEntitlementPoolEntity(elementInfo);
+ }
- private void mapInfoToEntitlementPoolEntity(EntitlementPoolEntity entitlementPool, Info info) {
- entitlementPool.setName(info.getName());
- entitlementPool.setDescription(info.getDescription());
- entitlementPool.setVersionUuId(info.getProperty("version_uuid"));
- entitlementPool.setType(EntitlementPoolType.permissiveValueOf(info.getProperty("EntitlementPoolType")));
- entitlementPool.setThresholdValue(toInteger(info.getProperty("thresholdValue")));
- String thresholdUnit = info.getProperty("threshold_unit");
- entitlementPool
- .setThresholdUnit(thresholdUnit == null ? null : ThresholdUnit.valueOf(thresholdUnit));
- entitlementPool.setIncrements(info.getProperty("increments"));
- entitlementPool.setOperationalScope(
- getOperationalScopeMultiChoiceOrOther(info.getProperty("operational_scope")));
- entitlementPool.setStartDate(info.getProperty("startDate"));
- entitlementPool.setExpiryDate(info.getProperty("expiryDate"));
- entitlementPool.setManufacturerReferenceNumber(info.getProperty("manufacturerReferenceNumber"));
- }
+ private EntitlementPoolEntity mapElementToEntitlementPoolEntity(Element element) {
+ EntitlementPoolEntity entitlementPool = new EntitlementPoolEntity();
+ entitlementPool.setId(element.getElementId().getValue());
+ mapInfoToEntitlementPoolEntity(entitlementPool, element.getInfo());
+ mapRelationsToEntitlementPoolEntity(entitlementPool, element.getRelations());
+ return entitlementPool;
+ }
- private void mapRelationsToEntitlementPoolEntity(EntitlementPoolEntity entitlementPool,
- Collection<Relation> relations) {
- if (relations != null && relations.size() > 0) {
- entitlementPool
- .setReferencingFeatureGroups(relations.stream().map(relation -> relation
- .getEdge2().getElementId().getValue()).collect(Collectors.toSet()));
+ private EntitlementPoolEntity mapElementInfoToEntitlementPoolEntity(ElementInfo elementInfo) {
+ EntitlementPoolEntity entitlementPool = new EntitlementPoolEntity();
+ entitlementPool.setId(elementInfo.getId().getValue());
+ mapInfoToEntitlementPoolEntity(entitlementPool, elementInfo.getInfo());
+ mapRelationsToEntitlementPoolEntity(entitlementPool, elementInfo.getRelations());
+ return entitlementPool;
}
- }
- private MultiChoiceOrOther<OperationalScope> getOperationalScopeMultiChoiceOrOther(
- Map<String, Object> operationalScope) {
- if (operationalScope == null || operationalScope.isEmpty()) {
- return null;
+ private void mapInfoToEntitlementPoolEntity(EntitlementPoolEntity entitlementPool, Info info) {
+ entitlementPool.setName(info.getName());
+ entitlementPool.setDescription(info.getDescription());
+ entitlementPool.setVersionUuId(info.getProperty("version_uuid"));
+ entitlementPool.setType(EntitlementPoolType.permissiveValueOf(info.getProperty("EntitlementPoolType")));
+ entitlementPool.setThresholdValue(toInteger(info.getProperty("thresholdValue")));
+ String thresholdUnit = info.getProperty("threshold_unit");
+ entitlementPool.setThresholdUnit(thresholdUnit == null ? null : ThresholdUnit.valueOf(thresholdUnit));
+ entitlementPool.setIncrements(info.getProperty("increments"));
+ entitlementPool.setOperationalScope(getOperationalScopeMultiChoiceOrOther(info.getProperty("operational_scope")));
+ entitlementPool.setStartDate(info.getProperty("startDate"));
+ entitlementPool.setExpiryDate(info.getProperty("expiryDate"));
+ entitlementPool.setManufacturerReferenceNumber(info.getProperty("manufacturerReferenceNumber"));
}
- Set<OperationalScope> choices = new HashSet<>();
- ((List<String>) operationalScope.get("choices")).
- forEach(choice -> choices.add(OperationalScope.valueOf(choice)));
+ private void mapRelationsToEntitlementPoolEntity(EntitlementPoolEntity entitlementPool, Collection<Relation> relations) {
+ if (relations != null && relations.size() > 0) {
+ entitlementPool.setReferencingFeatureGroups(
+ relations.stream().map(relation -> relation.getEdge2().getElementId().getValue()).collect(Collectors.toSet()));
+ }
+ }
- Object other = operationalScope.get("other");
- return new MultiChoiceOrOther<>(choices, other == null ? null : (String) other);
- }
+ private MultiChoiceOrOther<OperationalScope> getOperationalScopeMultiChoiceOrOther(Map<String, Object> operationalScope) {
+ if (operationalScope == null || operationalScope.isEmpty()) {
+ return null;
+ }
+ Set<OperationalScope> choices = new HashSet<>();
+ ((List<String>) operationalScope.get("choices")).forEach(choice -> choices.add(OperationalScope.valueOf(choice)));
+ Object other = operationalScope.get("other");
+ return new MultiChoiceOrOther<>(choices, other == null ? null : (String) other);
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToFeatureGroupConvertor.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToFeatureGroupConvertor.java
index 95eee9704c..d12cf3d8ea 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToFeatureGroupConvertor.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToFeatureGroupConvertor.java
@@ -23,80 +23,71 @@ import com.amdocs.zusammen.adaptor.inbound.api.types.item.Element;
import com.amdocs.zusammen.adaptor.inbound.api.types.item.ElementInfo;
import com.amdocs.zusammen.datatypes.item.Info;
import com.amdocs.zusammen.datatypes.item.Relation;
-import org.openecomp.convertor.ElementConvertor;
-import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.RelationType;
-import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity;
-
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
-
+import org.openecomp.convertor.ElementConvertor;
+import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.RelationType;
+import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity;
public class ElementToFeatureGroupConvertor extends ElementConvertor {
- @Override
- public FeatureGroupEntity convert(Element element) {
- if (element == null) {
- return null;
- }
- return mapElementToFeatureGroupEntity(element);
-
- }
- @Override
- public FeatureGroupEntity convert(ElementInfo elementInfo) {
- if (elementInfo == null) {
- return null;
+ @Override
+ public FeatureGroupEntity convert(Element element) {
+ if (element == null) {
+ return null;
+ }
+ return mapElementToFeatureGroupEntity(element);
}
- return mapElementInfoToFeatureGroupEntity(elementInfo);
-
- }
-
-
- private FeatureGroupEntity mapElementToFeatureGroupEntity(Element element) {
- FeatureGroupEntity featureGroup =
- new FeatureGroupEntity();
- featureGroup.setId(element.getElementId().getValue());
- mapInfoToFeatureGroup(featureGroup, element.getInfo());
- mapRelationsToFeatureGroup(featureGroup, element.getRelations());
- return featureGroup;
- }
+ @Override
+ public FeatureGroupEntity convert(ElementInfo elementInfo) {
+ if (elementInfo == null) {
+ return null;
+ }
+ return mapElementInfoToFeatureGroupEntity(elementInfo);
+ }
- private FeatureGroupEntity mapElementInfoToFeatureGroupEntity(ElementInfo elementInfo) {
- FeatureGroupEntity featureGroup = new FeatureGroupEntity();
- featureGroup.setId(elementInfo.getId().getValue());
- mapInfoToFeatureGroup(featureGroup, elementInfo.getInfo());
- mapRelationsToFeatureGroup(featureGroup, elementInfo.getRelations());
- return featureGroup;
- }
+ private FeatureGroupEntity mapElementToFeatureGroupEntity(Element element) {
+ FeatureGroupEntity featureGroup = new FeatureGroupEntity();
+ featureGroup.setId(element.getElementId().getValue());
+ mapInfoToFeatureGroup(featureGroup, element.getInfo());
+ mapRelationsToFeatureGroup(featureGroup, element.getRelations());
+ return featureGroup;
+ }
- private void mapInfoToFeatureGroup(FeatureGroupEntity featureGroup, Info info) {
- featureGroup.setName(info.getName());
- featureGroup.setDescription(info.getDescription());
- featureGroup.setPartNumber(info.getProperty("partNumber"));
- featureGroup.setManufacturerReferenceNumber(info.getProperty("manufacturerReferenceNumber"));
- }
+ private FeatureGroupEntity mapElementInfoToFeatureGroupEntity(ElementInfo elementInfo) {
+ FeatureGroupEntity featureGroup = new FeatureGroupEntity();
+ featureGroup.setId(elementInfo.getId().getValue());
+ mapInfoToFeatureGroup(featureGroup, elementInfo.getInfo());
+ mapRelationsToFeatureGroup(featureGroup, elementInfo.getRelations());
+ return featureGroup;
+ }
- private void mapRelationsToFeatureGroup(FeatureGroupEntity featureGroup,
- Collection<Relation> relations) {
- Set<String> entitlementPoolIds = new HashSet<>();
- Set<String> licenseAgreements = new HashSet<>();
- Set<String> licenseKeyGroupIds = new HashSet<>();
+ private void mapInfoToFeatureGroup(FeatureGroupEntity featureGroup, Info info) {
+ featureGroup.setName(info.getName());
+ featureGroup.setDescription(info.getDescription());
+ featureGroup.setPartNumber(info.getProperty("partNumber"));
+ featureGroup.setManufacturerReferenceNumber(info.getProperty("manufacturerReferenceNumber"));
+ }
- if (relations != null) {
- for (Relation relation : relations) {
- if (RelationType.FeatureGroupToEntitlmentPool.name().equals(relation.getType())) {
- entitlementPoolIds.add(relation.getEdge2().getElementId().getValue());
- } else if (RelationType.FeatureGroupToLicenseKeyGroup.name().equals(relation.getType())) {
- licenseKeyGroupIds.add(relation.getEdge2().getElementId().getValue());
- } else if (RelationType.FeatureGroupToReferencingLicenseAgreement.name()
- .equals(relation.getType())) {
- licenseAgreements.add(relation.getEdge2().getElementId().getValue());
+ private void mapRelationsToFeatureGroup(FeatureGroupEntity featureGroup, Collection<Relation> relations) {
+ Set<String> entitlementPoolIds = new HashSet<>();
+ Set<String> licenseAgreements = new HashSet<>();
+ Set<String> licenseKeyGroupIds = new HashSet<>();
+ if (relations != null) {
+ for (Relation relation : relations) {
+ if (RelationType.FeatureGroupToEntitlmentPool.name().equals(relation.getType())) {
+ entitlementPoolIds.add(relation.getEdge2().getElementId().getValue());
+ } else if (RelationType.FeatureGroupToLicenseKeyGroup.name().equals(relation.getType())) {
+ licenseKeyGroupIds.add(relation.getEdge2().getElementId().getValue());
+ } else if (RelationType.FeatureGroupToReferencingLicenseAgreement.name().equals(relation.getType())) {
+ licenseAgreements.add(relation.getEdge2().getElementId().getValue());
+ }
+ }
}
- }
+ featureGroup.setEntitlementPoolIds(entitlementPoolIds);
+ featureGroup.setLicenseKeyGroupIds(licenseKeyGroupIds);
+ featureGroup.setReferencingLicenseAgreements(licenseAgreements);
}
- featureGroup.setEntitlementPoolIds(entitlementPoolIds);
- featureGroup.setLicenseKeyGroupIds(licenseKeyGroupIds);
- featureGroup.setReferencingLicenseAgreements(licenseAgreements);
- }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToLicenseAgreementConvertor.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToLicenseAgreementConvertor.java
index 0623b10b04..f217c7c4c2 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToLicenseAgreementConvertor.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToLicenseAgreementConvertor.java
@@ -23,83 +23,63 @@ import com.amdocs.zusammen.adaptor.inbound.api.types.item.Element;
import com.amdocs.zusammen.adaptor.inbound.api.types.item.ElementInfo;
import com.amdocs.zusammen.datatypes.item.Info;
import com.amdocs.zusammen.datatypes.item.Relation;
+import java.util.Collection;
+import java.util.Map;
+import java.util.stream.Collectors;
import org.openecomp.convertor.ElementConvertor;
import org.openecomp.sdc.vendorlicense.dao.types.ChoiceOrOther;
import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementEntity;
import org.openecomp.sdc.vendorlicense.dao.types.LicenseTerm;
-import java.util.Collection;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-
public class ElementToLicenseAgreementConvertor extends ElementConvertor {
- @Override
- public LicenseAgreementEntity convert(Element element) {
- if (element == null) {
- return null;
- }
- return mapElementToLicenseAgreementEntity(element);
-
- }
-
- @Override
- public LicenseAgreementEntity convert(ElementInfo elementInfo) {
- if (elementInfo == null) {
- return null;
+ @Override
+ public LicenseAgreementEntity convert(Element element) {
+ if (element == null) {
+ return null;
+ }
+ return mapElementToLicenseAgreementEntity(element);
}
- return mapElementInfoToLicenseAgreementEntity(elementInfo);
-
- }
-
- private LicenseAgreementEntity mapElementToLicenseAgreementEntity(Element element) {
- LicenseAgreementEntity licenseAgreement =
- new LicenseAgreementEntity();
- licenseAgreement.setId(element.getElementId().getValue());
- mapInfoToLicenseAgreementEntity(licenseAgreement, element.getInfo());
- mapRelationsToLicenseAgreementEntity(licenseAgreement, element.getRelations());
- return licenseAgreement;
- }
-
-
- private LicenseAgreementEntity mapElementInfoToLicenseAgreementEntity(ElementInfo elementInfo) {
- LicenseAgreementEntity licenseAgreement =
- new LicenseAgreementEntity();
- licenseAgreement.setId( elementInfo.getId().getValue());
- mapInfoToLicenseAgreementEntity(licenseAgreement, elementInfo.getInfo());
- mapRelationsToLicenseAgreementEntity(licenseAgreement, elementInfo.getRelations());
- return licenseAgreement;
- }
-
- private void mapRelationsToLicenseAgreementEntity(LicenseAgreementEntity licenseAgreementEntity,
- Collection<Relation> relations) {
- if (relations != null && relations.size() > 0) {
- licenseAgreementEntity.setFeatureGroupIds(relations.stream()
- .map(relation -> relation.getEdge2().getElementId().getValue())
- .collect(Collectors.toSet()));
+ @Override
+ public LicenseAgreementEntity convert(ElementInfo elementInfo) {
+ if (elementInfo == null) {
+ return null;
+ }
+ return mapElementInfoToLicenseAgreementEntity(elementInfo);
}
- }
-
- private void mapInfoToLicenseAgreementEntity(LicenseAgreementEntity licenseAgreement, Info info) {
-
-
- licenseAgreement.setName(info.getName());
- licenseAgreement.setDescription(info.getDescription());
-
- licenseAgreement
- .setLicenseTerm(getCoiceOrOther(info.getProperty("licenseTerm")));
- licenseAgreement.setRequirementsAndConstrains(
- info.getProperty("requirementsAndConstrains"));
+ private LicenseAgreementEntity mapElementToLicenseAgreementEntity(Element element) {
+ LicenseAgreementEntity licenseAgreement = new LicenseAgreementEntity();
+ licenseAgreement.setId(element.getElementId().getValue());
+ mapInfoToLicenseAgreementEntity(licenseAgreement, element.getInfo());
+ mapRelationsToLicenseAgreementEntity(licenseAgreement, element.getRelations());
+ return licenseAgreement;
+ }
- }
+ private LicenseAgreementEntity mapElementInfoToLicenseAgreementEntity(ElementInfo elementInfo) {
+ LicenseAgreementEntity licenseAgreement = new LicenseAgreementEntity();
+ licenseAgreement.setId(elementInfo.getId().getValue());
+ mapInfoToLicenseAgreementEntity(licenseAgreement, elementInfo.getInfo());
+ mapRelationsToLicenseAgreementEntity(licenseAgreement, elementInfo.getRelations());
+ return licenseAgreement;
+ }
- private ChoiceOrOther<LicenseTerm> getCoiceOrOther(Map licenseTerm) {
- return new ChoiceOrOther<>(LicenseTerm.valueOf((String) licenseTerm.get("choice")),
- (String) licenseTerm.get("other"));
- }
+ private void mapRelationsToLicenseAgreementEntity(LicenseAgreementEntity licenseAgreementEntity, Collection<Relation> relations) {
+ if (relations != null && relations.size() > 0) {
+ licenseAgreementEntity
+ .setFeatureGroupIds(relations.stream().map(relation -> relation.getEdge2().getElementId().getValue()).collect(Collectors.toSet()));
+ }
+ }
+ private void mapInfoToLicenseAgreementEntity(LicenseAgreementEntity licenseAgreement, Info info) {
+ licenseAgreement.setName(info.getName());
+ licenseAgreement.setDescription(info.getDescription());
+ licenseAgreement.setLicenseTerm(getCoiceOrOther(info.getProperty("licenseTerm")));
+ licenseAgreement.setRequirementsAndConstrains(info.getProperty("requirementsAndConstrains"));
+ }
+ private ChoiceOrOther<LicenseTerm> getCoiceOrOther(Map licenseTerm) {
+ return new ChoiceOrOther<>(LicenseTerm.valueOf((String) licenseTerm.get("choice")), (String) licenseTerm.get("other"));
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToLicenseKeyGroupConvertor.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToLicenseKeyGroupConvertor.java
index c22fcf8935..601a5ec35a 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToLicenseKeyGroupConvertor.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToLicenseKeyGroupConvertor.java
@@ -19,103 +19,88 @@
*/
package org.openecomp.sdc.vendorlicense.dao.impl.zusammen.convertor;
+import static org.openecomp.sdc.vendorlicense.dao.impl.zusammen.VlmZusammenUtil.toInteger;
+
import com.amdocs.zusammen.adaptor.inbound.api.types.item.Element;
import com.amdocs.zusammen.adaptor.inbound.api.types.item.ElementInfo;
import com.amdocs.zusammen.datatypes.item.Info;
import com.amdocs.zusammen.datatypes.item.Relation;
-import org.openecomp.convertor.ElementConvertor;
-import org.openecomp.sdc.vendorlicense.dao.types.*;
-
-import java.util.stream.Collectors;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
-
-
-import static org.openecomp.sdc.vendorlicense.dao.impl.zusammen.VlmZusammenUtil.toInteger;
-
+import java.util.stream.Collectors;
+import org.openecomp.convertor.ElementConvertor;
+import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity;
+import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyType;
+import org.openecomp.sdc.vendorlicense.dao.types.MultiChoiceOrOther;
+import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope;
+import org.openecomp.sdc.vendorlicense.dao.types.ThresholdUnit;
public class ElementToLicenseKeyGroupConvertor extends ElementConvertor {
- @Override
- public LicenseKeyGroupEntity convert(Element element) {
- if (element == null) {
- return null;
- }
- return mapElementToLicenseKeyGroupEntity(element);
- }
-
- @Override
- public LicenseKeyGroupEntity convert(ElementInfo elementInfo) {
- if (elementInfo == null) {
- return null;
+ @Override
+ public LicenseKeyGroupEntity convert(Element element) {
+ if (element == null) {
+ return null;
+ }
+ return mapElementToLicenseKeyGroupEntity(element);
}
- return mapElementInfoToLicenseKeyGroupEntity(elementInfo);
-
- }
-
- private LicenseKeyGroupEntity mapElementToLicenseKeyGroupEntity(
- Element element) {
- LicenseKeyGroupEntity licenseKeyGroup =
- new LicenseKeyGroupEntity();
- licenseKeyGroup.setId(element.getElementId().getValue());
- mapInfoToLicenseKeyGroup(licenseKeyGroup, element.getInfo());
- mapRelationsToLicenseKeyGroup(licenseKeyGroup, element.getRelations());
- return licenseKeyGroup;
- }
-
-
- private LicenseKeyGroupEntity mapElementInfoToLicenseKeyGroupEntity(ElementInfo elementInfo) {
- LicenseKeyGroupEntity licenseKeyGroup =
- new LicenseKeyGroupEntity();
- licenseKeyGroup.setId(elementInfo.getId().getValue());
-
- mapInfoToLicenseKeyGroup(licenseKeyGroup, elementInfo.getInfo());
- mapRelationsToLicenseKeyGroup(licenseKeyGroup, elementInfo.getRelations());
- return licenseKeyGroup;
- }
- private void mapInfoToLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup, Info info) {
- licenseKeyGroup.setName(info.getName());
- licenseKeyGroup.setDescription(info.getDescription());
- licenseKeyGroup.setVersionUuId(info.getProperty("version_uuid"));
- licenseKeyGroup.setType(LicenseKeyType.valueOf(info.getProperty("LicenseKeyType")));
- licenseKeyGroup.setOperationalScope(
- getOperationalScopeMultiChoiceOrOther(info.getProperty("operational_scope")));
- licenseKeyGroup.setStartDate(info.getProperty("startDate"));
- licenseKeyGroup.setExpiryDate(info.getProperty("expiryDate"));
-
- String thresholdUnit = info.getProperty("thresholdUnits");
- licenseKeyGroup
- .setThresholdUnits(thresholdUnit == null ? null : ThresholdUnit.valueOf(thresholdUnit));
+ @Override
+ public LicenseKeyGroupEntity convert(ElementInfo elementInfo) {
+ if (elementInfo == null) {
+ return null;
+ }
+ return mapElementInfoToLicenseKeyGroupEntity(elementInfo);
+ }
- licenseKeyGroup.setThresholdValue(toInteger(info.getProperty("thresholdValue")));
- licenseKeyGroup.setIncrements(info.getProperty("increments"));
- licenseKeyGroup.setManufacturerReferenceNumber(info.getProperty("manufacturerReferenceNumber"));
- }
+ private LicenseKeyGroupEntity mapElementToLicenseKeyGroupEntity(Element element) {
+ LicenseKeyGroupEntity licenseKeyGroup = new LicenseKeyGroupEntity();
+ licenseKeyGroup.setId(element.getElementId().getValue());
+ mapInfoToLicenseKeyGroup(licenseKeyGroup, element.getInfo());
+ mapRelationsToLicenseKeyGroup(licenseKeyGroup, element.getRelations());
+ return licenseKeyGroup;
+ }
- private void mapRelationsToLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup,
- Collection<Relation> relations) {
- if (relations != null && relations.size() > 0) {
- licenseKeyGroup
- .setReferencingFeatureGroups((relations.stream().map(relation -> relation
- .getEdge2().getElementId().getValue()).collect(Collectors.toSet())));
+ private LicenseKeyGroupEntity mapElementInfoToLicenseKeyGroupEntity(ElementInfo elementInfo) {
+ LicenseKeyGroupEntity licenseKeyGroup = new LicenseKeyGroupEntity();
+ licenseKeyGroup.setId(elementInfo.getId().getValue());
+ mapInfoToLicenseKeyGroup(licenseKeyGroup, elementInfo.getInfo());
+ mapRelationsToLicenseKeyGroup(licenseKeyGroup, elementInfo.getRelations());
+ return licenseKeyGroup;
}
- }
- private MultiChoiceOrOther<OperationalScope> getOperationalScopeMultiChoiceOrOther(
- Map<String, Object> operationalScope) {
- if (operationalScope == null || operationalScope.isEmpty()) {
- return null;
+ private void mapInfoToLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup, Info info) {
+ licenseKeyGroup.setName(info.getName());
+ licenseKeyGroup.setDescription(info.getDescription());
+ licenseKeyGroup.setVersionUuId(info.getProperty("version_uuid"));
+ licenseKeyGroup.setType(LicenseKeyType.valueOf(info.getProperty("LicenseKeyType")));
+ licenseKeyGroup.setOperationalScope(getOperationalScopeMultiChoiceOrOther(info.getProperty("operational_scope")));
+ licenseKeyGroup.setStartDate(info.getProperty("startDate"));
+ licenseKeyGroup.setExpiryDate(info.getProperty("expiryDate"));
+ String thresholdUnit = info.getProperty("thresholdUnits");
+ licenseKeyGroup.setThresholdUnits(thresholdUnit == null ? null : ThresholdUnit.valueOf(thresholdUnit));
+ licenseKeyGroup.setThresholdValue(toInteger(info.getProperty("thresholdValue")));
+ licenseKeyGroup.setIncrements(info.getProperty("increments"));
+ licenseKeyGroup.setManufacturerReferenceNumber(info.getProperty("manufacturerReferenceNumber"));
}
- Set<OperationalScope> choices = new HashSet<>();
- ((List<String>) operationalScope.get("choices")).
- forEach(choice -> choices.add(OperationalScope.valueOf(choice)));
+ private void mapRelationsToLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup, Collection<Relation> relations) {
+ if (relations != null && relations.size() > 0) {
+ licenseKeyGroup.setReferencingFeatureGroups(
+ (relations.stream().map(relation -> relation.getEdge2().getElementId().getValue()).collect(Collectors.toSet())));
+ }
+ }
- Object other = operationalScope.get("other");
- return new MultiChoiceOrOther<>(choices, other == null ? null : (String) other);
- }
+ private MultiChoiceOrOther<OperationalScope> getOperationalScopeMultiChoiceOrOther(Map<String, Object> operationalScope) {
+ if (operationalScope == null || operationalScope.isEmpty()) {
+ return null;
+ }
+ Set<OperationalScope> choices = new HashSet<>();
+ ((List<String>) operationalScope.get("choices")).forEach(choice -> choices.add(OperationalScope.valueOf(choice)));
+ Object other = operationalScope.get("other");
+ return new MultiChoiceOrOther<>(choices, other == null ? null : (String) other);
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToLimitConvertor.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToLimitConvertor.java
index 20674c669a..ace15af3bf 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToLimitConvertor.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToLimitConvertor.java
@@ -24,36 +24,36 @@ import org.openecomp.sdc.vendorlicense.dao.types.LimitType;
* Created by ayalaben on 9/26/2017
*/
public class ElementToLimitConvertor extends ElementConvertor<LimitEntity> {
- @Override
- public LimitEntity convert(Element element) {
- if (element == null) {
- return null;
- }
- return mapElementToLimitEntity(element);
- }
- private LimitEntity mapElementToLimitEntity(Element element) {
- LimitEntity limit = new LimitEntity();
- limit.setId(element.getElementId().getValue());
- limit.setName(element.getInfo().getName());
- limit.setDescription(element.getInfo().getDescription());
- limit.setUnit(element.getInfo().getProperty("unit"));
- limit.setMetric(element.getInfo().getProperty("metric"));
- limit.setValue(element.getInfo().getProperty("value"));
- limit.setTime(element.getInfo().getProperty("time"));
- limit.setAggregationFunction(element.getInfo().getProperty("aggregationFunction"));
- setLimitType(limit,element.getInfo().getProperty("type"));
+ @Override
+ public LimitEntity convert(Element element) {
+ if (element == null) {
+ return null;
+ }
+ return mapElementToLimitEntity(element);
+ }
- return limit;
- }
+ private LimitEntity mapElementToLimitEntity(Element element) {
+ LimitEntity limit = new LimitEntity();
+ limit.setId(element.getElementId().getValue());
+ limit.setName(element.getInfo().getName());
+ limit.setDescription(element.getInfo().getDescription());
+ limit.setUnit(element.getInfo().getProperty("unit"));
+ limit.setMetric(element.getInfo().getProperty("metric"));
+ limit.setValue(element.getInfo().getProperty("value"));
+ limit.setTime(element.getInfo().getProperty("time"));
+ limit.setAggregationFunction(element.getInfo().getProperty("aggregationFunction"));
+ setLimitType(limit, element.getInfo().getProperty("type"));
+ return limit;
+ }
- private void setLimitType(LimitEntity limit, String type) {
- switch (LimitType.valueOf(type)) {
- case ServiceProvider:
- limit.setType(LimitType.ServiceProvider);
- break;
- case Vendor:
- limit.setType(LimitType.Vendor);
+ private void setLimitType(LimitEntity limit, String type) {
+ switch (LimitType.valueOf(type)) {
+ case ServiceProvider:
+ limit.setType(LimitType.ServiceProvider);
+ break;
+ case Vendor:
+ limit.setType(LimitType.Vendor);
+ }
}
- }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToVLMGeneralConvertor.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToVLMGeneralConvertor.java
index 5dc3b592c0..e274e264c0 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToVLMGeneralConvertor.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToVLMGeneralConvertor.java
@@ -27,39 +27,37 @@ import org.openecomp.convertor.ElementConvertor;
import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.VendorLicenseModelDaoZusammenImpl;
import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity;
-
public class ElementToVLMGeneralConvertor extends ElementConvertor {
- @Override
- public VendorLicenseModelEntity convert(Element element) {
- if(element == null) return null;
- return mapInfoToVendorLicenseModelEntity( element.getInfo());
-
- }
-
- @Override
- public VendorLicenseModelEntity convert(Item item) {
- if(item == null) return null;
- return mapInfoToVendorLicenseModelEntity( item.getInfo());
- }
-
- @Override
- public VendorLicenseModelEntity convert(ElementInfo elementInfo) {
- if(elementInfo == null) return null;
- return mapInfoToVendorLicenseModelEntity( elementInfo.getInfo());
-
- }
-
- private VendorLicenseModelEntity mapInfoToVendorLicenseModelEntity(Info info) {
-
- VendorLicenseModelEntity vendorLicenseModelEntity = new VendorLicenseModelEntity();
-
- vendorLicenseModelEntity.setVendorName(info.getProperty(
- VendorLicenseModelDaoZusammenImpl.InfoPropertyName.name.name()));
- vendorLicenseModelEntity.setDescription(info.getProperty(
- VendorLicenseModelDaoZusammenImpl.InfoPropertyName.description.name()));
- vendorLicenseModelEntity.setIconRef(info.getProperty(
- VendorLicenseModelDaoZusammenImpl.InfoPropertyName.iconRef.name()));
- return vendorLicenseModelEntity;
- }
+ @Override
+ public VendorLicenseModelEntity convert(Element element) {
+ if (element == null) {
+ return null;
+ }
+ return mapInfoToVendorLicenseModelEntity(element.getInfo());
+ }
+
+ @Override
+ public VendorLicenseModelEntity convert(Item item) {
+ if (item == null) {
+ return null;
+ }
+ return mapInfoToVendorLicenseModelEntity(item.getInfo());
+ }
+
+ @Override
+ public VendorLicenseModelEntity convert(ElementInfo elementInfo) {
+ if (elementInfo == null) {
+ return null;
+ }
+ return mapInfoToVendorLicenseModelEntity(elementInfo.getInfo());
+ }
+
+ private VendorLicenseModelEntity mapInfoToVendorLicenseModelEntity(Info info) {
+ VendorLicenseModelEntity vendorLicenseModelEntity = new VendorLicenseModelEntity();
+ vendorLicenseModelEntity.setVendorName(info.getProperty(VendorLicenseModelDaoZusammenImpl.InfoPropertyName.name.name()));
+ vendorLicenseModelEntity.setDescription(info.getProperty(VendorLicenseModelDaoZusammenImpl.InfoPropertyName.description.name()));
+ vendorLicenseModelEntity.setIconRef(info.getProperty(VendorLicenseModelDaoZusammenImpl.InfoPropertyName.iconRef.name()));
+ return vendorLicenseModelEntity;
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/facade/impl/VendorLicenseFacadeFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/facade/impl/VendorLicenseFacadeFactoryImpl.java
index 3cf6d0b806..7eacc8ca9d 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/facade/impl/VendorLicenseFacadeFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/facade/impl/VendorLicenseFacadeFactoryImpl.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,17 +17,17 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.facade.impl;
import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade;
import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacadeFactory;
public class VendorLicenseFacadeFactoryImpl extends VendorLicenseFacadeFactory {
- private static VendorLicenseFacade INSTANCE = new VendorLicenseFacadeImpl();
- @Override
- public VendorLicenseFacade createInterface() {
- return INSTANCE;
- }
+ private static VendorLicenseFacade INSTANCE = new VendorLicenseFacadeImpl();
+
+ @Override
+ public VendorLicenseFacade createInterface() {
+ return INSTANCE;
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/facade/impl/VendorLicenseFacadeImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/facade/impl/VendorLicenseFacadeImpl.java
index 818d772db4..d97b8c8c4d 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/facade/impl/VendorLicenseFacadeImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/facade/impl/VendorLicenseFacadeImpl.java
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.facade.impl;
import static org.openecomp.sdc.common.errors.ValidationErrorBuilder.FIELD_VALIDATION_ERROR_ERR_ID;
@@ -71,337 +70,263 @@ import org.openecomp.sdc.versioning.types.ItemStatus;
public class VendorLicenseFacadeImpl implements VendorLicenseFacade {
- private static final VendorLicenseModelDao
- vendorLicenseModelDao = VendorLicenseModelDaoFactory.getInstance().createInterface();
- private static final LicenseAgreementDao
- licenseAgreementDao = LicenseAgreementDaoFactory.getInstance().createInterface();
- private static final FeatureGroupDao featureGroupDao =
- FeatureGroupDaoFactory.getInstance().createInterface();
- private static final EntitlementPoolDao
- entitlementPoolDao = EntitlementPoolDaoFactory.getInstance().createInterface();
- private static final LicenseKeyGroupDao
- licenseKeyGroupDao = LicenseKeyGroupDaoFactory.getInstance().createInterface();
- private static final LimitDao limitDao = LimitDaoFactory.getInstance().createInterface();
- private static final UniqueValueUtil uniqueValueUtil = new UniqueValueUtil
- (UniqueValueDaoFactory.getInstance().createInterface());
- private static final ErrorCode USED_VLM_NOT_EXIST_ERROR =
- new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION).withId(FIELD_VALIDATION_ERROR_ERR_ID)
- .withMessage("The supplied vendor does not exist").build();
- private static final ErrorCode USED_VLM_ARCHIVE_ERROR =
- new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION).withId(FIELD_VALIDATION_ERROR_ERR_ID)
- .withMessage("The supplied vendor is archived and therefore cannot be used").build();
- private static final ErrorCode USED_VLM_IS_DRAFT_ERROR =
- new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION).withId(FIELD_VALIDATION_ERROR_ERR_ID)
- .withMessage("The supplied vendor version is draft and therefore can not be used").build();
-
-
- /**
- * Instantiates a new Vendor license facade.
- */
- public VendorLicenseFacadeImpl() {
- vendorLicenseModelDao.registerVersioning(VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE);
- licenseAgreementDao.registerVersioning(VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE);
- featureGroupDao.registerVersioning(VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE);
- entitlementPoolDao.registerVersioning(VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE);
- licenseKeyGroupDao.registerVersioning(VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE);
- limitDao.registerVersioning(VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE);
- }
-
- @Override
- public FeatureGroupEntity getFeatureGroup(FeatureGroupEntity featureGroup) {
- FeatureGroupEntity retrieved = featureGroupDao.get(featureGroup);
- VersioningUtil
- .validateEntityExistence(retrieved, featureGroup, VendorLicenseModelEntity.ENTITY_TYPE);
-
- return retrieved;
- }
-
- @Override
- public FeatureGroupModel getFeatureGroupModel(FeatureGroupEntity featureGroup) {
- FeatureGroupEntity retrieved = getFeatureGroup(featureGroup);
-
- FeatureGroupModel featureGroupModel = new FeatureGroupModel();
- featureGroupModel.setFeatureGroup(retrieved);
-
- for (String licenseKeyGroupId : retrieved.getLicenseKeyGroupIds()) {
- featureGroupModel.getLicenseKeyGroups().add(licenseKeyGroupDao.get(
- new LicenseKeyGroupEntity(retrieved.getVendorLicenseModelId(), retrieved.getVersion(),
- licenseKeyGroupId)));
+ private static final VendorLicenseModelDao vendorLicenseModelDao = VendorLicenseModelDaoFactory.getInstance().createInterface();
+ private static final LicenseAgreementDao licenseAgreementDao = LicenseAgreementDaoFactory.getInstance().createInterface();
+ private static final FeatureGroupDao featureGroupDao = FeatureGroupDaoFactory.getInstance().createInterface();
+ private static final EntitlementPoolDao entitlementPoolDao = EntitlementPoolDaoFactory.getInstance().createInterface();
+ private static final LicenseKeyGroupDao licenseKeyGroupDao = LicenseKeyGroupDaoFactory.getInstance().createInterface();
+ private static final LimitDao limitDao = LimitDaoFactory.getInstance().createInterface();
+ private static final UniqueValueUtil uniqueValueUtil = new UniqueValueUtil(UniqueValueDaoFactory.getInstance().createInterface());
+ private static final ErrorCode USED_VLM_NOT_EXIST_ERROR = new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION)
+ .withId(FIELD_VALIDATION_ERROR_ERR_ID).withMessage("The supplied vendor does not exist").build();
+ private static final ErrorCode USED_VLM_ARCHIVE_ERROR = new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION)
+ .withId(FIELD_VALIDATION_ERROR_ERR_ID).withMessage("The supplied vendor is archived and therefore cannot be used").build();
+ private static final ErrorCode USED_VLM_IS_DRAFT_ERROR = new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION)
+ .withId(FIELD_VALIDATION_ERROR_ERR_ID).withMessage("The supplied vendor version is draft and therefore can not be used").build();
+
+ /**
+ * Instantiates a new Vendor license facade.
+ */
+ public VendorLicenseFacadeImpl() {
+ vendorLicenseModelDao.registerVersioning(VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE);
+ licenseAgreementDao.registerVersioning(VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE);
+ featureGroupDao.registerVersioning(VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE);
+ entitlementPoolDao.registerVersioning(VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE);
+ licenseKeyGroupDao.registerVersioning(VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE);
+ limitDao.registerVersioning(VENDOR_LICENSE_MODEL_VERSIONABLE_TYPE);
}
- for (String entitlementPoolId : retrieved.getEntitlementPoolIds()) {
- featureGroupModel.getEntitlementPools().add(entitlementPoolDao.get(
- new EntitlementPoolEntity(retrieved.getVendorLicenseModelId(), retrieved.getVersion(),
- entitlementPoolId)));
- }
-
- return featureGroupModel;
- }
-
- @Override
- public LicenseAgreementModel getLicenseAgreementModel(String vlmId, Version version,
- String licenseAgreementId) {
- LicenseAgreementEntity retrieved =
- getLicenseAgreement(vlmId, version, licenseAgreementId);
-
- LicenseAgreementModel licenseAgreementModel = new LicenseAgreementModel();
- licenseAgreementModel.setLicenseAgreement(retrieved);
- for (String featureGroupId : retrieved.getFeatureGroupIds()) {
- licenseAgreementModel.getFeatureGroups().add(featureGroupDao
- .get(new FeatureGroupEntity(vlmId, retrieved.getVersion(), featureGroupId)));
+ @Override
+ public FeatureGroupEntity getFeatureGroup(FeatureGroupEntity featureGroup) {
+ FeatureGroupEntity retrieved = featureGroupDao.get(featureGroup);
+ VersioningUtil.validateEntityExistence(retrieved, featureGroup, VendorLicenseModelEntity.ENTITY_TYPE);
+ return retrieved;
}
- return licenseAgreementModel;
- }
-
- @Override
- public EntitlementPoolEntity createEntitlementPool(EntitlementPoolEntity entitlementPool) {
- entitlementPool.setVersionUuId(CommonMethods.nextUuId());
- uniqueValueUtil.createUniqueValue(VendorLicenseConstants.UniqueValues.ENTITLEMENT_POOL_NAME,
- entitlementPool.getVendorLicenseModelId(), entitlementPool.getVersion().getId(),
- entitlementPool.getName());
- entitlementPoolDao.create(entitlementPool);
- return entitlementPool;
- }
-
- @Override
- public void updateEntitlementPool(EntitlementPoolEntity entitlementPool) {
- EntitlementPoolEntity retrieved = entitlementPoolDao.get(entitlementPool);
- VersioningUtil
- .validateEntityExistence(retrieved, entitlementPool, VendorLicenseModelEntity.ENTITY_TYPE);
- if (retrieved.equals(entitlementPool)) {
- return;
+ @Override
+ public FeatureGroupModel getFeatureGroupModel(FeatureGroupEntity featureGroup) {
+ FeatureGroupEntity retrieved = getFeatureGroup(featureGroup);
+ FeatureGroupModel featureGroupModel = new FeatureGroupModel();
+ featureGroupModel.setFeatureGroup(retrieved);
+ for (String licenseKeyGroupId : retrieved.getLicenseKeyGroupIds()) {
+ featureGroupModel.getLicenseKeyGroups().add(
+ licenseKeyGroupDao.get(new LicenseKeyGroupEntity(retrieved.getVendorLicenseModelId(), retrieved.getVersion(), licenseKeyGroupId)));
+ }
+ for (String entitlementPoolId : retrieved.getEntitlementPoolIds()) {
+ featureGroupModel.getEntitlementPools().add(
+ entitlementPoolDao.get(new EntitlementPoolEntity(retrieved.getVendorLicenseModelId(), retrieved.getVersion(), entitlementPoolId)));
+ }
+ return featureGroupModel;
}
- uniqueValueUtil.updateUniqueValue(VendorLicenseConstants.UniqueValues.ENTITLEMENT_POOL_NAME,
- retrieved.getName(), entitlementPool.getName(), entitlementPool.getVendorLicenseModelId(),
- entitlementPool.getVersion().getId());
- entitlementPool.setVersionUuId(CommonMethods.nextUuId());
- entitlementPoolDao.update(entitlementPool);
- }
-
- @Override
- public Collection<LicenseKeyGroupEntity> listLicenseKeyGroups(String vlmId, Version version) {
- return licenseKeyGroupDao.list(new LicenseKeyGroupEntity(vlmId, version, null));
- }
-
- @Override
- public Collection<EntitlementPoolEntity> listEntitlementPools(String vlmId, Version version) {
- return entitlementPoolDao.list(new EntitlementPoolEntity(vlmId, version, null));
- }
- @Override
- public void updateLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup) {
- LicenseKeyGroupEntity retrieved = licenseKeyGroupDao.get(licenseKeyGroup);
- if (retrieved.equals(licenseKeyGroup)) {
- return;
+ @Override
+ public LicenseAgreementModel getLicenseAgreementModel(String vlmId, Version version, String licenseAgreementId) {
+ LicenseAgreementEntity retrieved = getLicenseAgreement(vlmId, version, licenseAgreementId);
+ LicenseAgreementModel licenseAgreementModel = new LicenseAgreementModel();
+ licenseAgreementModel.setLicenseAgreement(retrieved);
+ for (String featureGroupId : retrieved.getFeatureGroupIds()) {
+ licenseAgreementModel.getFeatureGroups().add(featureGroupDao.get(new FeatureGroupEntity(vlmId, retrieved.getVersion(), featureGroupId)));
+ }
+ return licenseAgreementModel;
}
- licenseKeyGroup.setVersionUuId((CommonMethods.nextUuId()));
- VersioningUtil
- .validateEntityExistence(retrieved, licenseKeyGroup, VendorLicenseModelEntity.ENTITY_TYPE);
- uniqueValueUtil.updateUniqueValue(VendorLicenseConstants.UniqueValues.LICENSE_KEY_GROUP_NAME,
- retrieved.getName(), licenseKeyGroup.getName(), licenseKeyGroup.getVendorLicenseModelId(),
- licenseKeyGroup.getVersion().getId());
- licenseKeyGroupDao.update(licenseKeyGroup);
- }
- @Override
- public LicenseKeyGroupEntity createLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup) {
- licenseKeyGroup.setVersionUuId(CommonMethods.nextUuId());
- uniqueValueUtil.createUniqueValue(VendorLicenseConstants.UniqueValues.LICENSE_KEY_GROUP_NAME,
- licenseKeyGroup.getVendorLicenseModelId(), licenseKeyGroup.getVersion().getId(),
- licenseKeyGroup.getName());
- licenseKeyGroupDao.create(licenseKeyGroup);
- return licenseKeyGroup;
- }
-
- @Override
- public VendorLicenseModelEntity getVendorLicenseModel(String vlmId, Version version) {
- VendorLicenseModelEntity vendorLicenseModel =
- vendorLicenseModelDao.get(new VendorLicenseModelEntity(vlmId, version));
- if (vendorLicenseModel == null) {
- throw new CoreException(new VendorLicenseModelNotFoundErrorBuilder(vlmId).build());
+ @Override
+ public EntitlementPoolEntity createEntitlementPool(EntitlementPoolEntity entitlementPool) {
+ entitlementPool.setVersionUuId(CommonMethods.nextUuId());
+ uniqueValueUtil.createUniqueValue(VendorLicenseConstants.UniqueValues.ENTITLEMENT_POOL_NAME, entitlementPool.getVendorLicenseModelId(),
+ entitlementPool.getVersion().getId(), entitlementPool.getName());
+ entitlementPoolDao.create(entitlementPool);
+ return entitlementPool;
}
- return vendorLicenseModel;
- }
- @Override
- public LicenseAgreementEntity createLicenseAgreement(LicenseAgreementEntity licenseAgreement) {
- VersioningUtil.validateEntitiesExistence(licenseAgreement.getFeatureGroupIds(),
- new FeatureGroupEntity(licenseAgreement.getVendorLicenseModelId(),
- licenseAgreement.getVersion(),
- null),
- featureGroupDao, VendorLicenseModelEntity.ENTITY_TYPE);
-
- uniqueValueUtil.validateUniqueValue(VendorLicenseConstants.UniqueValues.LICENSE_AGREEMENT_NAME,
- licenseAgreement.getVendorLicenseModelId(), licenseAgreement.getVersion().getId(),
- licenseAgreement.getName());
-
- licenseAgreementDao.create(licenseAgreement);
- uniqueValueUtil.createUniqueValue(VendorLicenseConstants.UniqueValues.LICENSE_AGREEMENT_NAME,
- licenseAgreement.getVendorLicenseModelId(), licenseAgreement.getVersion().getId(),
- licenseAgreement.getName());
- if (licenseAgreement.getFeatureGroupIds() != null) {
- for (String addedFgId : licenseAgreement.getFeatureGroupIds()) {
- featureGroupDao.addReferencingLicenseAgreement(
- new FeatureGroupEntity(licenseAgreement.getVendorLicenseModelId(),
- licenseAgreement.getVersion(),
- addedFgId), licenseAgreement.getId());
- }
+ @Override
+ public void updateEntitlementPool(EntitlementPoolEntity entitlementPool) {
+ EntitlementPoolEntity retrieved = entitlementPoolDao.get(entitlementPool);
+ VersioningUtil.validateEntityExistence(retrieved, entitlementPool, VendorLicenseModelEntity.ENTITY_TYPE);
+ if (retrieved.equals(entitlementPool)) {
+ return;
+ }
+ uniqueValueUtil.updateUniqueValue(VendorLicenseConstants.UniqueValues.ENTITLEMENT_POOL_NAME, retrieved.getName(), entitlementPool.getName(),
+ entitlementPool.getVendorLicenseModelId(), entitlementPool.getVersion().getId());
+ entitlementPool.setVersionUuId(CommonMethods.nextUuId());
+ entitlementPoolDao.update(entitlementPool);
}
- return licenseAgreement;
- }
- @Override
- public FeatureGroupEntity createFeatureGroup(FeatureGroupEntity featureGroup) {
- VersioningUtil.validateEntitiesExistence(featureGroup.getLicenseKeyGroupIds(),
- new LicenseKeyGroupEntity(featureGroup.getVendorLicenseModelId(), featureGroup.getVersion(),
- null),
- licenseKeyGroupDao, VendorLicenseModelEntity.ENTITY_TYPE);
- VersioningUtil.validateEntitiesExistence(featureGroup.getEntitlementPoolIds(),
- new EntitlementPoolEntity(featureGroup.getVendorLicenseModelId(), featureGroup.getVersion(),
- null),
- entitlementPoolDao, VendorLicenseModelEntity.ENTITY_TYPE);
- uniqueValueUtil.validateUniqueValue(VendorLicenseConstants.UniqueValues.FEATURE_GROUP_NAME,
- featureGroup.getVendorLicenseModelId(), featureGroup.getVersion().getId(),
- featureGroup.getName());
-
- featureGroupDao.create(featureGroup);
- uniqueValueUtil.createUniqueValue(VendorLicenseConstants.UniqueValues.FEATURE_GROUP_NAME,
- featureGroup.getVendorLicenseModelId(), featureGroup.getVersion().getId(),
- featureGroup.getName());
+ @Override
+ public Collection<LicenseKeyGroupEntity> listLicenseKeyGroups(String vlmId, Version version) {
+ return licenseKeyGroupDao.list(new LicenseKeyGroupEntity(vlmId, version, null));
+ }
- if (featureGroup.getLicenseKeyGroupIds() != null) {
- for (String addedLkgId : featureGroup.getLicenseKeyGroupIds()) {
- licenseKeyGroupDao.addReferencingFeatureGroup(
- new LicenseKeyGroupEntity(featureGroup.getVendorLicenseModelId(),
- featureGroup.getVersion(), addedLkgId),
- featureGroup.getId());
- }
+ @Override
+ public Collection<EntitlementPoolEntity> listEntitlementPools(String vlmId, Version version) {
+ return entitlementPoolDao.list(new EntitlementPoolEntity(vlmId, version, null));
}
- if (featureGroup.getEntitlementPoolIds() != null) {
- for (String addedEpId : featureGroup.getEntitlementPoolIds()) {
- entitlementPoolDao.addReferencingFeatureGroup(
- new EntitlementPoolEntity(featureGroup.getVendorLicenseModelId(),
- featureGroup.getVersion(), addedEpId), featureGroup.getId());
- }
+ @Override
+ public void updateLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup) {
+ LicenseKeyGroupEntity retrieved = licenseKeyGroupDao.get(licenseKeyGroup);
+ if (retrieved.equals(licenseKeyGroup)) {
+ return;
+ }
+ licenseKeyGroup.setVersionUuId((CommonMethods.nextUuId()));
+ VersioningUtil.validateEntityExistence(retrieved, licenseKeyGroup, VendorLicenseModelEntity.ENTITY_TYPE);
+ uniqueValueUtil.updateUniqueValue(VendorLicenseConstants.UniqueValues.LICENSE_KEY_GROUP_NAME, retrieved.getName(), licenseKeyGroup.getName(),
+ licenseKeyGroup.getVendorLicenseModelId(), licenseKeyGroup.getVersion().getId());
+ licenseKeyGroupDao.update(licenseKeyGroup);
}
- return featureGroup;
- }
- @Override
- public Collection<FeatureGroupEntity> listFeatureGroups(String vlmId, Version version) {
- return featureGroupDao.list(new FeatureGroupEntity(vlmId, version, null));
- }
+ @Override
+ public LicenseKeyGroupEntity createLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup) {
+ licenseKeyGroup.setVersionUuId(CommonMethods.nextUuId());
+ uniqueValueUtil.createUniqueValue(VendorLicenseConstants.UniqueValues.LICENSE_KEY_GROUP_NAME, licenseKeyGroup.getVendorLicenseModelId(),
+ licenseKeyGroup.getVersion().getId(), licenseKeyGroup.getName());
+ licenseKeyGroupDao.create(licenseKeyGroup);
+ return licenseKeyGroup;
+ }
+ @Override
+ public VendorLicenseModelEntity getVendorLicenseModel(String vlmId, Version version) {
+ VendorLicenseModelEntity vendorLicenseModel = vendorLicenseModelDao.get(new VendorLicenseModelEntity(vlmId, version));
+ if (vendorLicenseModel == null) {
+ throw new CoreException(new VendorLicenseModelNotFoundErrorBuilder(vlmId).build());
+ }
+ return vendorLicenseModel;
+ }
- @Override
- public Collection<ErrorCode> validateLicensingData(String vlmId, Version version,
- String licenseAgreementId,
- Collection<String> featureGroupIds) {
+ @Override
+ public LicenseAgreementEntity createLicenseAgreement(LicenseAgreementEntity licenseAgreement) {
+ VersioningUtil.validateEntitiesExistence(licenseAgreement.getFeatureGroupIds(),
+ new FeatureGroupEntity(licenseAgreement.getVendorLicenseModelId(), licenseAgreement.getVersion(), null), featureGroupDao,
+ VendorLicenseModelEntity.ENTITY_TYPE);
+ uniqueValueUtil.validateUniqueValue(VendorLicenseConstants.UniqueValues.LICENSE_AGREEMENT_NAME, licenseAgreement.getVendorLicenseModelId(),
+ licenseAgreement.getVersion().getId(), licenseAgreement.getName());
+ licenseAgreementDao.create(licenseAgreement);
+ uniqueValueUtil.createUniqueValue(VendorLicenseConstants.UniqueValues.LICENSE_AGREEMENT_NAME, licenseAgreement.getVendorLicenseModelId(),
+ licenseAgreement.getVersion().getId(), licenseAgreement.getName());
+ if (licenseAgreement.getFeatureGroupIds() != null) {
+ for (String addedFgId : licenseAgreement.getFeatureGroupIds()) {
+ featureGroupDao.addReferencingLicenseAgreement(
+ new FeatureGroupEntity(licenseAgreement.getVendorLicenseModelId(), licenseAgreement.getVersion(), addedFgId),
+ licenseAgreement.getId());
+ }
+ }
+ return licenseAgreement;
+ }
- List<ErrorCode> errorMessages = new ArrayList<>();
+ @Override
+ public FeatureGroupEntity createFeatureGroup(FeatureGroupEntity featureGroup) {
+ VersioningUtil.validateEntitiesExistence(featureGroup.getLicenseKeyGroupIds(),
+ new LicenseKeyGroupEntity(featureGroup.getVendorLicenseModelId(), featureGroup.getVersion(), null), licenseKeyGroupDao,
+ VendorLicenseModelEntity.ENTITY_TYPE);
+ VersioningUtil.validateEntitiesExistence(featureGroup.getEntitlementPoolIds(),
+ new EntitlementPoolEntity(featureGroup.getVendorLicenseModelId(), featureGroup.getVersion(), null), entitlementPoolDao,
+ VendorLicenseModelEntity.ENTITY_TYPE);
+ uniqueValueUtil.validateUniqueValue(VendorLicenseConstants.UniqueValues.FEATURE_GROUP_NAME, featureGroup.getVendorLicenseModelId(),
+ featureGroup.getVersion().getId(), featureGroup.getName());
+ featureGroupDao.create(featureGroup);
+ uniqueValueUtil.createUniqueValue(VendorLicenseConstants.UniqueValues.FEATURE_GROUP_NAME, featureGroup.getVendorLicenseModelId(),
+ featureGroup.getVersion().getId(), featureGroup.getName());
+ if (featureGroup.getLicenseKeyGroupIds() != null) {
+ for (String addedLkgId : featureGroup.getLicenseKeyGroupIds()) {
+ licenseKeyGroupDao.addReferencingFeatureGroup(
+ new LicenseKeyGroupEntity(featureGroup.getVendorLicenseModelId(), featureGroup.getVersion(), addedLkgId), featureGroup.getId());
+ }
+ }
+ if (featureGroup.getEntitlementPoolIds() != null) {
+ for (String addedEpId : featureGroup.getEntitlementPoolIds()) {
+ entitlementPoolDao.addReferencingFeatureGroup(
+ new EntitlementPoolEntity(featureGroup.getVendorLicenseModelId(), featureGroup.getVersion(), addedEpId), featureGroup.getId());
+ }
+ }
+ return featureGroup;
+ }
- try {
- getLicenseAgreement(vlmId, version, licenseAgreementId);
- } catch (CoreException exception) {
- errorMessages.add(exception.code());
+ @Override
+ public Collection<FeatureGroupEntity> listFeatureGroups(String vlmId, Version version) {
+ return featureGroupDao.list(new FeatureGroupEntity(vlmId, version, null));
}
- for (String featureGroupId : featureGroupIds) {
- try {
- FeatureGroupEntity featureGroup =
- getFeatureGroup(new FeatureGroupEntity(vlmId, version, featureGroupId));
- if (!featureGroup.getReferencingLicenseAgreements().contains(licenseAgreementId)) {
- errorMessages.add(new VersionableSubEntityNotFoundErrorBuilder(
- featureGroup.getEntityType(),
- featureGroupId,
- LicenseAgreementEntity.ENTITY_TYPE,
- licenseAgreementId,
- version).build());
+ @Override
+ public Collection<ErrorCode> validateLicensingData(String vlmId, Version version, String licenseAgreementId, Collection<String> featureGroupIds) {
+ List<ErrorCode> errorMessages = new ArrayList<>();
+ try {
+ getLicenseAgreement(vlmId, version, licenseAgreementId);
+ } catch (CoreException exception) {
+ errorMessages.add(exception.code());
}
- } catch (CoreException exception) {
- errorMessages.add(exception.code());
- }
+ for (String featureGroupId : featureGroupIds) {
+ try {
+ FeatureGroupEntity featureGroup = getFeatureGroup(new FeatureGroupEntity(vlmId, version, featureGroupId));
+ if (!featureGroup.getReferencingLicenseAgreements().contains(licenseAgreementId)) {
+ errorMessages.add(
+ new VersionableSubEntityNotFoundErrorBuilder(featureGroup.getEntityType(), featureGroupId, LicenseAgreementEntity.ENTITY_TYPE,
+ licenseAgreementId, version).build());
+ }
+ } catch (CoreException exception) {
+ errorMessages.add(exception.code());
+ }
+ }
+ return errorMessages;
}
- return errorMessages;
- }
-
@Override
public Optional<ErrorCode> validateVendorForUsage(String vlmId, Version version) {
Item vlm = ItemManagerFactory.getInstance().createInterface().get(vlmId);
- return vlm == null
- ? Optional.of(USED_VLM_NOT_EXIST_ERROR)
- : ItemStatus.ARCHIVED == vlm.getStatus()
- ? Optional.of(USED_VLM_ARCHIVE_ERROR)
- : isDraftVlm(vlm, version)
- ? Optional.of(USED_VLM_IS_DRAFT_ERROR)
- : Optional.empty();
+ return vlm == null ? Optional.of(USED_VLM_NOT_EXIST_ERROR) : ItemStatus.ARCHIVED == vlm.getStatus() ? Optional.of(USED_VLM_ARCHIVE_ERROR)
+ : isDraftVlm(vlm, version) ? Optional.of(USED_VLM_IS_DRAFT_ERROR) : Optional.empty();
}
- private boolean isDraftVlm(Item vlm, Version version) {
- return (version == null && isVlmWithoutCertifiedVersions(vlm)) ||
- (version != null && VersionStatus.Draft.equals(version.getStatus()));
- }
+ private boolean isDraftVlm(Item vlm, Version version) {
+ return (version == null && isVlmWithoutCertifiedVersions(vlm)) || (version != null && VersionStatus.Draft.equals(version.getStatus()));
+ }
- private boolean isVlmWithoutCertifiedVersions(Item vlm) {
+ private boolean isVlmWithoutCertifiedVersions(Item vlm) {
Integer numOfCertifiedVersions = vlm.getVersionStatusCounters().get(VersionStatus.Certified);
return numOfCertifiedVersions == null || numOfCertifiedVersions < 1;
}
@Override
- public LicenseAgreementEntity getLicenseAgreement(String vlmId, Version version,
- String licenseAgreementId) {
- LicenseAgreementEntity input = new LicenseAgreementEntity(vlmId, version, licenseAgreementId);
- LicenseAgreementEntity retrieved = licenseAgreementDao.get(input);
- VersioningUtil.validateEntityExistence(retrieved, input, VendorLicenseModelEntity.ENTITY_TYPE);
- return retrieved;
- }
-
- @Override
- public Collection<LimitEntity> listLimits(String vlmId, Version version, String epLkgId) {
- return limitDao.list(new LimitEntity(vlmId, version, epLkgId, null));
- }
-
- @Override
- public LimitEntity createLimit(LimitEntity limit) {
- limitDao.create(limit);
- return limit;
- }
+ public LicenseAgreementEntity getLicenseAgreement(String vlmId, Version version, String licenseAgreementId) {
+ LicenseAgreementEntity input = new LicenseAgreementEntity(vlmId, version, licenseAgreementId);
+ LicenseAgreementEntity retrieved = licenseAgreementDao.get(input);
+ VersioningUtil.validateEntityExistence(retrieved, input, VendorLicenseModelEntity.ENTITY_TYPE);
+ return retrieved;
+ }
- @Override
- public void updateLimit(LimitEntity limit) {
- limitDao.update(limit);
- }
+ @Override
+ public Collection<LimitEntity> listLimits(String vlmId, Version version, String epLkgId) {
+ return limitDao.list(new LimitEntity(vlmId, version, epLkgId, null));
+ }
- @Override
- public void validate(String vendorLicenseModelId, Version version) {
- Collection<String> allFeatureGroupEntities = new HashSet<>();
- Collection<LicenseAgreementEntity> licenseAgreements = licenseAgreementDao
- .list(new LicenseAgreementEntity(vendorLicenseModelId, version, null));
+ @Override
+ public LimitEntity createLimit(LimitEntity limit) {
+ limitDao.create(limit);
+ return limit;
+ }
- if (CollectionUtils.isNotEmpty(licenseAgreements)) {
- licenseAgreements.forEach(licenseAgreement -> {
- if (CollectionUtils.isEmpty(licenseAgreement.getFeatureGroupIds())) {
- throw new CoreException(
- new SubmitUncompletedLicenseModelErrorBuilder(
- SUBMIT_UNCOMPLETED_VLM_MSG_LA_MISSING_FG).build());
- }
- allFeatureGroupEntities.addAll(licenseAgreement.getFeatureGroupIds());
- });
+ @Override
+ public void updateLimit(LimitEntity limit) {
+ limitDao.update(limit);
+ }
- allFeatureGroupEntities.forEach(fg -> {
- FeatureGroupEntity featureGroupEntity =
- featureGroupDao.get(new FeatureGroupEntity(vendorLicenseModelId, version, fg));
- if (CollectionUtils.isEmpty(featureGroupEntity.getEntitlementPoolIds())) {
- throw new CoreException(
- new SubmitUncompletedLicenseModelErrorBuilder(
- SUBMIT_UNCOMPLETED_VLM_MSG_FG_MISSING_EP).build());
+ @Override
+ public void validate(String vendorLicenseModelId, Version version) {
+ Collection<String> allFeatureGroupEntities = new HashSet<>();
+ Collection<LicenseAgreementEntity> licenseAgreements = licenseAgreementDao
+ .list(new LicenseAgreementEntity(vendorLicenseModelId, version, null));
+ if (CollectionUtils.isNotEmpty(licenseAgreements)) {
+ licenseAgreements.forEach(licenseAgreement -> {
+ if (CollectionUtils.isEmpty(licenseAgreement.getFeatureGroupIds())) {
+ throw new CoreException(new SubmitUncompletedLicenseModelErrorBuilder(SUBMIT_UNCOMPLETED_VLM_MSG_LA_MISSING_FG).build());
+ }
+ allFeatureGroupEntities.addAll(licenseAgreement.getFeatureGroupIds());
+ });
+ allFeatureGroupEntities.forEach(fg -> {
+ FeatureGroupEntity featureGroupEntity = featureGroupDao.get(new FeatureGroupEntity(vendorLicenseModelId, version, fg));
+ if (CollectionUtils.isEmpty(featureGroupEntity.getEntitlementPoolIds())) {
+ throw new CoreException(new SubmitUncompletedLicenseModelErrorBuilder(SUBMIT_UNCOMPLETED_VLM_MSG_FG_MISSING_EP).build());
+ }
+ });
}
- });
}
- }
-
-
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/healing/impl/SimpleHealingServiceImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/healing/impl/SimpleHealingServiceImpl.java
index cc2f8acb97..75326b14d3 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/healing/impl/SimpleHealingServiceImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/healing/impl/SimpleHealingServiceImpl.java
@@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorlicense.healing.impl;
+import java.util.UUID;
import org.openecomp.sdc.vendorlicense.dao.EntitlementPoolDao;
import org.openecomp.sdc.vendorlicense.dao.EntitlementPoolDaoFactory;
import org.openecomp.sdc.vendorlicense.dao.LicenseKeyGroupDao;
@@ -27,48 +27,40 @@ import org.openecomp.sdc.versioning.VersioningManager;
import org.openecomp.sdc.versioning.VersioningManagerFactory;
import org.openecomp.sdc.versioning.dao.types.VersionableEntity;
-import java.util.UUID;
-
public class SimpleHealingServiceImpl implements HealingService {
- private static final EntitlementPoolDao entitlementPoolDao =
- EntitlementPoolDaoFactory.getInstance().createInterface();
- private static final LicenseKeyGroupDao licenseKeyGroupDao =
- LicenseKeyGroupDaoFactory.getInstance().createInterface();
- private static final VersioningManager VERSIONING_MANAGER =
- VersioningManagerFactory.getInstance().createInterface();
- @Override
- public VersionableEntity heal(VersionableEntity toHeal) {
- return handleMissingVersionId(toHeal);
- }
+ private static final EntitlementPoolDao entitlementPoolDao = EntitlementPoolDaoFactory.getInstance().createInterface();
+ private static final LicenseKeyGroupDao licenseKeyGroupDao = LicenseKeyGroupDaoFactory.getInstance().createInterface();
+ private static final VersioningManager VERSIONING_MANAGER = VersioningManagerFactory.getInstance().createInterface();
- @Override
- public void persistNoHealing(VersionableEntity alreadyHealed) {
- if (alreadyHealed instanceof EntitlementPoolEntity) {
- entitlementPoolDao.update((EntitlementPoolEntity) alreadyHealed);
- } else if (alreadyHealed instanceof LicenseKeyGroupEntity) {
- licenseKeyGroupDao.update((LicenseKeyGroupEntity) alreadyHealed);
+ @Override
+ public VersionableEntity heal(VersionableEntity toHeal) {
+ return handleMissingVersionId(toHeal);
}
- }
- private VersionableEntity handleMissingVersionId(VersionableEntity toHeal) {
- if (toHeal != null && toHeal.getVersionUuId() != null) {
- return toHeal;
+ @Override
+ public void persistNoHealing(VersionableEntity alreadyHealed) {
+ if (alreadyHealed instanceof EntitlementPoolEntity) {
+ entitlementPoolDao.update((EntitlementPoolEntity) alreadyHealed);
+ } else if (alreadyHealed instanceof LicenseKeyGroupEntity) {
+ licenseKeyGroupDao.update((LicenseKeyGroupEntity) alreadyHealed);
+ }
}
- if (toHeal instanceof EntitlementPoolEntity) {
- toHeal.setVersionUuId(UUID.randomUUID().toString());
- entitlementPoolDao.update((EntitlementPoolEntity) toHeal);
- } else if (toHeal instanceof LicenseKeyGroupEntity) {
- toHeal.setVersionUuId(UUID.randomUUID().toString());
- licenseKeyGroupDao.update((LicenseKeyGroupEntity) toHeal);
- } else {
- throw new UnsupportedOperationException(
- "Unsupported operation for 1610 release/1607->1610 migration.");
+ private VersionableEntity handleMissingVersionId(VersionableEntity toHeal) {
+ if (toHeal != null && toHeal.getVersionUuId() != null) {
+ return toHeal;
+ }
+ if (toHeal instanceof EntitlementPoolEntity) {
+ toHeal.setVersionUuId(UUID.randomUUID().toString());
+ entitlementPoolDao.update((EntitlementPoolEntity) toHeal);
+ } else if (toHeal instanceof LicenseKeyGroupEntity) {
+ toHeal.setVersionUuId(UUID.randomUUID().toString());
+ licenseKeyGroupDao.update((LicenseKeyGroupEntity) toHeal);
+ } else {
+ throw new UnsupportedOperationException("Unsupported operation for 1610 release/1607->1610 migration.");
+ }
+ VERSIONING_MANAGER.publish(toHeal.getFirstClassCitizenId(), toHeal.getVersion(), "Add missing version_uuid on ep/lkg");
+ return toHeal;
}
-
- VERSIONING_MANAGER.publish(toHeal.getFirstClassCitizenId(), toHeal.getVersion(), "Add missing version_uuid on ep/lkg");
-
- return toHeal;
- }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/VendorLicenseArtifactsServiceImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/VendorLicenseArtifactsServiceImpl.java
index f0f8a6cb7c..7b5902e08f 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/VendorLicenseArtifactsServiceImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/VendorLicenseArtifactsServiceImpl.java
@@ -13,9 +13,24 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorlicense.licenseartifacts.impl;
+import static org.openecomp.sdc.vendorlicense.VendorLicenseConstants.VENDOR_LICENSE_MODEL_ARTIFACT_NAME_WITH_PATH;
+import static org.openecomp.sdc.vendorlicense.VendorLicenseConstants.VNF_ARTIFACT_NAME_WITH_PATH;
+import static org.openecomp.sdc.vendorlicense.licenseartifacts.impl.util.VendorLicenseArtifactsServiceUtils.filterChangedEntities;
+import static org.openecomp.sdc.vendorlicense.licenseartifacts.impl.util.VendorLicenseArtifactsServiceUtils.getFinalVersionsForVlm;
+import static org.openecomp.sdc.vendorlicense.licenseartifacts.impl.util.VendorLicenseArtifactsServiceUtils.getVendorName;
+import static org.openecomp.sdc.vendorlicense.licenseartifacts.impl.util.VendorLicenseArtifactsServiceUtils.healEPs;
+import static org.openecomp.sdc.vendorlicense.licenseartifacts.impl.util.VendorLicenseArtifactsServiceUtils.healLkgs;
+import static org.openecomp.sdc.vendorlicense.licenseartifacts.impl.util.VendorLicenseArtifactsServiceUtils.prepareForFiltering;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Set;
+import java.util.stream.Collectors;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.openecomp.core.utilities.file.FileContentHandler;
@@ -32,155 +47,105 @@ import org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types.VendorLicense
import org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types.VnfLicenseArtifact;
import org.openecomp.sdc.versioning.dao.types.Version;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Objects;
-import java.util.Optional;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-import static org.openecomp.sdc.vendorlicense.VendorLicenseConstants.VENDOR_LICENSE_MODEL_ARTIFACT_NAME_WITH_PATH;
-import static org.openecomp.sdc.vendorlicense.VendorLicenseConstants.VNF_ARTIFACT_NAME_WITH_PATH;
-import static org.openecomp.sdc.vendorlicense.licenseartifacts.impl.util.VendorLicenseArtifactsServiceUtils.filterChangedEntities;
-import static org.openecomp.sdc.vendorlicense.licenseartifacts.impl.util.VendorLicenseArtifactsServiceUtils.getFinalVersionsForVlm;
-import static org.openecomp.sdc.vendorlicense.licenseartifacts.impl.util.VendorLicenseArtifactsServiceUtils.getVendorName;
-import static org.openecomp.sdc.vendorlicense.licenseartifacts.impl.util.VendorLicenseArtifactsServiceUtils.healEPs;
-import static org.openecomp.sdc.vendorlicense.licenseartifacts.impl.util.VendorLicenseArtifactsServiceUtils.healLkgs;
-import static org.openecomp.sdc.vendorlicense.licenseartifacts.impl.util.VendorLicenseArtifactsServiceUtils.prepareForFiltering;
-
public class VendorLicenseArtifactsServiceImpl implements VendorLicenseArtifactsService {
- public static final VendorLicenseFacade vendorLicenseFacade =
- VendorLicenseFacadeFactory.getInstance().createInterface();
- public static final HealingService healingService =
- HealingServiceFactory.getInstance().createInterface();
- private static byte[] createVnfArtifact(String vspId, String vlmId, Version vlmVersion, String vendorName,
- List<String> featureGroups) {
- VnfLicenseArtifact artifact = new VnfLicenseArtifact();
-
- artifact.setVspId(vspId);
- artifact.setVendorName(vendorName);
- if (featureGroups != null) {
- for (String featureGroupId : featureGroups) {
- FeatureGroupModel featureGroupModel = vendorLicenseFacade
- .getFeatureGroupModel(new FeatureGroupEntity(vlmId, vlmVersion, featureGroupId));
- Set<EntitlementPoolEntity> entitlementPoolEntities =
- featureGroupModel.getEntitlementPools();
- String manufacturerReferenceNumber = featureGroupModel.getEntityManufacturerReferenceNumber();
- for (EntitlementPoolEntity entitlementPoolEntity : entitlementPoolEntities) {
- entitlementPoolEntity.setLimits(vendorLicenseFacade.listLimits(vlmId, vlmVersion,
- entitlementPoolEntity.getId()));
- if (Objects.nonNull(manufacturerReferenceNumber) && !manufacturerReferenceNumber.trim().isEmpty()) {
- entitlementPoolEntity.setManufacturerReferenceNumber(manufacturerReferenceNumber);
- }
+ public static final VendorLicenseFacade vendorLicenseFacade = VendorLicenseFacadeFactory.getInstance().createInterface();
+ public static final HealingService healingService = HealingServiceFactory.getInstance().createInterface();
+
+ private static byte[] createVnfArtifact(String vspId, String vlmId, Version vlmVersion, String vendorName, List<String> featureGroups) {
+ VnfLicenseArtifact artifact = new VnfLicenseArtifact();
+ artifact.setVspId(vspId);
+ artifact.setVendorName(vendorName);
+ if (featureGroups != null) {
+ for (String featureGroupId : featureGroups) {
+ FeatureGroupModel featureGroupModel = vendorLicenseFacade
+ .getFeatureGroupModel(new FeatureGroupEntity(vlmId, vlmVersion, featureGroupId));
+ Set<EntitlementPoolEntity> entitlementPoolEntities = featureGroupModel.getEntitlementPools();
+ String manufacturerReferenceNumber = featureGroupModel.getEntityManufacturerReferenceNumber();
+ for (EntitlementPoolEntity entitlementPoolEntity : entitlementPoolEntities) {
+ entitlementPoolEntity.setLimits(vendorLicenseFacade.listLimits(vlmId, vlmVersion, entitlementPoolEntity.getId()));
+ if (Objects.nonNull(manufacturerReferenceNumber) && !manufacturerReferenceNumber.trim().isEmpty()) {
+ entitlementPoolEntity.setManufacturerReferenceNumber(manufacturerReferenceNumber);
+ }
+ }
+ Set<LicenseKeyGroupEntity> licenseKeyGroupEntities = featureGroupModel.getLicenseKeyGroups();
+ for (LicenseKeyGroupEntity licenseKeyGroupEntity : licenseKeyGroupEntities) {
+ licenseKeyGroupEntity.setLimits(vendorLicenseFacade.listLimits(vlmId, vlmVersion, licenseKeyGroupEntity.getId()));
+ if (Objects.nonNull(manufacturerReferenceNumber) && !manufacturerReferenceNumber.trim().isEmpty()) {
+ licenseKeyGroupEntity.setManufacturerReferenceNumber(manufacturerReferenceNumber);
+ }
+ }
+ featureGroupModel.setEntitlementPools(
+ entitlementPoolEntities.stream().map(entitlementPoolEntity -> (EntitlementPoolEntity) healingService.heal(entitlementPoolEntity))
+ .collect(Collectors.toSet()));
+ featureGroupModel.setLicenseKeyGroups(
+ licenseKeyGroupEntities.stream().map(licenseKeyGroupEntity -> (LicenseKeyGroupEntity) healingService.heal(licenseKeyGroupEntity))
+ .collect(Collectors.toSet()));
+ artifact.getFeatureGroups().add(featureGroupModel);
+ }
}
+ return artifact.toXml().getBytes();
+ }
- Set<LicenseKeyGroupEntity> licenseKeyGroupEntities =
- featureGroupModel.getLicenseKeyGroups();
- for (LicenseKeyGroupEntity licenseKeyGroupEntity : licenseKeyGroupEntities) {
- licenseKeyGroupEntity.setLimits(vendorLicenseFacade.listLimits(vlmId, vlmVersion,
- licenseKeyGroupEntity.getId()));
- if (Objects.nonNull(manufacturerReferenceNumber) && !manufacturerReferenceNumber.trim().isEmpty()) {
- licenseKeyGroupEntity.setManufacturerReferenceNumber(manufacturerReferenceNumber);
- }
+ private static byte[] createVendorLicenseArtifact(String vlmId, String vendorName) {
+ VendorLicenseArtifact vendorLicenseArtifact = new VendorLicenseArtifact();
+ vendorLicenseArtifact.setVendorName(vendorName);
+ Set<EntitlementPoolEntity> entitlementPoolEntities = new HashSet<>();
+ Set<LicenseKeyGroupEntity> licenseKeyGroupEntities = new HashSet<>();
+ List<Version> finalVersions = getFinalVersionsForVlm(vlmId);
+ for (Version finalVersion : finalVersions) {
+ Collection<EntitlementPoolEntity> eps = vendorLicenseFacade.listEntitlementPools(vlmId, finalVersion);
+ eps.forEach(entitlementPoolEntity -> {
+ entitlementPoolEntity.setLimits(vendorLicenseFacade.listLimits(vlmId, finalVersion, entitlementPoolEntity.getId()));
+ Optional<String> manufacturerReferenceNumber = getFeatureGroupManufactureRefNumber(
+ entitlementPoolEntity.getReferencingFeatureGroups(), vlmId, finalVersion);
+ manufacturerReferenceNumber.ifPresent(entitlementPoolEntity::setManufacturerReferenceNumber);
+ });
+ entitlementPoolEntities.addAll(eps);
+ Collection<LicenseKeyGroupEntity> lkgs = vendorLicenseFacade.listLicenseKeyGroups(vlmId, finalVersion);
+ lkgs.forEach(licenseKeyGroupEntity -> {
+ licenseKeyGroupEntity.setLimits(vendorLicenseFacade.listLimits(vlmId, finalVersion, licenseKeyGroupEntity.getId()));
+ Optional<String> manufacturerReferenceNumber = getFeatureGroupManufactureRefNumber(
+ licenseKeyGroupEntity.getReferencingFeatureGroups(), vlmId, finalVersion);
+ manufacturerReferenceNumber.ifPresent(licenseKeyGroupEntity::setManufacturerReferenceNumber);
+ });
+ licenseKeyGroupEntities.addAll(lkgs);
}
-
- featureGroupModel.setEntitlementPools(entitlementPoolEntities.stream().map(
- entitlementPoolEntity -> (EntitlementPoolEntity) healingService
- .heal(entitlementPoolEntity)).collect(Collectors.toSet()));
- featureGroupModel.setLicenseKeyGroups(licenseKeyGroupEntities.stream().map(
- licenseKeyGroupEntity -> (LicenseKeyGroupEntity) healingService
- .heal(licenseKeyGroupEntity)).collect(Collectors.toSet()));
- artifact.getFeatureGroups().add(featureGroupModel);
- }
+ entitlementPoolEntities = healEPs(filterChangedEntities(prepareForFiltering(entitlementPoolEntities, true)));
+ licenseKeyGroupEntities = healLkgs(filterChangedEntities(prepareForFiltering(licenseKeyGroupEntities, false)));
+ vendorLicenseArtifact.setEntitlementPoolEntities(entitlementPoolEntities);
+ vendorLicenseArtifact.setLicenseKeyGroupEntities(licenseKeyGroupEntities);
+ return vendorLicenseArtifact.toXml().getBytes();
}
- return artifact.toXml().getBytes();
- }
-
- private static byte[] createVendorLicenseArtifact(String vlmId, String vendorName) {
- VendorLicenseArtifact vendorLicenseArtifact = new VendorLicenseArtifact();
- vendorLicenseArtifact.setVendorName(vendorName);
- Set<EntitlementPoolEntity> entitlementPoolEntities = new HashSet<>();
- Set<LicenseKeyGroupEntity> licenseKeyGroupEntities = new HashSet<>();
-
- List<Version> finalVersions = getFinalVersionsForVlm(vlmId);
- for (Version finalVersion : finalVersions) {
- Collection<EntitlementPoolEntity> eps =
- vendorLicenseFacade.listEntitlementPools(vlmId, finalVersion);
- eps.forEach(entitlementPoolEntity -> {
- entitlementPoolEntity.setLimits(vendorLicenseFacade.listLimits(vlmId, finalVersion,
- entitlementPoolEntity.getId()));
- Optional<String> manufacturerReferenceNumber = getFeatureGroupManufactureRefNumber
- (entitlementPoolEntity.getReferencingFeatureGroups(), vlmId, finalVersion);
- manufacturerReferenceNumber
- .ifPresent(entitlementPoolEntity::setManufacturerReferenceNumber);
- });
- entitlementPoolEntities.addAll(eps);
- Collection<LicenseKeyGroupEntity> lkgs =
- vendorLicenseFacade.listLicenseKeyGroups(vlmId, finalVersion);
-
- lkgs.forEach(licenseKeyGroupEntity -> {
- licenseKeyGroupEntity.setLimits(vendorLicenseFacade.listLimits(vlmId, finalVersion,
- licenseKeyGroupEntity.getId()));
- Optional<String> manufacturerReferenceNumber = getFeatureGroupManufactureRefNumber
- (licenseKeyGroupEntity.getReferencingFeatureGroups(), vlmId, finalVersion);
- manufacturerReferenceNumber
- .ifPresent(licenseKeyGroupEntity::setManufacturerReferenceNumber);
- });
- licenseKeyGroupEntities.addAll(lkgs);
+ private static Optional<String> getFeatureGroupManufactureRefNumber(Set<String> featureGroupIds, String vlmId, Version finalVersion) {
+ String manufactureReferenceNumber = null;
+ if (CollectionUtils.isNotEmpty(featureGroupIds)) {
+ Object[] featureGroupIdsList = featureGroupIds.toArray();
+ if (featureGroupIdsList.length > 0) {
+ FeatureGroupEntity featureGroup = vendorLicenseFacade
+ .getFeatureGroup(new FeatureGroupEntity(vlmId, finalVersion, featureGroupIdsList[0].toString()));
+ manufactureReferenceNumber = featureGroup != null ? featureGroup.getManufacturerReferenceNumber() : null;
+ }
+ }
+ return StringUtils.isNotEmpty(manufactureReferenceNumber) ? Optional.of(manufactureReferenceNumber) : Optional.empty();
}
-
- entitlementPoolEntities =
- healEPs(filterChangedEntities(prepareForFiltering(entitlementPoolEntities, true)));
- licenseKeyGroupEntities =
- healLkgs(filterChangedEntities(prepareForFiltering(licenseKeyGroupEntities, false)));
- vendorLicenseArtifact.setEntitlementPoolEntities(entitlementPoolEntities);
- vendorLicenseArtifact.setLicenseKeyGroupEntities(licenseKeyGroupEntities);
- return vendorLicenseArtifact.toXml().getBytes();
- }
-
- private static Optional<String> getFeatureGroupManufactureRefNumber(Set<String> featureGroupIds,
- String vlmId,
- Version finalVersion) {
- String manufactureReferenceNumber = null;
- if (CollectionUtils.isNotEmpty(featureGroupIds)) {
- Object[] featureGroupIdsList = featureGroupIds.toArray();
- if (featureGroupIdsList.length > 0) {
- FeatureGroupEntity featureGroup =
- vendorLicenseFacade.getFeatureGroup(new FeatureGroupEntity(vlmId, finalVersion,
- featureGroupIdsList[0].toString()));
- manufactureReferenceNumber = featureGroup != null ? featureGroup
- .getManufacturerReferenceNumber() : null;
- }
+ /**
+ * Create License Artifacts.
+ *
+ * @param vspId vspId
+ * @param vlmId vlmId
+ * @param vlmVersion vlmVersion
+ * @param featureGroups featureGroups
+ * @return FileContentHandler
+ */
+ @Override
+ public FileContentHandler createLicenseArtifacts(String vspId, String vlmId, Version vlmVersion, List<String> featureGroups) {
+ FileContentHandler artifacts = new FileContentHandler();
+ String vendorName = getVendorName(vlmId);
+ artifacts.addFile(VNF_ARTIFACT_NAME_WITH_PATH, createVnfArtifact(vspId, vlmId, vlmVersion, vendorName, featureGroups));
+ artifacts.addFile(VENDOR_LICENSE_MODEL_ARTIFACT_NAME_WITH_PATH, createVendorLicenseArtifact(vlmId, vendorName));
+ return artifacts;
}
- return StringUtils.isNotEmpty(manufactureReferenceNumber) ? Optional.of(manufactureReferenceNumber) :
- Optional.empty();
- }
-
-
- /**
- * Create License Artifacts.
- *
- * @param vspId vspId
- * @param vlmId vlmId
- * @param vlmVersion vlmVersion
- * @param featureGroups featureGroups
- * @return FileContentHandler
- */
- @Override
- public FileContentHandler createLicenseArtifacts(String vspId, String vlmId, Version vlmVersion,
- List<String> featureGroups) {
- FileContentHandler artifacts = new FileContentHandler();
- String vendorName = getVendorName(vlmId);
-
- artifacts.addFile(VNF_ARTIFACT_NAME_WITH_PATH,
- createVnfArtifact(vspId, vlmId, vlmVersion, vendorName, featureGroups));
- artifacts.addFile(VENDOR_LICENSE_MODEL_ARTIFACT_NAME_WITH_PATH,
- createVendorLicenseArtifact(vlmId, vendorName));
- return artifacts;
- }
-
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/VendorLicenseArtifact.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/VendorLicenseArtifact.java
index afc1d3151b..a805b75587 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/VendorLicenseArtifact.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/VendorLicenseArtifact.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,13 +17,13 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
+import java.util.Collection;
import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity;
import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity;
import org.openecomp.sdc.vendorlicense.dao.types.xml.LimitXml;
@@ -31,53 +31,47 @@ import org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types.mixins.MixinE
import org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types.mixins.MixinLicenseKeyGroupEntityForVendorLicenseArtifact;
import org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types.mixins.MixinLimitArtifact;
-import java.util.Collection;
-
@JacksonXmlRootElement(localName = "vendor-license-model",
namespace = "http://xmlns.openecomp.org/asdc/license-model/1.0")
public class VendorLicenseArtifact extends XmlArtifact {
- @JsonProperty(value = "vendor-name")
- String vendorName;
- Collection<EntitlementPoolEntity> entitlementPoolEntities;
- Collection<LicenseKeyGroupEntity> licenseKeyGroupEntities;
+ @JsonProperty(value = "vendor-name")
+ String vendorName;
+ Collection<EntitlementPoolEntity> entitlementPoolEntities;
+ Collection<LicenseKeyGroupEntity> licenseKeyGroupEntities;
- public String getVendorName() {
- return vendorName;
- }
+ public String getVendorName() {
+ return vendorName;
+ }
- public void setVendorName(String vendorName) {
- this.vendorName = vendorName;
- }
+ public void setVendorName(String vendorName) {
+ this.vendorName = vendorName;
+ }
- @JacksonXmlProperty(isAttribute = false, localName = "entitlement-pool")
- @JacksonXmlElementWrapper(localName = "entitlement-pool-list")
- public Collection<EntitlementPoolEntity> getEntitlementPoolEntities() {
- return entitlementPoolEntities;
- }
+ @JacksonXmlProperty(isAttribute = false, localName = "entitlement-pool")
+ @JacksonXmlElementWrapper(localName = "entitlement-pool-list")
+ public Collection<EntitlementPoolEntity> getEntitlementPoolEntities() {
+ return entitlementPoolEntities;
+ }
- public void setEntitlementPoolEntities(
- Collection<EntitlementPoolEntity> entitlementPoolEntities) {
- this.entitlementPoolEntities = entitlementPoolEntities;
- }
+ public void setEntitlementPoolEntities(Collection<EntitlementPoolEntity> entitlementPoolEntities) {
+ this.entitlementPoolEntities = entitlementPoolEntities;
+ }
- @JacksonXmlProperty(isAttribute = false, localName = "license-key-group")
- @JacksonXmlElementWrapper(localName = "license-key-group-list")
- public Collection<LicenseKeyGroupEntity> getLicenseKeyGroupEntities() {
- return licenseKeyGroupEntities;
- }
+ @JacksonXmlProperty(isAttribute = false, localName = "license-key-group")
+ @JacksonXmlElementWrapper(localName = "license-key-group-list")
+ public Collection<LicenseKeyGroupEntity> getLicenseKeyGroupEntities() {
+ return licenseKeyGroupEntities;
+ }
- public void setLicenseKeyGroupEntities(
- Collection<LicenseKeyGroupEntity> licenseKeyGroupEntities) {
- this.licenseKeyGroupEntities = licenseKeyGroupEntities;
- }
+ public void setLicenseKeyGroupEntities(Collection<LicenseKeyGroupEntity> licenseKeyGroupEntities) {
+ this.licenseKeyGroupEntities = licenseKeyGroupEntities;
+ }
- @Override
- void initMapper() {
- xmlMapper.addMixIn(EntitlementPoolEntity.class,
- MixinEntitlementPoolEntityForVendorLicenseArtifact.class);
- xmlMapper.addMixIn(LicenseKeyGroupEntity.class,
- MixinLicenseKeyGroupEntityForVendorLicenseArtifact.class);
- xmlMapper.addMixIn(LimitXml.class, MixinLimitArtifact.class);
- }
+ @Override
+ void initMapper() {
+ xmlMapper.addMixIn(EntitlementPoolEntity.class, MixinEntitlementPoolEntityForVendorLicenseArtifact.class);
+ xmlMapper.addMixIn(LicenseKeyGroupEntity.class, MixinLicenseKeyGroupEntityForVendorLicenseArtifact.class);
+ xmlMapper.addMixIn(LimitXml.class, MixinLimitArtifact.class);
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/VnfLicenseArtifact.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/VnfLicenseArtifact.java
index 91a73b6377..1686b9631d 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/VnfLicenseArtifact.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/VnfLicenseArtifact.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types;
import com.ctc.wstx.api.WstxInputProperties;
@@ -29,6 +28,11 @@ import com.fasterxml.jackson.dataformat.xml.XmlMapper;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity;
import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupModel;
import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity;
@@ -38,63 +42,55 @@ import org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types.mixins.MixinF
import org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types.mixins.MixinLicenseKeyGroupEntityForVnfArtifact;
import org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types.mixins.MixinLimitArtifact;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.List;
-
@JacksonXmlRootElement(localName = "vf-license-model",
namespace = "http://xmlns.openecomp.org/asdc/license-model/1.0")
public class VnfLicenseArtifact extends XmlArtifact {
- @JsonProperty(value = "vendor-name")
- String vendorName;
- @JsonProperty(value = "vf-id")
- String vspId;
- List<FeatureGroupModel> featureGroups = new ArrayList<>();
-
- public String getVspId() {
- return vspId;
- }
-
- public void setVspId(String vspId) {
- this.vspId = vspId;
- }
- public String getVendorName() {
- return vendorName;
- }
+ @JsonProperty(value = "vendor-name")
+ String vendorName;
+ @JsonProperty(value = "vf-id")
+ String vspId;
+ List<FeatureGroupModel> featureGroups = new ArrayList<>();
- public void setVendorName(String vendorName) {
- this.vendorName = vendorName;
- }
+ public String getVspId() {
+ return vspId;
+ }
- @JacksonXmlProperty(isAttribute = false, localName = "feature-group")
- @JacksonXmlElementWrapper(localName = "feature-group-list")
- public List<FeatureGroupModel> getFeatureGroups() {
- return featureGroups;
- }
+ public void setVspId(String vspId) {
+ this.vspId = vspId;
+ }
- public void setFeatureGroups(List<FeatureGroupModel> featureGroups) {
- this.featureGroups = featureGroups;
- }
+ public String getVendorName() {
+ return vendorName;
+ }
- void initMapper() {
- WstxOutputFactory wstxOutputFactory = new WstxOutputFactory() {
- @Override
- public XMLStreamWriter createXMLStreamWriter(Writer writer) throws XMLStreamException {
- mConfig.setProperty(WstxInputProperties.P_RETURN_NULL_FOR_DEFAULT_NAMESPACE, true);
- return super.createXMLStreamWriter(writer);
- }
- };
- XmlFactory factory = new XmlFactory(new WstxInputFactory(), wstxOutputFactory);
+ public void setVendorName(String vendorName) {
+ this.vendorName = vendorName;
+ }
- xmlMapper = new XmlMapper(factory);
+ @JacksonXmlProperty(isAttribute = false, localName = "feature-group")
+ @JacksonXmlElementWrapper(localName = "feature-group-list")
+ public List<FeatureGroupModel> getFeatureGroups() {
+ return featureGroups;
+ }
+ public void setFeatureGroups(List<FeatureGroupModel> featureGroups) {
+ this.featureGroups = featureGroups;
+ }
- xmlMapper.addMixIn(EntitlementPoolEntity.class, MixinEntitlementPoolEntityForVnfArtifact.class);
- xmlMapper.addMixIn(LicenseKeyGroupEntity.class, MixinLicenseKeyGroupEntityForVnfArtifact.class);
- xmlMapper.addMixIn(FeatureGroupModel.class, MixinFeatureGroupModel.class);
- xmlMapper.addMixIn(LimitXml.class, MixinLimitArtifact.class);
- }
+ void initMapper() {
+ WstxOutputFactory wstxOutputFactory = new WstxOutputFactory() {
+ @Override
+ public XMLStreamWriter createXMLStreamWriter(Writer writer) throws XMLStreamException {
+ mConfig.setProperty(WstxInputProperties.P_RETURN_NULL_FOR_DEFAULT_NAMESPACE, true);
+ return super.createXMLStreamWriter(writer);
+ }
+ };
+ XmlFactory factory = new XmlFactory(new WstxInputFactory(), wstxOutputFactory);
+ xmlMapper = new XmlMapper(factory);
+ xmlMapper.addMixIn(EntitlementPoolEntity.class, MixinEntitlementPoolEntityForVnfArtifact.class);
+ xmlMapper.addMixIn(LicenseKeyGroupEntity.class, MixinLicenseKeyGroupEntityForVnfArtifact.class);
+ xmlMapper.addMixIn(FeatureGroupModel.class, MixinFeatureGroupModel.class);
+ xmlMapper.addMixIn(LimitXml.class, MixinLimitArtifact.class);
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/XmlArtifact.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/XmlArtifact.java
index 7052d6afb6..dc5089f57a 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/XmlArtifact.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/XmlArtifact.java
@@ -12,8 +12,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-*/
-
+ */
package org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types;
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
@@ -23,28 +22,23 @@ import org.openecomp.sdc.vendorlicense.errors.JsonErrorBuilder;
public abstract class XmlArtifact {
- XmlMapper xmlMapper = new XmlMapper();
-
- abstract void initMapper();
-
- /**
- * To xml string.
- *
- * @return the string
- */
- public String toXml() {
- initMapper();
- String xml;
-
- try {
- xml = xmlMapper.writeValueAsString(this);
- } catch (com.fasterxml.jackson.core.JsonProcessingException exception) {
- throw new CoreException(new JsonErrorBuilder("Failed to write xml value as string ")
- .build(), exception);
+ XmlMapper xmlMapper = new XmlMapper();
+
+ abstract void initMapper();
+
+ /**
+ * To xml string.
+ *
+ * @return the string
+ */
+ public String toXml() {
+ initMapper();
+ String xml;
+ try {
+ xml = xmlMapper.writeValueAsString(this);
+ } catch (com.fasterxml.jackson.core.JsonProcessingException exception) {
+ throw new CoreException(new JsonErrorBuilder("Failed to write xml value as string ").build(), exception);
+ }
+ return xml.replaceAll(VendorLicenseConstants.VENDOR_LICENSE_MODEL_ARTIFACT_REGEX_REMOVE, "");
}
-
- return xml.replaceAll(VendorLicenseConstants.VENDOR_LICENSE_MODEL_ARTIFACT_REGEX_REMOVE, "");
- }
-
-
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinEntitlementPoolEntityForVendorLicenseArtifact.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinEntitlementPoolEntityForVendorLicenseArtifact.java
index 5afd0a9ab1..55301c9b7f 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinEntitlementPoolEntityForVendorLicenseArtifact.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinEntitlementPoolEntityForVendorLicenseArtifact.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,98 +17,104 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types.mixins;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import org.openecomp.sdc.vendorlicense.dao.types.*;
-import org.openecomp.sdc.vendorlicense.dao.types.xml.*;
-
import java.util.Collection;
import java.util.Set;
-
-@JsonPropertyOrder({ "entitlement-pool-invariant-uuid", "entitlement-pool-uuid" })
+import org.openecomp.sdc.vendorlicense.dao.types.AggregationFunction;
+import org.openecomp.sdc.vendorlicense.dao.types.ChoiceOrOther;
+import org.openecomp.sdc.vendorlicense.dao.types.EntitlementMetric;
+import org.openecomp.sdc.vendorlicense.dao.types.EntitlementTime;
+import org.openecomp.sdc.vendorlicense.dao.types.LimitEntity;
+import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope;
+import org.openecomp.sdc.vendorlicense.dao.types.xml.AggregationFunctionForXml;
+import org.openecomp.sdc.vendorlicense.dao.types.xml.EntitlementMetricForXml;
+import org.openecomp.sdc.vendorlicense.dao.types.xml.EntitlementTimeForXml;
+import org.openecomp.sdc.vendorlicense.dao.types.xml.LimitForXml;
+import org.openecomp.sdc.vendorlicense.dao.types.xml.OperationalScopeForXml;
+import org.openecomp.sdc.vendorlicense.dao.types.xml.ThresholdForXml;
+
+@JsonPropertyOrder({"entitlement-pool-invariant-uuid", "entitlement-pool-uuid"})
public abstract class MixinEntitlementPoolEntityForVendorLicenseArtifact {
- @JsonProperty(value = "threshold-value")
- abstract ThresholdForXml getThresholdForArtifact();
-
- @JsonProperty(value = "entitlement-pool-uuid")
- abstract String getVersionUuId();
-
- @JsonIgnore
- abstract Set<String> getReferencingFeatureGroups();
- @JsonIgnore
- abstract String getFirstClassCitizenId();
+ @JsonProperty(value = "threshold-value")
+ abstract ThresholdForXml getThresholdForArtifact();
- @JsonProperty(value = "entitlement-pool-invariant-uuid")
- abstract String getId();
+ @JsonProperty(value = "entitlement-pool-uuid")
+ abstract String getVersionUuId();
- @JsonProperty(value = "manufacturer-reference-number")
- abstract String getManufacturerReferenceNumber();
+ @JsonIgnore
+ abstract Set<String> getReferencingFeatureGroups();
- @JsonProperty(value = "version")
- abstract String getVersionForArtifact();
+ @JsonIgnore
+ abstract String getFirstClassCitizenId();
- @JsonIgnore
- abstract String getStartDate();
+ @JsonProperty(value = "entitlement-pool-invariant-uuid")
+ abstract String getId();
- @JsonIgnore
- abstract String getExpiryDate();
+ @JsonProperty(value = "manufacturer-reference-number")
+ abstract String getManufacturerReferenceNumber();
- @JsonProperty(value = "start-date")
- abstract String getIsoFormatStartDate();
+ @JsonProperty(value = "version")
+ abstract String getVersionForArtifact();
- @JsonProperty(value = "expiry-date")
- abstract String getIsoFormatExpiryDate();
+ @JsonIgnore
+ abstract String getStartDate();
- @JsonIgnore
- abstract String getVendorLicenseModelId();
+ @JsonIgnore
+ abstract String getExpiryDate();
+ @JsonProperty(value = "start-date")
+ abstract String getIsoFormatStartDate();
+ @JsonProperty(value = "expiry-date")
+ abstract String getIsoFormatExpiryDate();
- @JsonIgnore
- abstract String getThresholdUnit();
+ @JsonIgnore
+ abstract String getVendorLicenseModelId();
- @JsonIgnore
- abstract float getThresholdValue();
+ @JsonIgnore
+ abstract String getThresholdUnit();
- @JsonIgnore
- abstract ChoiceOrOther<EntitlementMetric> getEntitlementMetric();
+ @JsonIgnore
+ abstract float getThresholdValue();
- @JsonIgnore
- abstract ChoiceOrOther<EntitlementTime> getTime();
+ @JsonIgnore
+ abstract ChoiceOrOther<EntitlementMetric> getEntitlementMetric();
- @JsonIgnore
- abstract ChoiceOrOther<AggregationFunction> getAggregationFunction();
+ @JsonIgnore
+ abstract ChoiceOrOther<EntitlementTime> getTime();
- @JsonIgnore
- abstract String getEntityType();
+ @JsonIgnore
+ abstract ChoiceOrOther<AggregationFunction> getAggregationFunction();
- @JsonProperty(value = "operational-scope")
- abstract OperationalScopeForXml getOperationalScopeForArtifact();
+ @JsonIgnore
+ abstract String getEntityType();
- @JsonIgnore
- abstract ChoiceOrOther<OperationalScope> getOperationalScope();
+ @JsonProperty(value = "operational-scope")
+ abstract OperationalScopeForXml getOperationalScopeForArtifact();
- @JsonProperty(value = "entitlement-metric")
- abstract EntitlementMetricForXml getEntitlementMetricForArtifact();
+ @JsonIgnore
+ abstract ChoiceOrOther<OperationalScope> getOperationalScope();
- @JsonProperty(value = "time")
- abstract EntitlementTimeForXml getTimeForArtifact();
+ @JsonProperty(value = "entitlement-metric")
+ abstract EntitlementMetricForXml getEntitlementMetricForArtifact();
+ @JsonProperty(value = "time")
+ abstract EntitlementTimeForXml getTimeForArtifact();
- @JsonProperty(value = "aggregation-function")
- abstract AggregationFunctionForXml getAggregationFunctionForArtifact();
+ @JsonProperty(value = "aggregation-function")
+ abstract AggregationFunctionForXml getAggregationFunctionForArtifact();
- @JsonProperty(value = "sp-limits")
- abstract LimitForXml getSPLimits();
+ @JsonProperty(value = "sp-limits")
+ abstract LimitForXml getSPLimits();
- @JsonProperty(value = "vendor-limits")
- abstract LimitForXml getVendorLimits();
+ @JsonProperty(value = "vendor-limits")
+ abstract LimitForXml getVendorLimits();
- @JsonIgnore
- abstract Collection<LimitEntity> getLimits();
+ @JsonIgnore
+ abstract Collection<LimitEntity> getLimits();
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinEntitlementPoolEntityForVnfArtifact.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinEntitlementPoolEntityForVnfArtifact.java
index 32ac6fb532..95dd28ada2 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinEntitlementPoolEntityForVnfArtifact.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinEntitlementPoolEntityForVnfArtifact.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,99 +17,105 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types.mixins;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
-import org.openecomp.sdc.vendorlicense.dao.types.*;
-import org.openecomp.sdc.vendorlicense.dao.types.xml.*;
-
import java.util.Collection;
import java.util.Set;
+import org.openecomp.sdc.vendorlicense.dao.types.AggregationFunction;
+import org.openecomp.sdc.vendorlicense.dao.types.ChoiceOrOther;
+import org.openecomp.sdc.vendorlicense.dao.types.EntitlementMetric;
+import org.openecomp.sdc.vendorlicense.dao.types.EntitlementTime;
+import org.openecomp.sdc.vendorlicense.dao.types.LimitEntity;
+import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope;
+import org.openecomp.sdc.vendorlicense.dao.types.xml.AggregationFunctionForXml;
+import org.openecomp.sdc.vendorlicense.dao.types.xml.EntitlementMetricForXml;
+import org.openecomp.sdc.vendorlicense.dao.types.xml.EntitlementTimeForXml;
+import org.openecomp.sdc.vendorlicense.dao.types.xml.LimitForXml;
+import org.openecomp.sdc.vendorlicense.dao.types.xml.OperationalScopeForXml;
+import org.openecomp.sdc.vendorlicense.dao.types.xml.ThresholdForXml;
public abstract class MixinEntitlementPoolEntityForVnfArtifact {
- @JsonProperty(value = "threshold-value")
- abstract ThresholdForXml getThresholdForArtifact();
-
- @JsonProperty(value = "entitlement-pool-invariant-uuid")
- abstract String getId();
-
- @JsonProperty(value = "manufacturer-reference-number")
- abstract String getManufacturerReferenceNumber();
- @JsonIgnore
- abstract Set<String> getReferencingFeatureGroups();
+ @JsonProperty(value = "threshold-value")
+ abstract ThresholdForXml getThresholdForArtifact();
- @JsonIgnore
- abstract String getFirstClassCitizenId();
+ @JsonProperty(value = "entitlement-pool-invariant-uuid")
+ abstract String getId();
- @JsonProperty(value = "entitlement-pool-uuid")
- abstract String getVersionUuId();
+ @JsonProperty(value = "manufacturer-reference-number")
+ abstract String getManufacturerReferenceNumber();
- @JsonIgnore
- abstract String getVersion();
+ @JsonIgnore
+ abstract Set<String> getReferencingFeatureGroups();
- @JsonProperty(value = "version")
- abstract String getVersionForArtifact();
+ @JsonIgnore
+ abstract String getFirstClassCitizenId();
- @JsonIgnore
- abstract String getVendorLicenseModelId();
+ @JsonProperty(value = "entitlement-pool-uuid")
+ abstract String getVersionUuId();
- @JsonIgnore
- abstract String getThresholdUnit();
+ @JsonIgnore
+ abstract String getVersion();
- @JsonIgnore
- abstract float getThresholdValue();
+ @JsonProperty(value = "version")
+ abstract String getVersionForArtifact();
- @JsonIgnore
- abstract String getStartDate();
+ @JsonIgnore
+ abstract String getVendorLicenseModelId();
- @JsonIgnore
- abstract String getExpiryDate();
+ @JsonIgnore
+ abstract String getThresholdUnit();
- @JsonProperty(value = "start-date")
- abstract String getIsoFormatStartDate();
+ @JsonIgnore
+ abstract float getThresholdValue();
- @JsonProperty(value = "expiry-date")
- abstract String getIsoFormatExpiryDate();
+ @JsonIgnore
+ abstract String getStartDate();
- @JsonIgnore
- abstract ChoiceOrOther<EntitlementMetric> getEntitlementMetric();
+ @JsonIgnore
+ abstract String getExpiryDate();
- @JsonIgnore
- abstract ChoiceOrOther<EntitlementTime> getTime();
+ @JsonProperty(value = "start-date")
+ abstract String getIsoFormatStartDate();
- @JsonIgnore
- abstract ChoiceOrOther<AggregationFunction> getAggregationFunction();
+ @JsonProperty(value = "expiry-date")
+ abstract String getIsoFormatExpiryDate();
- @JsonIgnore
- abstract String getEntityType();
+ @JsonIgnore
+ abstract ChoiceOrOther<EntitlementMetric> getEntitlementMetric();
- @JsonProperty(value = "operational-scope")
- abstract OperationalScopeForXml getOperationalScopeForArtifact();
+ @JsonIgnore
+ abstract ChoiceOrOther<EntitlementTime> getTime();
- @JsonIgnore
- abstract ChoiceOrOther<OperationalScope> getOperationalScope();
+ @JsonIgnore
+ abstract ChoiceOrOther<AggregationFunction> getAggregationFunction();
+ @JsonIgnore
+ abstract String getEntityType();
- @JsonProperty(value = "entitlement-metric")
- abstract EntitlementMetricForXml getEntitlementMetricForArtifact();
+ @JsonProperty(value = "operational-scope")
+ abstract OperationalScopeForXml getOperationalScopeForArtifact();
- @JsonProperty(value = "time")
- abstract EntitlementTimeForXml getTimeForArtifact();
+ @JsonIgnore
+ abstract ChoiceOrOther<OperationalScope> getOperationalScope();
+ @JsonProperty(value = "entitlement-metric")
+ abstract EntitlementMetricForXml getEntitlementMetricForArtifact();
- @JsonProperty(value = "aggregation-function")
- abstract AggregationFunctionForXml getAggregationFunctionForArtifact();
+ @JsonProperty(value = "time")
+ abstract EntitlementTimeForXml getTimeForArtifact();
- @JsonProperty(value = "sp-limits")
- abstract LimitForXml getSPLimits();
+ @JsonProperty(value = "aggregation-function")
+ abstract AggregationFunctionForXml getAggregationFunctionForArtifact();
- @JsonProperty(value = "vendor-limits")
- abstract LimitForXml getVendorLimits();
+ @JsonProperty(value = "sp-limits")
+ abstract LimitForXml getSPLimits();
- @JsonIgnore
- abstract Collection<LimitEntity> getLimits();
+ @JsonProperty(value = "vendor-limits")
+ abstract LimitForXml getVendorLimits();
+ @JsonIgnore
+ abstract Collection<LimitEntity> getLimits();
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinFeatureGroupEntity.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinFeatureGroupEntity.java
index 61751b111b..970290b25a 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinFeatureGroupEntity.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinFeatureGroupEntity.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,49 +17,44 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types.mixins;
import com.fasterxml.jackson.annotation.JsonIgnore;
-import org.openecomp.sdc.versioning.dao.types.Version;
-
import java.util.Set;
+import org.openecomp.sdc.versioning.dao.types.Version;
public abstract class MixinFeatureGroupEntity {
- @JsonIgnore
- abstract String getVendorLicenseModelId();
-
- @JsonIgnore
- abstract String getEntityType();
-
-
- @JsonIgnore
- abstract Version getVersion();
+ @JsonIgnore
+ abstract String getVendorLicenseModelId();
- @JsonIgnore
- abstract String getId();
+ @JsonIgnore
+ abstract String getEntityType();
- @JsonIgnore
- abstract String getName();
+ @JsonIgnore
+ abstract Version getVersion();
- @JsonIgnore
- abstract String getDescription();
+ @JsonIgnore
+ abstract String getId();
- @JsonIgnore
- abstract String getPartNumber();
+ @JsonIgnore
+ abstract String getName();
- @JsonIgnore
- abstract String getManufacturerReferenceNumber();
+ @JsonIgnore
+ abstract String getDescription();
- @JsonIgnore
- abstract Set<String> getLicenseKeyGroupIds();
+ @JsonIgnore
+ abstract String getPartNumber();
- @JsonIgnore
- abstract Set<String> getEntitlementPoolIds();
+ @JsonIgnore
+ abstract String getManufacturerReferenceNumber();
+ @JsonIgnore
+ abstract Set<String> getLicenseKeyGroupIds();
- @JsonIgnore
- abstract Set<String> getReferencingLicenseAgreements();
+ @JsonIgnore
+ abstract Set<String> getEntitlementPoolIds();
+ @JsonIgnore
+ abstract Set<String> getReferencingLicenseAgreements();
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinFeatureGroupModel.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinFeatureGroupModel.java
index b8c45ba4c6..45feb365e5 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinFeatureGroupModel.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinFeatureGroupModel.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,48 +17,44 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types.mixins;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
+import java.util.Set;
import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity;
import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity;
import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity;
-import java.util.Set;
-
public abstract class MixinFeatureGroupModel {
- @JacksonXmlProperty(isAttribute = false, localName = "entitlement-pool")
- @JacksonXmlElementWrapper(localName = "entitlement-pool-list")
- abstract Set<EntitlementPoolEntity> getEntitlementPools();
-
- @JacksonXmlProperty(isAttribute = false, localName = "license-key-group")
- @JacksonXmlElementWrapper(localName = "license-key-group-list")
- abstract Set<LicenseKeyGroupEntity> getLicenseKeyGroups();
-
- @JacksonXmlProperty(isAttribute = false, localName = "part-number")
- abstract String getEntityPartNumber();
- @JacksonXmlProperty(isAttribute = false, localName = "feature-group-uuid")
- abstract String getEntityId();
+ @JacksonXmlProperty(isAttribute = false, localName = "entitlement-pool")
+ @JacksonXmlElementWrapper(localName = "entitlement-pool-list")
+ abstract Set<EntitlementPoolEntity> getEntitlementPools();
- @JacksonXmlProperty(isAttribute = false, localName = "description")
- abstract String getEntityDesc();
+ @JacksonXmlProperty(isAttribute = false, localName = "license-key-group")
+ @JacksonXmlElementWrapper(localName = "license-key-group-list")
+ abstract Set<LicenseKeyGroupEntity> getLicenseKeyGroups();
- @JacksonXmlProperty(isAttribute = false, localName = "name")
- abstract String getEntityName();
+ @JacksonXmlProperty(isAttribute = false, localName = "part-number")
+ abstract String getEntityPartNumber();
+ @JacksonXmlProperty(isAttribute = false, localName = "feature-group-uuid")
+ abstract String getEntityId();
- @JsonIgnore
- abstract FeatureGroupEntity getFeatureGroup();
+ @JacksonXmlProperty(isAttribute = false, localName = "description")
+ abstract String getEntityDesc();
- @JsonIgnore
- abstract String getEntityType();
+ @JacksonXmlProperty(isAttribute = false, localName = "name")
+ abstract String getEntityName();
- @JsonIgnore
- abstract String getEntityManufacturerReferenceNumber();
+ @JsonIgnore
+ abstract FeatureGroupEntity getFeatureGroup();
+ @JsonIgnore
+ abstract String getEntityType();
+ @JsonIgnore
+ abstract String getEntityManufacturerReferenceNumber();
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinLicenseKeyGroupEntityForVendorLicenseArtifact.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinLicenseKeyGroupEntityForVendorLicenseArtifact.java
index eeaa7c0a3a..03bc6c83ad 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinLicenseKeyGroupEntityForVendorLicenseArtifact.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinLicenseKeyGroupEntityForVendorLicenseArtifact.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,11 +17,12 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types.mixins;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.Collection;
+import java.util.Set;
import org.openecomp.sdc.vendorlicense.dao.types.ChoiceOrOther;
import org.openecomp.sdc.vendorlicense.dao.types.LimitEntity;
import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope;
@@ -30,74 +31,68 @@ import org.openecomp.sdc.vendorlicense.dao.types.xml.LimitForXml;
import org.openecomp.sdc.vendorlicense.dao.types.xml.OperationalScopeForXml;
import org.openecomp.sdc.vendorlicense.dao.types.xml.ThresholdForXml;
-import java.util.Collection;
-import java.util.Set;
-
public abstract class MixinLicenseKeyGroupEntityForVendorLicenseArtifact {
- @JsonProperty(value = "license-key-group-uuid")
- abstract String getVersionUuId();
-
- @JsonIgnore
- abstract Set<String> getReferencingFeatureGroups();
-
- @JsonProperty(value = "version")
- abstract String getVersionForArtifact();
-
- @JsonIgnore
- abstract String getVendorLicenseModelId();
+ @JsonProperty(value = "license-key-group-uuid")
+ abstract String getVersionUuId();
- @JsonIgnore
- abstract String getEntityType();
+ @JsonIgnore
+ abstract Set<String> getReferencingFeatureGroups();
- @JsonIgnore
- abstract String getFirstClassCitizenId();
+ @JsonProperty(value = "version")
+ abstract String getVersionForArtifact();
- @JsonProperty(value = "license-key-group-invariant-uuid")
- abstract String getId();
+ @JsonIgnore
+ abstract String getVendorLicenseModelId();
+ @JsonIgnore
+ abstract String getEntityType();
- @JsonIgnore
- abstract ChoiceOrOther<OperationalScope> getOperationalScope();
+ @JsonIgnore
+ abstract String getFirstClassCitizenId();
- @JsonProperty(value = "operational-scope")
- abstract OperationalScopeForXml getOperationalScopeForArtifact();
+ @JsonProperty(value = "license-key-group-invariant-uuid")
+ abstract String getId();
+ @JsonIgnore
+ abstract ChoiceOrOther<OperationalScope> getOperationalScope();
- @JsonIgnore
- abstract LicenseKeyTypeForXml getTypeForArtifact();
+ @JsonProperty(value = "operational-scope")
+ abstract OperationalScopeForXml getOperationalScopeForArtifact();
- @JsonIgnore
- abstract String getVersionableId();
+ @JsonIgnore
+ abstract LicenseKeyTypeForXml getTypeForArtifact();
- @JsonProperty(value = "sp-limits")
- abstract LimitForXml getSPLimits();
+ @JsonIgnore
+ abstract String getVersionableId();
- @JsonProperty(value = "vendor-limits")
- abstract LimitForXml getVendorLimits();
+ @JsonProperty(value = "sp-limits")
+ abstract LimitForXml getSPLimits();
- @JsonIgnore
- abstract Collection<LimitEntity> getLimits();
+ @JsonProperty(value = "vendor-limits")
+ abstract LimitForXml getVendorLimits();
- @JsonIgnore
- abstract String getStartDate();
+ @JsonIgnore
+ abstract Collection<LimitEntity> getLimits();
- @JsonIgnore
- abstract String getExpiryDate();
+ @JsonIgnore
+ abstract String getStartDate();
- @JsonProperty(value = "start-date")
- abstract String getIsoFormatStartDate();
+ @JsonIgnore
+ abstract String getExpiryDate();
- @JsonProperty(value = "expiry-date")
- abstract String getIsoFormatExpiryDate();
+ @JsonProperty(value = "start-date")
+ abstract String getIsoFormatStartDate();
- @JsonProperty(value = "threshold-value")
- abstract ThresholdForXml getThresholdForArtifact();
+ @JsonProperty(value = "expiry-date")
+ abstract String getIsoFormatExpiryDate();
- @JsonIgnore
- abstract String getThresholdUnits();
+ @JsonProperty(value = "threshold-value")
+ abstract ThresholdForXml getThresholdForArtifact();
- @JsonIgnore
- abstract float getThresholdValue();
+ @JsonIgnore
+ abstract String getThresholdUnits();
+ @JsonIgnore
+ abstract float getThresholdValue();
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinLicenseKeyGroupEntityForVnfArtifact.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinLicenseKeyGroupEntityForVnfArtifact.java
index f560f363a1..c9e21806ce 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinLicenseKeyGroupEntityForVnfArtifact.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinLicenseKeyGroupEntityForVnfArtifact.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,11 +17,12 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types.mixins;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.Collection;
+import java.util.Set;
import org.openecomp.sdc.vendorlicense.dao.types.ChoiceOrOther;
import org.openecomp.sdc.vendorlicense.dao.types.LimitEntity;
import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope;
@@ -30,78 +31,74 @@ import org.openecomp.sdc.vendorlicense.dao.types.xml.LimitForXml;
import org.openecomp.sdc.vendorlicense.dao.types.xml.OperationalScopeForXml;
import org.openecomp.sdc.vendorlicense.dao.types.xml.ThresholdForXml;
-import java.util.Collection;
-import java.util.Set;
-
public abstract class MixinLicenseKeyGroupEntityForVnfArtifact {
- @JsonProperty(value = "license-key-group-invariant-uuid")
- abstract String getId();
-
- @JsonProperty(value = "manufacturer-reference-number")
- abstract String getManufacturerReferenceNumber();
- @JsonIgnore
- abstract Set<String> getReferencingFeatureGroups();
+ @JsonProperty(value = "license-key-group-invariant-uuid")
+ abstract String getId();
- @JsonIgnore
- abstract String getVersion();
+ @JsonProperty(value = "manufacturer-reference-number")
+ abstract String getManufacturerReferenceNumber();
- @JsonProperty(value = "version")
- abstract String getVersionForArtifact();
+ @JsonIgnore
+ abstract Set<String> getReferencingFeatureGroups();
- @JsonIgnore
- abstract String getVendorLicenseModelId();
+ @JsonIgnore
+ abstract String getVersion();
+ @JsonProperty(value = "version")
+ abstract String getVersionForArtifact();
- @JsonIgnore
- abstract String getEntityType();
+ @JsonIgnore
+ abstract String getVendorLicenseModelId();
- @JsonProperty(value = "license-key-group-uuid")
- abstract String getVersionUuId();
+ @JsonIgnore
+ abstract String getEntityType();
- @JsonIgnore
- abstract String getFirstClassCitizenId();
+ @JsonProperty(value = "license-key-group-uuid")
+ abstract String getVersionUuId();
+ @JsonIgnore
+ abstract String getFirstClassCitizenId();
- @JsonIgnore
- abstract ChoiceOrOther<OperationalScope> getOperationalScope();
+ @JsonIgnore
+ abstract ChoiceOrOther<OperationalScope> getOperationalScope();
- @JsonProperty(value = "operational-scope")
- abstract OperationalScopeForXml getOperationalScopeForArtifact();
+ @JsonProperty(value = "operational-scope")
+ abstract OperationalScopeForXml getOperationalScopeForArtifact();
+ @JsonIgnore
+ abstract LicenseKeyTypeForXml getTypeForArtifact();
- @JsonIgnore
- abstract LicenseKeyTypeForXml getTypeForArtifact();
+ @JsonIgnore
+ abstract String getVersionableId();
- @JsonIgnore
- abstract String getVersionableId();
+ @JsonProperty(value = "threshold-value")
+ abstract ThresholdForXml getThresholdForArtifact();
- @JsonProperty(value = "threshold-value")
- abstract ThresholdForXml getThresholdForArtifact();
- @JsonProperty(value = "sp-limits")
- abstract LimitForXml getSPLimits();
+ @JsonProperty(value = "sp-limits")
+ abstract LimitForXml getSPLimits();
- @JsonProperty(value = "vendor-limits")
- abstract LimitForXml getVendorLimits();
+ @JsonProperty(value = "vendor-limits")
+ abstract LimitForXml getVendorLimits();
- @JsonIgnore
- abstract Collection<LimitEntity> getLimits();
+ @JsonIgnore
+ abstract Collection<LimitEntity> getLimits();
- @JsonIgnore
- abstract String getStartDate();
+ @JsonIgnore
+ abstract String getStartDate();
- @JsonIgnore
- abstract String getExpiryDate();
+ @JsonIgnore
+ abstract String getExpiryDate();
- @JsonProperty(value = "start-date")
- abstract String getIsoFormatStartDate();
+ @JsonProperty(value = "start-date")
+ abstract String getIsoFormatStartDate();
- @JsonProperty(value = "expiry-date")
- abstract String getIsoFormatExpiryDate();
+ @JsonProperty(value = "expiry-date")
+ abstract String getIsoFormatExpiryDate();
- @JsonIgnore
- abstract String getThresholdUnits();
+ @JsonIgnore
+ abstract String getThresholdUnits();
- @JsonIgnore
- abstract float getThresholdValue();
+ @JsonIgnore
+ abstract float getThresholdValue();
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinLimitArtifact.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinLimitArtifact.java
index 1a15a6e557..7627d5f243 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinLimitArtifact.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinLimitArtifact.java
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types.mixins;
import com.fasterxml.jackson.annotation.JsonIgnore;
@@ -27,16 +26,15 @@ import org.openecomp.sdc.vendorlicense.dao.types.xml.EntitlementTimeForXml;
public abstract class MixinLimitArtifact {
- @JsonIgnore
- abstract String getTime();
-
- @JsonIgnore
- abstract String getAggregationFunction();
+ @JsonIgnore
+ abstract String getTime();
- @JsonProperty(value = "aggregation-function")
- abstract AggregationFunctionForXml getAggregationFunctionForArtifact();
+ @JsonIgnore
+ abstract String getAggregationFunction();
- @JsonProperty(value = "time")
- abstract EntitlementTimeForXml getTimeForArtifact();
+ @JsonProperty(value = "aggregation-function")
+ abstract AggregationFunctionForXml getAggregationFunctionForArtifact();
+ @JsonProperty(value = "time")
+ abstract EntitlementTimeForXml getTimeForArtifact();
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/util/VendorLicenseArtifactsServiceUtils.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/util/VendorLicenseArtifactsServiceUtils.java
index 7153f45d2f..7dbbad7b44 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/util/VendorLicenseArtifactsServiceUtils.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/util/VendorLicenseArtifactsServiceUtils.java
@@ -13,17 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.vendorlicense.licenseartifacts.impl.util;
-
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
-
import org.apache.commons.collections4.MultiValuedMap;
import org.apache.commons.collections4.multimap.ArrayListValuedHashMap;
import org.openecomp.sdc.vendorlicense.HealingServiceFactory;
@@ -38,148 +35,116 @@ import org.openecomp.sdc.versioning.dao.types.Version;
import org.openecomp.sdc.versioning.dao.types.VersionStatus;
import org.openecomp.sdc.versioning.dao.types.VersionableEntity;
-
-
/**
* @author katyr
* @since January 10, 2017
*/
-
public class VendorLicenseArtifactsServiceUtils {
- private static final HealingService healingService =
- HealingServiceFactory.getInstance().createInterface();
- /**
- * maps the entities by id
- *
- * @return a Map of id -> list of versionable entities with that id
- */
- private static MultiValuedMap<String, VersionableEntity> mapById(
- Collection<? extends VersionableEntity> versionableEntities) {
- MultiValuedMap<String, VersionableEntity> mappedById = new ArrayListValuedHashMap<>();
- for (VersionableEntity ve : versionableEntities) {
- mappedById.put(ve.getId(), ve);
+ private static final HealingService healingService = HealingServiceFactory.getInstance().createInterface();
+
+ /**
+ * maps the entities by id
+ *
+ * @return a Map of id -> list of versionable entities with that id
+ */
+ private static MultiValuedMap<String, VersionableEntity> mapById(Collection<? extends VersionableEntity> versionableEntities) {
+ MultiValuedMap<String, VersionableEntity> mappedById = new ArrayListValuedHashMap<>();
+ for (VersionableEntity ve : versionableEntities) {
+ mappedById.put(ve.getId(), ve);
+ }
+ return mappedById;
}
- return mappedById;
- }
-
- /**
- * For all entities with same id, only entities that differ from one another will be returned.
- * If no change has occured, the entity with the earlier VLM version will be returned.
- * If only one version of said entities exists it will be returned
- *
- * @return a list of entities that has been changed
- */
- public static List<VersionableEntity> filterChangedEntities(
- Collection<? extends VersionableEntity> versionableEntities) {
- MultiValuedMap<String, VersionableEntity> entitiesById = mapById(
- versionableEntities);
- MultiValuedMap<String, VersionableEntity> entitiesByVersionUuId =
- new ArrayListValuedHashMap<>();
- List<VersionableEntity> changedOnly = new ArrayList<>();
- for (String epId : entitiesById.keySet()) {
- Collection<VersionableEntity> versionableEntitiesForId = entitiesById.get(epId);
- for (VersionableEntity ep : versionableEntitiesForId) {
- entitiesByVersionUuId.put(ep.getVersionUuId(), ep);
- }
+ /**
+ * For all entities with same id, only entities that differ from one another will be returned. If no change has occured, the entity with the
+ * earlier VLM version will be returned. If only one version of said entities exists it will be returned
+ *
+ * @return a list of entities that has been changed
+ */
+ public static List<VersionableEntity> filterChangedEntities(Collection<? extends VersionableEntity> versionableEntities) {
+ MultiValuedMap<String, VersionableEntity> entitiesById = mapById(versionableEntities);
+ MultiValuedMap<String, VersionableEntity> entitiesByVersionUuId = new ArrayListValuedHashMap<>();
+ List<VersionableEntity> changedOnly = new ArrayList<>();
+ for (String epId : entitiesById.keySet()) {
+ Collection<VersionableEntity> versionableEntitiesForId = entitiesById.get(epId);
+ for (VersionableEntity ep : versionableEntitiesForId) {
+ entitiesByVersionUuId.put(ep.getVersionUuId(), ep);
+ }
+ }
+ //for every list of eps which have the same uuid, get the one with the earliest vlm version.
+ for (String versionUid : entitiesByVersionUuId.keySet()) {
+ List<VersionableEntity> versionableEntitiesForUuid = (List<VersionableEntity>) entitiesByVersionUuId.get(versionUid);
+ versionableEntitiesForUuid.sort(new VersionableEntitySortByVlmMajorVersion());
+ changedOnly.add(versionableEntitiesForUuid.get(0));
+ }
+ return changedOnly;
}
- //for every list of eps which have the same uuid, get the one with the earliest vlm version.
- for (String versionUid : entitiesByVersionUuId.keySet()) {
- List<VersionableEntity> versionableEntitiesForUuid =
- (List<VersionableEntity>) entitiesByVersionUuId.get(versionUid);
- versionableEntitiesForUuid.sort(new VersionableEntitySortByVlmMajorVersion());
- changedOnly.add(versionableEntitiesForUuid.get(0));
+ public static Set<LicenseKeyGroupEntity> healLkgs(Collection<? extends VersionableEntity> licenseKeyGroupEntities) {
+ Set<LicenseKeyGroupEntity> healed = new HashSet<>();
+ for (VersionableEntity licenseKeyGroupEntity : licenseKeyGroupEntities) {
+ healed.add((LicenseKeyGroupEntity) VendorLicenseArtifactsServiceImpl.healingService.heal(licenseKeyGroupEntity));
+ }
+ return healed;
}
- return changedOnly;
- }
-
- public static Set<LicenseKeyGroupEntity> healLkgs(
- Collection<? extends VersionableEntity> licenseKeyGroupEntities) {
- Set<LicenseKeyGroupEntity> healed = new HashSet<>();
- for (VersionableEntity licenseKeyGroupEntity : licenseKeyGroupEntities) {
- healed.add((LicenseKeyGroupEntity) VendorLicenseArtifactsServiceImpl.healingService
- .heal(licenseKeyGroupEntity));
+ public static Set<EntitlementPoolEntity> healEPs(Collection<? extends VersionableEntity> entitlementPoolEntities) {
+ Set<EntitlementPoolEntity> healed = new HashSet<>();
+ for (VersionableEntity entitlementPoolEntity : entitlementPoolEntities) {
+ healed.add((EntitlementPoolEntity) VendorLicenseArtifactsServiceImpl.healingService.heal(entitlementPoolEntity));
+ }
+ return healed;
}
- return healed;
- }
-
- public static Set<EntitlementPoolEntity> healEPs(
- Collection<? extends VersionableEntity> entitlementPoolEntities) {
- Set<EntitlementPoolEntity> healed = new HashSet<>();
- for (VersionableEntity entitlementPoolEntity : entitlementPoolEntities) {
- healed.add((EntitlementPoolEntity) VendorLicenseArtifactsServiceImpl.healingService
- .heal(entitlementPoolEntity));
+ public static List<Version> getFinalVersionsForVlm(String vlmId) {
+ VersioningManager versioningManager = VersioningManagerFactory.getInstance().createInterface();
+ return versioningManager.list(vlmId).stream().filter(version -> VersionStatus.Certified == version.getStatus())
+ .map(certifiedVersion -> versioningManager.get(vlmId, certifiedVersion)) //sync to private
+ .collect(Collectors.toList());
}
- return healed;
- }
-
- public static List<Version> getFinalVersionsForVlm(String vlmId) {
- VersioningManager versioningManager = VersioningManagerFactory.getInstance().createInterface();
- return versioningManager.list(vlmId).stream()
- .filter(version -> VersionStatus.Certified == version.getStatus())
- .map(certifiedVersion -> versioningManager.get(vlmId, certifiedVersion)) //sync to private
- .collect(Collectors.toList());
- }
-
- public static String getVendorName(String vendorLicenseModelId) {
- return AsdcItemManagerFactory.getInstance().createInterface().get(vendorLicenseModelId)
- .getName();
- }
-
-
- /**
- * Written to handle the consequences of ATTASDC-4780 where version_uuid was not saved or
- * retrieved correctly by DAO for EPs and LKGs. Performs a healing of sorts according to the
- * following : 1. all versions of a specific entity (EP or LKG that have the same invariant_uuid)
- * are ordered by their VLM version 2. first element is sent to healing (which will set a
- * versionUUID for it IF it doesnt exist) 3. each subsequent element is compared to previous . If
- * same, UUID is copied from the previous element , if they differ - the current element is sent
- * to healing as before. For VLMs created post-bugfix this code should not update any element
- */
- public static Collection<? extends VersionableEntity> prepareForFiltering(Collection<? extends
- VersionableEntity> versionableEntities, boolean isEP) {
- MultiValuedMap<String, VersionableEntity> entitiesById = mapById(
- versionableEntities);
-
- for (String epId : entitiesById.keySet()) {
- List<VersionableEntity> versionableEntitiesForId = new ArrayList<>();
- versionableEntitiesForId.addAll(entitiesById.get(epId));
- versionableEntitiesForId.sort(new VersionableEntitySortByVlmMajorVersion());
- healingService.heal(versionableEntitiesForId.get(0));
- for (int i = 1; i < versionableEntitiesForId.size(); i++) {
- if (isEP) {
- EntitlementPoolEntity current = (EntitlementPoolEntity) versionableEntitiesForId.get(i);
- EntitlementPoolEntity previous = (EntitlementPoolEntity) versionableEntitiesForId
- .get(i - 1);
- if (current.equals(previous) && current.getVersionUuId() == null) {
- current.setVersionUuId(previous.getVersionUuId());
- healingService.persistNoHealing(current);
- } else {
- versionableEntitiesForId.set(i, healingService.heal(versionableEntitiesForId.get(i)));
- }
-
- } else {
- LicenseKeyGroupEntity current = (LicenseKeyGroupEntity) versionableEntitiesForId.get(i);
- LicenseKeyGroupEntity previous = (LicenseKeyGroupEntity) versionableEntitiesForId
- .get(i - 1);
- if (current.equals(previous) && current.getVersionUuId() == null) {
- current.setVersionUuId(previous.getVersionUuId());
- healingService.persistNoHealing(current);
- } else {
- versionableEntitiesForId.set(i, healingService.heal(versionableEntitiesForId.get(i)));
- }
-
+ public static String getVendorName(String vendorLicenseModelId) {
+ return AsdcItemManagerFactory.getInstance().createInterface().get(vendorLicenseModelId).getName();
+ }
+ /**
+ * Written to handle the consequences of ATTASDC-4780 where version_uuid was not saved or retrieved correctly by DAO for EPs and LKGs. Performs a
+ * healing of sorts according to the following : 1. all versions of a specific entity (EP or LKG that have the same invariant_uuid) are ordered by
+ * their VLM version 2. first element is sent to healing (which will set a versionUUID for it IF it doesnt exist) 3. each subsequent element is
+ * compared to previous . If same, UUID is copied from the previous element , if they differ - the current element is sent to healing as before.
+ * For VLMs created post-bugfix this code should not update any element
+ */
+ public static Collection<? extends VersionableEntity> prepareForFiltering(Collection<? extends VersionableEntity> versionableEntities,
+ boolean isEP) {
+ MultiValuedMap<String, VersionableEntity> entitiesById = mapById(versionableEntities);
+ for (String epId : entitiesById.keySet()) {
+ List<VersionableEntity> versionableEntitiesForId = new ArrayList<>();
+ versionableEntitiesForId.addAll(entitiesById.get(epId));
+ versionableEntitiesForId.sort(new VersionableEntitySortByVlmMajorVersion());
+ healingService.heal(versionableEntitiesForId.get(0));
+ for (int i = 1; i < versionableEntitiesForId.size(); i++) {
+ if (isEP) {
+ EntitlementPoolEntity current = (EntitlementPoolEntity) versionableEntitiesForId.get(i);
+ EntitlementPoolEntity previous = (EntitlementPoolEntity) versionableEntitiesForId.get(i - 1);
+ if (current.equals(previous) && current.getVersionUuId() == null) {
+ current.setVersionUuId(previous.getVersionUuId());
+ healingService.persistNoHealing(current);
+ } else {
+ versionableEntitiesForId.set(i, healingService.heal(versionableEntitiesForId.get(i)));
+ }
+ } else {
+ LicenseKeyGroupEntity current = (LicenseKeyGroupEntity) versionableEntitiesForId.get(i);
+ LicenseKeyGroupEntity previous = (LicenseKeyGroupEntity) versionableEntitiesForId.get(i - 1);
+ if (current.equals(previous) && current.getVersionUuId() == null) {
+ current.setVersionUuId(previous.getVersionUuId());
+ healingService.persistNoHealing(current);
+ } else {
+ versionableEntitiesForId.set(i, healingService.heal(versionableEntitiesForId.get(i)));
+ }
+ }
+ }
}
- }
+ return versionableEntities;
}
- return versionableEntities;
- }
-
-
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/util/VersionableEntitySortByVlmMajorVersion.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/util/VersionableEntitySortByVlmMajorVersion.java
index 1aee2dd97e..2626382479 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/util/VersionableEntitySortByVlmMajorVersion.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/util/VersionableEntitySortByVlmMajorVersion.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,22 +17,19 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.vendorlicense.licenseartifacts.impl.util;
-import org.openecomp.sdc.versioning.dao.types.VersionableEntity;
-
import java.util.Comparator;
+import org.openecomp.sdc.versioning.dao.types.VersionableEntity;
/**
* @author katyr
* @since January 10, 2017
*/
-
public class VersionableEntitySortByVlmMajorVersion implements Comparator<VersionableEntity> {
- @Override
- public int compare(VersionableEntity o1, VersionableEntity o2) {
- return Integer.compare(o1.getVersion().getMajor(), o2.getVersion().getMajor());
- }
+ @Override
+ public int compare(VersionableEntity o1, VersionableEntity o2) {
+ return Integer.compare(o1.getVersion().getMajor(), o2.getVersion().getMajor());
+ }
}