diff options
author | 2017-06-09 02:39:56 +0300 | |
---|---|---|
committer | 2017-06-09 02:39:56 +0300 | |
commit | 280f8015d06af1f41a3ef12e8300801c7a5e0d54 (patch) | |
tree | 9c1d3978c04cd28068f02073038c936bb49ca9e0 /openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org | |
parent | fd3821dad11780d33c5373d74c957c442489945e (diff) |
[SDC-29] Amdocs OnBoard 1707 initial commit.
Change-Id: Ie4d12a3f574008b792899b368a0902a8b46b5370
Signed-off-by: AviZi <avi.ziv@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org')
26 files changed, 288 insertions, 195 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/VendorLicenseConstants.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/VendorLicenseConstants.java index 2a1930d626..82fdf045db 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/VendorLicenseConstants.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/VendorLicenseConstants.java @@ -32,6 +32,8 @@ public final class VendorLicenseConstants { public static final String VENDOR_LICENSE_MODEL_ARTIFACT_NAME_WITH_PATH = EXTERNAL_ARTIFACTS_DIR + File.separator + "vendor-license-model.xml"; public static final String VENDOR_LICENSE_MODEL_ARTIFACT_REGEX_REMOVE = " xmlns=\"\""; + public static final String UNSUPPORTED_OPERATION_ERROR = + "An error has occurred: Unsupported operation for 1707 release."; public final class UniqueValues { public static final String VENDOR_NAME = "Vendor name"; @@ -39,5 +41,6 @@ public final class VendorLicenseConstants { public static final String FEATURE_GROUP_NAME = "Feature Group name"; public static final String ENTITLEMENT_POOL_NAME = "Entitlement Pool name"; public static final String LICENSE_KEY_GROUP_NAME = "License Key Group name"; + } } diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/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 c507e6946a..28524e8977 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 @@ -20,12 +20,23 @@ package org.openecomp.sdc.vendorlicense.dao; + 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); + + void delete(EntitlementPoolEntity entitlementPool); + + EntitlementPoolEntity get(EntitlementPoolEntity entitlementPool); + + Collection<EntitlementPoolEntity> list(EntitlementPoolEntity entitlementPool); + long count(EntitlementPoolEntity entitlementPool); void deleteAll(EntitlementPoolEntity entitlementPool); 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 a5db802861..3a7ce9ac04 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 @@ -24,10 +24,20 @@ 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); + + void create(FeatureGroupEntity featureGroup); + + FeatureGroupEntity get(FeatureGroupEntity entity); + + Collection<FeatureGroupEntity> list(FeatureGroupEntity entity); + long count(FeatureGroupEntity featureGroup); void deleteAll(FeatureGroupEntity featureGroup); 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 58832e12ae..5a32ee420a 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 @@ -24,6 +24,7 @@ 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); 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 df5e972422..8e2e4889ba 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,8 +1,8 @@ /*- - * ============LICENSE_START======================================================= + * ============LICENSE_SLicenseAgreementEntityARLicenseAgreementEntity======================================================= * SDC * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 ALicenseAgreementEntity&LicenseAgreementEntity 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. @@ -12,7 +12,7 @@ * * 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. + * WILicenseAgreementEntityHOULicenseAgreementEntity WARRANLicenseAgreementEntityIES OR CONDILicenseAgreementEntityIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============LICENSE_END========================================================= @@ -24,9 +24,10 @@ import org.openecomp.core.dao.BaseDao; 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, BaseDao<LicenseAgreementEntity> { +public interface LicenseAgreementDao extends VersionableDao{ long count(LicenseAgreementEntity entity); @@ -37,4 +38,13 @@ public interface LicenseAgreementDao extends VersionableDao, BaseDao<LicenseAgre void updateColumnsAndDeltaFeatureGroupIds(LicenseAgreementEntity licenseAgreement, Set<String> addedFeatureGroupIds, Set<String> removedFeatureGroupIds); + Collection<LicenseAgreementEntity> list(LicenseAgreementEntity entity); + + void create(LicenseAgreementEntity entity); + + void update(LicenseAgreementEntity entity); + + LicenseAgreementEntity get(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/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 43e380d9b9..4e0ce93ed4 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 @@ -20,12 +20,26 @@ package org.openecomp.sdc.vendorlicense.dao; + 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 delete(LicenseKeyGroupEntity licenseKeyGroup); + + LicenseKeyGroupEntity get(LicenseKeyGroupEntity licenseKeyGroup); + + Collection<LicenseKeyGroupEntity> list(LicenseKeyGroupEntity licenseKeyGroup); + + long count(LicenseKeyGroupEntity licenseKeyGroup); + void deleteAll(LicenseKeyGroupEntity licenseKeyGroup); void addReferencingFeatureGroup(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 1f887390db..8c76c46301 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 @@ -23,6 +23,7 @@ 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> { 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 b8e39bc496..0bb2e62b41 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 @@ -25,5 +25,4 @@ import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity; import org.openecomp.sdc.versioning.dao.VersionableDao; public interface VendorLicenseModelDao extends VersionableDao, BaseDao<VendorLicenseModelEntity> { -// void updateLastModificationTime(VendorLicenseModelEntity vendorLicenseModel); } 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 9a5af213c4..5b5a97f92b 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 @@ -23,5 +23,5 @@ package org.openecomp.sdc.vendorlicense.dao.types; public enum AggregationFunction { Peak, Average, - Other + 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 ca7a09b0df..4483c67b65 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 @@ -25,6 +25,12 @@ import com.datastax.driver.mapping.annotations.UDT; import org.openecomp.sdc.common.errors.CoreException; import org.openecomp.sdc.common.errors.ErrorCategory; import org.openecomp.sdc.common.errors.ErrorCode; +import org.openecomp.sdc.datatypes.error.ErrorLevel; +import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage; +import org.openecomp.sdc.logging.types.LoggerConstants; +import org.openecomp.sdc.logging.types.LoggerErrorCode; +import org.openecomp.sdc.logging.types.LoggerErrorDescription; +import org.openecomp.sdc.logging.types.LoggerTragetServiceName; @UDT(keyspace = "dox", name = "choice_or_other") public class ChoiceOrOther<E extends Enum<E>> { @@ -110,10 +116,13 @@ public class ChoiceOrOther<E extends Enum<E>> { try { choice = E.valueOf(enumClass, result); - } catch (IllegalArgumentException e0) { + } catch (IllegalArgumentException exception) { try { choice = E.valueOf(enumClass, OTHER_ENUM_VALUE); } catch (IllegalArgumentException ex) { + MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, + LoggerTragetServiceName.VALIDATE_CHOICE_VALUE, ErrorLevel.ERROR.name(), + LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.INVALID_VALUE); throw new CoreException(new ErrorCode.ErrorCodeBuilder() .withId(CHOICE_OR_OTHER_INVALID_ENUM_ERR_ID) .withMessage(CHOICE_OR_OTHER_INVALID_ENUM_MSG) @@ -124,6 +133,14 @@ public class ChoiceOrOther<E extends Enum<E>> { } @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; + } + + @Override public boolean equals(Object obj) { if (this == obj) { return true; @@ -143,12 +160,4 @@ public class ChoiceOrOther<E extends Enum<E>> { return result != null ? result.equals(that.result) : that.result == null; } - - @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; - } } 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 42cc231273..23423dc241 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 @@ -33,5 +33,5 @@ public enum EntitlementMetric { Units_TB, Units_MB, Units_GB, - Other + 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/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 8964458181..0a704721d5 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 @@ -55,7 +55,6 @@ public class EntitlementPoolEntity implements VersionableEntity { private String name; private String description; - @Column(name = "threshold") private int thresholdValue; @@ -114,14 +113,6 @@ public class EntitlementPoolEntity implements VersionableEntity { return getVendorLicenseModelId(); } - public String getVendorLicenseModelId() { - return vendorLicenseModelId; - } - - public void setVendorLicenseModelId(String vendorLicenseModelId) { - this.vendorLicenseModelId = vendorLicenseModelId; - } - @Override public String getId() { return id; @@ -142,6 +133,24 @@ public class EntitlementPoolEntity implements VersionableEntity { 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; } @@ -234,13 +243,11 @@ public class EntitlementPoolEntity implements VersionableEntity { this.manufacturerReferenceNumber = manufacturerReferenceNumber; } - /** * Gets threshold for artifact. * * @return the threshold for artifact */ - //util methods for XML public ThresholdForXml getThresholdForArtifact() { ThresholdForXml threshold = new ThresholdForXml(); threshold.setUnit(getThresholdUnit() == null ? null : getThresholdUnit().name()); @@ -249,6 +256,14 @@ public class EntitlementPoolEntity implements VersionableEntity { } /** + * Gets version for artifact. + * @return version in format suitable for artifact + */ + public String getVersionForArtifact() { + return version.toString(); + } + + /** * Gets entitlement metric for artifact. * * @return the entitlement metric for artifact @@ -277,26 +292,12 @@ public class EntitlementPoolEntity implements VersionableEntity { return timeForXml; } - @Override - public String toString() { - return "EntitlementPoolEntity{" - + "vendorLicenseModelId='" + vendorLicenseModelId + '\'' - + ", version=" + version - + ", id='" + id + '\'' - + ", name='" + name + '\'' - + ", description='" + description + '\'' - + ", thresholdValue=" + thresholdValue - + ", thresholdUnit='" + thresholdUnit + '\'' - + ", entitlementMetric=" + entitlementMetric - + ", increments='" + increments + '\'' - + ", aggregationFunction=" + aggregationFunction - + ", operationalScope=" + operationalScope - + ", time=" + time - + ", manufacturerReferenceNumber='" + manufacturerReferenceNumber + '\'' - + ", referencingFeatureGroups=" + referencingFeatureGroups - + ", version_uuid=" + versionUuId - + '}'; + public int hashCode() { + return Objects + .hash(vendorLicenseModelId, version, id, name, description, thresholdValue, thresholdUnit, + entitlementMetric, increments, aggregationFunction, operationalScope, time, + manufacturerReferenceNumber, referencingFeatureGroups); } @Override @@ -310,7 +311,6 @@ public class EntitlementPoolEntity implements VersionableEntity { EntitlementPoolEntity that = (EntitlementPoolEntity) obj; return Float.compare(that.thresholdValue, thresholdValue) == 0 && 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) @@ -325,11 +325,24 @@ public class EntitlementPoolEntity implements VersionableEntity { } @Override - public int hashCode() { - return Objects - .hash(vendorLicenseModelId, version, id, name, description, thresholdValue, thresholdUnit, - entitlementMetric, increments, aggregationFunction, operationalScope, time, - manufacturerReferenceNumber, referencingFeatureGroups); + public String toString() { + return "EntitlementPoolEntity{" + + "vendorLicenseModelId='" + vendorLicenseModelId + '\'' + + ", version=" + version + + ", id='" + id + '\'' + + ", name='" + name + '\'' + + ", description='" + description + '\'' + + ", thresholdValue=" + thresholdValue + + ", thresholdUnit='" + thresholdUnit + '\'' + + ", entitlementMetric=" + entitlementMetric + + ", increments='" + increments + '\'' + + ", aggregationFunction=" + aggregationFunction + + ", operationalScope=" + operationalScope + + ", time=" + time + + ", manufacturerReferenceNumber='" + manufacturerReferenceNumber + '\'' + + ", referencingFeatureGroups=" + referencingFeatureGroups + + ", version_uuid=" + versionUuId + + '}'; } /** @@ -359,12 +372,4 @@ public class EntitlementPoolEntity implements VersionableEntity { return null; } } - - public String getVersionUuId() { - return versionUuId; - } - - public void setVersionUuId(String uuId) { - versionUuId = uuId; - } } 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 5005075122..78576d1e7d 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 @@ -26,5 +26,5 @@ public enum EntitlementTime { //TODO MetricTime ? ask Segev... Month, Quarter, Year, - Other + 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 de5bd2e1c5..a297f8aa63 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 @@ -28,7 +28,6 @@ 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; @@ -83,12 +82,14 @@ public class FeatureGroupEntity implements VersionableEntity { return getVendorLicenseModelId(); } - public String getVendorLicenseModelId() { - return vendorLicenseModelId; + @Override + public String getId() { + return id; } - public void setVendorLicenseModelId(String vendorLicenseModelId) { - this.vendorLicenseModelId = vendorLicenseModelId; + @Override + public void setId(String id) { + this.id = id; } @Override @@ -101,14 +102,12 @@ public class FeatureGroupEntity implements VersionableEntity { this.version = version; } - @Override - public String getId() { - return id; + public String getVendorLicenseModelId() { + return vendorLicenseModelId; } - @Override - public void setId(String id) { - this.id = id; + public void setVendorLicenseModelId(String vendorLicenseModelId) { + this.vendorLicenseModelId = vendorLicenseModelId; } public String getName() { @@ -160,18 +159,10 @@ public class FeatureGroupEntity implements VersionableEntity { } @Override - public String toString() { - return "FeatureGroupEntity{" - + "vendorLicenseModelId='" + vendorLicenseModelId + '\'' - + ", version=" + version - + ", id='" + id + '\'' - + ", name='" + name + '\'' - + ", description='" + description + '\'' - + ", partNumber='" + partNumber + '\'' - + ", licenseKeyGroupIds=" + licenseKeyGroupIds - + ", entitlementPoolIds=" + entitlementPoolIds - + ", referencingLicenseAgreements=" + referencingLicenseAgreements - + '}'; + public int hashCode() { + return Objects + .hash(vendorLicenseModelId, version, id, name, description, partNumber, licenseKeyGroupIds, + entitlementPoolIds, referencingLicenseAgreements); } @Override @@ -195,9 +186,17 @@ public class FeatureGroupEntity implements VersionableEntity { } @Override - public int hashCode() { - return Objects - .hash(vendorLicenseModelId, version, id, name, description, partNumber, licenseKeyGroupIds, - entitlementPoolIds, referencingLicenseAgreements); + public String toString() { + return "FeatureGroupEntity{" + + "vendorLicenseModelId='" + vendorLicenseModelId + '\'' + + ", version=" + version + + ", id='" + id + '\'' + + ", name='" + name + '\'' + + ", description='" + description + '\'' + + ", partNumber='" + partNumber + '\'' + + ", 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 78e081760c..174cbbb9b9 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 @@ -41,14 +41,14 @@ public class FeatureGroupModel { return entitlementPools; } - public Set<LicenseKeyGroupEntity> getLicenseKeyGroups() { - return licenseKeyGroups; - } - public void setEntitlementPools(Set<EntitlementPoolEntity> entitlementPools) { this.entitlementPools = entitlementPools; } + public Set<LicenseKeyGroupEntity> getLicenseKeyGroups() { + return licenseKeyGroups; + } + public void setLicenseKeyGroups(Set<LicenseKeyGroupEntity> licenseKeyGroups) { this.licenseKeyGroups = licenseKeyGroups; } @@ -72,4 +72,3 @@ public class FeatureGroupModel { } - 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 a6e46bf44c..7f7dab684a 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 @@ -86,12 +86,14 @@ public class LicenseAgreementEntity implements VersionableEntity { return getVendorLicenseModelId(); } - public String getVendorLicenseModelId() { - return vendorLicenseModelId; + @Override + public String getId() { + return id; } - public void setVendorLicenseModelId(String vendorLicenseModelId) { - this.vendorLicenseModelId = vendorLicenseModelId; + @Override + public void setId(String id) { + this.id = id; } @Override @@ -104,14 +106,12 @@ public class LicenseAgreementEntity implements VersionableEntity { this.version = version; } - @Override - public String getId() { - return id; + public String getVendorLicenseModelId() { + return vendorLicenseModelId; } - @Override - public void setId(String id) { - this.id = id; + public void setVendorLicenseModelId(String vendorLicenseModelId) { + this.vendorLicenseModelId = vendorLicenseModelId; } public String getName() { @@ -156,6 +156,12 @@ public class LicenseAgreementEntity implements VersionableEntity { } @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; @@ -173,10 +179,4 @@ public class LicenseAgreementEntity implements VersionableEntity { && Objects.equals(requirementsAndConstrains, that.requirementsAndConstrains) && Objects.equals(featureGroupIds, that.featureGroupIds); } - - @Override - public int hashCode() { - return Objects.hash(vendorLicenseModelId, version, id, name, description, licenseTerm, - requirementsAndConstrains, 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/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 2a7e936cb3..07641594c2 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 @@ -30,7 +30,6 @@ import org.openecomp.sdc.vendorlicense.dao.types.xml.LicenseKeyTypeForXml; 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; @@ -87,14 +86,6 @@ public class LicenseKeyGroupEntity implements VersionableEntity { return getVendorLicenseModelId(); } - public String getVendorLicenseModelId() { - return vendorLicenseModelId; - } - - public void setVendorLicenseModelId(String vendorLicenseModelId) { - this.vendorLicenseModelId = vendorLicenseModelId; - } - public String getId() { return id; } @@ -111,6 +102,24 @@ public class LicenseKeyGroupEntity implements VersionableEntity { 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; } @@ -153,17 +162,10 @@ public class LicenseKeyGroupEntity implements VersionableEntity { } @Override - public String toString() { - return "LicenseKeyGroupEntity{" + "vendorLicenseModelId='" + vendorLicenseModelId + '\'' - + ", version=" + version - + ", id='" + id + '\'' - + ", name='" + name + '\'' - + ", description='" + description + '\'' - + ", type=" + type - + ", operationalScope=" + operationalScope - + ", referencingFeatureGroups=" + referencingFeatureGroups - + ", versionUuId='" + versionUuId + '\'' - + '}'; + public int hashCode() { + return Objects + .hash(vendorLicenseModelId, version, id, name, description, type, operationalScope, + referencingFeatureGroups); } @Override @@ -176,7 +178,6 @@ public class LicenseKeyGroupEntity implements VersionableEntity { } 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) @@ -186,10 +187,17 @@ public class LicenseKeyGroupEntity implements VersionableEntity { } @Override - public int hashCode() { - return Objects - .hash(vendorLicenseModelId, version, id, name, description, type, operationalScope, - referencingFeatureGroups); + public String toString() { + return "LicenseKeyGroupEntity{" + "vendorLicenseModelId='" + vendorLicenseModelId + '\'' + + ", version=" + version + + ", id='" + id + '\'' + + ", name='" + name + '\'' + + ", description='" + description + '\'' + + ", type=" + type + + ", operationalScope=" + operationalScope + + ", referencingFeatureGroups=" + referencingFeatureGroups + + ", versionUuId='" + versionUuId + '\'' + + '}'; } /** @@ -206,6 +214,14 @@ public class LicenseKeyGroupEntity implements VersionableEntity { } /** + * 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 @@ -219,13 +235,4 @@ public class LicenseKeyGroupEntity implements VersionableEntity { } return typeXml; } - - - public String getVersionUuId() { - return versionUuId; - } - - public void setVersionUuId(String uuId) { - versionUuId = uuId; - } } 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 3ba913de31..35e6f217e8 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 @@ -23,5 +23,5 @@ package org.openecomp.sdc.vendorlicense.dao.types; public enum LicenseKeyType { Universal, Unique, - One_Time + 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 729a985473..b8a7f9d09b 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 @@ -24,5 +24,5 @@ public enum LicenseTerm { Fixed_Term, Perpetual, Unlimited, - Other + 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/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 df9d6887ce..165260f9c5 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 @@ -25,6 +25,12 @@ import com.datastax.driver.mapping.annotations.UDT; import org.openecomp.sdc.common.errors.CoreException; import org.openecomp.sdc.common.errors.ErrorCategory; import org.openecomp.sdc.common.errors.ErrorCode; +import org.openecomp.sdc.datatypes.error.ErrorLevel; +import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage; +import org.openecomp.sdc.logging.types.LoggerConstants; +import org.openecomp.sdc.logging.types.LoggerErrorCode; +import org.openecomp.sdc.logging.types.LoggerErrorDescription; +import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import java.util.HashSet; import java.util.Set; @@ -127,10 +133,14 @@ public class MultiChoiceOrOther<E extends Enum<E>> { String result = results.iterator().next(); try { choices.add(E.valueOf(enumClass, result)); - } catch (IllegalArgumentException illegalArgumentException) { + } catch (IllegalArgumentException exception) { try { choices.add(E.valueOf(enumClass, OTHER_ENUM_VALUE)); } catch (IllegalArgumentException ex) { + + MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, + LoggerTragetServiceName.VALIDATE_CHOICE_VALUE, ErrorLevel.ERROR.name(), + LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.INVALID_VALUE); throw new CoreException(new ErrorCode.ErrorCodeBuilder() .withId(MULTI_CHOICE_OR_OTHER_INVALID_ENUM_ERR_ID) .withMessage(MULTI_CHOICE_OR_OTHER_INVALID_ENUM_MSG) @@ -142,6 +152,14 @@ public class MultiChoiceOrOther<E extends Enum<E>> { } @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; @@ -161,12 +179,4 @@ public class MultiChoiceOrOther<E extends Enum<E>> { return results != null ? results.equals(that.results) : that.results == null; } - - @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; - } } 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 ed9497d30b..69cdb2dabb 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 @@ -28,5 +28,5 @@ public enum OperationalScope { VM, CPU, Core, - Other + 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/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 ea93b1ab4f..b57b850f60 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 @@ -42,9 +42,6 @@ public class VendorLicenseModelEntity implements VersionableEntity { @Frozen private Version version; - // @Column(name = "last_modification_time") - // private Date lastModificationTime; - @Column(name = "vendor_name") private String vendorName; private String description; @@ -115,6 +112,11 @@ public class VendorLicenseModelEntity implements VersionableEntity { } @Override + public int hashCode() { + return Objects.hash(id, version, vendorName, description, iconRef); + } + + @Override public boolean equals(Object obj) { if (this == obj) { return true; @@ -130,19 +132,6 @@ public class VendorLicenseModelEntity implements VersionableEntity { && Objects.equals(iconRef, that.iconRef); } - @Override - public int hashCode() { - return Objects.hash(id, version, vendorName, description, iconRef); - } - - // public Date getLastModificationTime() { - // return lastModificationTime; - // } - // - // public void setLastModificationTime(Date lastModificationTime) { - // this.lastModificationTime = lastModificationTime; - // } - public Long getWritetimeMicroSeconds() { return writetimeMicroSeconds; } diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/SubmitUncompletedLicenseModelErrorBuilder.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/SubmitUncompletedLicenseModelErrorBuilder.java index 0a00cff8ea..4cf134c262 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/SubmitUncompletedLicenseModelErrorBuilder.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/SubmitUncompletedLicenseModelErrorBuilder.java @@ -25,26 +25,23 @@ import org.openecomp.sdc.common.errors.ErrorCode; public class SubmitUncompletedLicenseModelErrorBuilder { - private static final String SUBMIT_UNCOMPLETED_LICENSE_MODEL_MSG = - "Uncompleted vendor license model %s cannot be submitted. " - + "It must contain license_agreement(s) that all feature groups " - + "contain at least one entitlement pool."; - private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); - - /** - * Instantiates a new Submit uncompleted license model error builder. - * - * @param vlmId the vlm id - */ - public SubmitUncompletedLicenseModelErrorBuilder(String vlmId) { - builder.withId(VendorLicenseErrorCodes.SUBMIT_UNCOMPLETED_LICENSE_MODEL); - builder.withCategory(ErrorCategory.APPLICATION); - builder.withMessage(String.format(SUBMIT_UNCOMPLETED_LICENSE_MODEL_MSG, vlmId)); - } - - public ErrorCode build() { - return builder.build(); - } + + private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); + + /** + * Instantiates a new Submit uncompleted license model error builder. + * + * @param error + */ + public SubmitUncompletedLicenseModelErrorBuilder(UncompletedVendorLicenseModelErrorType error) { + builder.withId(VendorLicenseErrorCodes.SUBMIT_UNCOMPLETED_LICENSE_MODEL); + builder.withCategory(ErrorCategory.APPLICATION); + builder.withMessage(error.getErrorMessage()); + } + + public ErrorCode build() { + return builder.build(); + } } diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/UncompletedVendorLicenseModelErrorType.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/UncompletedVendorLicenseModelErrorType.java new file mode 100644 index 0000000000..17632fb0ad --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/UncompletedVendorLicenseModelErrorType.java @@ -0,0 +1,28 @@ +package org.openecomp.sdc.vendorlicense.errors; + +/** + * Created by ayalaben on 5/8/2017 + */ +public enum UncompletedVendorLicenseModelErrorType { + + SUBMIT_UNCOMPLETED_VLM_MSG_MISSING_LA("Uncompleted vendor license model - cannot be submitted. \n" + + "It must contain a license agreement(s)."), + + SUBMIT_UNCOMPLETED_VLM_MSG_LA_MISSING_FG("Uncompleted vendor license model - cannot be submitted. \n" + + "The license agreement(s) must contain at least one feature group."), + + SUBMIT_UNCOMPLETED_VLM_MSG_FG_MISSING_EP("Uncompleted vendor license model - cannot be submitted. \n" + + "The feature group(s) must contain at least one entitlement pool."); + + + private String errorMessage; + + UncompletedVendorLicenseModelErrorType(String errorMessage) { + this.errorMessage = errorMessage; + } + + public String getErrorMessage() { + return errorMessage; + } +} + diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/VendorLicenseErrorCodes.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/VendorLicenseErrorCodes.java index 4cd7a5bc1b..98f773860c 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/VendorLicenseErrorCodes.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/errors/VendorLicenseErrorCodes.java @@ -20,6 +20,7 @@ package org.openecomp.sdc.vendorlicense.errors; + public class VendorLicenseErrorCodes { public static final String VENDOR_LICENSE_MODEL_NOT_FOUND = "VENDOR_LICENSE_MODEL_NOT_FOUND"; diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/facade/VendorLicenseFacade.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/facade/VendorLicenseFacade.java index e36852d25f..ecff0f56d6 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/facade/VendorLicenseFacade.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/facade/VendorLicenseFacade.java @@ -37,9 +37,9 @@ import java.util.Collection; public interface VendorLicenseFacade { - void checkin(String vendorLicenseModelId, String user); + Version checkin(String vendorLicenseModelId, String user); - void submit(String vendorLicenseModelId, String user); + Version submit(String vendorLicenseModelId, String user); FeatureGroupEntity getFeatureGroup(FeatureGroupEntity featureGroup, String user); @@ -53,8 +53,6 @@ public interface VendorLicenseFacade { EntitlementPoolEntity createEntitlementPool(EntitlementPoolEntity entitlementPool, String user); - LicenseKeyGroupEntity createLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup, String user); - void updateEntitlementPool(EntitlementPoolEntity entitlementPool, String user); Collection<LicenseKeyGroupEntity> listLicenseKeyGroups(String vlmId, Version version, @@ -65,6 +63,8 @@ public interface VendorLicenseFacade { void updateLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup, String user); + LicenseKeyGroupEntity createLicenseKeyGroup(LicenseKeyGroupEntity licenseKeyGroup, String user); + VersionedVendorLicenseModel getVendorLicenseModel(String vlmId, Version version, String user); |