From 04c1754116920f5b43b20f449a39cbfa7a681102 Mon Sep 17 00:00:00 2001 From: sheetalm Date: Wed, 14 Feb 2018 09:39:22 +0530 Subject: Onboarding foundation changes for ItemManager Resolved conflicting changes 1. Split ItemManager to ASDCItemManager and ItemManager 2. ItemManager provides basic capability of item without collaboration 3. AsdcItemManager provides all capabilities of item including collaboration which are required by onboarding 4. ItemManager can be used by other services like activity spec to create a basic item without collaboration features. Change-Id: I6c6dc34a2b1a1745c796099b70e359432e90f85e Issue-ID: SDC-1039 Signed-off-by: sheetalm --- .../dao/impl/EntitlementPoolCassandraDaoImpl.java | 41 +++++++-------- .../dao/impl/FeatureGroupCassandraDaoImpl.java | 61 ++++++++++------------ .../dao/impl/LicenseAgreementCassandraDaoImpl.java | 43 +++++++-------- .../dao/impl/LicenseKeyGroupCassandraDaoImpl.java | 35 ++++++------- .../impl/VendorLicenseModelCassandraDaoImpl.java | 23 ++++---- .../VendorLicenseModelDaoZusammenImpl.java | 48 ++++++++--------- .../util/VendorLicenseArtifactsServiceUtils.java | 34 ++++++------ 7 files changed, 128 insertions(+), 157 deletions(-) (limited to 'openecomp-be/lib/openecomp-sdc-vendor-license-lib') 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/EntitlementPoolCassandraDaoImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/EntitlementPoolCassandraDaoImpl.java index cc32d00906..ac43ed19fe 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/EntitlementPoolCassandraDaoImpl.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/EntitlementPoolCassandraDaoImpl.java @@ -1,21 +1,17 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ +/* + * Copyright © 2016-2018 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 - * + * + * 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.impl; @@ -27,6 +23,10 @@ import com.datastax.driver.mapping.Result; import com.datastax.driver.mapping.UDTMapper; import com.datastax.driver.mapping.annotations.Accessor; import com.datastax.driver.mapping.annotations.Query; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.Set; import org.openecomp.core.dao.impl.CassandraBaseDao; import org.openecomp.core.nosqldb.api.NoSqlDb; import org.openecomp.core.nosqldb.factory.NoSqlDbFactory; @@ -34,16 +34,11 @@ import org.openecomp.core.utilities.CommonMethods; import org.openecomp.sdc.vendorlicense.VendorLicenseConstants; import org.openecomp.sdc.vendorlicense.dao.EntitlementPoolDao; import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity; -import org.openecomp.sdc.versioning.VersioningManagerFactory; +import org.openecomp.sdc.versioning.ActionVersioningManagerFactory; import org.openecomp.sdc.versioning.dao.types.Version; import org.openecomp.sdc.versioning.types.UniqueValueMetadata; import org.openecomp.sdc.versioning.types.VersionableEntityMetadata; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.Set; - public class EntitlementPoolCassandraDaoImpl extends CassandraBaseDao implements EntitlementPoolDao { @@ -67,7 +62,7 @@ public class EntitlementPoolCassandraDaoImpl extends CassandraBaseDao listByVlmVersion(String vendorLicenseModelId, - UDTValue vendorLicenseModelVersion); + UDTValue vendorLicenseModelVersion); @Query("delete from entitlement_pool where vlm_id=? AND version=?") ResultSet deleteByVlmVersion(String vendorLicenseModelId, UDTValue vendorLicenseModelVersion); @@ -140,14 +135,14 @@ public class EntitlementPoolCassandraDaoImpl extends CassandraBaseDao referencingFeatureGroups, - String vendorLicenseModelId, - UDTValue vendorLicenseModelVersion, String id); + String vendorLicenseModelId, + UDTValue vendorLicenseModelVersion, String id); @Query( "UPDATE entitlement_pool SET ref_fg_ids = ref_fg_ids - ? WHERE vlm_id=? AND version=? " + "AND ep_id=?") ResultSet removeReferencingFeatureGroups(Set referencingFeatureGroups, - String vendorLicenseModelId, - UDTValue vendorLicenseModelVersion, String id); + String vendorLicenseModelId, + UDTValue vendorLicenseModelVersion, String id); } } 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/FeatureGroupCassandraDaoImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/FeatureGroupCassandraDaoImpl.java index dd22397760..3c804f3bfe 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/FeatureGroupCassandraDaoImpl.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/FeatureGroupCassandraDaoImpl.java @@ -1,25 +1,23 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ +/* + * Copyright © 2016-2018 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 - * + * + * 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.impl; +import static org.openecomp.core.utilities.CommonMethods.toSingleElementSet; + import com.datastax.driver.core.ResultSet; import com.datastax.driver.core.UDTValue; import com.datastax.driver.mapping.Mapper; @@ -27,6 +25,11 @@ import com.datastax.driver.mapping.Result; import com.datastax.driver.mapping.UDTMapper; import com.datastax.driver.mapping.annotations.Accessor; import com.datastax.driver.mapping.annotations.Query; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; import org.openecomp.core.dao.impl.CassandraBaseDao; import org.openecomp.core.nosqldb.api.NoSqlDb; import org.openecomp.core.nosqldb.factory.NoSqlDbFactory; @@ -34,19 +37,11 @@ import org.openecomp.core.utilities.CommonMethods; import org.openecomp.sdc.vendorlicense.VendorLicenseConstants; import org.openecomp.sdc.vendorlicense.dao.FeatureGroupDao; import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity; -import org.openecomp.sdc.versioning.VersioningManagerFactory; +import org.openecomp.sdc.versioning.ActionVersioningManagerFactory; import org.openecomp.sdc.versioning.dao.types.Version; import org.openecomp.sdc.versioning.types.UniqueValueMetadata; import org.openecomp.sdc.versioning.types.VersionableEntityMetadata; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.Set; - -import static org.openecomp.core.utilities.CommonMethods.toSingleElementSet; - public class FeatureGroupCassandraDaoImpl extends CassandraBaseDao implements FeatureGroupDao { @@ -74,7 +69,7 @@ public class FeatureGroupCassandraDaoImpl extends CassandraBaseDao addedEntitlementPools, - Set removedEntitlementPools, - Set addedLicenseKeyGroups, - Set removedLicenseKeyGroups, - String vendorLicenseModelId, UDTValue version, - String id); + String partNumber, + Set addedEntitlementPools, + Set removedEntitlementPools, + Set addedLicenseKeyGroups, + Set removedLicenseKeyGroups, + String vendorLicenseModelId, UDTValue version, + String id); @Query( "UPDATE feature_group SET ref_la_ids = ref_la_ids + ? WHERE vlm_id=? AND version=? " + "AND fg_id=?") ResultSet addReferencingLicenseAgreements(Set licenseAgreementIds, - String vendorLicenseModelId, UDTValue version, - String id); + String vendorLicenseModelId, UDTValue version, + String id); @Query( "UPDATE feature_group SET ref_la_ids = ref_la_ids - ? WHERE vlm_id=? AND version=? AND " + "fg_id=?") ResultSet removeReferencingLicenseAgreements(Set licenseAgreementIds, - String vendorLicenseModelId, UDTValue version, - String id); + String vendorLicenseModelId, UDTValue version, + String id); @Query("UPDATE feature_group SET ep_ids = ep_ids - ? WHERE vlm_id=? AND version=? AND fg_id=?") ResultSet removeEntitlementPools(Set entitlementPoolIds, String vendorLicenseModelId, - UDTValue version, String id); + UDTValue version, String id); @Query( "UPDATE feature_group SET lkg_ids = lkg_ids - ? WHERE vlm_id=? AND version=? AND fg_id=?") ResultSet removeLicenseKeyGroup(Set licenseKeyGroupIds, String vendorLicenseModelId, - UDTValue version, String id); + UDTValue version, String id); } } 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/LicenseAgreementCassandraDaoImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/LicenseAgreementCassandraDaoImpl.java index 3b5a3b3bb4..0ba9ca3899 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/LicenseAgreementCassandraDaoImpl.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/LicenseAgreementCassandraDaoImpl.java @@ -1,21 +1,17 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ +/* + * Copyright © 2016-2018 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 - * + * + * 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.impl; @@ -27,6 +23,11 @@ import com.datastax.driver.mapping.Result; import com.datastax.driver.mapping.UDTMapper; import com.datastax.driver.mapping.annotations.Accessor; import com.datastax.driver.mapping.annotations.Query; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; import org.openecomp.core.dao.impl.CassandraBaseDao; import org.openecomp.core.nosqldb.api.NoSqlDb; import org.openecomp.core.nosqldb.factory.NoSqlDbFactory; @@ -35,17 +36,11 @@ import org.openecomp.sdc.vendorlicense.VendorLicenseConstants; import org.openecomp.sdc.vendorlicense.dao.LicenseAgreementDao; import org.openecomp.sdc.vendorlicense.dao.types.ChoiceOrOther; import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementEntity; -import org.openecomp.sdc.versioning.VersioningManagerFactory; +import org.openecomp.sdc.versioning.ActionVersioningManagerFactory; import org.openecomp.sdc.versioning.dao.types.Version; import org.openecomp.sdc.versioning.types.UniqueValueMetadata; import org.openecomp.sdc.versioning.types.VersionableEntityMetadata; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.Set; - public class LicenseAgreementCassandraDaoImpl extends CassandraBaseDao implements LicenseAgreementDao { @@ -75,7 +70,7 @@ public class LicenseAgreementCassandraDaoImpl extends CassandraBaseDao addedFeatureGroupIds, - Set removedFeatureGroupIds, - String vendorLicenseModelId, UDTValue version, - String id); + UDTValue licenseTerm, String reqAndConst, + Set addedFeatureGroupIds, + Set removedFeatureGroupIds, + String vendorLicenseModelId, UDTValue version, + String id); @Query("UPDATE license_agreement SET fg_ids=fg_ids-? WHERE vlm_id=? AND version=? AND la_id=?") ResultSet removeFeatureGroup(Set featureGroupIds, String vendorLicenseModelId, - UDTValue version, String id); + UDTValue version, String id); } } 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/LicenseKeyGroupCassandraDaoImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/LicenseKeyGroupCassandraDaoImpl.java index 96eecc9747..fdd5716472 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/LicenseKeyGroupCassandraDaoImpl.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/LicenseKeyGroupCassandraDaoImpl.java @@ -1,21 +1,17 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ +/* + * Copyright © 2016-2018 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 - * + * + * 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.impl; @@ -27,6 +23,10 @@ import com.datastax.driver.mapping.Result; import com.datastax.driver.mapping.UDTMapper; import com.datastax.driver.mapping.annotations.Accessor; import com.datastax.driver.mapping.annotations.Query; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.Set; import org.openecomp.core.dao.impl.CassandraBaseDao; import org.openecomp.core.nosqldb.api.NoSqlDb; import org.openecomp.core.nosqldb.factory.NoSqlDbFactory; @@ -34,16 +34,11 @@ import org.openecomp.core.utilities.CommonMethods; import org.openecomp.sdc.vendorlicense.VendorLicenseConstants; import org.openecomp.sdc.vendorlicense.dao.LicenseKeyGroupDao; import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity; -import org.openecomp.sdc.versioning.VersioningManagerFactory; +import org.openecomp.sdc.versioning.ActionVersioningManagerFactory; import org.openecomp.sdc.versioning.dao.types.Version; import org.openecomp.sdc.versioning.types.UniqueValueMetadata; import org.openecomp.sdc.versioning.types.VersionableEntityMetadata; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.Set; - public class LicenseKeyGroupCassandraDaoImpl extends CassandraBaseDao implements LicenseKeyGroupDao { @@ -67,7 +62,7 @@ public class LicenseKeyGroupCassandraDaoImpl extends CassandraBaseDao referencingFeatureGroups, - String vendorLicenseModelId, UDTValue version, String id); + String vendorLicenseModelId, UDTValue version, String id); @Query( "UPDATE license_key_group SET ref_fg_ids = ref_fg_ids - ? WHERE vlm_id=? AND version=? " + "AND lkg_id=?") ResultSet removeReferencingFeatureGroups(Set referencingFeatureGroups, - String vendorLicenseModelId, UDTValue version, - String id); + String vendorLicenseModelId, UDTValue version, + String id); } } 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/VendorLicenseModelCassandraDaoImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/VendorLicenseModelCassandraDaoImpl.java index b52f4ba9dd..9574dac3d5 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/VendorLicenseModelCassandraDaoImpl.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/VendorLicenseModelCassandraDaoImpl.java @@ -1,21 +1,17 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ +/* + * Copyright © 2016-2018 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 - * + * + * 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.impl; @@ -25,17 +21,16 @@ import com.datastax.driver.mapping.Result; import com.datastax.driver.mapping.UDTMapper; import com.datastax.driver.mapping.annotations.Accessor; import com.datastax.driver.mapping.annotations.Query; +import java.util.Collection; import org.openecomp.core.dao.impl.CassandraBaseDao; import org.openecomp.core.nosqldb.api.NoSqlDb; import org.openecomp.core.nosqldb.factory.NoSqlDbFactory; import org.openecomp.sdc.vendorlicense.dao.VendorLicenseModelDao; import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity; -import org.openecomp.sdc.versioning.VersioningManagerFactory; +import org.openecomp.sdc.versioning.ActionVersioningManagerFactory; import org.openecomp.sdc.versioning.dao.types.Version; import org.openecomp.sdc.versioning.types.VersionableEntityMetadata; -import java.util.Collection; - public class VendorLicenseModelCassandraDaoImpl extends CassandraBaseDao implements VendorLicenseModelDao { @@ -50,7 +45,7 @@ public class VendorLicenseModelCassandraDaoImpl extends CassandraBaseDao