From ec7da6aea30a1b73d1e0f5f75d2b6119ed8fa251 Mon Sep 17 00:00:00 2001 From: "Ben David, Elad (eb7504)" Date: Tue, 17 Mar 2020 18:12:17 +0200 Subject: Entitlement Pool - Support Type Field Change-Id: Ibd9996cce04849332bd23dd62e6143386cdd9a70 Issue-ID: SDC-2820 Signed-off-by: Ben David, Elad (eb7504) --- ...lementPoolEntityToEntitlementPoolEntityDto.java | 1 + ...ementPoolRequestDtoToEntitlementPoolEntity.java | 1 + ...ntPoolEntityToEntitlementPoolEntityDtoTest.java | 13 ++++++ ...tPoolRequestDtoToEntitlementPoolEntityTest.java | 14 +++++++ .../types/EntitlementPoolRequestDto.java | 12 ++++++ .../vendorlicense/impl/EntitlementPoolTest.java | 48 +++++++++++----------- .../dao/types/EntitlementPoolEntity.java | 13 +++++- .../dao/types/EntitlementPoolType.java | 35 ++++++++++++++++ .../zusammen/EntitlementPoolZusammenDaoImpl.java | 1 + .../ElementToEntitlementPoolConvertor.java | 2 + openecomp-be/pom.xml | 5 --- 11 files changed, 116 insertions(+), 29 deletions(-) create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/EntitlementPoolType.java (limited to 'openecomp-be') diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolEntityToEntitlementPoolEntityDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolEntityToEntitlementPoolEntityDto.java index 52135fad55..2510bd0634 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolEntityToEntitlementPoolEntityDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolEntityToEntitlementPoolEntityDto.java @@ -32,6 +32,7 @@ public class MapEntitlementPoolEntityToEntitlementPoolEntityDto target.setId(source.getId()); target.setName(source.getName()); target.setDescription(source.getDescription()); + target.setType(source.getType()); target.setThresholdValue(source.getThresholdValue()); target.setThresholdUnits(source.getThresholdUnit()); target.setIncrements(source.getIncrements()); diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolRequestDtoToEntitlementPoolEntity.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolRequestDtoToEntitlementPoolEntity.java index 5832596580..5c45ed652a 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolRequestDtoToEntitlementPoolEntity.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolRequestDtoToEntitlementPoolEntity.java @@ -32,6 +32,7 @@ public class MapEntitlementPoolRequestDtoToEntitlementPoolEntity target.setName(source.getName()); target.setManufacturerReferenceNumber(source.getManufacturerReferenceNumber()); target.setDescription(source.getDescription()); + target.setType(source.getType()); target.setThresholdValue(source.getThresholdValue()); target.setThresholdUnit(source.getThresholdUnits()); target.setIncrements(source.getIncrements()); diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolEntityToEntitlementPoolEntityDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolEntityToEntitlementPoolEntityDtoTest.java index f2010e62de..999b430bd8 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolEntityToEntitlementPoolEntityDtoTest.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolEntityToEntitlementPoolEntityDtoTest.java @@ -23,6 +23,7 @@ import java.util.Collections; import java.util.HashSet; import java.util.Set; import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity; +import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolType; import org.openecomp.sdc.vendorlicense.dao.types.MultiChoiceOrOther; import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope; import org.openecomp.sdcrests.vendorlicense.types.EntitlementPoolEntityDto; @@ -154,4 +155,16 @@ public class MapEntitlementPoolEntityToEntitlementPoolEntityDtoTest { mapper.doMapping(source, target); assertEquals(target.getManufacturerReferenceNumber(), param); } + + @Test + public void testType() { + EntitlementPoolEntity source = new EntitlementPoolEntity(); + EntitlementPoolEntityDto target = new EntitlementPoolEntityDto(); + MapEntitlementPoolEntityToEntitlementPoolEntityDto mapper = + new MapEntitlementPoolEntityToEntitlementPoolEntityDto(); + EntitlementPoolType entitlementPoolType = EntitlementPoolType.One_Time; + source.setType(entitlementPoolType); + mapper.doMapping(source, target); + assertEquals(target.getType(), entitlementPoolType); + } } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolRequestDtoToEntitlementPoolEntityTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolRequestDtoToEntitlementPoolEntityTest.java index 7ff6fb78f5..0c28ceef36 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolRequestDtoToEntitlementPoolEntityTest.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolRequestDtoToEntitlementPoolEntityTest.java @@ -21,6 +21,7 @@ import static org.testng.Assert.assertEquals; import java.util.Collections; import java.util.HashSet; import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity; +import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolType; import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope; import org.openecomp.sdcrests.vendorlicense.types.EntitlementPoolRequestDto; import org.openecomp.sdcrests.vendorlicense.types.MultiChoiceOrOtherDto; @@ -126,6 +127,19 @@ public class MapEntitlementPoolRequestDtoToEntitlementPoolEntityTest { assertEquals(target.getManufacturerReferenceNumber(), param); } + @Test + public void testType() { + EntitlementPoolRequestDto source = new EntitlementPoolRequestDto(); + EntitlementPoolEntity target = new EntitlementPoolEntity(); + MapEntitlementPoolRequestDtoToEntitlementPoolEntity mapper = new + MapEntitlementPoolRequestDtoToEntitlementPoolEntity(); + EntitlementPoolType entitlementPoolType = EntitlementPoolType.Universal; + source.setType(entitlementPoolType); + mapper.doMapping(source, target); + assertEquals(target.getType(), entitlementPoolType); + } + + enum TestEnum { Yes } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/EntitlementPoolRequestDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/EntitlementPoolRequestDto.java index dbd6ddc063..f9a04566b2 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/EntitlementPoolRequestDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/EntitlementPoolRequestDto.java @@ -24,6 +24,7 @@ package org.openecomp.sdcrests.vendorlicense.types; import io.swagger.v3.oas.annotations.media.Schema; import org.codehaus.jackson.annotate.JsonIgnoreProperties; import org.hibernate.validator.constraints.NotBlank; +import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolType; import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope; import org.openecomp.sdc.vendorlicense.dao.types.ThresholdUnit; @@ -46,6 +47,9 @@ public class EntitlementPoolRequestDto { @Size(max = 1000) private String description; + @NotNull + private EntitlementPoolType type; + private Integer thresholdValue; private ThresholdUnit thresholdUnits; @@ -82,6 +86,14 @@ public class EntitlementPoolRequestDto { this.description = description; } + public EntitlementPoolType getType() { + return type; + } + + public void setType(EntitlementPoolType type) { + this.type = type; + } + public Integer getThresholdValue() { return thresholdValue; } diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/EntitlementPoolTest.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/EntitlementPoolTest.java index 5db85fef06..d7edce3c78 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/EntitlementPoolTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/EntitlementPoolTest.java @@ -31,6 +31,7 @@ import org.openecomp.sdc.vendorlicense.dao.LimitDao; import org.openecomp.sdc.vendorlicense.dao.types.AggregationFunction; import org.openecomp.sdc.vendorlicense.dao.types.EntitlementMetric; import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity; +import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolType; import org.openecomp.sdc.vendorlicense.dao.types.EntitlementTime; import org.openecomp.sdc.vendorlicense.dao.types.MultiChoiceOrOther; import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope; @@ -78,6 +79,7 @@ public class EntitlementPoolTest { public EntitlementPoolEntity createEntitlementPool(String vlmId, Version version, String id, String name, String desc, int threshold, ThresholdUnit thresholdUnit, + EntitlementPoolType type, EntitlementMetric entitlementMetricChoice, String entitlementMetricOther, String increments, @@ -93,6 +95,7 @@ public class EntitlementPoolTest { entitlementPool.setVersion(version); entitlementPool.setName(name); entitlementPool.setDescription(desc); + entitlementPool.setType(type); entitlementPool.setThresholdValue(threshold); entitlementPool.setThresholdUnit(thresholdUnit); entitlementPool.setIncrements(increments); @@ -102,7 +105,7 @@ public class EntitlementPoolTest { } @Before - public void setUp() throws Exception { + public void setUp() { MockitoAnnotations.initMocks(this); } @@ -121,7 +124,7 @@ public class EntitlementPoolTest { opScopeChoices.add(OperationalScope.Network_Wide); EntitlementPoolEntity ep2 = createEntitlementPool("vlm1Id", null, ep1_id, EP1_NAME, "EP2 dec", 70, ThresholdUnit - .Absolute, + .Absolute, EntitlementPoolType.Unique, EntitlementMetric.Other, "exception metric2", "inc2", AggregationFunction.Average, null, opScopeChoices, null, EntitlementTime.Other, "time2", "sku2"); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy"); @@ -144,8 +147,8 @@ public class EntitlementPoolTest { opScopeChoices.add(OperationalScope.Network_Wide); EntitlementPoolEntity ep2 = createEntitlementPool("vlm2Id", null, ep1_id, EP1_NAME, "EP2 dec", 70, - ThresholdUnit.Absolute, - EntitlementMetric.Other, "exception metric2", "inc2", AggregationFunction.Average, null, + ThresholdUnit.Absolute, EntitlementPoolType.Unique, + EntitlementMetric.Other, "exception metric2", "inc2", AggregationFunction.Average, null, opScopeChoices, null, EntitlementTime.Other, "time2", "sku2"); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy"); ep2.setStartDate(LocalDate.now().format(formatter)); @@ -166,8 +169,8 @@ public class EntitlementPoolTest { opScopeChoices.add(OperationalScope.Network_Wide); EntitlementPoolEntity ep2 = createEntitlementPool("vlm3Id", null, ep1_id, EP1_NAME, "EP2 dec", 70, - ThresholdUnit.Absolute, - EntitlementMetric.Other, "exception metric2", "inc2", AggregationFunction.Average, null, + ThresholdUnit.Absolute, EntitlementPoolType.Unique, + EntitlementMetric.Other, "exception metric2", "inc2", AggregationFunction.Average, null, opScopeChoices, null, EntitlementTime.Other, "time2", "sku2"); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy"); ep2.setExpiryDate(LocalDate.now().plusDays(2L).format(formatter)); @@ -187,8 +190,8 @@ public class EntitlementPoolTest { opScopeChoices.add(OperationalScope.Network_Wide); EntitlementPoolEntity ep2 = createEntitlementPool("vlm4Id", null, ep1_id, EP1_NAME, "EP2 dec", 70, - ThresholdUnit.Absolute, - EntitlementMetric.Other, "exception metric2", "inc2", AggregationFunction.Average, null, + ThresholdUnit.Absolute, EntitlementPoolType.Unique, + EntitlementMetric.Other, "exception metric2", "inc2", AggregationFunction.Average, null, opScopeChoices, null, EntitlementTime.Other, "time2", "sku2"); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy"); ep2.setStartDate(LocalDate.now().format(formatter)); @@ -208,7 +211,7 @@ public class EntitlementPoolTest { opScopeChoices.add(OperationalScope.Network_Wide); EntitlementPoolEntity ep2 = createEntitlementPool("vlm2Id", null, ep1_id, EP1_NAME, "EP2 dec", 70, - ThresholdUnit.Absolute, + ThresholdUnit.Absolute, EntitlementPoolType.Unique, EntitlementMetric.Other, "exception metric2", "inc2", AggregationFunction.Average, null, opScopeChoices, null, EntitlementTime.Other, "time2", "sku2"); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy"); @@ -230,7 +233,7 @@ public class EntitlementPoolTest { opScopeChoices.add(OperationalScope.Network_Wide); EntitlementPoolEntity ep2 = createEntitlementPool("vlm2Id", null, ep1_id, EP1_NAME, "EP2 dec", 70, - ThresholdUnit.Absolute, + ThresholdUnit.Absolute, EntitlementPoolType.Unique, EntitlementMetric.Other, "exception metric2", "inc2", AggregationFunction.Average, null, opScopeChoices, null, EntitlementTime.Other, "time2", "sku2"); ep2.setStartDate(null); @@ -250,9 +253,8 @@ public class EntitlementPoolTest { opScopeChoices.add(OperationalScope.Network_Wide); EntitlementPoolEntity ep2 = createEntitlementPool(vlm1_id, VERSION01, ep1_id, EP1_NAME, "EP2 dec", 70, - ThresholdUnit - .Absolute, - EntitlementMetric.Other, "exception metric2", "inc2", AggregationFunction.Average, null, + ThresholdUnit.Absolute, EntitlementPoolType.Unique, + EntitlementMetric.Other, "exception metric2", "inc2", AggregationFunction.Average, null, opScopeChoices, null, EntitlementTime.Other, "time2", "sku2"); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy"); ep2.setStartDate(LocalDate.now().minusDays(3L).format(formatter)); @@ -271,8 +273,8 @@ public class EntitlementPoolTest { opScopeChoices.add(OperationalScope.Network_Wide); EntitlementPoolEntity ep2 = createEntitlementPool("vlm2Id", null, ep1_id, EP1_NAME, "EP2 dec", 70, - ThresholdUnit.Absolute, - EntitlementMetric.Other, "exception metric2", "inc2", AggregationFunction.Average, null, + ThresholdUnit.Absolute, EntitlementPoolType.Unique, + EntitlementMetric.Other, "exception metric2", "inc2", AggregationFunction.Average, null, opScopeChoices, null, EntitlementTime.Other, "time2", "sku2"); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy"); ep2.setStartDate(LocalDate.now().format(formatter)); @@ -294,8 +296,8 @@ public class EntitlementPoolTest { opScopeChoices.add(OperationalScope.Network_Wide); EntitlementPoolEntity ep2 = createEntitlementPool("vlm3Id", null, ep1_id, EP1_NAME, "EP2 dec", 70, - ThresholdUnit.Absolute, - EntitlementMetric.Other, "exception metric2", "inc2", AggregationFunction.Average, + ThresholdUnit.Absolute, EntitlementPoolType.Unique, + EntitlementMetric.Other, "exception metric2", "inc2", AggregationFunction.Average, null, opScopeChoices, null, EntitlementTime.Other, "time2", "sku2"); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy"); @@ -318,8 +320,8 @@ public class EntitlementPoolTest { opScopeChoices.add(OperationalScope.Network_Wide); EntitlementPoolEntity ep2 = createEntitlementPool("vlm4Id", null, ep1_id, EP1_NAME, "EP2 dec", 70, - ThresholdUnit.Absolute, - EntitlementMetric.Other, "exception metric2", "inc2", AggregationFunction.Average, + ThresholdUnit.Absolute, EntitlementPoolType.Unique, + EntitlementMetric.Other, "exception metric2", "inc2", AggregationFunction.Average, null, opScopeChoices, null, EntitlementTime.Other, "time2", "sku2"); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy"); @@ -342,7 +344,7 @@ public class EntitlementPoolTest { EntitlementPoolEntity entitlementPool = createEntitlementPool(vlm1_id, VERSION01, ep1_id, EP1_NAME, "EP2 dec", 70, - ThresholdUnit.Absolute, EntitlementMetric.Other, "exception metric2", "inc2", + ThresholdUnit.Absolute, EntitlementPoolType.Unique, EntitlementMetric.Other, "exception metric2", "inc2", AggregationFunction.Average, null, opScopeChoices, null, EntitlementTime.Other, "time2", "sku2"); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy"); @@ -371,7 +373,7 @@ public class EntitlementPoolTest { EntitlementPoolEntity entitlementPool = createEntitlementPool(vlm1_id, VERSION01, ep1_id, EP1_NAME, "EP2 dec", 70, - ThresholdUnit.Absolute, EntitlementMetric.Other, "exception metric2", "inc2", + ThresholdUnit.Absolute, EntitlementPoolType.Unique, EntitlementMetric.Other, "exception metric2", "inc2", AggregationFunction.Average, null, opScopeChoices, null, EntitlementTime.Other, "time2", "sku2"); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy'T'HH:mm:ss'Z'"); @@ -400,11 +402,11 @@ public class EntitlementPoolTest { doReturn(Arrays.asList( createEntitlementPool(vlm1_id, VERSION01, ep1_id, EP1_NAME, "EP1 dec", 70, - ThresholdUnit.Absolute, EntitlementMetric.Other, "exception metric1", + ThresholdUnit.Absolute, EntitlementPoolType.Unique, EntitlementMetric.Other, "exception metric1", "inc1", AggregationFunction.Average, null, opScopeChoices, null, EntitlementTime.Other, "time1", "sku1"), createEntitlementPool(vlm1_id, VERSION01, ep2_id, EP2_NAME, "EP2 dec", 70, - ThresholdUnit.Absolute, EntitlementMetric.Other, "exception metric2", + ThresholdUnit.Absolute, EntitlementPoolType.Unique, EntitlementMetric.Other, "exception metric2", "inc2", AggregationFunction.Average, null, opScopeChoices, null, EntitlementTime.Other, "time2", "sku2"))) .when(vendorLicenseFacade).listEntitlementPools(vlm1_id, VERSION01); 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 4c2435a3a5..4d3c1d63a7 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 @@ -57,6 +57,7 @@ public class EntitlementPoolEntity implements VersionableEntity { private String id; private String name; private String description; + private EntitlementPoolType type; @Column(name = "threshold") private Integer thresholdValue; @@ -179,6 +180,14 @@ public class EntitlementPoolEntity implements VersionableEntity { this.description = description; } + public EntitlementPoolType getType() { + return type; + } + + public void setType(EntitlementPoolType type) { + this.type = type; + } + public Integer getThresholdValue() { return thresholdValue; } @@ -311,7 +320,7 @@ public class EntitlementPoolEntity implements VersionableEntity { @Override public int hashCode() { return Objects - .hash(vendorLicenseModelId, version, id, name, description, thresholdValue, thresholdUnit, + .hash(vendorLicenseModelId, version, id, name, description, type, thresholdValue, thresholdUnit, increments, operationalScope, referencingFeatureGroups, startDate, expiryDate); } @@ -329,6 +338,7 @@ public class EntitlementPoolEntity implements VersionableEntity { && 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) @@ -346,6 +356,7 @@ public class EntitlementPoolEntity implements VersionableEntity { + ", id='" + id + '\'' + ", name='" + name + '\'' + ", description='" + description + '\'' + + ", type=" + type + ", thresholdValue=" + thresholdValue + ", thresholdUnit='" + thresholdUnit + '\'' + ", increments='" + increments + '\'' 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 new file mode 100644 index 0000000000..3b66fab110 --- /dev/null +++ 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 @@ -0,0 +1,35 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.vendorlicense.dao.types; + +public enum EntitlementPoolType { + Universal, + Unique, + One_Time; + + public static EntitlementPoolType permissiveValueOf(String name) { + if (name == null){ + return null; + } else { + return EntitlementPoolType.valueOf(name); + } + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/EntitlementPoolZusammenDaoImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/EntitlementPoolZusammenDaoImpl.java index aa9c249007..e084cf1c1b 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/EntitlementPoolZusammenDaoImpl.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/EntitlementPoolZusammenDaoImpl.java @@ -238,6 +238,7 @@ public class EntitlementPoolZusammenDaoImpl implements EntitlementPoolDao { info.setDescription(entitlementPool.getDescription()); info.addProperty(ElementPropertyName.elementType.name(), ElementType.EntitlementPool); info.addProperty("version_uuid", entitlementPool.getVersionUuId()); + info.addProperty("EntitlementPoolType", entitlementPool.getType()); info.addProperty("thresholdValue", entitlementPool.getThresholdValue()); info.addProperty("threshold_unit", entitlementPool.getThresholdUnit()); info.addProperty("increments", entitlementPool.getIncrements()); diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToEntitlementPoolConvertor.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToEntitlementPoolConvertor.java index 258886c601..2f06b9b0d0 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToEntitlementPoolConvertor.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToEntitlementPoolConvertor.java @@ -25,6 +25,7 @@ import com.amdocs.zusammen.datatypes.item.Info; import com.amdocs.zusammen.datatypes.item.Relation; import org.openecomp.convertor.ElementConvertor; import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity; +import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolType; import org.openecomp.sdc.vendorlicense.dao.types.MultiChoiceOrOther; import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope; import org.openecomp.sdc.vendorlicense.dao.types.ThresholdUnit; @@ -78,6 +79,7 @@ public class ElementToEntitlementPoolConvertor extends ElementConvertor { entitlementPool.setName(info.getName()); entitlementPool.setDescription(info.getDescription()); entitlementPool.setVersionUuId(info.getProperty("version_uuid")); + entitlementPool.setType(EntitlementPoolType.permissiveValueOf(info.getProperty("EntitlementPoolType"))); entitlementPool.setThresholdValue(toInteger(info.getProperty("thresholdValue"))); String thresholdUnit = info.getProperty("threshold_unit"); entitlementPool diff --git a/openecomp-be/pom.xml b/openecomp-be/pom.xml index 09f6dafcd6..7c99ba52c6 100644 --- a/openecomp-be/pom.xml +++ b/openecomp-be/pom.xml @@ -59,11 +59,6 @@ - - org.apache.maven.plugins - maven-compiler-plugin - ${mvn.compiler.version} - org.apache.maven.plugins maven-jar-plugin -- cgit 1.2.3-korg