aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be')
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/services/VersionsImpl.java51
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/VendorLicenseModelsImpl.java16
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java19
-rw-r--r--openecomp-be/backend/openecomp-sdc-action-manager/src/main/java/org/openecomp/sdc/action/impl/ActionManagerImpl.java129
-rw-r--r--openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/ItemPermissionsManagerFactoryImpl.java20
-rw-r--r--openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/ItemPermissionsManagerImpl.java51
-rw-r--r--openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/test/java/org/openecomp/sdc/itempermissions/dao/impl/ItemPermissionsManagerImplTest.java58
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java3
-rw-r--r--openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-core/src/main/java/org/openecomp/conflicts/ItemMergeHandlerFactoryImpl.java27
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionDaoImpl.java93
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceArtifactDaoCassandraImpl.java29
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceTemplateDaoCassandraImpl.java29
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceArtifactDaoCassandraImpl.java27
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceTemplateDaoCassandraImpl.java27
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/EntitlementPoolCassandraDaoImpl.java41
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/FeatureGroupCassandraDaoImpl.java61
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/LicenseAgreementCassandraDaoImpl.java43
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/LicenseKeyGroupCassandraDaoImpl.java35
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/VendorLicenseModelCassandraDaoImpl.java23
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/VendorLicenseModelDaoZusammenImpl.java48
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/util/VendorLicenseArtifactsServiceUtils.java34
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentDaoCassandraImpl.java37
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentDependencyModelDaoCassandraImpl.java31
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComputeDaoCassandraImpl.java31
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/DeploymentFlavorDaoCassandraImpl.java162
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ImageDaoImpl.java31
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/VendorSoftwareProductInfoDaoZusammenImpl.java17
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/ActionVersioningManager.java75
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/ActionVersioningManagerFactory.java28
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/AsdcItemManager.java40
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/AsdcItemManagerFactory.java27
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/ItemManager.java28
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/VersioningManager.java52
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/resources/factoryConfiguration.json2
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionInfoDaoFactoryImpl.java19
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionInfoDaoImpl.java36
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/ActionVersioningManagerFactoryImpl.java39
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/ActionVersioningManagerImpl.java630
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/AsdcItemManagerFactoryImpl.java35
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/AsdcItemManagerImpl.java70
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/ItemManagerFactoryImpl.java22
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/ItemManagerImpl.java59
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/VersioningManagerFactoryImpl.java30
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/VersioningManagerImpl.java479
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/impl/AsdcItemManagerImplTest.java (renamed from openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/impl/ItemManagerImplTest.java)4
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/impl/VersioningManagerImplTest.java11
46 files changed, 1707 insertions, 1152 deletions
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/services/VersionsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/services/VersionsImpl.java
index c3497e8dc6..f627dc590f 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/services/VersionsImpl.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/services/VersionsImpl.java
@@ -1,25 +1,33 @@
-/*-
- * ============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.sdcrests.item.rest.services;
+import static org.openecomp.sdc.itempermissions.notifications.NotificationConstants.PERMISSION_USER;
+import static org.openecomp.sdc.versioning.VersioningNotificationConstansts.ITEM_ID;
+import static org.openecomp.sdc.versioning.VersioningNotificationConstansts.ITEM_NAME;
+import static org.openecomp.sdc.versioning.VersioningNotificationConstansts.SUBMIT_DESCRIPTION;
+import static org.openecomp.sdc.versioning.VersioningNotificationConstansts.VERSION_ID;
+import static org.openecomp.sdc.versioning.VersioningNotificationConstansts.VERSION_NAME;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.inject.Named;
+import javax.ws.rs.core.Response;
import org.openecomp.sdc.activitylog.ActivityLogManager;
import org.openecomp.sdc.activitylog.ActivityLogManagerFactory;
import org.openecomp.sdc.activitylog.dao.type.ActivityLogEntity;
@@ -35,8 +43,8 @@ import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.notification.dtos.Event;
import org.openecomp.sdc.notification.factories.NotificationPropagationManagerFactory;
import org.openecomp.sdc.notification.services.NotificationPropagationManager;
-import org.openecomp.sdc.versioning.ItemManager;
-import org.openecomp.sdc.versioning.ItemManagerFactory;
+import org.openecomp.sdc.versioning.AsdcItemManager;
+import org.openecomp.sdc.versioning.AsdcItemManagerFactory;
import org.openecomp.sdc.versioning.VersioningManager;
import org.openecomp.sdc.versioning.VersioningManagerFactory;
import org.openecomp.sdc.versioning.dao.types.Revision;
@@ -44,6 +52,7 @@ import org.openecomp.sdc.versioning.dao.types.SynchronizationState;
import org.openecomp.sdc.versioning.dao.types.Version;
import org.openecomp.sdc.versioning.errors.RevisionIdNotFoundErrorBuilder;
import org.openecomp.sdc.versioning.types.NotificationEventTypes;
+import org.openecomp.sdc.versioning.types.VersionCreationMethod;
import org.openecomp.sdcrests.item.rest.Versions;
import org.openecomp.sdcrests.item.rest.mapping.MapActivityLogEntityToDto;
import org.openecomp.sdcrests.item.rest.mapping.MapRevisionToDto;
@@ -59,19 +68,6 @@ import org.openecomp.sdcrests.wrappers.GenericCollectionWrapper;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
-import javax.inject.Named;
-import javax.ws.rs.core.Response;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import static org.openecomp.sdc.itempermissions.notifications.NotificationConstants.PERMISSION_USER;
-import static org.openecomp.sdc.versioning.VersioningNotificationConstansts.ITEM_ID;
-import static org.openecomp.sdc.versioning.VersioningNotificationConstansts.ITEM_NAME;
-import static org.openecomp.sdc.versioning.VersioningNotificationConstansts.SUBMIT_DESCRIPTION;
-import static org.openecomp.sdc.versioning.VersioningNotificationConstansts.VERSION_ID;
-import static org.openecomp.sdc.versioning.VersioningNotificationConstansts.VERSION_NAME;
-
@Named
@Service("versions")
@Scope(value = "prototype")
@@ -82,8 +78,8 @@ public class VersionsImpl implements Versions {
private ItemPermissionsManager permissionsManager =
ItemPermissionsManagerFactory.getInstance().createInterface();
- private ItemManager itemManager =
- ItemManagerFactory.getInstance().createInterface();
+ private AsdcItemManager asdcItemManager =
+ AsdcItemManagerFactory.getInstance().createInterface();
private VersioningManager versioningManager =
VersioningManagerFactory.getInstance().createInterface();
private ConflictsManager conflictsManager =
@@ -110,7 +106,8 @@ public class VersionsImpl implements Versions {
version.setBaseId(baseVersionId);
version.setDescription(request.getDescription());
- version = versioningManager.create(itemId, version, request.getCreationMethod());
+ version = versioningManager.create(itemId, version, VersionCreationMethod.valueOf(request
+ .getCreationMethod().name()));
VersionDto versionDto = new MapVersionToDto().applyMapping(version, VersionDto.class);
@@ -228,7 +225,7 @@ public class VersionsImpl implements Versions {
private void notifyUsers(String itemId, Version version, String message,
String userName, NotificationEventTypes eventType) {
Map<String, Object> eventProperties = new HashMap<>();
- eventProperties.put(ITEM_NAME, itemManager.get(itemId).getName());
+ eventProperties.put(ITEM_NAME, asdcItemManager.get(itemId).getName());
eventProperties.put(ITEM_ID, itemId);
Version ver = versioningManager.get(itemId, version);
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/services/VendorLicenseModelsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/VendorLicenseModelsImpl.java
index e5db536deb..812e3d94f0 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/VendorLicenseModelsImpl.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/VendorLicenseModelsImpl.java
@@ -39,8 +39,8 @@ import org.openecomp.sdc.vendorlicense.VendorLicenseConstants;
import org.openecomp.sdc.vendorlicense.VendorLicenseManager;
import org.openecomp.sdc.vendorlicense.VendorLicenseManagerFactory;
import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity;
-import org.openecomp.sdc.versioning.ItemManager;
-import org.openecomp.sdc.versioning.ItemManagerFactory;
+import org.openecomp.sdc.versioning.AsdcItemManager;
+import org.openecomp.sdc.versioning.AsdcItemManagerFactory;
import org.openecomp.sdc.versioning.VersioningManager;
import org.openecomp.sdc.versioning.VersioningManagerFactory;
import org.openecomp.sdc.versioning.dao.types.Version;
@@ -94,7 +94,7 @@ public class VendorLicenseModelsImpl implements VendorLicenseModels {
private NotificationPropagationManager notifier =
NotificationPropagationManagerFactory.getInstance().createInterface();
- private ItemManager itemManager = ItemManagerFactory.getInstance().createInterface();
+ private AsdcItemManager asdcItemManager = AsdcItemManagerFactory.getInstance().createInterface();
private VersioningManager versioningManager =
VersioningManagerFactory.getInstance().createInterface();
private VendorLicenseManager vendorLicenseManager =
@@ -120,7 +120,7 @@ public class VendorLicenseModelsImpl implements VendorLicenseModels {
GenericCollectionWrapper<ItemDto> results = new GenericCollectionWrapper<>();
MapItemToDto mapper = new MapItemToDto();
- itemManager.list(itemPredicate).stream()
+ asdcItemManager.list(itemPredicate).stream()
.sorted((o1, o2) -> o2.getModificationTime().compareTo(o1.getModificationTime()))
.forEach(vspItem -> results.add(mapper.applyMapping(vspItem, ItemDto.class)));
return Response.ok(results).build();
@@ -137,7 +137,7 @@ public class VendorLicenseModelsImpl implements VendorLicenseModels {
UniqueValueUtil
.validateUniqueValue(VendorLicenseConstants.UniqueValues.VENDOR_NAME, item.getName());
- item = itemManager.create(item);
+ item = asdcItemManager.create(item);
UniqueValueUtil
.createUniqueValue(VendorLicenseConstants.UniqueValues.VENDOR_NAME, item.getName());
@@ -202,7 +202,7 @@ public class VendorLicenseModelsImpl implements VendorLicenseModels {
@Override
public Response deleteLicenseModel(String vlmId, String user) {
- Item vlm = itemManager.get(vlmId);
+ Item vlm = asdcItemManager.get(vlmId);
if (!vlm.getType().equals(ItemType.vlm.name())){
throw new CoreException((new ErrorCode.ErrorCodeBuilder()
@@ -212,7 +212,7 @@ public class VendorLicenseModelsImpl implements VendorLicenseModels {
Integer certifiedVersionsCounter = vlm.getVersionStatusCounters().get(VersionStatus.Certified);
if (Objects.isNull(certifiedVersionsCounter) || certifiedVersionsCounter == 0) {
- itemManager.delete(vlm);
+ asdcItemManager.delete(vlm);
permissionsManager.deleteItemPermissions(vlmId);
UniqueValueUtil
.deleteUniqueValue(VendorLicenseConstants.UniqueValues.VENDOR_NAME, vlm.getName());
@@ -269,7 +269,7 @@ public class VendorLicenseModelsImpl implements VendorLicenseModels {
private void notifyUsers(String itemId, String itemName, Version version, String message,
String userName, NotificationEventTypes eventType) {
Map<String, Object> eventProperties = new HashMap<>();
- eventProperties.put(ITEM_NAME, itemName == null ? itemManager.get(itemId).getName() : itemName);
+ eventProperties.put(ITEM_NAME, itemName == null ? asdcItemManager.get(itemId).getName() : itemName);
eventProperties.put(ITEM_ID, itemId);
if (version != null) {
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java
index ebabda6831..185bb93983 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java
@@ -53,8 +53,8 @@ import org.openecomp.sdc.vendorsoftwareproduct.errors.OnboardingMethodErrorBuild
import org.openecomp.sdc.vendorsoftwareproduct.errors.PackageNotFoundErrorBuilder;
import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireResponse;
import org.openecomp.sdc.vendorsoftwareproduct.types.ValidationResponse;
-import org.openecomp.sdc.versioning.ItemManager;
-import org.openecomp.sdc.versioning.ItemManagerFactory;
+import org.openecomp.sdc.versioning.AsdcItemManager;
+import org.openecomp.sdc.versioning.AsdcItemManagerFactory;
import org.openecomp.sdc.versioning.VersioningManager;
import org.openecomp.sdc.versioning.VersioningManagerFactory;
import org.openecomp.sdc.versioning.dao.types.Version;
@@ -124,7 +124,8 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts {
private static ItemCreationDto validationVsp;
- private final ItemManager itemManager = ItemManagerFactory.getInstance().createInterface();
+ private final AsdcItemManager asdcItemManager = AsdcItemManagerFactory.getInstance()
+ .createInterface();
private final ItemPermissionsManager permissionsManager =
ItemPermissionsManagerFactory.getInstance().createInterface();
private final VersioningManager versioningManager =
@@ -168,7 +169,7 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts {
item.addProperty(VspItemProperty.ONBOARDING_METHOD, onboardingMethod.name());
UniqueValueUtil.validateUniqueValue(VENDOR_SOFTWARE_PRODUCT_NAME, item.getName());
- item = itemManager.create(item);
+ item = asdcItemManager.create(item);
UniqueValueUtil.createUniqueValue(VENDOR_SOFTWARE_PRODUCT_NAME, item.getName());
Version version = versioningManager.create(item.getId(), new Version(), null);
@@ -214,7 +215,7 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts {
GenericCollectionWrapper<VspDetailsDto> results = new GenericCollectionWrapper<>();
MapItemToVspDetailsDto mapper = new MapItemToVspDetailsDto();
- itemManager.list(itemPredicate).stream()
+ asdcItemManager.list(itemPredicate).stream()
.sorted((o1, o2) -> o2.getModificationTime().compareTo(o1.getModificationTime()))
.forEach(vspItem -> results.add(mapper.applyMapping(vspItem, VspDetailsDto.class)));
@@ -283,7 +284,7 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts {
@Override
public Response deleteVsp(String vspId, String user) {
- Item vsp = itemManager.get(vspId);
+ Item vsp = asdcItemManager.get(vspId);
if(!vsp.getType().equals(ItemType.vsp.name())){
throw new CoreException((new ErrorCode.ErrorCodeBuilder()
@@ -293,7 +294,7 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts {
Integer certifiedVersionsCounter = vsp.getVersionStatusCounters().get(VersionStatus.Certified);
if (Objects.isNull(certifiedVersionsCounter) || certifiedVersionsCounter == 0) {
- itemManager.delete(vsp);
+ asdcItemManager.delete(vsp);
permissionsManager.deleteItemPermissions(vspId);
UniqueValueUtil.deleteUniqueValue(VENDOR_SOFTWARE_PRODUCT_NAME, vsp.getName());
notifyUsers(vspId, vsp.getName(), null, "VSP was deleted", user,
@@ -353,7 +354,7 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts {
} catch (CoreException validationVspAlreadyExistException) {
// find validationVsp
- String validationVspId = itemManager.list(item ->
+ String validationVspId = asdcItemManager.list(item ->
ItemType.vsp.name().equals(item.getType()) && VALIDATION_VSP_NAME.equals(item.getName()))
.stream().findFirst().orElseThrow(() -> new IllegalStateException("Vsp with name %s "
+ "does not exist even though the name exists according to unique value util"))
@@ -522,7 +523,7 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts {
private void notifyUsers(String itemId, String itemName, Version version, String message,
String userName, NotificationEventTypes eventType) {
Map<String, Object> eventProperties = new HashMap<>();
- eventProperties.put(ITEM_NAME, itemName == null ? itemManager.get(itemId).getName() : itemName);
+ eventProperties.put(ITEM_NAME, itemName == null ? asdcItemManager.get(itemId).getName() : itemName);
eventProperties.put(ITEM_ID, itemId);
if (version != null) {
diff --git a/openecomp-be/backend/openecomp-sdc-action-manager/src/main/java/org/openecomp/sdc/action/impl/ActionManagerImpl.java b/openecomp-be/backend/openecomp-sdc-action-manager/src/main/java/org/openecomp/sdc/action/impl/ActionManagerImpl.java
index 492bfef019..1189a9c00a 100644
--- a/openecomp-be/backend/openecomp-sdc-action-manager/src/main/java/org/openecomp/sdc/action/impl/ActionManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-action-manager/src/main/java/org/openecomp/sdc/action/impl/ActionManagerImpl.java
@@ -1,72 +1,21 @@
-/*-
- * ============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.action.impl;
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.lang.StringUtils;
-import org.openecomp.core.util.UniqueValueUtil;
-import org.openecomp.core.utilities.CommonMethods;
-import org.openecomp.core.utilities.json.JsonUtil;
-import org.openecomp.sdc.action.ActionConstants;
-import org.openecomp.sdc.action.ActionManager;
-import org.openecomp.sdc.action.dao.ActionArtifactDao;
-import org.openecomp.sdc.action.dao.ActionArtifactDaoFactory;
-import org.openecomp.sdc.action.dao.ActionDao;
-import org.openecomp.sdc.action.dao.ActionDaoFactory;
-import org.openecomp.sdc.action.dao.types.ActionArtifactEntity;
-import org.openecomp.sdc.action.dao.types.ActionEntity;
-import org.openecomp.sdc.action.errors.ActionErrorConstants;
-import org.openecomp.sdc.action.errors.ActionException;
-import org.openecomp.sdc.action.logging.StatusCode;
-import org.openecomp.sdc.action.types.Action;
-import org.openecomp.sdc.action.types.ActionArtifact;
-import org.openecomp.sdc.action.types.ActionArtifactProtection;
-import org.openecomp.sdc.action.types.ActionStatus;
-import org.openecomp.sdc.action.types.ActionSubOperation;
-import org.openecomp.sdc.action.types.OpenEcompComponent;
-import org.openecomp.sdc.common.errors.CoreException;
-import org.openecomp.sdc.logging.api.Logger;
-import org.openecomp.sdc.logging.api.LoggerFactory;
-import org.openecomp.sdc.versioning.VersioningManager;
-import org.openecomp.sdc.versioning.VersioningManagerFactory;
-import org.openecomp.sdc.versioning.dao.VersionInfoDao;
-import org.openecomp.sdc.versioning.dao.VersionInfoDaoFactory;
-import org.openecomp.sdc.versioning.dao.types.UserCandidateVersion;
-import org.openecomp.sdc.versioning.dao.types.Version;
-import org.openecomp.sdc.versioning.dao.types.VersionInfoEntity;
-import org.openecomp.sdc.versioning.errors.EntityNotExistErrorBuilder;
-import org.openecomp.sdc.versioning.errors.VersioningErrorCodes;
-import org.openecomp.sdc.versioning.types.VersionInfo;
-import org.openecomp.sdc.versioning.types.VersionableEntityAction;
-import org.slf4j.MDC;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-
import static org.openecomp.sdc.action.ActionConstants.ACTION_VERSIONABLE_TYPE;
import static org.openecomp.sdc.action.ActionConstants.ARTIFACT_METADATA_ATTR_NAME;
import static org.openecomp.sdc.action.ActionConstants.ARTIFACT_METADATA_ATTR_UUID;
@@ -115,6 +64,52 @@ import static org.openecomp.sdc.action.util.ActionUtil.actionLogPreProcessor;
import static org.openecomp.sdc.action.util.ActionUtil.getCurrentTimeStampUtc;
import static org.openecomp.sdc.versioning.dao.types.Version.VERSION_STRING_VIOLATION_MSG;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang.StringUtils;
+import org.openecomp.core.util.UniqueValueUtil;
+import org.openecomp.core.utilities.CommonMethods;
+import org.openecomp.core.utilities.json.JsonUtil;
+import org.openecomp.sdc.action.ActionConstants;
+import org.openecomp.sdc.action.ActionManager;
+import org.openecomp.sdc.action.dao.ActionArtifactDao;
+import org.openecomp.sdc.action.dao.ActionArtifactDaoFactory;
+import org.openecomp.sdc.action.dao.ActionDao;
+import org.openecomp.sdc.action.dao.ActionDaoFactory;
+import org.openecomp.sdc.action.dao.types.ActionArtifactEntity;
+import org.openecomp.sdc.action.dao.types.ActionEntity;
+import org.openecomp.sdc.action.errors.ActionErrorConstants;
+import org.openecomp.sdc.action.errors.ActionException;
+import org.openecomp.sdc.action.logging.StatusCode;
+import org.openecomp.sdc.action.types.Action;
+import org.openecomp.sdc.action.types.ActionArtifact;
+import org.openecomp.sdc.action.types.ActionArtifactProtection;
+import org.openecomp.sdc.action.types.ActionStatus;
+import org.openecomp.sdc.action.types.ActionSubOperation;
+import org.openecomp.sdc.action.types.OpenEcompComponent;
+import org.openecomp.sdc.common.errors.CoreException;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
+import org.openecomp.sdc.versioning.ActionVersioningManager;
+import org.openecomp.sdc.versioning.ActionVersioningManagerFactory;
+import org.openecomp.sdc.versioning.dao.VersionInfoDao;
+import org.openecomp.sdc.versioning.dao.VersionInfoDaoFactory;
+import org.openecomp.sdc.versioning.dao.types.UserCandidateVersion;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdc.versioning.dao.types.VersionInfoEntity;
+import org.openecomp.sdc.versioning.errors.EntityNotExistErrorBuilder;
+import org.openecomp.sdc.versioning.errors.VersioningErrorCodes;
+import org.openecomp.sdc.versioning.types.VersionInfo;
+import org.openecomp.sdc.versioning.types.VersionableEntityAction;
+import org.slf4j.MDC;
+
/**
* Manager Implementation for {@link ActionManager Action Library Operations} <br> Handles Business
* layer validations and acts as an interface between the REST and DAO layers.
@@ -122,8 +117,8 @@ import static org.openecomp.sdc.versioning.dao.types.Version.VERSION_STRING_VIOL
public class ActionManagerImpl implements ActionManager {
private static final ActionDao actionDao = ActionDaoFactory.getInstance().createInterface();
- private static final VersioningManager versioningManager =
- VersioningManagerFactory.getInstance().createInterface();
+ private static final ActionVersioningManager versioningManager =
+ ActionVersioningManagerFactory.getInstance().createInterface();
private static final ActionArtifactDao actionArtifactDao =
ActionArtifactDaoFactory.getInstance().createInterface();
private static VersionInfoDao versionInfoDao =
@@ -140,7 +135,7 @@ public class ActionManagerImpl implements ActionManager {
*
* @param invariantId Invariant UUID of the action for which the information is required
* @return List of All Major, Last Minor and Candidate version if any Of {@link Action} with given
- actionInvariantUuId.
+ * actionInvariantUuId.
* @throws ActionException Exception with an action library specific code, short description and
* detailed message for the error occurred during the operation
*/
@@ -168,7 +163,7 @@ public class ActionManagerImpl implements ActionManager {
* @param filterType Filter by Vendor/Category/Model/Component/None
* @param filterValue Filter Parameter Value (Vendor ID/Category ID/Model ID/Component ID)
* @return List of {@link Action} objects based on a filter criteria <br> Empty List if no records
- match the provided filter criteria
+ * match the provided filter criteria
* @throws ActionException Exception with an action library specific code, short description and
* detailed message for the error occurred for the error occurred during
* the operation
@@ -243,7 +238,7 @@ public class ActionManagerImpl implements ActionManager {
* List OPENECOMP Components supported by Action Library.
*
* @return List of {@link OpenEcompComponent} objects supported by Action Library <br> Empty List if
- no components are found
+ * no components are found
* @throws ActionException Exception with an action library specific code, short description and
* detailed message for the error occurred for the error occurred during
* the operation
@@ -476,7 +471,8 @@ public class ActionManagerImpl implements ActionManager {
List<ActionArtifact> currentVersionArtifacts = action.getArtifacts();
//Delete the artifacts from action_artifact table (if any)
- if (CollectionUtils.isNotEmpty(currentVersionArtifacts) && currentVersionArtifacts.size() > 0) {
+ if (CollectionUtils.isNotEmpty(currentVersionArtifacts) &&
+ currentVersionArtifacts.size() > 0) {
for (ActionArtifact artifact : currentVersionArtifacts) {
ActionArtifactEntity artifactDeleteEntity =
new ActionArtifactEntity(artifact.getArtifactUuId(),
@@ -902,7 +898,7 @@ public class ActionManagerImpl implements ActionManager {
*
* @param actions Exhaustive list of the action versions
* @return List {@link Action} of last major and last minor version (no candidate) of action from
- a list of actions
+ * a list of actions
*/
private List<Action> getMajorMinorVersionActions(List<Action> actions) {
log.debug(" entering getMajorMinorVersionActions for actions ");
@@ -1047,10 +1043,9 @@ public class ActionManagerImpl implements ActionManager {
action.setActionUuId(existingAction.getActionUuId());
} catch (IllegalArgumentException iae) {
String message = iae.getMessage();
- if(message == VERSION_STRING_VIOLATION_MSG) {
+ if (message == VERSION_STRING_VIOLATION_MSG) {
throw new ActionException(ACTION_UPDATE_NOT_ALLOWED_CODE, message);
- }
- else {
+ } else {
throw iae;
}
}
diff --git a/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/ItemPermissionsManagerFactoryImpl.java b/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/ItemPermissionsManagerFactoryImpl.java
index 2255ad5fc3..6e41465a11 100644
--- a/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/ItemPermissionsManagerFactoryImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/ItemPermissionsManagerFactoryImpl.java
@@ -1,3 +1,19 @@
+/*
+ * 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
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.openecomp.sdc.itempermissions.dao.impl;
import org.openecomp.sdc.itempermissions.ItemPermissionsManager;
@@ -5,7 +21,7 @@ import org.openecomp.sdc.itempermissions.ItemPermissionsManagerFactory;
import org.openecomp.sdc.itempermissions.PermissionsServicesFactory;
import org.openecomp.sdc.notification.factories.NotificationPropagationManagerFactory;
import org.openecomp.sdc.notification.factories.SubscriptionServiceFactory;
-import org.openecomp.sdc.versioning.ItemManagerFactory;
+import org.openecomp.sdc.versioning.AsdcItemManagerFactory;
/**
* Created by ayalaben on 6/18/2017
@@ -14,7 +30,7 @@ public class ItemPermissionsManagerFactoryImpl extends ItemPermissionsManagerFac
private static final ItemPermissionsManager INSTANCE =
new ItemPermissionsManagerImpl(PermissionsServicesFactory.getInstance().createInterface(),
- ItemManagerFactory.getInstance().createInterface(),
+ AsdcItemManagerFactory.getInstance().createInterface(),
NotificationPropagationManagerFactory.getInstance().createInterface(),
SubscriptionServiceFactory.getInstance().createInterface());
diff --git a/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/ItemPermissionsManagerImpl.java b/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/ItemPermissionsManagerImpl.java
index 838530a1cd..a68c2d89f9 100644
--- a/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/ItemPermissionsManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/ItemPermissionsManagerImpl.java
@@ -1,5 +1,32 @@
+/*
+ * 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
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.openecomp.sdc.itempermissions.dao.impl;
+import static org.openecomp.sdc.itempermissions.notifications.NotificationConstants.ITEM_ID_PROP;
+import static org.openecomp.sdc.itempermissions.notifications.NotificationConstants.ITEM_NAME_PROP;
+import static org.openecomp.sdc.itempermissions.notifications.NotificationConstants.PERMISSION_CHANGED;
+import static org.openecomp.sdc.itempermissions.notifications.NotificationConstants.PERMISSION_GRANTED;
+import static org.openecomp.sdc.itempermissions.notifications.NotificationConstants.PERMISSION_ITEM;
+import static org.openecomp.sdc.itempermissions.notifications.NotificationConstants.PERMISSION_USER;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.common.errors.ErrorCategory;
import org.openecomp.sdc.common.errors.ErrorCode;
@@ -14,21 +41,9 @@ import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.notification.dtos.Event;
import org.openecomp.sdc.notification.services.NotificationPropagationManager;
import org.openecomp.sdc.notification.services.SubscriptionService;
-import org.openecomp.sdc.versioning.ItemManager;
+import org.openecomp.sdc.versioning.AsdcItemManager;
import org.openecomp.sdc.versioning.types.Item;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import static org.openecomp.sdc.itempermissions.notifications.NotificationConstants.ITEM_ID_PROP;
-import static org.openecomp.sdc.itempermissions.notifications.NotificationConstants.ITEM_NAME_PROP;
-import static org.openecomp.sdc.itempermissions.notifications.NotificationConstants.PERMISSION_CHANGED;
-import static org.openecomp.sdc.itempermissions.notifications.NotificationConstants.PERMISSION_GRANTED;
-import static org.openecomp.sdc.itempermissions.notifications.NotificationConstants.PERMISSION_ITEM;
-import static org.openecomp.sdc.itempermissions.notifications.NotificationConstants.PERMISSION_USER;
-
/**
* Created by ayalaben on 6/18/2017.
*/
@@ -38,16 +53,16 @@ public class ItemPermissionsManagerImpl implements ItemPermissionsManager {
private static final String CHANGE_PERMISSIONS = "Change_Item_Permissions";
private PermissionsServices permissionsServices;
- private ItemManager itemManager;
+ private AsdcItemManager asdcItemManager;
private NotificationPropagationManager notifier;
private SubscriptionService subscriptionService;
public ItemPermissionsManagerImpl(PermissionsServices permissionsServices,
- ItemManager itemManager,
+ AsdcItemManager asdcItemManager,
NotificationPropagationManager notificationPropagationManager,
SubscriptionService subscriptionService) {
this.permissionsServices = permissionsServices;
- this.itemManager = itemManager;
+ this.asdcItemManager = asdcItemManager;
this.notifier = notificationPropagationManager;
this.subscriptionService = subscriptionService;
}
@@ -74,7 +89,7 @@ public class ItemPermissionsManagerImpl implements ItemPermissionsManager {
if (permission.equals(PermissionTypes.Owner.name()) ){
if (addedUsersIds.size() == 1){
- itemManager.updateOwner(itemId,addedUsersIds.iterator().next());
+ asdcItemManager.updateOwner(itemId,addedUsersIds.iterator().next());
} else {
throw new CoreException(new ErrorCode.ErrorCodeBuilder()
.withMessage(Messages.PERMISSIONS_OWNER_ERROR.getErrorMessage())
@@ -92,7 +107,7 @@ public class ItemPermissionsManagerImpl implements ItemPermissionsManager {
private void sendNotifications(String itemId, String permission, Set<String> addedUsersIds,
Set<String> removedUsersIds, String userName) {
- Item item = itemManager.get(itemId);
+ Item item = asdcItemManager.get(itemId);
addedUsersIds.forEach(affectedUser -> {
notifyUser(userName, true, item.getName(), itemId, affectedUser, permission);
subscriptionService.subscribe(affectedUser, itemId);
diff --git a/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/test/java/org/openecomp/sdc/itempermissions/dao/impl/ItemPermissionsManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/test/java/org/openecomp/sdc/itempermissions/dao/impl/ItemPermissionsManagerImplTest.java
index 439b8b6105..e215db2335 100644
--- a/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/test/java/org/openecomp/sdc/itempermissions/dao/impl/ItemPermissionsManagerImplTest.java
+++ b/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/test/java/org/openecomp/sdc/itempermissions/dao/impl/ItemPermissionsManagerImplTest.java
@@ -1,28 +1,53 @@
+/*
+ * 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
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.openecomp.sdc.itempermissions.dao.impl;
-import org.mockito.*;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.verify;
+import static org.openecomp.sdc.itempermissions.notifications.NotificationConstants.ITEM_ID_PROP;
+import static org.openecomp.sdc.itempermissions.notifications.NotificationConstants.PERMISSION_CHANGED;
+import static org.openecomp.sdc.itempermissions.notifications.NotificationConstants.PERMISSION_GRANTED;
+import static org.openecomp.sdc.itempermissions.notifications.NotificationConstants.PERMISSION_ITEM;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import org.mockito.ArgumentCaptor;
+import org.mockito.Captor;
+import org.mockito.InjectMocks;
+import org.mockito.Matchers;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.common.session.SessionContextProviderFactory;
import org.openecomp.sdc.itempermissions.PermissionsServices;
import org.openecomp.sdc.notification.dtos.Event;
import org.openecomp.sdc.notification.services.NotificationPropagationManager;
import org.openecomp.sdc.notification.services.SubscriptionService;
-import org.openecomp.sdc.versioning.ItemManager;
+import org.openecomp.sdc.versioning.AsdcItemManager;
import org.openecomp.sdc.versioning.types.Item;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
-import java.util.*;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.verify;
-import static org.openecomp.sdc.itempermissions.notifications.NotificationConstants.*;
-import static org.openecomp.sdc.itempermissions.notifications.NotificationConstants.PERMISSION_CHANGED;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-
/**
* Created by ayalaben on 7/6/2017
*/
@@ -40,7 +65,7 @@ public class ItemPermissionsManagerImplTest {
@Mock
private PermissionsServices permissionsServicesMock;
@Mock
- private ItemManager itemManagerMock;
+ private AsdcItemManager asdcItemManagerMock;
@Mock
private SubscriptionService subscriptionServiceMock;
@Mock
@@ -54,7 +79,8 @@ public class ItemPermissionsManagerImplTest {
@BeforeMethod
public void setUp() throws Exception {
- SessionContextProviderFactory.getInstance().createInterface().create(USER, tenant);
+ SessionContextProviderFactory.getInstance().createInterface().create(USER,
+ tenant);
MockitoAnnotations.initMocks(this);
}
@@ -73,7 +99,7 @@ public class ItemPermissionsManagerImplTest {
doReturn(true).when(permissionsServicesMock).isAllowed(ITEM1_ID, USER, ACTION);
Item item = new Item();
item.setName("Item 1 Name");
- doReturn(item).when(itemManagerMock).get(ITEM1_ID);
+ doReturn(item).when(asdcItemManagerMock).get(ITEM1_ID);
Set<String> addedUsersIds =
Stream.of(AFFECTED_USER1, AFFECTED_USER2).collect(Collectors.toSet());
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java
index a9223db285..299affe29f 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java
@@ -66,6 +66,7 @@ import org.openecomp.sdc.vendorsoftwareproduct.informationArtifact.InformationAr
import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileResponse;
import org.openecomp.sdc.vendorsoftwareproduct.types.ValidationResponse;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.DeploymentFlavor;
+import org.openecomp.sdc.versioning.ActionVersioningManager;
import org.openecomp.sdc.versioning.VersioningManager;
import org.openecomp.sdc.versioning.dao.types.Version;
import org.openecomp.sdc.versioning.dao.types.VersionStatus;
@@ -105,7 +106,7 @@ public class VendorSoftwareProductManagerImplTest {
private static String id007 = null;
@Mock
- private VersioningManager versioningManagerMock;
+ private ActionVersioningManager versioningManagerMock;
@Mock
private OrchestrationTemplateDao orchestrationTemplateDataDaoMock;
@Mock
diff --git a/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-core/src/main/java/org/openecomp/conflicts/ItemMergeHandlerFactoryImpl.java b/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-core/src/main/java/org/openecomp/conflicts/ItemMergeHandlerFactoryImpl.java
index 4c981acee4..1e3213a953 100644
--- a/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-core/src/main/java/org/openecomp/conflicts/ItemMergeHandlerFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-core/src/main/java/org/openecomp/conflicts/ItemMergeHandlerFactoryImpl.java
@@ -1,18 +1,33 @@
+/*
+ * 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
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.openecomp.conflicts;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Optional;
import org.openecomp.conflicts.dao.ConflictsDaoFactory;
import org.openecomp.conflicts.impl.VspMergeHandler;
import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.datatypes.model.ItemType;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VspMergeDaoFactory;
-import org.openecomp.sdc.versioning.ItemManagerFactory;
+import org.openecomp.sdc.versioning.AsdcItemManagerFactory;
import org.openecomp.sdc.versioning.errors.EntityNotExistErrorBuilder;
import org.openecomp.sdc.versioning.types.Item;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Optional;
-
public class ItemMergeHandlerFactoryImpl extends ItemMergeHandlerFactory {
// TODO: 11/1/2017 read this map from configuration, move Vsp merge handler to vsp lib, rearrange lib deps
private static final Map<ItemType, ItemMergeHandler> MERGE_HANDLER_BY_ITEM_TYPE =
@@ -26,7 +41,7 @@ public class ItemMergeHandlerFactoryImpl extends ItemMergeHandlerFactory {
@Override
public Optional<ItemMergeHandler> createInterface(String itemId) {
- Item item = ItemManagerFactory.getInstance().createInterface().get(itemId);
+ Item item = AsdcItemManagerFactory.getInstance().createInterface().get(itemId);
if (item == null) {
throw new CoreException(new EntityNotExistErrorBuilder("", itemId).build());
}
diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionDaoImpl.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionDaoImpl.java
index a79687f9a4..5b7e1b2c8e 100644
--- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionDaoImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionDaoImpl.java
@@ -1,25 +1,45 @@
-/*-
- * ============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.action.dao.impl;
+import static com.datastax.driver.core.querybuilder.QueryBuilder.eq;
+import static com.datastax.driver.core.querybuilder.QueryBuilder.in;
+import static com.datastax.driver.core.querybuilder.QueryBuilder.set;
+import static org.openecomp.core.nosqldb.impl.cassandra.CassandraSessionFactory.getSession;
+import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_CATEGORY;
+import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_MODEL;
+import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_NAME;
+import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_NONE;
+import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_OPEN_ECOMP_COMPONENT;
+import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_VENDOR;
+import static org.openecomp.sdc.action.ActionConstants.STATUS;
+import static org.openecomp.sdc.action.ActionConstants.TARGET_ENTITY;
+import static org.openecomp.sdc.action.ActionConstants.TARGET_ENTITY_DB;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ARTIFACT_DEL_LOCKED_OTHER_USER;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ARTIFACT_DEL_LOCKED_OTHER_USER_CODE;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ENTITY_NOT_EXIST;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ENTITY_NOT_EXIST_CODE;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_INTERNAL_SERVER_ERR_CODE;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_NOT_LOCKED_CODE;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_NOT_LOCKED_MSG;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_QUERY_FAILURE_CODE;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_QUERY_FAILURE_MSG;
+
import com.datastax.driver.core.ResultSet;
import com.datastax.driver.core.Row;
import com.datastax.driver.core.Statement;
@@ -31,6 +51,14 @@ 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.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
import org.openecomp.core.dao.impl.CassandraBaseDao;
import org.openecomp.core.nosqldb.api.NoSqlDb;
import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
@@ -49,7 +77,7 @@ import org.openecomp.sdc.action.types.OpenEcompComponent;
import org.openecomp.sdc.action.util.ActionUtil;
import org.openecomp.sdc.logging.api.Logger;
import org.openecomp.sdc.logging.api.LoggerFactory;
-import org.openecomp.sdc.versioning.VersioningManagerFactory;
+import org.openecomp.sdc.versioning.ActionVersioningManagerFactory;
import org.openecomp.sdc.versioning.dao.VersionInfoDao;
import org.openecomp.sdc.versioning.dao.VersionInfoDaoFactory;
import org.openecomp.sdc.versioning.dao.VersionInfoDeletedDao;
@@ -60,39 +88,6 @@ import org.openecomp.sdc.versioning.dao.types.VersionInfoEntity;
import org.openecomp.sdc.versioning.types.VersionableEntityMetadata;
import org.slf4j.MDC;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-import static com.datastax.driver.core.querybuilder.QueryBuilder.eq;
-import static com.datastax.driver.core.querybuilder.QueryBuilder.in;
-import static com.datastax.driver.core.querybuilder.QueryBuilder.set;
-import static org.openecomp.core.nosqldb.impl.cassandra.CassandraSessionFactory.getSession;
-import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_CATEGORY;
-import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_MODEL;
-import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_NAME;
-import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_NONE;
-import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_OPEN_ECOMP_COMPONENT;
-import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_VENDOR;
-import static org.openecomp.sdc.action.ActionConstants.STATUS;
-import static org.openecomp.sdc.action.ActionConstants.TARGET_ENTITY;
-import static org.openecomp.sdc.action.ActionConstants.TARGET_ENTITY_DB;
-import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ARTIFACT_DEL_LOCKED_OTHER_USER;
-import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ARTIFACT_DEL_LOCKED_OTHER_USER_CODE;
-import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG;
-import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ENTITY_NOT_EXIST;
-import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ENTITY_NOT_EXIST_CODE;
-import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_INTERNAL_SERVER_ERR_CODE;
-import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_NOT_LOCKED_CODE;
-import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_NOT_LOCKED_MSG;
-import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_QUERY_FAILURE_CODE;
-import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_QUERY_FAILURE_MSG;
-
public class ActionDaoImpl extends CassandraBaseDao<ActionEntity> implements ActionDao {
private static NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
@@ -111,7 +106,7 @@ public class ActionDaoImpl extends CassandraBaseDao<ActionEntity> implements Act
@Override
public void registerVersioning(String versionableEntityType) {
- VersioningManagerFactory.getInstance().createInterface()
+ ActionVersioningManagerFactory.getInstance().createInterface()
.register(versionableEntityType, new VersionableEntityMetadata(
mapper.getTableMetadata().getName(),
mapper.getTableMetadata().getPartitionKey().get(0).getName(),
@@ -292,13 +287,15 @@ public class ActionDaoImpl extends CassandraBaseDao<ActionEntity> implements Act
try {
log.debug(" entering getOpenEcompComponents ");
ActionUtil
- .actionLogPreProcessor(ActionSubOperation.GET_OPEN_ECOMP_COMPONENTS_ENTITY, TARGET_ENTITY_DB);
+ .actionLogPreProcessor(ActionSubOperation.GET_OPEN_ECOMP_COMPONENTS_ENTITY,
+ TARGET_ENTITY_DB);
result = accessor.getOpenEcompComponents();
ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
log.metrics("");
if (result != null) {
openEcompComponents.addAll(
- result.all().stream().map(OpenEcompComponentEntity::toDto).collect(Collectors.toList()));
+ result.all().stream().map(OpenEcompComponentEntity::toDto)
+ .collect(Collectors.toList()));
}
} catch (NoHostAvailableException noHostAvailableException) {
logGenericException(noHostAvailableException);
@@ -479,7 +476,7 @@ public class ActionDaoImpl extends CassandraBaseDao<ActionEntity> implements Act
private void updateStatusInActionData(String actionInvariantUuId, List<Version> versions,
ActionStatus status) {
log.debug("entering updateStatusInActionData for actionInvariantUuId = " + actionInvariantUuId
- + " and status = " + status + " for versions " + versions);
+ + " and status = " + status + " for versions " + versions);
for (Version v : versions) {
ActionEntity entity = this.get(new ActionEntity(actionInvariantUuId, v));
String currentData = entity.getData();
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceArtifactDaoCassandraImpl.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceArtifactDaoCassandraImpl.java
index 2a0b964066..4962ae37a2 100644
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceArtifactDaoCassandraImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceArtifactDaoCassandraImpl.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.model.impl;
@@ -27,19 +23,18 @@ 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 java.util.List;
+import java.util.stream.Collectors;
import org.openecomp.core.model.dao.EnrichedServiceArtifactDao;
import org.openecomp.core.model.types.EnrichedServiceArtifactEntity;
import org.openecomp.core.model.types.ServiceArtifact;
import org.openecomp.core.nosqldb.api.NoSqlDb;
import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
-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;
-import java.util.List;
-import java.util.stream.Collectors;
-
public class EnrichedServiceArtifactDaoCassandraImpl implements EnrichedServiceArtifactDao {
private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
@@ -54,7 +49,7 @@ public class EnrichedServiceArtifactDaoCassandraImpl implements EnrichedServiceA
@Override
public void registerVersioning(String versionableEntityType) {
- VersioningManagerFactory.getInstance().createInterface().register(versionableEntityType,
+ ActionVersioningManagerFactory.getInstance().createInterface().register(versionableEntityType,
new VersionableEntityMetadata(mapper.getTableMetadata().getName(),
mapper.getTableMetadata().getPartitionKey().get(0).getName(),
mapper.getTableMetadata().getPartitionKey().get(1).getName()));
@@ -133,7 +128,7 @@ public class EnrichedServiceArtifactDaoCassandraImpl implements EnrichedServiceA
"SELECT vsp_id,version,name,content_data FROM "
+ "vsp_enriched_service_artifact where vsp_id=? and version=? and name=?")
Result<EnrichedServiceArtifactEntity> getArtifactInfo(String vspId, UDTValue version,
- String name);
+ String name);
@Query("DELETE from vsp_enriched_service_artifact where vsp_id=? and version=?")
ResultSet delete(String vspId, UDTValue version);
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceTemplateDaoCassandraImpl.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceTemplateDaoCassandraImpl.java
index ab13e6a9f0..2e28ac94f8 100644
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceTemplateDaoCassandraImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceTemplateDaoCassandraImpl.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.model.impl;
@@ -27,19 +23,18 @@ 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 java.util.List;
+import java.util.stream.Collectors;
import org.openecomp.core.model.dao.EnrichedServiceTemplateDao;
import org.openecomp.core.model.types.EnrichedServiceTemplateEntity;
import org.openecomp.core.model.types.ServiceTemplate;
import org.openecomp.core.nosqldb.api.NoSqlDb;
import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
-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;
-import java.util.List;
-import java.util.stream.Collectors;
-
public class EnrichedServiceTemplateDaoCassandraImpl implements EnrichedServiceTemplateDao {
private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
@@ -54,7 +49,7 @@ public class EnrichedServiceTemplateDaoCassandraImpl implements EnrichedServiceT
@Override
public void registerVersioning(String versionableEntityType) {
- VersioningManagerFactory.getInstance().createInterface().register(versionableEntityType,
+ ActionVersioningManagerFactory.getInstance().createInterface().register(versionableEntityType,
new VersionableEntityMetadata(mapper.getTableMetadata().getName(),
mapper.getTableMetadata().getPartitionKey().get(0).getName(),
mapper.getTableMetadata().getPartitionKey().get(1).getName()));
@@ -141,7 +136,7 @@ public class EnrichedServiceTemplateDaoCassandraImpl implements EnrichedServiceT
"SELECT vsp_id, version, name, base_name ,content_data FROM "
+ "vsp_enriched_service_template where vsp_id=? and version=? and name=?")
Result<EnrichedServiceTemplateEntity> getTemplateInfo(String vspId, UDTValue version,
- String name);
+ String name);
@Query(
"SELECT vsp_id, version, name, base_name FROM "
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceArtifactDaoCassandraImpl.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceArtifactDaoCassandraImpl.java
index 15aae0f710..84972342f8 100644
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceArtifactDaoCassandraImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceArtifactDaoCassandraImpl.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.model.impl;
@@ -27,19 +23,18 @@ 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 java.util.List;
+import java.util.stream.Collectors;
import org.openecomp.core.model.dao.ServiceArtifactDao;
import org.openecomp.core.model.types.ServiceArtifact;
import org.openecomp.core.model.types.ServiceArtifactEntity;
import org.openecomp.core.nosqldb.api.NoSqlDb;
import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
-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;
-import java.util.List;
-import java.util.stream.Collectors;
-
public class ServiceArtifactDaoCassandraImpl implements ServiceArtifactDao {
private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
@@ -53,7 +48,7 @@ public class ServiceArtifactDaoCassandraImpl implements ServiceArtifactDao {
@Override
public void registerVersioning(String versionableEntityType) {
- VersioningManagerFactory.getInstance().createInterface().register(versionableEntityType,
+ ActionVersioningManagerFactory.getInstance().createInterface().register(versionableEntityType,
new VersionableEntityMetadata(mapper.getTableMetadata().getName(),
mapper.getTableMetadata().getPartitionKey().get(0).getName(),
mapper.getTableMetadata().getPartitionKey().get(1).getName()));
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceTemplateDaoCassandraImpl.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceTemplateDaoCassandraImpl.java
index 71334ce8d3..9db89414d2 100644
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceTemplateDaoCassandraImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceTemplateDaoCassandraImpl.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.model.impl;
@@ -27,19 +23,18 @@ 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 java.util.List;
+import java.util.stream.Collectors;
import org.openecomp.core.model.dao.ServiceTemplateDao;
import org.openecomp.core.model.types.ServiceTemplate;
import org.openecomp.core.model.types.ServiceTemplateEntity;
import org.openecomp.core.nosqldb.api.NoSqlDb;
import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
-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;
-import java.util.List;
-import java.util.stream.Collectors;
-
public class ServiceTemplateDaoCassandraImpl implements ServiceTemplateDao {
private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
@@ -53,7 +48,7 @@ public class ServiceTemplateDaoCassandraImpl implements ServiceTemplateDao {
@Override
public void registerVersioning(String versionableEntityType) {
- VersioningManagerFactory.getInstance().createInterface().register(versionableEntityType,
+ ActionVersioningManagerFactory.getInstance().createInterface().register(versionableEntityType,
new VersionableEntityMetadata(mapper.getTableMetadata().getName(),
mapper.getTableMetadata().getPartitionKey().get(0).getName(),
mapper.getTableMetadata().getPartitionKey().get(1).getName()));
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<EntitlementPoolEntity>
implements EntitlementPoolDao {
@@ -67,7 +62,7 @@ public class EntitlementPoolCassandraDaoImpl extends CassandraBaseDao<Entitlemen
Arrays.asList(mapper.getTableMetadata().getPartitionKey().get(0).getName(),
mapper.getTableMetadata().getPartitionKey().get(1).getName(), "name"))));
- VersioningManagerFactory.getInstance().createInterface()
+ ActionVersioningManagerFactory.getInstance().createInterface()
.register(versionableEntityType, metadata);
}
@@ -83,7 +78,7 @@ public class EntitlementPoolCassandraDaoImpl extends CassandraBaseDao<Entitlemen
}
@Override
- public String getManufacturerReferenceNumber(EntitlementPoolEntity entitlementPoolEntity){
+ public String getManufacturerReferenceNumber(EntitlementPoolEntity entitlementPoolEntity) {
return null;
}
@@ -128,7 +123,7 @@ public class EntitlementPoolCassandraDaoImpl extends CassandraBaseDao<Entitlemen
@Query("select * from entitlement_pool where vlm_id=? AND version=?")
Result<EntitlementPoolEntity> 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<Entitlemen
"UPDATE entitlement_pool SET ref_fg_ids = ref_fg_ids + ? WHERE vlm_id=? AND version=? "
+ " AND ep_id=?")
ResultSet addReferencingFeatureGroups(Set<String> 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<String> 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<FeatureGroupEntity>
implements FeatureGroupDao {
@@ -74,7 +69,7 @@ public class FeatureGroupCassandraDaoImpl extends CassandraBaseDao<FeatureGroupE
Arrays.asList(mapper.getTableMetadata().getPartitionKey().get(0).getName(),
mapper.getTableMetadata().getPartitionKey().get(1).getName(), "name"))));
- VersioningManagerFactory.getInstance().createInterface()
+ ActionVersioningManagerFactory.getInstance().createInterface()
.register(versionableEntityType, metadata);
}
@@ -171,36 +166,36 @@ public class FeatureGroupCassandraDaoImpl extends CassandraBaseDao<FeatureGroupE
+ "ep_ids=ep_ids-?, lkg_ids=lkg_ids+?,lkg_ids=lkg_ids-? WHERE vlm_id=? AND version=? "
+ "AND fg_id=?")
ResultSet updateColumnsAndDeltaFeatureGroupIds(String name, String description,
- String partNumber,
- Set<String> addedEntitlementPools,
- Set<String> removedEntitlementPools,
- Set<String> addedLicenseKeyGroups,
- Set<String> removedLicenseKeyGroups,
- String vendorLicenseModelId, UDTValue version,
- String id);
+ String partNumber,
+ Set<String> addedEntitlementPools,
+ Set<String> removedEntitlementPools,
+ Set<String> addedLicenseKeyGroups,
+ Set<String> 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<String> 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<String> 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<String> 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<String> 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<LicenseAgreementEntity>
implements LicenseAgreementDao {
@@ -75,7 +70,7 @@ public class LicenseAgreementCassandraDaoImpl extends CassandraBaseDao<LicenseAg
Arrays.asList(mapper.getTableMetadata().getPartitionKey().get(0).getName(),
mapper.getTableMetadata().getPartitionKey().get(1).getName(), "name"))));
- VersioningManagerFactory.getInstance().createInterface()
+ ActionVersioningManagerFactory.getInstance().createInterface()
.register(versionableEntityType, metadata);
}
@@ -148,14 +143,14 @@ public class LicenseAgreementCassandraDaoImpl extends CassandraBaseDao<LicenseAg
"UPDATE license_agreement SET name=?, description=?, lic_term=?, req_const=?, "
+ "fg_ids=fg_ids+?, fg_ids=fg_ids-? WHERE vlm_id=? AND version=? AND la_id=?")
ResultSet updateColumnsAndDeltaFeatureGroupIds(String name, String description,
- UDTValue licenseTerm, String reqAndConst,
- Set<String> addedFeatureGroupIds,
- Set<String> removedFeatureGroupIds,
- String vendorLicenseModelId, UDTValue version,
- String id);
+ UDTValue licenseTerm, String reqAndConst,
+ Set<String> addedFeatureGroupIds,
+ Set<String> 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<String> 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<LicenseKeyGroupEntity>
implements LicenseKeyGroupDao {
@@ -67,7 +62,7 @@ public class LicenseKeyGroupCassandraDaoImpl extends CassandraBaseDao<LicenseKey
Arrays.asList(mapper.getTableMetadata().getPartitionKey().get(0).getName(),
mapper.getTableMetadata().getPartitionKey().get(1).getName(), "name"))));
- VersioningManagerFactory.getInstance().createInterface()
+ ActionVersioningManagerFactory.getInstance().createInterface()
.register(versionableEntityType, metadata);
}
@@ -123,13 +118,13 @@ public class LicenseKeyGroupCassandraDaoImpl extends CassandraBaseDao<LicenseKey
"UPDATE license_key_group SET ref_fg_ids = ref_fg_ids + ? WHERE vlm_id=? AND version=? "
+ "AND lkg_id=?")
ResultSet addReferencingFeatureGroups(Set<String> 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<String> 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<VendorLicenseModelEntity>
implements
VendorLicenseModelDao {
@@ -50,7 +45,7 @@ public class VendorLicenseModelCassandraDaoImpl extends CassandraBaseDao<VendorL
@Override
public void registerVersioning(String versionableEntityType) {
- VersioningManagerFactory.getInstance().createInterface()
+ ActionVersioningManagerFactory.getInstance().createInterface()
.register(versionableEntityType, new VersionableEntityMetadata(
mapper.getTableMetadata().getName(),
mapper.getTableMetadata().getPartitionKey().get(0).getName(),
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/VendorLicenseModelDaoZusammenImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/VendorLicenseModelDaoZusammenImpl.java
index 13065515d8..78b31f8865 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/VendorLicenseModelDaoZusammenImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/VendorLicenseModelDaoZusammenImpl.java
@@ -1,3 +1,19 @@
+/*
+ * 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
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.openecomp.sdc.vendorlicense.dao.impl.zusammen;
import com.amdocs.zusammen.adaptor.inbound.api.types.item.ZusammenElement;
@@ -5,19 +21,18 @@ import com.amdocs.zusammen.datatypes.SessionContext;
import com.amdocs.zusammen.datatypes.item.Action;
import com.amdocs.zusammen.datatypes.item.ElementContext;
import com.amdocs.zusammen.datatypes.item.Info;
+import java.util.Collection;
+import java.util.stream.Collectors;
import org.openecomp.core.zusammen.api.ZusammenAdaptor;
import org.openecomp.core.zusammen.api.ZusammenUtil;
import org.openecomp.sdc.datatypes.model.ElementType;
import org.openecomp.sdc.vendorlicense.dao.VendorLicenseModelDao;
import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.convertor.ElementToVLMGeneralConvertor;
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.types.VersionableEntityMetadata;
import org.openecomp.sdc.versioning.types.VersionableEntityStoreType;
-import java.util.Collection;
-import java.util.stream.Collectors;
-
public class VendorLicenseModelDaoZusammenImpl implements VendorLicenseModelDao {
private ZusammenAdaptor zusammenAdaptor;
@@ -32,7 +47,7 @@ public class VendorLicenseModelDaoZusammenImpl implements VendorLicenseModelDao
new VersionableEntityMetadata(VersionableEntityStoreType.Zusammen, "VendorLicenseModel",
null, null);
- VersioningManagerFactory.getInstance().createInterface()
+ ActionVersioningManagerFactory.getInstance().createInterface()
.register(versionableEntityType, metadata);
}
@@ -66,25 +81,25 @@ public class VendorLicenseModelDaoZusammenImpl implements VendorLicenseModelDao
"Create VLM General Info Element");
ZusammenElement licenseAgreementsElement =
- ZusammenUtil.buildStructuralElement(ElementType.LicenseAgreements, Action.CREATE);
+ ZusammenUtil.buildStructuralElement(ElementType.LicenseAgreements, Action.CREATE);
zusammenAdaptor.saveElement(context, elementContext, licenseAgreementsElement,
"Create VLM licenseAgreementsElement");
ZusammenElement featureGroupsElement =
- ZusammenUtil.buildStructuralElement(ElementType.FeatureGroups, Action.CREATE);
+ ZusammenUtil.buildStructuralElement(ElementType.FeatureGroups, Action.CREATE);
zusammenAdaptor.saveElement(context, elementContext, featureGroupsElement,
"Create VLM featureGroupsElement");
ZusammenElement lkgsElement =
- ZusammenUtil.buildStructuralElement(ElementType.LicenseKeyGroups, Action.CREATE);
+ ZusammenUtil.buildStructuralElement(ElementType.LicenseKeyGroups, Action.CREATE);
zusammenAdaptor.saveElement(context, elementContext, lkgsElement,
"Create VLM lkgsElement");
ZusammenElement entitlementPoolsElement =
- ZusammenUtil.buildStructuralElement(ElementType.EntitlementPools, Action.CREATE);
+ ZusammenUtil.buildStructuralElement(ElementType.EntitlementPools, Action.CREATE);
zusammenAdaptor.saveElement(context, elementContext, entitlementPoolsElement,
"Create VLM entitlementPoolsElement");
@@ -122,14 +137,6 @@ public class VendorLicenseModelDaoZusammenImpl implements VendorLicenseModelDao
}
- /* private Info mapVlmToZusammenItemInfo(VendorLicenseModelEntity vendorLicenseModel) {
- Info info = new Info();
- info.setName(vendorLicenseModel.getVendorName());
- info.setDescription(vendorLicenseModel.getDescription());
- info.addProperty("type", "VendorLicenseModel");
- addVlmToInfo(info, vendorLicenseModel);
- return info;
- }*/
private ZusammenElement mapVlmToZusammenElement(VendorLicenseModelEntity vendorLicenseModel,
Action action) {
@@ -146,13 +153,6 @@ public class VendorLicenseModelDaoZusammenImpl implements VendorLicenseModelDao
info.addProperty(InfoPropertyName.oldVersion.name(), vendorLicenseModel.getOldVersion());
}
- /*private VendorLicenseModelEntity mapInfoToVlm(String vlmId, Version version, Info info) {
- VendorLicenseModelEntity vendorLicenseModel = new VendorLicenseModelEntity(vlmId, version);
- vendorLicenseModel.setVendorName(info.getProperty(InfoPropertyName.name.name()));
- vendorLicenseModel.setDescription(info.getProperty(InfoPropertyName.description.name()));
- vendorLicenseModel.setIconRef(info.getProperty(InfoPropertyName.iconRef.name()));
- return vendorLicenseModel;
- }*/
public enum InfoPropertyName {
name,
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/util/VendorLicenseArtifactsServiceUtils.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/util/VendorLicenseArtifactsServiceUtils.java
index bd209f9e81..cbc0b9c19a 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/util/VendorLicenseArtifactsServiceUtils.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/util/VendorLicenseArtifactsServiceUtils.java
@@ -1,25 +1,27 @@
-/*-
- * ============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.licenseartifacts.impl.util;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
import org.apache.commons.collections4.MultiValuedMap;
import org.apache.commons.collections4.multimap.ArrayListValuedHashMap;
import org.openecomp.sdc.vendorlicense.HealingServiceFactory;
@@ -27,20 +29,13 @@ import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity;
import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity;
import org.openecomp.sdc.vendorlicense.healing.HealingService;
import org.openecomp.sdc.vendorlicense.licenseartifacts.impl.VendorLicenseArtifactsServiceImpl;
-import org.openecomp.sdc.versioning.ItemManagerFactory;
+import org.openecomp.sdc.versioning.AsdcItemManagerFactory;
import org.openecomp.sdc.versioning.VersioningManager;
import org.openecomp.sdc.versioning.VersioningManagerFactory;
import org.openecomp.sdc.versioning.dao.types.Version;
import org.openecomp.sdc.versioning.dao.types.VersionStatus;
import org.openecomp.sdc.versioning.dao.types.VersionableEntity;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.stream.Collectors;
-
/**
* @author katyr
* @since January 10, 2017
@@ -128,7 +123,8 @@ public class VendorLicenseArtifactsServiceUtils {
}
public static String getVendorName(String vendorLicenseModelId) {
- return ItemManagerFactory.getInstance().createInterface().get(vendorLicenseModelId).getName();
+ return AsdcItemManagerFactory.getInstance().createInterface().get(vendorLicenseModelId)
+ .getName();
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentDaoCassandraImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentDaoCassandraImpl.java
index 9cdd950a72..da852a62b4 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentDaoCassandraImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentDaoCassandraImpl.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.vendorsoftwareproduct.dao.impl;
@@ -27,21 +23,20 @@ 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 org.openecomp.core.dao.impl.CassandraBaseDao;
import org.openecomp.core.nosqldb.api.NoSqlDb;
import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity;
-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;
-
public class ComponentDaoCassandraImpl extends CassandraBaseDao<ComponentEntity>
implements ComponentDao {
@@ -66,7 +61,7 @@ public class ComponentDaoCassandraImpl extends CassandraBaseDao<ComponentEntity>
Arrays.asList(mapper.getTableMetadata().getPartitionKey().get(0).getName(),
mapper.getTableMetadata().getPartitionKey().get(1).getName(), "name"))));
- VersioningManagerFactory.getInstance().createInterface()
+ ActionVersioningManagerFactory.getInstance().createInterface()
.register(versionableEntityType, metadata);
}
@@ -100,7 +95,8 @@ public class ComponentDaoCassandraImpl extends CassandraBaseDao<ComponentEntity>
@Override
public void updateQuestionnaireData(String vspId, Version version, String componentId,
String questionnaireData) {
- accessor.updateQuestionnaireData(questionnaireData, vspId, versionMapper.toUDT(version), componentId);
+ accessor.updateQuestionnaireData(questionnaireData, vspId, versionMapper.toUDT(version),
+ componentId);
}
@Override
@@ -109,7 +105,8 @@ public class ComponentDaoCassandraImpl extends CassandraBaseDao<ComponentEntity>
}
@Override
- public Collection<ComponentEntity> listCompositionAndQuestionnaire(String vspId, Version version){
+ public Collection<ComponentEntity> listCompositionAndQuestionnaire(String vspId,
+ Version version) {
return accessor.listCompositionAndQuestionnaire(vspId, versionMapper.toUDT(version)).all();
}
@@ -145,13 +142,13 @@ public class ComponentDaoCassandraImpl extends CassandraBaseDao<ComponentEntity>
"insert into vsp_component (vsp_id, version, component_id, composition_data)"
+ " values (?,?,?,?)")
ResultSet updateCompositionData(String vspId, UDTValue version, String id,
- String compositionData);
+ String compositionData);
@Query(
"update vsp_component set questionnaire_data=? where vsp_id=? and version=?"
+ " and component_id=?")
ResultSet updateQuestionnaireData(String questionnaireData, String vspId, UDTValue version,
- String id);
+ String id);
@Query("delete from vsp_component where vsp_id=? and version=?")
ResultSet deleteAll(String vspId, Version version);
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentDependencyModelDaoCassandraImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentDependencyModelDaoCassandraImpl.java
index 2fcbc1aae8..11524ed05f 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentDependencyModelDaoCassandraImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentDependencyModelDaoCassandraImpl.java
@@ -1,3 +1,19 @@
+/*
+ * 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
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.openecomp.sdc.vendorsoftwareproduct.dao.impl;
import com.datastax.driver.core.ResultSet;
@@ -7,23 +23,22 @@ 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 org.openecomp.core.dao.impl.CassandraBaseDao;
import org.openecomp.core.nosqldb.api.NoSqlDb;
import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDependencyModelDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentDependencyModelEntity;
-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;
-
-public class ComponentDependencyModelDaoCassandraImpl extends CassandraBaseDao
- <ComponentDependencyModelEntity> implements ComponentDependencyModelDao {
+public class ComponentDependencyModelDaoCassandraImpl extends
+ CassandraBaseDao<ComponentDependencyModelEntity> implements ComponentDependencyModelDao {
private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
private static final Mapper<ComponentDependencyModelEntity> mapper =
@@ -62,7 +77,7 @@ public class ComponentDependencyModelDaoCassandraImpl extends CassandraBaseDao
VendorSoftwareProductConstants.UniqueValues.PROCESS_NAME,
Arrays.asList("vsp_id", "version", "component_id", "name"))));
- VersioningManagerFactory.getInstance().createInterface()
+ ActionVersioningManagerFactory.getInstance().createInterface()
.register(versionableEntityType, metadata);
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComputeDaoCassandraImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComputeDaoCassandraImpl.java
index ba878c661e..4e85ff61c3 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComputeDaoCassandraImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComputeDaoCassandraImpl.java
@@ -1,3 +1,19 @@
+/*
+ * 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
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.openecomp.sdc.vendorsoftwareproduct.dao.impl;
import com.datastax.driver.core.ResultSet;
@@ -7,21 +23,20 @@ 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 org.openecomp.core.dao.impl.CassandraBaseDao;
import org.openecomp.core.nosqldb.api.NoSqlDb;
import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComputeEntity;
-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;
-
public class ComputeDaoCassandraImpl extends CassandraBaseDao<ComputeEntity> implements
ComputeDao {
@@ -45,7 +60,7 @@ public class ComputeDaoCassandraImpl extends CassandraBaseDao<ComputeEntity> imp
VendorSoftwareProductConstants.UniqueValues.COMPUTE_NAME,
Arrays.asList("vsp_id", "version", "component_id", "name"))));
- VersioningManagerFactory.getInstance().createInterface()
+ ActionVersioningManagerFactory.getInstance().createInterface()
.register(versionableEntityType, metadata);
}
@@ -107,12 +122,12 @@ public class ComputeDaoCassandraImpl extends CassandraBaseDao<ComputeEntity> imp
@Query("update vsp_component_compute set composition_data=? where vsp_id=? and version=?"
+ " and component_id=? and compute_id=?")
ResultSet updateCompositionData(String compositionData, String vspId, UDTValue version,
- String componentId, String computeId);
+ String componentId, String computeId);
@Query("update vsp_component_compute set questionnaire_data=? where vsp_id=? and version=?"
+ " and component_id=? and compute_id=?")
ResultSet updateQuestionnaireData(String questionnaireData, String vspId, UDTValue version,
- String componentId, String computeId);
+ String componentId, String computeId);
@Query("delete from vsp_component_compute where vsp_id=? and version=?")
ResultSet deleteAll(String vspId, Version version);
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/DeploymentFlavorDaoCassandraImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/DeploymentFlavorDaoCassandraImpl.java
index 5831b582fc..2a19082005 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/DeploymentFlavorDaoCassandraImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/DeploymentFlavorDaoCassandraImpl.java
@@ -1,3 +1,19 @@
+/*
+ * 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
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.openecomp.sdc.vendorsoftwareproduct.dao.impl;
import com.datastax.driver.core.ResultSet;
@@ -7,87 +23,89 @@ 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 org.openecomp.core.dao.impl.CassandraBaseDao;
import org.openecomp.core.nosqldb.api.NoSqlDb;
import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants;
import org.openecomp.sdc.vendorsoftwareproduct.dao.DeploymentFlavorDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.DeploymentFlavorEntity;
-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;
-
-public class DeploymentFlavorDaoCassandraImpl extends CassandraBaseDao<DeploymentFlavorEntity> implements DeploymentFlavorDao {
- private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
- private static final Mapper<DeploymentFlavorEntity> mapper = noSqlDb.getMappingManager().mapper(DeploymentFlavorEntity.class);
- private static final DeploymentFlavorAccessor accessor =
- noSqlDb.getMappingManager().createAccessor(DeploymentFlavorAccessor.class);
- private static final UDTMapper<Version> versionMapper =
- noSqlDb.getMappingManager().udtMapper(Version.class);
- @Override
- protected Mapper<DeploymentFlavorEntity> getMapper() {
- return mapper;
- }
-
- @Override
- protected Object[] getKeys(DeploymentFlavorEntity entity) {
- return new Object[]{entity.getVspId(), versionMapper.toUDT(entity.getVersion()),
- entity.getId()};
- }
-
- @Override
- public Collection<DeploymentFlavorEntity> list(DeploymentFlavorEntity entity) {
- return accessor.list(entity.getVspId(), versionMapper.toUDT(entity.getVersion())).all();
- }
-
- @Override
- public void update(DeploymentFlavorEntity entity) {
- accessor.updateCompositionData(entity.getVspId(), versionMapper.toUDT(entity.getVersion()),
- entity.getId(), entity.getCompositionData());
- }
-
- @Override
- public void registerVersioning(String versionableEntityType) {
- VersionableEntityMetadata metadata = new VersionableEntityMetadata(
- mapper.getTableMetadata().getName(),
- mapper.getTableMetadata().getPartitionKey().get(0).getName(),
- mapper.getTableMetadata().getPartitionKey().get(1).getName());
-
-
- metadata.setUniqueValuesMetadata(Collections.singletonList(new UniqueValueMetadata(
- VendorSoftwareProductConstants.UniqueValues.DEPLOYMENT_FLAVOR_NAME,
- Arrays.asList(mapper.getTableMetadata().getPartitionKey().get(0).getName(),
- mapper.getTableMetadata().getPartitionKey().get(1).getName(), "name"))));
-
- VersioningManagerFactory.getInstance().createInterface()
- .register(versionableEntityType, metadata);
- }
-
- @Override
- public void deleteAll(String vspId, Version version) {
- accessor.deleteAll(vspId, version);
- }
-
- @Accessor
- interface DeploymentFlavorAccessor {
- @Query(
- "select vsp_id, version, deployment_flavor_id, composition_data from vsp_deployment_flavor where vsp_id=?"
- + " and version=?")
- Result<DeploymentFlavorEntity> list(String vspId, UDTValue version);
-
- @Query(
- "insert into vsp_deployment_flavor (vsp_id, version, deployment_flavor_id, composition_data) values (?,?,?,?)")
- ResultSet updateCompositionData(String vspId, UDTValue version, String id,
- String compositionData);
-
- @Query("delete from vsp_deployment_flavor where vsp_id=? and version=?")
- ResultSet deleteAll(String vspId, Version version);
-
- }
+public class DeploymentFlavorDaoCassandraImpl extends CassandraBaseDao<DeploymentFlavorEntity>
+ implements DeploymentFlavorDao {
+ private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
+ private static final Mapper<DeploymentFlavorEntity> mapper =
+ noSqlDb.getMappingManager().mapper(DeploymentFlavorEntity.class);
+ private static final DeploymentFlavorAccessor accessor =
+ noSqlDb.getMappingManager().createAccessor(DeploymentFlavorAccessor.class);
+ private static final UDTMapper<Version> versionMapper =
+ noSqlDb.getMappingManager().udtMapper(Version.class);
+
+ @Override
+ protected Mapper<DeploymentFlavorEntity> getMapper() {
+ return mapper;
+ }
+
+ @Override
+ protected Object[] getKeys(DeploymentFlavorEntity entity) {
+ return new Object[]{entity.getVspId(), versionMapper.toUDT(entity.getVersion()),
+ entity.getId()};
+ }
+
+ @Override
+ public Collection<DeploymentFlavorEntity> list(DeploymentFlavorEntity entity) {
+ return accessor.list(entity.getVspId(), versionMapper.toUDT(entity.getVersion())).all();
+ }
+
+ @Override
+ public void update(DeploymentFlavorEntity entity) {
+ accessor.updateCompositionData(entity.getVspId(), versionMapper.toUDT(entity.getVersion()),
+ entity.getId(), entity.getCompositionData());
+ }
+
+ @Override
+ public void registerVersioning(String versionableEntityType) {
+ VersionableEntityMetadata metadata = new VersionableEntityMetadata(
+ mapper.getTableMetadata().getName(),
+ mapper.getTableMetadata().getPartitionKey().get(0).getName(),
+ mapper.getTableMetadata().getPartitionKey().get(1).getName());
+
+
+ metadata.setUniqueValuesMetadata(Collections.singletonList(new UniqueValueMetadata(
+ VendorSoftwareProductConstants.UniqueValues.DEPLOYMENT_FLAVOR_NAME,
+ Arrays.asList(mapper.getTableMetadata().getPartitionKey().get(0).getName(),
+ mapper.getTableMetadata().getPartitionKey().get(1).getName(), "name"))));
+
+ ActionVersioningManagerFactory.getInstance().createInterface()
+ .register(versionableEntityType, metadata);
+ }
+
+ @Override
+ public void deleteAll(String vspId, Version version) {
+ accessor.deleteAll(vspId, version);
+ }
+
+ @Accessor
+ interface DeploymentFlavorAccessor {
+ @Query(
+ "select vsp_id, version, deployment_flavor_id, composition_data from vsp_deployment_flavor where vsp_id=?"
+ + " and version=?")
+ Result<DeploymentFlavorEntity> list(String vspId, UDTValue version);
+
+ @Query(
+ "insert into vsp_deployment_flavor (vsp_id, version, deployment_flavor_id, composition_data) values (?,?,?,?)")
+ ResultSet updateCompositionData(String vspId, UDTValue version, String id,
+ String compositionData);
+
+ @Query("delete from vsp_deployment_flavor where vsp_id=? and version=?")
+ ResultSet deleteAll(String vspId, Version version);
+
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ImageDaoImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ImageDaoImpl.java
index 24217830e4..441f8fbbf9 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ImageDaoImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ImageDaoImpl.java
@@ -1,3 +1,19 @@
+/*
+ * 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
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.openecomp.sdc.vendorsoftwareproduct.dao.impl;
import com.datastax.driver.core.ResultSet;
@@ -7,21 +23,20 @@ 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 org.openecomp.core.dao.impl.CassandraBaseDao;
import org.openecomp.core.nosqldb.api.NoSqlDb;
import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ImageDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ImageEntity;
-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;
-
public class ImageDaoImpl extends CassandraBaseDao<ImageEntity> implements ImageDao {
private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
@@ -45,7 +60,7 @@ public class ImageDaoImpl extends CassandraBaseDao<ImageEntity> implements Image
VendorSoftwareProductConstants.UniqueValues.IMAGE_NAME,
Arrays.asList("vsp_id", "version", "component_id", "name"))));
- VersioningManagerFactory.getInstance().createInterface()
+ ActionVersioningManagerFactory.getInstance().createInterface()
.register(versionableEntityType, metadata);
}
@@ -111,12 +126,12 @@ public class ImageDaoImpl extends CassandraBaseDao<ImageEntity> implements Image
"insert into vsp_component_image (vsp_id, version, component_id, image_id, "
+ "composition_data) values (?,?,?,?,?)")
ResultSet updateCompositionData(String vspId, UDTValue version, String componentId, String id,
- String compositionData);
+ String compositionData);
@Query("update vsp_component_image set questionnaire_data=? where vsp_id=? and version=?"
+ " and component_id=? and image_id=?")
ResultSet updateQuestionnaireData(String questionnaireData, String vspId, UDTValue version,
- String componentId, String computeId);
+ String componentId, String computeId);
@Query("delete from vsp_component_image where vsp_id=? and version=?")
ResultSet deleteByVspId(String vspId, UDTValue version);
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/VendorSoftwareProductInfoDaoZusammenImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/VendorSoftwareProductInfoDaoZusammenImpl.java
index 8d9a8eed93..482536342b 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/VendorSoftwareProductInfoDaoZusammenImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/VendorSoftwareProductInfoDaoZusammenImpl.java
@@ -15,11 +15,17 @@
*/
package org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen;
+import static org.openecomp.core.zusammen.api.ZusammenUtil.buildStructuralElement;
+import static org.openecomp.core.zusammen.api.ZusammenUtil.createSessionContext;
+
import com.amdocs.zusammen.adaptor.inbound.api.types.item.ZusammenElement;
import com.amdocs.zusammen.datatypes.SessionContext;
import com.amdocs.zusammen.datatypes.item.Action;
import com.amdocs.zusammen.datatypes.item.ElementContext;
import com.amdocs.zusammen.datatypes.item.Info;
+import java.io.ByteArrayInputStream;
+import java.util.Collection;
+import java.util.stream.Collectors;
import org.openecomp.core.zusammen.api.ZusammenAdaptor;
import org.openecomp.sdc.datatypes.model.ElementType;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
@@ -27,18 +33,11 @@ import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.convertor.Eleme
import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.convertor.ElementToVSPQuestionnaireConvertor;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspQuestionnaireEntity;
-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 org.openecomp.sdc.versioning.types.VersionableEntityStoreType;
-import java.io.ByteArrayInputStream;
-import java.util.Collection;
-import java.util.stream.Collectors;
-
-import static org.openecomp.core.zusammen.api.ZusammenUtil.buildStructuralElement;
-import static org.openecomp.core.zusammen.api.ZusammenUtil.createSessionContext;
-
public class VendorSoftwareProductInfoDaoZusammenImpl implements VendorSoftwareProductInfoDao {
private static final String EMPTY_DATA = "{}";
@@ -54,7 +53,7 @@ public class VendorSoftwareProductInfoDaoZusammenImpl implements VendorSoftwareP
new VersionableEntityMetadata(VersionableEntityStoreType.Zusammen, "VendorSoftwareProduct",
null, null);
- VersioningManagerFactory.getInstance().createInterface()
+ ActionVersioningManagerFactory.getInstance().createInterface()
.register(versionableEntityType, metadata);
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/ActionVersioningManager.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/ActionVersioningManager.java
new file mode 100644
index 0000000000..3875e59f33
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/ActionVersioningManager.java
@@ -0,0 +1,75 @@
+/*
+ * 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
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.openecomp.sdc.versioning;
+
+import java.util.List;
+import java.util.Map;
+import org.openecomp.sdc.versioning.dao.types.Revision;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdc.versioning.types.VersionCreationMethod;
+import org.openecomp.sdc.versioning.types.VersionInfo;
+import org.openecomp.sdc.versioning.types.VersionableEntityAction;
+import org.openecomp.sdc.versioning.types.VersionableEntityMetadata;
+
+public interface ActionVersioningManager {
+
+ void register(String entityType, VersionableEntityMetadata entityMetadata);
+
+ Version create(String entityType, String entityId, String user);
+
+ void delete(String entityType, String entityId, String user);
+
+ void undoDelete(String entityType, String entityId, String user);
+
+ Version checkout(String entityType, String entityId, String user);
+
+ Version undoCheckout(String entityType, String entityId, String user);
+
+ Version checkin(String entityType, String entityId, String user, String checkinDescription);
+
+ Version submit(String entityType, String entityId, String user, String submitDescription);
+
+ VersionInfo getEntityVersionInfo(String entityType, String entityId, String user,
+ VersionableEntityAction action);
+
+ Map<String, VersionInfo> listEntitiesVersionInfo(String entityType, String user,
+ VersionableEntityAction action);
+
+ Map<String, VersionInfo> listDeletedEntitiesVersionInfo(String entityType, String user,
+ VersionableEntityAction action);
+
+
+ List<Version> list(String itemId); // TODO: 5/24/2017 filter (by status for example)
+
+ Version get(String itemId, Version version);
+
+ Version create(String itemId, Version version,
+ VersionCreationMethod creationMethod);
+
+ void submit(String itemId, Version version, String submitDescription);
+
+ void publish(String itemId, Version version, String message);
+
+ void sync(String itemId, Version version);
+
+ void forceSync(String itemId, Version version);
+
+ void revert(String itemId, Version version, String revisionId);
+
+ List<Revision> listRevisions(String itemId, Version version);
+
+}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/ActionVersioningManagerFactory.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/ActionVersioningManagerFactory.java
new file mode 100644
index 0000000000..4ab659ac11
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/ActionVersioningManagerFactory.java
@@ -0,0 +1,28 @@
+/*
+ * 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
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.openecomp.sdc.versioning;
+
+import org.openecomp.core.factory.api.AbstractComponentFactory;
+import org.openecomp.core.factory.api.AbstractFactory;
+
+public abstract class ActionVersioningManagerFactory extends
+ AbstractComponentFactory<ActionVersioningManager> {
+
+ public static ActionVersioningManagerFactory getInstance() {
+ return AbstractFactory.getInstance(ActionVersioningManagerFactory.class);
+ }
+}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/AsdcItemManager.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/AsdcItemManager.java
new file mode 100644
index 0000000000..a4ea65fa08
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/AsdcItemManager.java
@@ -0,0 +1,40 @@
+/*
+ * 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
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.openecomp.sdc.versioning;
+
+import java.util.Collection;
+import java.util.function.Predicate;
+import org.openecomp.sdc.versioning.dao.types.VersionStatus;
+import org.openecomp.sdc.versioning.types.Item;
+
+public interface AsdcItemManager {
+
+ Collection<Item> list(Predicate<Item> predicate);
+
+ Item get(String itemId);
+
+ Item create(Item item);
+
+ void updateVersionStatus(String itemId, VersionStatus addedVersionStatus,
+ VersionStatus removedVersionStatus);
+
+ void updateOwner(String itemId, String owner);
+
+ void updateName(String itemId, String name);
+
+ void delete(Item item);
+}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/AsdcItemManagerFactory.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/AsdcItemManagerFactory.java
new file mode 100644
index 0000000000..a2095b8663
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/AsdcItemManagerFactory.java
@@ -0,0 +1,27 @@
+/*
+ * 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
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.openecomp.sdc.versioning;
+
+import org.openecomp.core.factory.api.AbstractComponentFactory;
+import org.openecomp.core.factory.api.AbstractFactory;
+
+public abstract class AsdcItemManagerFactory extends AbstractComponentFactory<AsdcItemManager> {
+
+ public static AsdcItemManagerFactory getInstance() {
+ return AbstractFactory.getInstance(AsdcItemManagerFactory.class);
+ }
+}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/ItemManager.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/ItemManager.java
index 885d96a132..41a2c12058 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/ItemManager.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/ItemManager.java
@@ -1,10 +1,25 @@
-package org.openecomp.sdc.versioning;
+/*
+ * 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
+ *
+ * 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.
+ */
-import org.openecomp.sdc.versioning.dao.types.VersionStatus;
-import org.openecomp.sdc.versioning.types.Item;
+package org.openecomp.sdc.versioning;
import java.util.Collection;
import java.util.function.Predicate;
+import org.openecomp.sdc.versioning.dao.types.VersionStatus;
+import org.openecomp.sdc.versioning.types.Item;
public interface ItemManager {
@@ -15,10 +30,11 @@ public interface ItemManager {
Item create(Item item);
void updateVersionStatus(String itemId, VersionStatus addedVersionStatus,
- VersionStatus removedVersionStatus);
-
- void updateOwner(String itemId, String owner);
+ VersionStatus removedVersionStatus);
void delete(Item item);
+ void updateName(String itemId, String name);
+
+ void update(Item item);
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/VersioningManager.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/VersioningManager.java
index c03769462b..cbb234e3e2 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/VersioningManager.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/VersioningManager.java
@@ -1,69 +1,34 @@
-/*-
- * ============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.versioning;
+import java.util.List;
import org.openecomp.sdc.versioning.dao.types.Revision;
import org.openecomp.sdc.versioning.dao.types.Version;
import org.openecomp.sdc.versioning.types.VersionCreationMethod;
-import org.openecomp.sdc.versioning.types.VersionInfo;
-import org.openecomp.sdc.versioning.types.VersionableEntityAction;
-import org.openecomp.sdc.versioning.types.VersionableEntityMetadata;
-
-import java.util.List;
-import java.util.Map;
public interface VersioningManager {
- void register(String entityType, VersionableEntityMetadata entityMetadata);
-
- Version create(String entityType, String entityId, String user);
-
- void delete(String entityType, String entityId, String user);
-
- void undoDelete(String entityType, String entityId, String user);
-
- Version checkout(String entityType, String entityId, String user);
-
- Version undoCheckout(String entityType, String entityId, String user);
-
- Version checkin(String entityType, String entityId, String user, String checkinDescription);
-
- Version submit(String entityType, String entityId, String user, String submitDescription);
-
- VersionInfo getEntityVersionInfo(String entityType, String entityId, String user,
- VersionableEntityAction action);
-
- Map<String, VersionInfo> listEntitiesVersionInfo(String entityType, String user,
- VersionableEntityAction action);
-
- Map<String, VersionInfo> listDeletedEntitiesVersionInfo(String entityType, String user,
- VersionableEntityAction action);
-
-
List<Version> list(String itemId); // TODO: 5/24/2017 filter (by status for example)
Version get(String itemId, Version version);
Version create(String itemId, Version version,
- VersionCreationMethod creationMethod);
+ VersionCreationMethod creationMethod);
void submit(String itemId, Version version, String submitDescription);
@@ -77,4 +42,5 @@ public interface VersioningManager {
List<Revision> listRevisions(String itemId, Version version);
+ void updateVersion(String itemId, Version version);
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/resources/factoryConfiguration.json b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/resources/factoryConfiguration.json
index 90d11f1700..579f107178 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/resources/factoryConfiguration.json
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/resources/factoryConfiguration.json
@@ -1,6 +1,8 @@
{
"org.openecomp.sdc.versioning.ItemManagerFactory": "org.openecomp.sdc.versioning.impl.ItemManagerFactoryImpl",
+ "org.openecomp.sdc.versioning.AsdcItemManagerFactory": "org.openecomp.sdc.versioning.impl.AsdcItemManagerFactoryImpl",
"org.openecomp.sdc.versioning.VersioningManagerFactory": "org.openecomp.sdc.versioning.impl.VersioningManagerFactoryImpl",
+ "org.openecomp.sdc.versioning.ActionVersioningManagerFactory": "org.openecomp.sdc.versioning.impl.ActionVersioningManagerFactoryImpl",
"org.openecomp.sdc.versioning.dao.VersionableEntityDaoFactory": "org.openecomp.sdc.versioning.dao.impl.VersionableEntityDaoFactoryImpl",
"org.openecomp.sdc.versioning.dao.VersionInfoDaoFactory": "org.openecomp.sdc.versioning.dao.impl.VersionInfoDaoFactoryImpl",
"org.openecomp.sdc.versioning.dao.VersionInfoDeletedDaoFactory": "org.openecomp.sdc.versioning.dao.impl.VersionInfoDeletedDaoFactoryImpl",
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionInfoDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionInfoDaoFactoryImpl.java
index 46c6a9d795..f26164a9d3 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionInfoDaoFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionInfoDaoFactoryImpl.java
@@ -1,30 +1,27 @@
-/*-
- * ============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.versioning.dao.impl;
+import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
import org.openecomp.sdc.versioning.dao.VersionInfoDao;
import org.openecomp.sdc.versioning.dao.VersionInfoDaoFactory;
public class VersionInfoDaoFactoryImpl extends VersionInfoDaoFactory {
- private static VersionInfoDao INSTANCE = new VersionInfoDaoImpl();
+ private static VersionInfoDao INSTANCE = new VersionInfoDaoImpl(NoSqlDbFactory.getInstance().createInterface());
@Override
public VersionInfoDao createInterface() {
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionInfoDaoImpl.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionInfoDaoImpl.java
index 7bc73ce3d5..1afc4202f5 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionInfoDaoImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/dao/impl/VersionInfoDaoImpl.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.versioning.dao.impl;
@@ -24,22 +20,26 @@ import com.datastax.driver.mapping.Mapper;
import com.datastax.driver.mapping.Result;
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.versioning.dao.VersionInfoDao;
import org.openecomp.sdc.versioning.dao.types.VersionInfoEntity;
-import java.util.Collection;
-
public class VersionInfoDaoImpl extends CassandraBaseDao<VersionInfoEntity>
implements VersionInfoDao {
- private static NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
- private static Mapper<VersionInfoEntity> mapper =
- noSqlDb.getMappingManager().mapper(VersionInfoEntity.class);
- private static VersionInfoAccessor accessor =
- noSqlDb.getMappingManager().createAccessor(VersionInfoAccessor.class);
+
+ private final NoSqlDb noSqlDb;
+ private final Mapper<VersionInfoEntity> mapper;
+ private final VersionInfoAccessor accessor;
+
+
+ public VersionInfoDaoImpl(NoSqlDb noSqlDb) {
+ this.noSqlDb = noSqlDb;
+ this.mapper = this.noSqlDb.getMappingManager().mapper(VersionInfoEntity.class);
+ this.accessor = this.noSqlDb.getMappingManager().createAccessor(VersionInfoAccessor.class);
+ }
@Override
protected Mapper<VersionInfoEntity> getMapper() {
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/ActionVersioningManagerFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/ActionVersioningManagerFactoryImpl.java
new file mode 100644
index 0000000000..054a569958
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/ActionVersioningManagerFactoryImpl.java
@@ -0,0 +1,39 @@
+/*
+ * 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
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.openecomp.sdc.versioning.impl;
+
+import org.openecomp.sdc.versioning.ActionVersioningManager;
+import org.openecomp.sdc.versioning.ActionVersioningManagerFactory;
+import org.openecomp.sdc.versioning.AsdcItemManagerFactory;
+import org.openecomp.sdc.versioning.VersionCalculatorFactory;
+import org.openecomp.sdc.versioning.dao.VersionDaoFactory;
+import org.openecomp.sdc.versioning.dao.VersionInfoDaoFactory;
+import org.openecomp.sdc.versioning.dao.VersionInfoDeletedDaoFactory;
+
+public class ActionVersioningManagerFactoryImpl extends ActionVersioningManagerFactory {
+
+
+ @Override
+ public ActionVersioningManager createInterface() {
+ return new ActionVersioningManagerImpl(
+ VersionInfoDaoFactory.getInstance().createInterface(),
+ VersionInfoDeletedDaoFactory.getInstance().createInterface(),
+ VersionDaoFactory.getInstance().createInterface(),
+ VersionCalculatorFactory.getInstance().createInterface(),
+ AsdcItemManagerFactory.getInstance().createInterface());
+ }
+}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/ActionVersioningManagerImpl.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/ActionVersioningManagerImpl.java
new file mode 100644
index 0000000000..0763ad970b
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/ActionVersioningManagerImpl.java
@@ -0,0 +1,630 @@
+/*
+ * 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
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.openecomp.sdc.versioning.impl;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+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.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
+import org.openecomp.sdc.versioning.ActionVersioningManager;
+import org.openecomp.sdc.versioning.AsdcItemManager;
+import org.openecomp.sdc.versioning.VersionCalculator;
+import org.openecomp.sdc.versioning.dao.VersionDao;
+import org.openecomp.sdc.versioning.dao.VersionInfoDao;
+import org.openecomp.sdc.versioning.dao.VersionInfoDeletedDao;
+import org.openecomp.sdc.versioning.dao.VersionableEntityDaoFactory;
+import org.openecomp.sdc.versioning.dao.types.Revision;
+import org.openecomp.sdc.versioning.dao.types.SynchronizationState;
+import org.openecomp.sdc.versioning.dao.types.UserCandidateVersion;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdc.versioning.dao.types.VersionInfoDeletedEntity;
+import org.openecomp.sdc.versioning.dao.types.VersionInfoEntity;
+import org.openecomp.sdc.versioning.dao.types.VersionStatus;
+import org.openecomp.sdc.versioning.errors.CheckinOnEntityLockedByOtherErrorBuilder;
+import org.openecomp.sdc.versioning.errors.CheckinOnUnlockedEntityErrorBuilder;
+import org.openecomp.sdc.versioning.errors.CheckoutOnLockedEntityErrorBuilder;
+import org.openecomp.sdc.versioning.errors.DeleteOnLockedEntityErrorBuilder;
+import org.openecomp.sdc.versioning.errors.EditOnEntityLockedByOtherErrorBuilder;
+import org.openecomp.sdc.versioning.errors.EditOnUnlockedEntityErrorBuilder;
+import org.openecomp.sdc.versioning.errors.EntityAlreadyExistErrorBuilder;
+import org.openecomp.sdc.versioning.errors.EntityAlreadyFinalizedErrorBuilder;
+import org.openecomp.sdc.versioning.errors.EntityNotExistErrorBuilder;
+import org.openecomp.sdc.versioning.errors.SubmitLockedEntityNotAllowedErrorBuilder;
+import org.openecomp.sdc.versioning.errors.UndoCheckoutOnEntityLockedByOtherErrorBuilder;
+import org.openecomp.sdc.versioning.errors.UndoCheckoutOnUnlockedEntityErrorBuilder;
+import org.openecomp.sdc.versioning.types.VersionCreationMethod;
+import org.openecomp.sdc.versioning.types.VersionInfo;
+import org.openecomp.sdc.versioning.types.VersionableEntityAction;
+import org.openecomp.sdc.versioning.types.VersionableEntityMetadata;
+import org.slf4j.MDC;
+
+public class ActionVersioningManagerImpl implements ActionVersioningManager {
+ private static final Logger LOGGER = LoggerFactory.getLogger(ActionVersioningManagerImpl.class);
+ private static final Version INITIAL_ACTIVE_VERSION = new Version(0, 0);
+ private static final Map<String, Set<VersionableEntityMetadata>> VERSIONABLE_ENTITIES =
+ new HashMap<>();
+
+ private final VersionInfoDao versionInfoDao;
+ private final VersionInfoDeletedDao versionInfoDeletedDao;
+ private VersionDao versionDao;
+ private VersionCalculator versionCalculator;
+ private AsdcItemManager asdcItemManager;
+
+ public ActionVersioningManagerImpl(VersionInfoDao versionInfoDao,
+ VersionInfoDeletedDao versionInfoDeletedDao,
+ VersionDao versionDao,
+ VersionCalculator versionCalculator,
+ AsdcItemManager asdcItemManager) {
+ this.versionInfoDao = versionInfoDao;
+ this.versionInfoDeletedDao = versionInfoDeletedDao;
+ this.versionDao = versionDao;
+ this.versionCalculator = versionCalculator;
+ this.asdcItemManager = asdcItemManager;
+ }
+
+ private static VersionInfo getVersionInfo(VersionInfoEntity versionInfoEntity, String user,
+ VersionableEntityAction action) {
+ return getVersionInfo(versionInfoEntity.getEntityId(),
+ versionInfoEntity.getEntityType(),
+ versionInfoEntity.getActiveVersion(),
+ versionInfoEntity.getCandidate(),
+ versionInfoEntity.getStatus(),
+ versionInfoEntity.getLatestFinalVersion(),
+ versionInfoEntity.getViewableVersions(),
+ action,
+ user);
+ }
+
+ private static VersionInfo getVersionInfo(VersionInfoDeletedEntity versionInfoEntity, String user,
+ VersionableEntityAction action) {
+ return getVersionInfo(versionInfoEntity.getEntityId(),
+ versionInfoEntity.getEntityType(),
+ versionInfoEntity.getActiveVersion(),
+ versionInfoEntity.getCandidate(),
+ versionInfoEntity.getStatus(),
+ versionInfoEntity.getLatestFinalVersion(),
+ versionInfoEntity.getViewableVersions(),
+ action,
+ user);
+ }
+
+ private static VersionInfo getVersionInfo(String entityId, String entityType, Version activeVer,
+ UserCandidateVersion candidate, VersionStatus status,
+ Version latestFinalVersion,
+ Set<Version> viewableVersions,
+ VersionableEntityAction action, String user) {
+ Version activeVersion;
+
+ if (action == VersionableEntityAction.Write) {
+ if (candidate != null) {
+ if (user.equals(candidate.getUser())) {
+ activeVersion = candidate.getVersion();
+ } else {
+ throw new CoreException(
+ new EditOnEntityLockedByOtherErrorBuilder(entityType, entityId, candidate.getUser())
+ .build());
+ }
+ } else {
+ throw new CoreException(new EditOnUnlockedEntityErrorBuilder(entityType, entityId).build());
+ }
+ } else {
+ if (candidate != null && user.equals(candidate.getUser())) {
+ activeVersion = candidate.getVersion();
+ } else {
+ activeVersion = activeVer;
+ }
+ }
+
+ VersionInfo versionInfo = new VersionInfo();
+ versionInfo.setStatus(status);
+ activeVersion.setStatus(status);
+ if (latestFinalVersion != null) {
+ latestFinalVersion.setStatus(status);
+ }
+ if (viewableVersions != null) {
+ viewableVersions.forEach(version -> version.setStatus(status));
+ }
+ versionInfo.setActiveVersion(activeVersion);
+ versionInfo.setLatestFinalVersion(latestFinalVersion);
+ versionInfo.setViewableVersions(toSortedList(viewableVersions));
+ versionInfo.setFinalVersions(getFinalVersions(viewableVersions));
+ if (candidate != null) {
+ candidate.getVersion().setStatus(status);
+ versionInfo.setLockingUser(candidate.getUser());
+ if (user.equals(candidate.getUser())) {
+ versionInfo.getViewableVersions().add(candidate.getVersion());
+ }
+ }
+ return versionInfo;
+ }
+
+ private static List<Version> toSortedList(
+ Set<Version> versions) { // changing the Set to List in DB will require migration...
+ return versions.stream().sorted((o1, o2) -> o1.getMajor() > o2.getMajor() ? 1
+ : o1.getMajor() == o2.getMajor() ? (o1.getMinor() > o2.getMinor() ? 1
+ : o1.getMinor() == o2.getMinor() ? 0 : -1) : -1).collect(Collectors.toList());
+ }
+
+ private static List<Version> getFinalVersions(Set<Version> versions) {
+ return versions.stream().filter(Version::isFinal).collect(Collectors.toList());
+ }
+
+ @Override
+ public void register(String entityType, VersionableEntityMetadata entityMetadata) {
+ Set<VersionableEntityMetadata> entitiesMetadata =
+ VERSIONABLE_ENTITIES.computeIfAbsent(entityType, k -> new HashSet<>());
+ entitiesMetadata.add(entityMetadata);
+ }
+
+ @Override
+ public Version create(String entityType, String entityId, String user) {
+ VersionInfoEntity
+ versionInfoEntity = versionInfoDao.get(new VersionInfoEntity(entityType, entityId));
+ if (versionInfoEntity != null) {
+ throw new CoreException(new EntityAlreadyExistErrorBuilder(entityType, entityId).build());
+ }
+
+ versionInfoEntity = new VersionInfoEntity(entityType, entityId);
+ versionInfoEntity.setActiveVersion(INITIAL_ACTIVE_VERSION);
+ markAsCheckedOut(versionInfoEntity, user);
+ versionInfoDao.create(versionInfoEntity);
+
+ return versionInfoEntity.getCandidate().getVersion();
+ }
+
+ @Override
+ public void delete(String entityType, String entityId, String user) {
+ VersionInfoEntity versionInfoEntity =
+ versionInfoDao.get(new VersionInfoEntity(entityType, entityId));
+ if (versionInfoEntity == null) {
+ throw new CoreException(new EntityNotExistErrorBuilder(entityType, entityId).build());
+ }
+
+ switch (versionInfoEntity.getStatus()) {
+ case Locked:
+ throw new CoreException(new DeleteOnLockedEntityErrorBuilder(entityType, entityId,
+ versionInfoEntity.getCandidate().getUser()).build());
+ default:
+ //do nothing
+ break;
+ }
+
+ doDelete(versionInfoEntity);
+ }
+
+ @Override
+ public void undoDelete(String entityType, String entityId, String user) {
+ VersionInfoDeletedEntity versionInfoDeletedEntity =
+ versionInfoDeletedDao.get(new VersionInfoDeletedEntity(entityType, entityId));
+ if (versionInfoDeletedEntity == null) {
+ throw new CoreException(new EntityNotExistErrorBuilder(entityType, entityId).build());
+ }
+
+ doUndoDelete(versionInfoDeletedEntity);
+}
+
+ @Override
+ public Version checkout(String entityType, String entityId, String user) {
+ VersionInfoEntity versionInfoEntity =
+ versionInfoDao.get(new VersionInfoEntity(entityType, entityId));
+ if (versionInfoEntity == null) {
+ throw new CoreException(new EntityNotExistErrorBuilder(entityType, entityId).build());
+ }
+
+ Version checkoutVersion = null;
+ switch (versionInfoEntity.getStatus()) {
+ case Locked:
+ throw new CoreException(new CheckoutOnLockedEntityErrorBuilder(entityType, entityId,
+ versionInfoEntity.getCandidate().getUser()).build());
+ case Certified:
+ case Draft:
+ checkoutVersion = doCheckout(versionInfoEntity, user);
+ break;
+ default:
+ //do nothing
+ break;
+ }
+
+ return checkoutVersion;
+ }
+
+ @Override
+ public Version undoCheckout(String entityType, String entityId, String user) {
+ VersionInfoEntity versionInfoEntity =
+ versionInfoDao.get(new VersionInfoEntity(entityType, entityId));
+ if (versionInfoEntity == null) {
+ throw new CoreException(new EntityNotExistErrorBuilder(entityType, entityId).build());
+ }
+
+ Version activeVersion = null;
+ switch (versionInfoEntity.getStatus()) {
+ case Locked:
+ if (!user.equals(versionInfoEntity.getCandidate().getUser())) {
+ throw new CoreException(
+ new UndoCheckoutOnEntityLockedByOtherErrorBuilder(entityType, entityId,
+ versionInfoEntity.getCandidate().getUser()).build());
+ }
+ activeVersion = undoCheckout(versionInfoEntity);
+ break;
+ case Certified:
+ case Draft:
+ throw new CoreException(
+ new UndoCheckoutOnUnlockedEntityErrorBuilder(entityType, entityId).build());
+ default:
+ //do nothing
+ break;
+ }
+
+ return activeVersion;
+ }
+
+ private Version undoCheckout(VersionInfoEntity versionInfoEntity) {
+ deleteVersionFromEntity(versionInfoEntity.getEntityType(), versionInfoEntity.getEntityId(),
+ versionInfoEntity.getCandidate().getVersion(), versionInfoEntity.getActiveVersion());
+
+ versionInfoEntity
+ .setStatus(versionInfoEntity.getActiveVersion().isFinal() ? VersionStatus.Certified
+ : VersionStatus.Draft);
+ versionInfoEntity.setCandidate(null);
+ versionInfoDao.update(versionInfoEntity);
+ return versionInfoEntity.getActiveVersion();
+ }
+
+ @Override
+ public Version checkin(String entityType, String entityId, String user,
+ String checkinDescription) {
+ VersionInfoEntity versionInfoEntity =
+ versionInfoDao.get(new VersionInfoEntity(entityType, entityId));
+ if (versionInfoEntity == null) {
+ throw new CoreException(new EntityNotExistErrorBuilder(entityType, entityId).build());
+ }
+
+ Version checkedInVersion = null;
+ switch (versionInfoEntity.getStatus()) {
+ case Draft:
+ case Certified:
+ throw new CoreException(
+ new CheckinOnUnlockedEntityErrorBuilder(entityType, entityId).build());
+ case Locked:
+ if (!user.equals(versionInfoEntity.getCandidate().getUser())) {
+ throw new CoreException(new CheckinOnEntityLockedByOtherErrorBuilder(entityType, entityId,
+ versionInfoEntity.getCandidate().getUser()).build());
+ }
+ checkedInVersion = doCheckin(versionInfoEntity, checkinDescription);
+ break;
+ default:
+ //do nothing
+ break;
+ }
+
+ return checkedInVersion;
+ }
+
+ @Override
+ public Version submit(String entityType, String entityId, String user, String submitDescription) {
+ VersionInfoEntity versionInfoEntity =
+ versionInfoDao.get(new VersionInfoEntity(entityType, entityId));
+ if (versionInfoEntity == null) {
+ throw new CoreException(new EntityNotExistErrorBuilder(entityType, entityId).build());
+ }
+
+ Version submitVersion = null;
+ switch (versionInfoEntity.getStatus()) {
+ case Certified:
+ throw new CoreException(
+ new EntityAlreadyFinalizedErrorBuilder(entityType, entityId).build());
+ case Locked:
+ throw new CoreException(new SubmitLockedEntityNotAllowedErrorBuilder(entityType, entityId,
+ versionInfoEntity.getCandidate().getUser()).build());
+ case Draft:
+ submitVersion = doSubmit(versionInfoEntity, user, submitDescription);
+ break;
+ default:
+ //do nothing
+ break;
+ }
+
+ return submitVersion;
+ }
+
+ @Override
+ public VersionInfo getEntityVersionInfo(String entityType, String entityId, String user,
+ VersionableEntityAction action) {
+ VersionInfoEntity versionInfoEntity =
+ versionInfoDao.get(new VersionInfoEntity(entityType, entityId));
+ if (versionInfoEntity == null) {
+ throw new CoreException(new EntityNotExistErrorBuilder(entityType, entityId).build());
+ }
+ return getVersionInfo(versionInfoEntity, user, action);
+ }
+
+ @Override
+ public Map<String, VersionInfo> listEntitiesVersionInfo(String entityType, String user,
+ VersionableEntityAction action) {
+ Collection<VersionInfoEntity> versionInfoEntities =
+ versionInfoDao.list(new VersionInfoEntity(entityType, null));
+ Map<String, VersionInfo> activeVersions = new HashMap<>();
+ for (VersionInfoEntity versionInfoEntity : versionInfoEntities) {
+ activeVersions
+ .put(versionInfoEntity.getEntityId(), getVersionInfo(versionInfoEntity, user, action));
+ }
+ return activeVersions;
+ }
+
+ @Override
+ public Map<String, VersionInfo> listDeletedEntitiesVersionInfo(String entityType, String user,
+ VersionableEntityAction action) {
+ Collection<VersionInfoDeletedEntity> versionInfoDeletedEntities =
+ versionInfoDeletedDao.list(new VersionInfoDeletedEntity(entityType, null));
+ Map<String, VersionInfo> activeVersions = new HashMap<>();
+
+
+ for (VersionInfoDeletedEntity versionInfoDeletedEntity : versionInfoDeletedEntities) {
+ activeVersions.put(versionInfoDeletedEntity.getEntityId(),
+ getVersionInfo(versionInfoDeletedEntity, user, action));
+ }
+ return activeVersions;
+ }
+
+ @Override
+ public List<Version> list(String itemId) {
+
+ List<Version> versions = versionDao.list(itemId);
+ Set<String> versionsNames = versions.stream().map(Version::getName).collect(Collectors.toSet());
+ versions.forEach(version -> {
+ version.setAdditionalInfo(new HashMap<>());
+ versionCalculator.injectAdditionalInfo(version, versionsNames);
+ });
+ return versions;
+ }
+
+ @Override
+ public Version get(String itemId, Version version) {
+ return versionDao.get(itemId, version)
+ .map(retrievedVersion -> getUpdateRetrievedVersion(itemId, retrievedVersion))
+ .orElseGet(() -> getSyncedVersion(itemId, version));
+ }
+
+ private Version getUpdateRetrievedVersion(String itemId, Version version) {
+ if (version.getStatus() == VersionStatus.Certified &&
+ (version.getState().getSynchronizationState() == SynchronizationState.OutOfSync ||
+ version.getState().isDirty())) {
+ forceSync(itemId, version);
+ LOGGER.info("Item Id {}, version Id {}: Force sync is done", itemId, version.getId());
+ version = versionDao.get(itemId, version)
+ .orElseThrow(() -> new IllegalStateException(
+ "Get version after a successful force sync must return the version"));
+ }
+ return version;
+ }
+
+ private Version getSyncedVersion(String itemId, Version version) {
+ sync(itemId, version);
+ LOGGER.info("Item Id {}, version Id {}: First time sync is done", itemId, version.getId());
+ return versionDao.get(itemId, version)
+ .orElseThrow(() -> new IllegalStateException(
+ "Get version after a successful sync must return the version"));
+ }
+
+ @Override
+ public Version create(String itemId, Version version, VersionCreationMethod creationMethod) {
+ String baseVersionName = null;
+ if (version.getBaseId() == null) {
+ version.setDescription("Initial version");
+ } else {
+ baseVersionName = get(itemId, new Version(version.getBaseId())).getName();
+ }
+ String versionName = versionCalculator.calculate(baseVersionName, creationMethod);
+ validateVersionName(itemId, versionName);
+ version.setName(versionName);
+
+ versionDao.create(itemId, version);
+ asdcItemManager.updateVersionStatus(itemId, VersionStatus.Draft, null);
+
+ publish(itemId, version, String.format("Create version: %s", version.getName()));
+ return version;
+ }
+
+ private void validateVersionName(String itemId, String versionName) {
+ if (versionDao.list(itemId).stream()
+ .anyMatch(version -> versionName.equals(version.getName()))) {
+ String errorDescription = String
+ .format("Item %s: create version failed, a version with the name %s already exist",
+ itemId, versionName);
+ throw new CoreException(new ErrorCode.ErrorCodeBuilder()
+ .withCategory(ErrorCategory.APPLICATION)
+ .withId("VERSION_NAME_ALREADY_EXIST")
+ .withMessage(errorDescription)
+ .build());
+ }
+ }
+
+ @Override
+ public void submit(String itemId, Version version, String submitDescription) {
+ version = get(itemId, version);
+
+ validateSubmit(itemId, version);
+
+ version.setStatus(VersionStatus.Certified);
+ versionDao.update(itemId, version);
+
+ publish(itemId, version, submitDescription);
+
+ asdcItemManager.updateVersionStatus(itemId, VersionStatus.Certified, VersionStatus.Draft);
+ }
+
+ private void validateSubmit(String itemId, Version version) {
+ if (version.getStatus() == VersionStatus.Certified) {
+ String errorDescription = String
+ .format("Item %s: submit version failed, version %s is already Certified", itemId,
+ version.getId());
+ throw new CoreException(new ErrorCode.ErrorCodeBuilder()
+ .withCategory(ErrorCategory.APPLICATION)
+ .withId("VERSION_ALREADY_CERTIFIED")
+ .withMessage(errorDescription)
+ .build());
+ }
+ }
+
+ @Override
+ public void publish(String itemId, Version version, String message) {
+ versionDao.publish(itemId, version, message);
+ }
+
+
+ @Override
+ public void sync(String itemId, Version version) {
+ versionDao.sync(itemId, version);
+ }
+
+ @Override
+ public void forceSync(String itemId, Version version) {
+ versionDao.forceSync(itemId, version);
+ }
+
+ @Override
+ public void revert(String itemId, Version version, String revisionId) {
+ versionDao.revert(itemId, version, revisionId);
+ }
+
+ @Override
+ public List<Revision> listRevisions(String itemId, Version version) {
+ return versionDao.listRevisions(itemId, version);
+ }
+
+ private void markAsCheckedOut(VersionInfoEntity versionInfoEntity, String checkingOutUser) {
+ versionInfoEntity.setStatus(VersionStatus.Locked);
+ versionInfoEntity.setCandidate(new UserCandidateVersion(checkingOutUser,
+ versionInfoEntity.getActiveVersion().calculateNextCandidate()));
+ }
+
+ private Version doCheckout(VersionInfoEntity versionInfoEntity, String user) {
+ markAsCheckedOut(versionInfoEntity, user);
+ versionInfoDao.update(versionInfoEntity);
+
+ initVersionOnEntity(versionInfoEntity.getEntityType(), versionInfoEntity.getEntityId(),
+ versionInfoEntity.getActiveVersion(), versionInfoEntity.getCandidate().getVersion());
+
+ return versionInfoEntity.getCandidate().getVersion();
+ }
+
+ private void doDelete(VersionInfoEntity versionInfoEntity) {
+ VersionInfoDeletedEntity versionInfoDeletedEntity = new VersionInfoDeletedEntity();
+ versionInfoDeletedEntity.setStatus(versionInfoEntity.getStatus());
+ versionInfoDeletedEntity.setViewableVersions(versionInfoEntity.getViewableVersions());
+ versionInfoDeletedEntity.setActiveVersion(versionInfoEntity.getActiveVersion());
+ versionInfoDeletedEntity.setCandidate(versionInfoEntity.getCandidate());
+ versionInfoDeletedEntity.setEntityId(versionInfoEntity.getEntityId());
+ versionInfoDeletedEntity.setEntityType(versionInfoEntity.getEntityType());
+ versionInfoDeletedEntity.setLatestFinalVersion(versionInfoEntity.getLatestFinalVersion());
+ versionInfoDeletedDao.create(versionInfoDeletedEntity);
+ versionInfoDao.delete(versionInfoEntity);
+ }
+
+ private void doUndoDelete(VersionInfoDeletedEntity versionInfoDeletedEntity) {
+ VersionInfoEntity versionInfoEntity = new VersionInfoEntity();
+ versionInfoEntity.setStatus(versionInfoDeletedEntity.getStatus());
+ versionInfoEntity.setViewableVersions(versionInfoDeletedEntity.getViewableVersions());
+ versionInfoEntity.setActiveVersion(versionInfoDeletedEntity.getActiveVersion());
+ versionInfoEntity.setCandidate(versionInfoDeletedEntity.getCandidate());
+ versionInfoEntity.setEntityId(versionInfoDeletedEntity.getEntityId());
+ versionInfoEntity.setEntityType(versionInfoDeletedEntity.getEntityType());
+ versionInfoEntity.setLatestFinalVersion(versionInfoDeletedEntity.getLatestFinalVersion());
+ versionInfoDao.create(versionInfoEntity);
+ versionInfoDeletedDao.delete(versionInfoDeletedEntity);
+ }
+
+ private Version doCheckin(VersionInfoEntity versionInfoEntity, String checkinDescription) {
+ UserCandidateVersion userCandidateVersion = versionInfoEntity.getCandidate();
+ versionInfoEntity.setCandidate(null);
+ versionInfoEntity.setActiveVersion(userCandidateVersion.getVersion());
+ versionInfoEntity.getViewableVersions().add(versionInfoEntity.getActiveVersion());
+ versionInfoEntity.setStatus(VersionStatus.Draft);
+
+ closeVersionOnEntity(versionInfoEntity.getEntityType(), versionInfoEntity.getEntityId(),
+ versionInfoEntity.getActiveVersion());
+
+ versionInfoDao.update(versionInfoEntity);
+
+ return versionInfoEntity.getActiveVersion();
+ }
+
+ private Version doSubmit(VersionInfoEntity versionInfoEntity, String submittingUser,
+ String submitDescription) {
+ Version finalVersion = versionInfoEntity.getActiveVersion().calculateNextFinal();
+ initVersionOnEntity(versionInfoEntity.getEntityType(), versionInfoEntity.getEntityId(),
+ versionInfoEntity.getActiveVersion(), finalVersion);
+ closeVersionOnEntity(versionInfoEntity.getEntityType(), versionInfoEntity.getEntityId(),
+ finalVersion);
+
+ Set<Version> viewableVersions = new HashSet<>();
+ for (Version version : versionInfoEntity.getViewableVersions()) {
+ if (version.isFinal()) {
+ viewableVersions.add(version);
+ }
+ }
+ viewableVersions.add(finalVersion);
+ versionInfoEntity.setViewableVersions(viewableVersions);
+ versionInfoEntity.setActiveVersion(finalVersion);
+ versionInfoEntity.setLatestFinalVersion(finalVersion);
+ versionInfoEntity.setStatus(VersionStatus.Certified);
+ versionInfoDao.update(versionInfoEntity);
+
+ return finalVersion;
+ }
+
+ private void initVersionOnEntity(String entityType, String entityId, Version baseVersion,
+ Version newVersion) {
+ Set<VersionableEntityMetadata> entityMetadatas = VERSIONABLE_ENTITIES.get(entityType);
+ if (entityMetadatas != null) {
+ for (VersionableEntityMetadata entityMetadata : entityMetadatas) {
+ VersionableEntityDaoFactory.getInstance().createInterface(entityMetadata.getStoreType())
+ .initVersion(entityMetadata, entityId, baseVersion, newVersion);
+ }
+ }
+ }
+
+ private void deleteVersionFromEntity(String entityType, String entityId,
+ Version versionToDelete, Version backToVersion) {
+ Set<VersionableEntityMetadata> entityMetadatas = VERSIONABLE_ENTITIES.get(entityType);
+ if (entityMetadatas != null) {
+ for (VersionableEntityMetadata entityMetadata : entityMetadatas) {
+ VersionableEntityDaoFactory.getInstance().createInterface(entityMetadata.getStoreType())
+ .deleteVersion(entityMetadata, entityId, versionToDelete, backToVersion);
+ }
+ }
+ }
+
+ private void closeVersionOnEntity(String entityType, String entityId, Version versionToClose) {
+ Set<VersionableEntityMetadata> entityMetadatas = VERSIONABLE_ENTITIES.get(entityType);
+ if (entityMetadatas != null) {
+ for (VersionableEntityMetadata entityMetadata : entityMetadatas) {
+ VersionableEntityDaoFactory.getInstance().createInterface(entityMetadata.getStoreType())
+ .closeVersion(entityMetadata, entityId, versionToClose);
+ }
+ }
+ }
+}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/AsdcItemManagerFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/AsdcItemManagerFactoryImpl.java
new file mode 100644
index 0000000000..090f042027
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/AsdcItemManagerFactoryImpl.java
@@ -0,0 +1,35 @@
+/*
+ * 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
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.openecomp.sdc.versioning.impl;
+
+import org.openecomp.sdc.itempermissions.PermissionsServicesFactory;
+import org.openecomp.sdc.notification.factories.SubscriptionServiceFactory;
+import org.openecomp.sdc.versioning.AsdcItemManager;
+import org.openecomp.sdc.versioning.AsdcItemManagerFactory;
+import org.openecomp.sdc.versioning.dao.ItemDaoFactory;
+
+public class AsdcItemManagerFactoryImpl extends AsdcItemManagerFactory {
+ private static final AsdcItemManager INSTANCE =
+ new AsdcItemManagerImpl(ItemDaoFactory.getInstance().createInterface(),
+ PermissionsServicesFactory.getInstance().createInterface(),
+ SubscriptionServiceFactory.getInstance().createInterface());
+
+ @Override
+ public AsdcItemManager createInterface() {
+ return INSTANCE;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/AsdcItemManagerImpl.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/AsdcItemManagerImpl.java
new file mode 100644
index 0000000000..82d3ae5a61
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/AsdcItemManagerImpl.java
@@ -0,0 +1,70 @@
+/*
+ * 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
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.openecomp.sdc.versioning.impl;
+
+import org.openecomp.sdc.common.session.SessionContextProviderFactory;
+import org.openecomp.sdc.itempermissions.PermissionsServices;
+import org.openecomp.sdc.notification.services.SubscriptionService;
+import org.openecomp.sdc.versioning.AsdcItemManager;
+import org.openecomp.sdc.versioning.dao.ItemDao;
+import org.openecomp.sdc.versioning.types.Item;
+
+public class AsdcItemManagerImpl extends ItemManagerImpl implements AsdcItemManager {
+ private static final String CREATE_ITEM = "Create_Item";
+
+ private PermissionsServices permissionsServices;
+ private SubscriptionService subscriptionService;
+
+ public AsdcItemManagerImpl(ItemDao itemDao, PermissionsServices permissionsServices,
+ SubscriptionService subscriptionService) {
+ super(itemDao);
+
+ this.permissionsServices = permissionsServices;
+ this.subscriptionService = subscriptionService;
+ }
+
+ @Override
+ public Item create(Item item) {
+ Item createdItem = super.create(item);
+
+ String userId = SessionContextProviderFactory.getInstance()
+ .createInterface().get().getUser().getUserId();
+ String itemId = createdItem.getId();
+ permissionsServices.execute(itemId, userId, CREATE_ITEM);
+ subscriptionService.subscribe(userId, itemId);
+
+ return createdItem;
+ }
+
+
+ @Override
+ public void updateOwner(String itemId, String owner) {
+ Item item = get(itemId);
+ if (item == null) {
+ return;
+ }
+ item.setOwner(owner);
+ super.update(item);
+ }
+
+ @Override
+ public void delete(Item item) {
+ super.delete(item);
+ }
+
+
+}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/ItemManagerFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/ItemManagerFactoryImpl.java
index ba5bd07d42..fbbc32e58e 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/ItemManagerFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/ItemManagerFactoryImpl.java
@@ -1,39 +1,31 @@
-/*-
- * ============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.versioning.impl;
-import org.openecomp.sdc.itempermissions.PermissionsServicesFactory;
-import org.openecomp.sdc.notification.factories.SubscriptionServiceFactory;
import org.openecomp.sdc.versioning.ItemManager;
import org.openecomp.sdc.versioning.ItemManagerFactory;
import org.openecomp.sdc.versioning.dao.ItemDaoFactory;
public class ItemManagerFactoryImpl extends ItemManagerFactory {
- private static final ItemManager INSTANCE =
- new ItemManagerImpl(ItemDaoFactory.getInstance().createInterface(),
- PermissionsServicesFactory.getInstance().createInterface(),
- SubscriptionServiceFactory.getInstance().createInterface());
+ private static final ItemManager instance =
+ new ItemManagerImpl(ItemDaoFactory.getInstance().createInterface());
@Override
public ItemManager createInterface() {
- return INSTANCE;
+ return instance;
}
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/ItemManagerImpl.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/ItemManagerImpl.java
index ba51b17575..dadf456ad4 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/ItemManagerImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/ItemManagerImpl.java
@@ -1,29 +1,37 @@
+/*
+ * 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
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.openecomp.sdc.versioning.impl;
-import org.openecomp.sdc.common.session.SessionContextProviderFactory;
-import org.openecomp.sdc.itempermissions.PermissionsServices;
-import org.openecomp.sdc.notification.services.SubscriptionService;
+import java.util.Collection;
+import java.util.function.Predicate;
+import java.util.stream.Collectors;
import org.openecomp.sdc.versioning.ItemManager;
import org.openecomp.sdc.versioning.dao.ItemDao;
import org.openecomp.sdc.versioning.dao.types.VersionStatus;
import org.openecomp.sdc.versioning.types.Item;
-import java.util.Collection;
-import java.util.function.Predicate;
-import java.util.stream.Collectors;
-
public class ItemManagerImpl implements ItemManager {
- private static final String CREATE_ITEM = "Create_Item";
private ItemDao itemDao;
- private PermissionsServices permissionsServices;
- private SubscriptionService subscriptionService;
- public ItemManagerImpl(ItemDao itemDao, PermissionsServices permissionsServices,
- SubscriptionService subscriptionService) {
+
+ public ItemManagerImpl(ItemDao itemDao) {
this.itemDao = itemDao;
- this.permissionsServices = permissionsServices;
- this.subscriptionService = subscriptionService;
+
}
@Override
@@ -40,15 +48,7 @@ public class ItemManagerImpl implements ItemManager {
@Override
public Item create(Item item) {
- Item createdItem = itemDao.create(item);
-
- String userId = SessionContextProviderFactory.getInstance()
- .createInterface().get().getUser().getUserId();
- String itemId = createdItem.getId();
- permissionsServices.execute(itemId, userId, CREATE_ITEM);
- subscriptionService.subscribe(userId, itemId);
-
- return createdItem;
+ return itemDao.create(item);
}
@Override
@@ -67,18 +67,23 @@ public class ItemManagerImpl implements ItemManager {
}
@Override
- public void updateOwner(String itemId, String owner){
+ public void delete(Item item) {
+ itemDao.delete(item);
+ }
+
+ @Override
+ public void updateName(String itemId, String name) {
Item item = get(itemId);
if (item == null) {
return;
}
- item.setOwner(owner);
+ item.setName(name);
itemDao.update(item);
}
@Override
- public void delete(Item item) {
- itemDao.delete(item);
+ public void update(Item item) {
+ itemDao.update(item);
}
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/VersioningManagerFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/VersioningManagerFactoryImpl.java
index b4dbcf3a08..83f3d77ae3 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/VersioningManagerFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/VersioningManagerFactoryImpl.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.versioning.impl;
@@ -25,19 +21,15 @@ import org.openecomp.sdc.versioning.VersionCalculatorFactory;
import org.openecomp.sdc.versioning.VersioningManager;
import org.openecomp.sdc.versioning.VersioningManagerFactory;
import org.openecomp.sdc.versioning.dao.VersionDaoFactory;
-import org.openecomp.sdc.versioning.dao.VersionInfoDaoFactory;
-import org.openecomp.sdc.versioning.dao.VersionInfoDeletedDaoFactory;
public class VersioningManagerFactoryImpl extends VersioningManagerFactory {
- private static final VersioningManager INSTANCE = new VersioningManagerImpl(
- VersionInfoDaoFactory.getInstance().createInterface(),
- VersionInfoDeletedDaoFactory.getInstance().createInterface(),
- VersionDaoFactory.getInstance().createInterface(),
- VersionCalculatorFactory.getInstance().createInterface(),
- ItemManagerFactory.getInstance().createInterface());
+
@Override
public VersioningManager createInterface() {
- return INSTANCE;
+ return new VersioningManagerImpl(
+ VersionDaoFactory.getInstance().createInterface(),
+ VersionCalculatorFactory.getInstance().createInterface(),
+ ItemManagerFactory.getInstance().createInterface());
}
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/VersioningManagerImpl.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/VersioningManagerImpl.java
index af63d86b69..091def645d 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/VersioningManagerImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/main/java/org/openecomp/sdc/versioning/impl/VersioningManagerImpl.java
@@ -1,11 +1,11 @@
/*
- * Copyright © 2016-2017 European Support Limited
+ * 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,
@@ -16,7 +16,15 @@
package org.openecomp.sdc.versioning.impl;
+import static org.openecomp.sdc.versioning.dao.types.VersionStatus.Certified;
+import static org.openecomp.sdc.versioning.dao.types.VersionStatus.Draft;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
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.logging.api.Logger;
import org.openecomp.sdc.logging.api.LoggerFactory;
@@ -24,364 +32,26 @@ import org.openecomp.sdc.versioning.ItemManager;
import org.openecomp.sdc.versioning.VersionCalculator;
import org.openecomp.sdc.versioning.VersioningManager;
import org.openecomp.sdc.versioning.dao.VersionDao;
-import org.openecomp.sdc.versioning.dao.VersionInfoDao;
-import org.openecomp.sdc.versioning.dao.VersionInfoDeletedDao;
-import org.openecomp.sdc.versioning.dao.VersionableEntityDaoFactory;
import org.openecomp.sdc.versioning.dao.types.Revision;
import org.openecomp.sdc.versioning.dao.types.SynchronizationState;
-import org.openecomp.sdc.versioning.dao.types.UserCandidateVersion;
import org.openecomp.sdc.versioning.dao.types.Version;
-import org.openecomp.sdc.versioning.dao.types.VersionInfoDeletedEntity;
-import org.openecomp.sdc.versioning.dao.types.VersionInfoEntity;
-import org.openecomp.sdc.versioning.dao.types.VersionStatus;
-import org.openecomp.sdc.versioning.errors.CheckinOnEntityLockedByOtherErrorBuilder;
-import org.openecomp.sdc.versioning.errors.CheckinOnUnlockedEntityErrorBuilder;
-import org.openecomp.sdc.versioning.errors.CheckoutOnLockedEntityErrorBuilder;
-import org.openecomp.sdc.versioning.errors.DeleteOnLockedEntityErrorBuilder;
-import org.openecomp.sdc.versioning.errors.EditOnEntityLockedByOtherErrorBuilder;
-import org.openecomp.sdc.versioning.errors.EditOnUnlockedEntityErrorBuilder;
-import org.openecomp.sdc.versioning.errors.EntityAlreadyExistErrorBuilder;
-import org.openecomp.sdc.versioning.errors.EntityAlreadyFinalizedErrorBuilder;
-import org.openecomp.sdc.versioning.errors.EntityNotExistErrorBuilder;
-import org.openecomp.sdc.versioning.errors.SubmitLockedEntityNotAllowedErrorBuilder;
-import org.openecomp.sdc.versioning.errors.UndoCheckoutOnEntityLockedByOtherErrorBuilder;
-import org.openecomp.sdc.versioning.errors.UndoCheckoutOnUnlockedEntityErrorBuilder;
import org.openecomp.sdc.versioning.types.VersionCreationMethod;
-import org.openecomp.sdc.versioning.types.VersionInfo;
-import org.openecomp.sdc.versioning.types.VersionableEntityAction;
-import org.openecomp.sdc.versioning.types.VersionableEntityMetadata;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.stream.Collectors;
public class VersioningManagerImpl implements VersioningManager {
private static final Logger LOGGER = LoggerFactory.getLogger(VersioningManagerImpl.class);
- private static final Version INITIAL_ACTIVE_VERSION = new Version(0, 0);
- private static final Map<String, Set<VersionableEntityMetadata>> VERSIONABLE_ENTITIES =
- new HashMap<>();
- private final VersionInfoDao versionInfoDao;
- private final VersionInfoDeletedDao versionInfoDeletedDao;
private VersionDao versionDao;
private VersionCalculator versionCalculator;
private ItemManager itemManager;
- public VersioningManagerImpl(VersionInfoDao versionInfoDao,
- VersionInfoDeletedDao versionInfoDeletedDao,
- VersionDao versionDao,
+ public VersioningManagerImpl(VersionDao versionDao,
VersionCalculator versionCalculator,
- ItemManager itemManager) {
- this.versionInfoDao = versionInfoDao;
- this.versionInfoDeletedDao = versionInfoDeletedDao;
+ ItemManager itemManager) {
this.versionDao = versionDao;
this.versionCalculator = versionCalculator;
this.itemManager = itemManager;
}
- private static VersionInfo getVersionInfo(VersionInfoEntity versionInfoEntity, String user,
- VersionableEntityAction action) {
- return getVersionInfo(versionInfoEntity.getEntityId(),
- versionInfoEntity.getEntityType(),
- versionInfoEntity.getActiveVersion(),
- versionInfoEntity.getCandidate(),
- versionInfoEntity.getStatus(),
- versionInfoEntity.getLatestFinalVersion(),
- versionInfoEntity.getViewableVersions(),
- action,
- user);
- }
-
- private static VersionInfo getVersionInfo(VersionInfoDeletedEntity versionInfoEntity, String user,
- VersionableEntityAction action) {
- return getVersionInfo(versionInfoEntity.getEntityId(),
- versionInfoEntity.getEntityType(),
- versionInfoEntity.getActiveVersion(),
- versionInfoEntity.getCandidate(),
- versionInfoEntity.getStatus(),
- versionInfoEntity.getLatestFinalVersion(),
- versionInfoEntity.getViewableVersions(),
- action,
- user);
- }
-
- private static VersionInfo getVersionInfo(String entityId, String entityType, Version activeVer,
- UserCandidateVersion candidate, VersionStatus status,
- Version latestFinalVersion,
- Set<Version> viewableVersions,
- VersionableEntityAction action, String user) {
- Version activeVersion;
-
- if (action == VersionableEntityAction.Write) {
- if (candidate != null) {
- if (user.equals(candidate.getUser())) {
- activeVersion = candidate.getVersion();
- } else {
- throw new CoreException(
- new EditOnEntityLockedByOtherErrorBuilder(entityType, entityId, candidate.getUser())
- .build());
- }
- } else {
- throw new CoreException(new EditOnUnlockedEntityErrorBuilder(entityType, entityId).build());
- }
- } else {
- if (candidate != null && user.equals(candidate.getUser())) {
- activeVersion = candidate.getVersion();
- } else {
- activeVersion = activeVer;
- }
- }
-
- VersionInfo versionInfo = new VersionInfo();
- versionInfo.setStatus(status);
- activeVersion.setStatus(status);
- if (latestFinalVersion != null) {
- latestFinalVersion.setStatus(status);
- }
- if (viewableVersions != null) {
- viewableVersions.forEach(version -> version.setStatus(status));
- }
- versionInfo.setActiveVersion(activeVersion);
- versionInfo.setLatestFinalVersion(latestFinalVersion);
- versionInfo.setViewableVersions(toSortedList(viewableVersions));
- versionInfo.setFinalVersions(getFinalVersions(viewableVersions));
- if (candidate != null) {
- candidate.getVersion().setStatus(status);
- versionInfo.setLockingUser(candidate.getUser());
- if (user.equals(candidate.getUser())) {
- versionInfo.getViewableVersions().add(candidate.getVersion());
- }
- }
- return versionInfo;
- }
-
- private static List<Version> toSortedList(
- Set<Version> versions) { // changing the Set to List in DB will require migration...
- return versions.stream().sorted((o1, o2) -> o1.getMajor() > o2.getMajor() ? 1
- : o1.getMajor() == o2.getMajor() ? (Integer.compare(o1.getMinor(), o2.getMinor())) : -1)
- .collect(Collectors.toList());
- }
-
- private static List<Version> getFinalVersions(Set<Version> versions) {
- return versions.stream().filter(Version::isFinal).collect(Collectors.toList());
- }
-
- @Override
- public void register(String entityType, VersionableEntityMetadata entityMetadata) {
- Set<VersionableEntityMetadata> entitiesMetadata =
- VERSIONABLE_ENTITIES.computeIfAbsent(entityType, k -> new HashSet<>());
- entitiesMetadata.add(entityMetadata);
- }
-
- @Override
- public Version create(String entityType, String entityId, String user) {
- VersionInfoEntity
- versionInfoEntity = versionInfoDao.get(new VersionInfoEntity(entityType, entityId));
- if (versionInfoEntity != null) {
- throw new CoreException(new EntityAlreadyExistErrorBuilder(entityType, entityId).build());
- }
-
- versionInfoEntity = new VersionInfoEntity(entityType, entityId);
- versionInfoEntity.setActiveVersion(INITIAL_ACTIVE_VERSION);
- markAsCheckedOut(versionInfoEntity, user);
- versionInfoDao.create(versionInfoEntity);
-
- return versionInfoEntity.getCandidate().getVersion();
- }
-
- @Override
- public void delete(String entityType, String entityId, String user) {
- VersionInfoEntity versionInfoEntity =
- versionInfoDao.get(new VersionInfoEntity(entityType, entityId));
- if (versionInfoEntity == null) {
- throw new CoreException(new EntityNotExistErrorBuilder(entityType, entityId).build());
- }
-
- if (versionInfoEntity.getStatus() == VersionStatus.Locked) {
- throw new CoreException(new DeleteOnLockedEntityErrorBuilder(entityType, entityId,
- versionInfoEntity.getCandidate().getUser()).build());
- }
-
- doDelete(versionInfoEntity);
- }
-
- @Override
- public void undoDelete(String entityType, String entityId, String user) {
- VersionInfoDeletedEntity versionInfoDeletedEntity =
- versionInfoDeletedDao.get(new VersionInfoDeletedEntity(entityType, entityId));
- if (versionInfoDeletedEntity == null) {
- throw new CoreException(new EntityNotExistErrorBuilder(entityType, entityId).build());
- }
-
- doUndoDelete(versionInfoDeletedEntity);
- }
-
- @Override
- public Version checkout(String entityType, String entityId, String user) {
- VersionInfoEntity versionInfoEntity =
- versionInfoDao.get(new VersionInfoEntity(entityType, entityId));
- if (versionInfoEntity == null) {
- throw new CoreException(new EntityNotExistErrorBuilder(entityType, entityId).build());
- }
-
- Version checkoutVersion = null;
- switch (versionInfoEntity.getStatus()) {
- case Locked:
- throw new CoreException(new CheckoutOnLockedEntityErrorBuilder(entityType, entityId,
- versionInfoEntity.getCandidate().getUser()).build());
- case Certified:
- case Draft:
- checkoutVersion = doCheckout(versionInfoEntity, user);
- break;
- default:
- //do nothing
- break;
- }
-
- return checkoutVersion;
- }
-
- @Override
- public Version undoCheckout(String entityType, String entityId, String user) {
- VersionInfoEntity versionInfoEntity =
- versionInfoDao.get(new VersionInfoEntity(entityType, entityId));
- if (versionInfoEntity == null) {
- throw new CoreException(new EntityNotExistErrorBuilder(entityType, entityId).build());
- }
-
- Version activeVersion = null;
- switch (versionInfoEntity.getStatus()) {
- case Locked:
- if (!user.equals(versionInfoEntity.getCandidate().getUser())) {
- throw new CoreException(
- new UndoCheckoutOnEntityLockedByOtherErrorBuilder(entityType, entityId,
- versionInfoEntity.getCandidate().getUser()).build());
- }
- activeVersion = undoCheckout(versionInfoEntity);
- break;
- case Certified:
- case Draft:
- throw new CoreException(
- new UndoCheckoutOnUnlockedEntityErrorBuilder(entityType, entityId).build());
- default:
- //do nothing
- break;
- }
-
- return activeVersion;
- }
-
- private Version undoCheckout(VersionInfoEntity versionInfoEntity) {
- deleteVersionFromEntity(versionInfoEntity.getEntityType(), versionInfoEntity.getEntityId(),
- versionInfoEntity.getCandidate().getVersion(), versionInfoEntity.getActiveVersion());
-
- versionInfoEntity
- .setStatus(versionInfoEntity.getActiveVersion().isFinal() ? VersionStatus.Certified
- : VersionStatus.Draft);
- versionInfoEntity.setCandidate(null);
- versionInfoDao.update(versionInfoEntity);
- return versionInfoEntity.getActiveVersion();
- }
-
- @Override
- public Version checkin(String entityType, String entityId, String user,
- String checkinDescription) {
- VersionInfoEntity versionInfoEntity =
- versionInfoDao.get(new VersionInfoEntity(entityType, entityId));
- if (versionInfoEntity == null) {
- throw new CoreException(new EntityNotExistErrorBuilder(entityType, entityId).build());
- }
-
- Version checkedInVersion = null;
- switch (versionInfoEntity.getStatus()) {
- case Draft:
- case Certified:
- throw new CoreException(
- new CheckinOnUnlockedEntityErrorBuilder(entityType, entityId).build());
- case Locked:
- if (!user.equals(versionInfoEntity.getCandidate().getUser())) {
- throw new CoreException(new CheckinOnEntityLockedByOtherErrorBuilder(entityType, entityId,
- versionInfoEntity.getCandidate().getUser()).build());
- }
- checkedInVersion = doCheckin(versionInfoEntity);
- break;
- default:
- //do nothing
- break;
- }
-
- return checkedInVersion;
- }
-
- @Override
- public Version submit(String entityType, String entityId, String user, String submitDescription) {
- VersionInfoEntity versionInfoEntity =
- versionInfoDao.get(new VersionInfoEntity(entityType, entityId));
- if (versionInfoEntity == null) {
- throw new CoreException(new EntityNotExistErrorBuilder(entityType, entityId).build());
- }
-
- Version submitVersion = null;
- switch (versionInfoEntity.getStatus()) {
- case Certified:
- throw new CoreException(
- new EntityAlreadyFinalizedErrorBuilder(entityType, entityId).build());
- case Locked:
- throw new CoreException(new SubmitLockedEntityNotAllowedErrorBuilder(entityType, entityId,
- versionInfoEntity.getCandidate().getUser()).build());
- case Draft:
- submitVersion = doSubmit(versionInfoEntity);
- break;
- default:
- //do nothing
- break;
- }
-
- return submitVersion;
- }
-
- @Override
- public VersionInfo getEntityVersionInfo(String entityType, String entityId, String user,
- VersionableEntityAction action) {
- VersionInfoEntity versionInfoEntity =
- versionInfoDao.get(new VersionInfoEntity(entityType, entityId));
- if (versionInfoEntity == null) {
- throw new CoreException(new EntityNotExistErrorBuilder(entityType, entityId).build());
- }
- return getVersionInfo(versionInfoEntity, user, action);
- }
-
- @Override
- public Map<String, VersionInfo> listEntitiesVersionInfo(String entityType, String user,
- VersionableEntityAction action) {
- Collection<VersionInfoEntity> versionInfoEntities =
- versionInfoDao.list(new VersionInfoEntity(entityType, null));
- Map<String, VersionInfo> activeVersions = new HashMap<>();
- for (VersionInfoEntity versionInfoEntity : versionInfoEntities) {
- activeVersions
- .put(versionInfoEntity.getEntityId(), getVersionInfo(versionInfoEntity, user, action));
- }
- return activeVersions;
- }
-
- @Override
- public Map<String, VersionInfo> listDeletedEntitiesVersionInfo(String entityType, String user,
- VersionableEntityAction action) {
- Collection<VersionInfoDeletedEntity> versionInfoDeletedEntities =
- versionInfoDeletedDao.list(new VersionInfoDeletedEntity(entityType, null));
- Map<String, VersionInfo> activeVersions = new HashMap<>();
-
-
- for (VersionInfoDeletedEntity versionInfoDeletedEntity : versionInfoDeletedEntities) {
- activeVersions.put(versionInfoDeletedEntity.getEntityId(),
- getVersionInfo(versionInfoDeletedEntity, user, action));
- }
- return activeVersions;
- }
@Override
public List<Version> list(String itemId) {
@@ -403,7 +73,7 @@ public class VersioningManagerImpl implements VersioningManager {
}
private Version getUpdateRetrievedVersion(String itemId, Version version) {
- if (version.getStatus() == VersionStatus.Certified &&
+ if (version.getStatus() == Certified &&
(version.getState().getSynchronizationState() == SynchronizationState.OutOfSync ||
version.getState().isDirty())) {
forceSync(itemId, version);
@@ -436,7 +106,7 @@ public class VersioningManagerImpl implements VersioningManager {
version.setName(versionName);
versionDao.create(itemId, version);
- itemManager.updateVersionStatus(itemId, VersionStatus.Draft, null);
+ itemManager.updateVersionStatus(itemId, Draft, null);
publish(itemId, version, String.format("Create version: %s", version.getName()));
return version;
@@ -448,6 +118,7 @@ public class VersioningManagerImpl implements VersioningManager {
String errorDescription = String
.format("Item %s: create version failed, a version with the name %s already exist",
itemId, versionName);
+
throw new CoreException(new ErrorCode.ErrorCodeBuilder()
.withMessage(errorDescription)
.build());
@@ -460,20 +131,22 @@ public class VersioningManagerImpl implements VersioningManager {
validateSubmit(itemId, version);
- version.setStatus(VersionStatus.Certified);
+ version.setStatus(Certified);
versionDao.update(itemId, version);
publish(itemId, version, submitDescription);
- itemManager.updateVersionStatus(itemId, VersionStatus.Certified, VersionStatus.Draft);
+ itemManager.updateVersionStatus(itemId, Certified, Draft);
}
private void validateSubmit(String itemId, Version version) {
- if (version.getStatus() == VersionStatus.Certified) {
+ if (version.getStatus() == Certified) {
String errorDescription = String
.format("Item %s: submit version failed, version %s is already Certified", itemId,
version.getId());
throw new CoreException(new ErrorCode.ErrorCodeBuilder()
+ .withCategory(ErrorCategory.APPLICATION)
+ .withId("VERSION_ALREADY_CERTIFIED")
.withMessage(errorDescription)
.build());
}
@@ -505,115 +178,9 @@ public class VersioningManagerImpl implements VersioningManager {
return versionDao.listRevisions(itemId, version);
}
- private void markAsCheckedOut(VersionInfoEntity versionInfoEntity, String checkingOutUser) {
- versionInfoEntity.setStatus(VersionStatus.Locked);
- versionInfoEntity.setCandidate(new UserCandidateVersion(checkingOutUser,
- versionInfoEntity.getActiveVersion().calculateNextCandidate()));
- }
-
- private Version doCheckout(VersionInfoEntity versionInfoEntity, String user) {
- markAsCheckedOut(versionInfoEntity, user);
- versionInfoDao.update(versionInfoEntity);
-
- initVersionOnEntity(versionInfoEntity.getEntityType(), versionInfoEntity.getEntityId(),
- versionInfoEntity.getActiveVersion(), versionInfoEntity.getCandidate().getVersion());
-
- return versionInfoEntity.getCandidate().getVersion();
- }
-
- private void doDelete(VersionInfoEntity versionInfoEntity) {
- VersionInfoDeletedEntity versionInfoDeletedEntity = new VersionInfoDeletedEntity();
- versionInfoDeletedEntity.setStatus(versionInfoEntity.getStatus());
- versionInfoDeletedEntity.setViewableVersions(versionInfoEntity.getViewableVersions());
- versionInfoDeletedEntity.setActiveVersion(versionInfoEntity.getActiveVersion());
- versionInfoDeletedEntity.setCandidate(versionInfoEntity.getCandidate());
- versionInfoDeletedEntity.setEntityId(versionInfoEntity.getEntityId());
- versionInfoDeletedEntity.setEntityType(versionInfoEntity.getEntityType());
- versionInfoDeletedEntity.setLatestFinalVersion(versionInfoEntity.getLatestFinalVersion());
- versionInfoDeletedDao.create(versionInfoDeletedEntity);
- versionInfoDao.delete(versionInfoEntity);
- }
-
- private void doUndoDelete(VersionInfoDeletedEntity versionInfoDeletedEntity) {
- VersionInfoEntity versionInfoEntity = new VersionInfoEntity();
- versionInfoEntity.setStatus(versionInfoDeletedEntity.getStatus());
- versionInfoEntity.setViewableVersions(versionInfoDeletedEntity.getViewableVersions());
- versionInfoEntity.setActiveVersion(versionInfoDeletedEntity.getActiveVersion());
- versionInfoEntity.setCandidate(versionInfoDeletedEntity.getCandidate());
- versionInfoEntity.setEntityId(versionInfoDeletedEntity.getEntityId());
- versionInfoEntity.setEntityType(versionInfoDeletedEntity.getEntityType());
- versionInfoEntity.setLatestFinalVersion(versionInfoDeletedEntity.getLatestFinalVersion());
- versionInfoDao.create(versionInfoEntity);
- versionInfoDeletedDao.delete(versionInfoDeletedEntity);
- }
-
- private Version doCheckin(VersionInfoEntity versionInfoEntity) {
- UserCandidateVersion userCandidateVersion = versionInfoEntity.getCandidate();
- versionInfoEntity.setCandidate(null);
- versionInfoEntity.setActiveVersion(userCandidateVersion.getVersion());
- versionInfoEntity.getViewableVersions().add(versionInfoEntity.getActiveVersion());
- versionInfoEntity.setStatus(VersionStatus.Draft);
-
- closeVersionOnEntity(versionInfoEntity.getEntityType(), versionInfoEntity.getEntityId(),
- versionInfoEntity.getActiveVersion());
-
- versionInfoDao.update(versionInfoEntity);
-
- return versionInfoEntity.getActiveVersion();
- }
-
- private Version doSubmit(VersionInfoEntity versionInfoEntity) {
- Version finalVersion = versionInfoEntity.getActiveVersion().calculateNextFinal();
- initVersionOnEntity(versionInfoEntity.getEntityType(), versionInfoEntity.getEntityId(),
- versionInfoEntity.getActiveVersion(), finalVersion);
- closeVersionOnEntity(versionInfoEntity.getEntityType(), versionInfoEntity.getEntityId(),
- finalVersion);
-
- Set<Version> viewableVersions = new HashSet<>();
- for (Version version : versionInfoEntity.getViewableVersions()) {
- if (version.isFinal()) {
- viewableVersions.add(version);
- }
- }
- viewableVersions.add(finalVersion);
- versionInfoEntity.setViewableVersions(viewableVersions);
- versionInfoEntity.setActiveVersion(finalVersion);
- versionInfoEntity.setLatestFinalVersion(finalVersion);
- versionInfoEntity.setStatus(VersionStatus.Certified);
- versionInfoDao.update(versionInfoEntity);
-
- return finalVersion;
- }
-
- private void initVersionOnEntity(String entityType, String entityId, Version baseVersion,
- Version newVersion) {
- Set<VersionableEntityMetadata> entityMetadatas = VERSIONABLE_ENTITIES.get(entityType);
- if (entityMetadatas != null) {
- for (VersionableEntityMetadata entityMetadata : entityMetadatas) {
- VersionableEntityDaoFactory.getInstance().createInterface(entityMetadata.getStoreType())
- .initVersion(entityMetadata, entityId, baseVersion, newVersion);
- }
- }
- }
-
- private void deleteVersionFromEntity(String entityType, String entityId,
- Version versionToDelete, Version backToVersion) {
- Set<VersionableEntityMetadata> entityMetadatas = VERSIONABLE_ENTITIES.get(entityType);
- if (entityMetadatas != null) {
- for (VersionableEntityMetadata entityMetadata : entityMetadatas) {
- VersionableEntityDaoFactory.getInstance().createInterface(entityMetadata.getStoreType())
- .deleteVersion(entityMetadata, entityId, versionToDelete, backToVersion);
- }
- }
+ @Override
+ public void updateVersion(String itemId, Version version) {
+ versionDao.update(itemId, version);
}
- private void closeVersionOnEntity(String entityType, String entityId, Version versionToClose) {
- Set<VersionableEntityMetadata> entityMetadatas = VERSIONABLE_ENTITIES.get(entityType);
- if (entityMetadatas != null) {
- for (VersionableEntityMetadata entityMetadata : entityMetadatas) {
- VersionableEntityDaoFactory.getInstance().createInterface(entityMetadata.getStoreType())
- .closeVersion(entityMetadata, entityId, versionToClose);
- }
- }
- }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/impl/ItemManagerImplTest.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/impl/AsdcItemManagerImplTest.java
index 95c38e46e4..92d1e7f719 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/impl/ItemManagerImplTest.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/impl/AsdcItemManagerImplTest.java
@@ -25,7 +25,7 @@ import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNull;
import static org.testng.Assert.assertTrue;
-public class ItemManagerImplTest {
+public class AsdcItemManagerImplTest {
private static final String USER = "user1";
private static final String ITEM_ID = "item1";
@@ -40,7 +40,7 @@ public class ItemManagerImplTest {
@Mock
private SubscriptionService subscriptionService;
@InjectMocks
- private ItemManagerImpl itemManager;
+ private AsdcItemManagerImpl itemManager;
@BeforeMethod
public void setUp() throws Exception {
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/impl/VersioningManagerImplTest.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/impl/VersioningManagerImplTest.java
index 4f8c682c5e..5225f0e644 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/impl/VersioningManagerImplTest.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/impl/VersioningManagerImplTest.java
@@ -20,12 +20,13 @@
package org.openecomp.sdc.versioning.impl;
-
import org.mockito.ArgumentCaptor;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.openecomp.sdc.common.errors.CoreException;
+import org.openecomp.sdc.versioning.ActionVersioningManager;
+import org.openecomp.sdc.versioning.AsdcItemManager;
import org.openecomp.sdc.versioning.ItemManager;
import org.openecomp.sdc.versioning.VersionCalculator;
import org.openecomp.sdc.versioning.dao.VersionDao;
@@ -66,7 +67,7 @@ public class VersioningManagerImplTest {
@Mock
private VersionCalculator versionCalculatorMock;
@Mock
- private ItemManager itemManagerMock;
+ private ItemManager asdcItemManager;
@InjectMocks
private VersioningManagerImpl versioningManager;
@@ -169,7 +170,7 @@ public class VersioningManagerImplTest {
Assert.assertEquals(version.getName(), versionName);
verify(versionDaoMock).create(ITEM_ID, requestedVersion);
- verify(itemManagerMock).updateVersionStatus(ITEM_ID, Draft, null);
+ verify(asdcItemManager).updateVersionStatus(ITEM_ID, Draft, null);
verify(versionDaoMock)
.publish(eq(ITEM_ID), eq(requestedVersion), eq("Create version: versionName"));
}
@@ -198,7 +199,7 @@ public class VersioningManagerImplTest {
Assert.assertEquals(version.getName(), versionName);
verify(versionDaoMock).create(ITEM_ID, requestedVersion);
- verify(itemManagerMock).updateVersionStatus(ITEM_ID, Draft, null);
+ verify(asdcItemManager).updateVersionStatus(ITEM_ID, Draft, null);
verify(versionDaoMock).publish(eq(ITEM_ID), eq(requestedVersion), eq("Create version: 4.0"));
}
@@ -250,7 +251,7 @@ public class VersioningManagerImplTest {
verify(versionDaoMock).update(eq(ITEM_ID), versionArgumentCaptor.capture());
Assert.assertEquals(Certified, versionArgumentCaptor.getValue().getStatus());
verify(versionDaoMock).publish(ITEM_ID, version, submitDescription);
- verify(itemManagerMock).updateVersionStatus(ITEM_ID, Certified, Draft);
+ verify(asdcItemManager).updateVersionStatus(ITEM_ID, Certified, Draft);
}
@Test