diff options
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao')
39 files changed, 1757 insertions, 1992 deletions
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; + } } |