diff options
author | sheetalm <sheetal.mudholkar@amdocs.com> | 2018-02-14 09:39:22 +0530 |
---|---|---|
committer | Vitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com> | 2018-02-18 19:44:22 +0000 |
commit | 04c1754116920f5b43b20f449a39cbfa7a681102 (patch) | |
tree | 805a48420c86466c82eace500d5edc6531e1f554 /openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest | |
parent | 1f79fe6cf0abafc9db0a99f4c9fbd661a5d87b32 (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/openecomp-sdc-rest-webapp/vendor-software-products-rest')
1 files changed, 10 insertions, 9 deletions
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) { |