aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/api
diff options
context:
space:
mode:
authorsheetalm <sheetal.mudholkar@amdocs.com>2018-02-14 09:39:22 +0530
committerVitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com>2018-02-18 19:44:22 +0000
commit04c1754116920f5b43b20f449a39cbfa7a681102 (patch)
tree805a48420c86466c82eace500d5edc6531e1f554 /openecomp-be/api
parent1f79fe6cf0abafc9db0a99f4c9fbd661a5d87b32 (diff)
Onboarding foundation changes for ItemManager
Resolved conflicting changes 1. Split ItemManager to ASDCItemManager and ItemManager 2. ItemManager provides basic capability of item without collaboration 3. AsdcItemManager provides all capabilities of item including collaboration which are required by onboarding 4. ItemManager can be used by other services like activity spec to create a basic item without collaboration features. Change-Id: I6c6dc34a2b1a1745c796099b70e359432e90f85e Issue-ID: SDC-1039 Signed-off-by: sheetalm <sheetal.mudholkar@amdocs.com>
Diffstat (limited to 'openecomp-be/api')
-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
3 files changed, 42 insertions, 44 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) {