aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/item-permissions-rest-services/src/main
diff options
context:
space:
mode:
authorvasraz <vasyl.razinkov@est.tech>2021-03-22 15:33:06 +0000
committerChristophe Closset <christophe.closset@intl.att.com>2021-03-24 06:59:47 +0000
commitd378c37fbd1ecec7b43394926f1ca32a695e07de (patch)
tree5c8a085f8732f980d871d966ac49361644efa698 /openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/item-permissions-rest-services/src/main
parenta6ae7294ecd336d7e88f915710b08e2658eaee00 (diff)
Reformat openecomp-be
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech> Issue-ID: SDC-3449 Change-Id: I13e02322f8e00820cc5a1d85752caaeda9bf10d1
Diffstat (limited to 'openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/item-permissions-rest-services/src/main')
-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/ItemPermissions.java50
-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/mapping/MapItemPermissionsToItemPermissionsDto.java20
-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.java48
3 files changed, 50 insertions, 68 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/ItemPermissions.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/item-permissions-rest-services/src/main/java/org/openecomp/sdcrests/itempermissions/rest/ItemPermissions.java
index c3ebc31b08..4343c1a000 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/item-permissions-rest-services/src/main/java/org/openecomp/sdcrests/itempermissions/rest/ItemPermissions.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/item-permissions-rest-services/src/main/java/org/openecomp/sdcrests/itempermissions/rest/ItemPermissions.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,30 +17,32 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdcrests.itempermissions.rest;
+import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
+import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.info.Info;
import io.swagger.v3.oas.annotations.media.ArraySchema;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.tags.Tags;
-import org.openecomp.sdcrests.itempermissions.types.ItemPermissionsDto;
-import org.openecomp.sdcrests.itempermissions.types.ItemPermissionsRequestDto;
-import org.springframework.validation.annotation.Validated;
-
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
-import javax.ws.rs.*;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.HeaderParam;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-
-import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
-import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
+import org.openecomp.sdcrests.itempermissions.types.ItemPermissionsDto;
+import org.openecomp.sdcrests.itempermissions.types.ItemPermissionsRequestDto;
+import org.springframework.validation.annotation.Validated;
/**
* Created by ayalaben on 6/18/2017.
@@ -52,19 +54,15 @@ import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG
@Validated
public interface ItemPermissions {
- @GET
- @Path("/")
- @Operation(description = "List users permissions assigned on item",responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = ItemPermissionsDto.class)))))
- Response list(@PathParam("itemId") String itemId,
- @HeaderParam(USER_ID_HEADER_PARAM) String user);
-
- @PUT
- @Path("/{permission}")
- @Operation(description = "Update useres permission on item")
- Response updatePermissions(@Valid ItemPermissionsRequestDto request,
- @PathParam("itemId") String itemId,
- @PathParam("permission") String permission,
- @NotNull(message = USER_MISSING_ERROR_MSG)
- @HeaderParam(USER_ID_HEADER_PARAM) String user);
+ @GET
+ @Path("/")
+ @Operation(description = "List users permissions assigned on item", responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = ItemPermissionsDto.class)))))
+ Response list(@PathParam("itemId") String itemId, @HeaderParam(USER_ID_HEADER_PARAM) String user);
+ @PUT
+ @Path("/{permission}")
+ @Operation(description = "Update useres permission on item")
+ Response updatePermissions(@Valid ItemPermissionsRequestDto request, @PathParam("itemId") String itemId,
+ @PathParam("permission") String permission,
+ @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
}
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/mapping/MapItemPermissionsToItemPermissionsDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/item-permissions-rest-services/src/main/java/org/openecomp/sdcrests/itempermissions/rest/mapping/MapItemPermissionsToItemPermissionsDto.java
index c578cbe699..97011ef4c9 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/item-permissions-rest-services/src/main/java/org/openecomp/sdcrests/itempermissions/rest/mapping/MapItemPermissionsToItemPermissionsDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/item-permissions-rest-services/src/main/java/org/openecomp/sdcrests/itempermissions/rest/mapping/MapItemPermissionsToItemPermissionsDto.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdcrests.itempermissions.rest.mapping;
import org.openecomp.sdc.itempermissions.type.ItemPermissionsEntity;
@@ -27,14 +26,11 @@ import org.openecomp.sdcrests.mapping.MappingBase;
/**
* Created by ayalaben on 6/18/2017.
*/
+public class MapItemPermissionsToItemPermissionsDto extends MappingBase<ItemPermissionsEntity, ItemPermissionsDto> {
-public class MapItemPermissionsToItemPermissionsDto extends
- MappingBase<ItemPermissionsEntity, ItemPermissionsDto> {
-
-
- @Override
- public void doMapping(ItemPermissionsEntity source, ItemPermissionsDto target) {
- target.setUserId(source.getUserId());
- target.setPermission(source.getPermission());
- }
+ @Override
+ public void doMapping(ItemPermissionsEntity source, ItemPermissionsDto target) {
+ target.setUserId(source.getUserId());
+ target.setPermission(source.getPermission());
+ }
}
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
index 213af650f7..ece235a29a 100644
--- 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
@@ -15,7 +15,8 @@
*/
package org.openecomp.sdcrests.itempermissions.rest.services;
-
+import javax.inject.Named;
+import javax.ws.rs.core.Response;
import org.openecomp.sdc.itempermissions.PermissionsManager;
import org.openecomp.sdc.itempermissions.PermissionsManagerFactory;
import org.openecomp.sdcrests.itempermissions.rest.ItemPermissions;
@@ -26,41 +27,28 @@ 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 PermissionsManager permissionsManager =
- PermissionsManagerFactory.getInstance().createInterface();
-
- @Override
- public Response list(String itemId, String user) {
-
- GenericCollectionWrapper<ItemPermissionsDto> results = new GenericCollectionWrapper<>();
- MapItemPermissionsToItemPermissionsDto mapper = new MapItemPermissionsToItemPermissionsDto();
-
- permissionsManager.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) {
-
- permissionsManager.updateItemPermissions(itemId,permission,request.getAddedUsersIds(),
- request.getRemovedUsersIds());
-
- return Response.ok().build();
- }
+ private PermissionsManager permissionsManager = PermissionsManagerFactory.getInstance().createInterface();
+
+ @Override
+ public Response list(String itemId, String user) {
+ GenericCollectionWrapper<ItemPermissionsDto> results = new GenericCollectionWrapper<>();
+ MapItemPermissionsToItemPermissionsDto mapper = new MapItemPermissionsToItemPermissionsDto();
+ permissionsManager.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) {
+ permissionsManager.updateItemPermissions(itemId, permission, request.getAddedUsersIds(), request.getRemovedUsersIds());
+ return Response.ok().build();
+ }
}