diff options
author | 2017-12-20 14:30:43 +0200 | |
---|---|---|
committer | 2017-12-21 11:12:33 +0000 | |
commit | 8e9c0653dd6c6862123c9609ae34e1206d86456e (patch) | |
tree | 5eeef00ec0677133baa439ca8d7ffd7aca4804b6 /openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/item-permissions-rest-services/src/main/java/org/openecomp/sdcrests/itempermissions/rest/services | |
parent | 785ebcc95de3e064e843bec04ba7a209d854fc7c (diff) |
Add collaboration feature
Issue-ID: SDC-767
Change-Id: I14fb4c1f54086ed03a56a7ff7fab9ecd40381795
Signed-off-by: talig <talig@amdocs.com>
Diffstat (limited to 'openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/item-permissions-rest-services/src/main/java/org/openecomp/sdcrests/itempermissions/rest/services')
-rw-r--r-- | openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/item-permissions-rest-services/src/main/java/org/openecomp/sdcrests/itempermissions/rest/services/ItemPermissionsImpl.java | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/item-permissions-rest-services/src/main/java/org/openecomp/sdcrests/itempermissions/rest/services/ItemPermissionsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/item-permissions-rest-services/src/main/java/org/openecomp/sdcrests/itempermissions/rest/services/ItemPermissionsImpl.java new file mode 100644 index 0000000000..4fe93c20ac --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/item-permissions-rest-services/src/main/java/org/openecomp/sdcrests/itempermissions/rest/services/ItemPermissionsImpl.java @@ -0,0 +1,52 @@ +//package org.openecomp.sdcrests.itempermissions.rest.mapping.mapping.services; +package org.openecomp.sdcrests.itempermissions.rest.services; + + +import org.openecomp.sdc.itempermissions.ItemPermissionsManager; +import org.openecomp.sdc.itempermissions.ItemPermissionsManagerFactory; +import org.openecomp.sdcrests.itempermissions.rest.ItemPermissions; +import org.openecomp.sdcrests.itempermissions.rest.mapping.MapItemPermissionsToItemPermissionsDto; +import org.openecomp.sdcrests.itempermissions.types.ItemPermissionsDto; +import org.openecomp.sdcrests.itempermissions.types.ItemPermissionsRequestDto; +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; + +/** + * Created by ayalaben on 6/18/2017. + */ + +@Named +@Service("itemPermissions") +@Scope(value = "prototype") +public class ItemPermissionsImpl implements ItemPermissions { + + private ItemPermissionsManager itemPermissionsManager = + ItemPermissionsManagerFactory.getInstance().createInterface(); + + @Override + public Response list(String itemId, String user) { + + GenericCollectionWrapper<ItemPermissionsDto> results = new GenericCollectionWrapper<>(); + MapItemPermissionsToItemPermissionsDto mapper = new MapItemPermissionsToItemPermissionsDto(); + + itemPermissionsManager.listItemPermissions(itemId) + .forEach(itemPermission -> results.add(mapper.applyMapping + (itemPermission, ItemPermissionsDto.class))); + + return Response.ok(results).build(); + } + + @Override + public Response updatePermissions(ItemPermissionsRequestDto request, String itemId, + String permission, String user) { + + itemPermissionsManager.updateItemPermissions(itemId,permission,request.getAddedUsersIds(), + request.getRemovedUsersIds()); + + return Response.ok().build(); + } +} |