diff options
Diffstat (limited to 'openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java')
12 files changed, 64 insertions, 83 deletions
diff --git a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/PermissionsRules.java b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/PermissionsRules.java index b15ad10d7c..49d5ab4053 100644 --- a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/PermissionsRules.java +++ b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/PermissionsRules.java @@ -26,11 +26,9 @@ import java.util.Set; */ public interface PermissionsRules { - boolean isAllowed(String userId,String action); + boolean isAllowed(String userId, String action); - void executeAction(String itemId, String userId, String action); - - void updatePermission(String itemId,String currentUserId, String permission,Set<String> - addedUsersIds, Set<String> removedUsersIds); + void executeAction(String itemId, String userId, String action); + void updatePermission(String itemId, String currentUserId, String permission, Set<String> addedUsersIds, Set<String> removedUsersIds); } diff --git a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/PermissionsRulesFactory.java b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/PermissionsRulesFactory.java index a4afa2a5c0..b7efc852b6 100644 --- a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/PermissionsRulesFactory.java +++ b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/PermissionsRulesFactory.java @@ -25,11 +25,9 @@ import org.openecomp.core.factory.api.AbstractFactory; /** * Created by ayalaben on 6/26/2017 */ -public abstract class PermissionsRulesFactory extends - AbstractComponentFactory<PermissionsRules> { - - public static PermissionsRulesFactory getInstance() { - return AbstractFactory.getInstance(PermissionsRulesFactory.class); - } +public abstract class PermissionsRulesFactory extends AbstractComponentFactory<PermissionsRules> { + public static PermissionsRulesFactory getInstance() { + return AbstractFactory.getInstance(PermissionsRulesFactory.class); + } } diff --git a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/PermissionsServices.java b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/PermissionsServices.java index 72ae535b20..fe690df7bb 100644 --- a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/PermissionsServices.java +++ b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/PermissionsServices.java @@ -15,29 +15,27 @@ */ package org.openecomp.sdc.itempermissions; -import org.openecomp.sdc.itempermissions.type.ItemPermissionsEntity; - import java.util.Collection; import java.util.Optional; import java.util.Set; +import org.openecomp.sdc.itempermissions.type.ItemPermissionsEntity; /** * Created by ayalaben on 6/22/2017 */ public interface PermissionsServices { - Collection<ItemPermissionsEntity> listItemPermissions(String itemId); + Collection<ItemPermissionsEntity> listItemPermissions(String itemId); - Set<String> listUserPermittedItems(String userId, String permission); + Set<String> listUserPermittedItems(String userId, String permission); - void updateItemPermissions(String itemId, String permission, Set<String> addedUsersIds, - Set<String> removedUsersIds); + void updateItemPermissions(String itemId, String permission, Set<String> addedUsersIds, Set<String> removedUsersIds); - boolean isAllowed(String itemId, String userId, String action); + boolean isAllowed(String itemId, String userId, String action); - void execute(String itemId, String userId, String action); + void execute(String itemId, String userId, String action); - Optional<String> getUserItemPermission(String itemId, String userId); + Optional<String> getUserItemPermission(String itemId, String userId); - void deleteItemPermissions(String itemId); + void deleteItemPermissions(String itemId); } diff --git a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/PermissionsServicesFactory.java b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/PermissionsServicesFactory.java index 36ed52e440..4ccfee061a 100644 --- a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/PermissionsServicesFactory.java +++ b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/PermissionsServicesFactory.java @@ -25,11 +25,9 @@ import org.openecomp.core.factory.api.AbstractFactory; /** * Created by ayalaben on 6/22/2017. */ -public abstract class PermissionsServicesFactory extends - AbstractComponentFactory<PermissionsServices> { - - public static PermissionsServicesFactory getInstance() { - return AbstractFactory.getInstance(PermissionsServicesFactory.class); - } +public abstract class PermissionsServicesFactory extends AbstractComponentFactory<PermissionsServices> { + public static PermissionsServicesFactory getInstance() { + return AbstractFactory.getInstance(PermissionsServicesFactory.class); + } } diff --git a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/dao/ItemPermissionsDao.java b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/dao/ItemPermissionsDao.java index ea2211df85..4bd2adf7e9 100644 --- a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/dao/ItemPermissionsDao.java +++ b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/dao/ItemPermissionsDao.java @@ -15,23 +15,21 @@ */ package org.openecomp.sdc.itempermissions.dao; -import org.openecomp.sdc.itempermissions.type.ItemPermissionsEntity; - import java.util.Collection; import java.util.Optional; import java.util.Set; +import org.openecomp.sdc.itempermissions.type.ItemPermissionsEntity; /** * Created by ayalaben on 6/18/2017. */ public interface ItemPermissionsDao { - Collection<ItemPermissionsEntity> listItemPermissions(String itemId); + Collection<ItemPermissionsEntity> listItemPermissions(String itemId); - void updateItemPermissions(String itemId, String permission, Set<String> addedUsersIds, - Set<String> removedUsersIds); + void updateItemPermissions(String itemId, String permission, Set<String> addedUsersIds, Set<String> removedUsersIds); - Optional<String> getUserItemPermission(String itemId, String userId); + Optional<String> getUserItemPermission(String itemId, String userId); - void deleteItemPermissions(String itemId); + void deleteItemPermissions(String itemId); } diff --git a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/dao/ItemPermissionsDaoFactory.java b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/dao/ItemPermissionsDaoFactory.java index 9e46f9309f..d192b4e5c6 100644 --- a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/dao/ItemPermissionsDaoFactory.java +++ b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/dao/ItemPermissionsDaoFactory.java @@ -27,8 +27,7 @@ import org.openecomp.core.factory.api.AbstractFactory; */ public abstract class ItemPermissionsDaoFactory extends AbstractComponentFactory<ItemPermissionsDao> { - public static ItemPermissionsDaoFactory getInstance() { - return AbstractFactory.getInstance(ItemPermissionsDaoFactory.class); - } - + public static ItemPermissionsDaoFactory getInstance() { + return AbstractFactory.getInstance(ItemPermissionsDaoFactory.class); + } } diff --git a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/dao/UserPermissionsDao.java b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/dao/UserPermissionsDao.java index 990fde9f84..56c81b0153 100644 --- a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/dao/UserPermissionsDao.java +++ b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/dao/UserPermissionsDao.java @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.openecomp.sdc.itempermissions.dao; import java.util.Set; @@ -22,8 +21,5 @@ public interface UserPermissionsDao { Set<String> listUserPermittedItems(String userId, String permission); - void updatePermissions(String itemId, String permission, Set<String> addedUsersIds, - Set<String> removedUsersIds); - + void updatePermissions(String itemId, String permission, Set<String> addedUsersIds, Set<String> removedUsersIds); } - diff --git a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/dao/UserPermissionsDaoFactory.java b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/dao/UserPermissionsDaoFactory.java index 582fa23c0d..8ac89eba68 100644 --- a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/dao/UserPermissionsDaoFactory.java +++ b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/dao/UserPermissionsDaoFactory.java @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.openecomp.sdc.itempermissions.dao; import org.openecomp.core.factory.api.AbstractComponentFactory; diff --git a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/errors/PermissionsErrorMessages.java b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/errors/PermissionsErrorMessages.java index 1b8a36d0d4..c616884fc9 100644 --- a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/errors/PermissionsErrorMessages.java +++ b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/errors/PermissionsErrorMessages.java @@ -24,19 +24,19 @@ package org.openecomp.sdc.itempermissions.errors; */ public enum PermissionsErrorMessages { - NO_PERMISSION_FOR_USER("The user is not permitted to edit this item"), - USER_NOT_OWNER_SUBMIT("The user must be the owner to submit the item"), - INVALID_PERMISSION_TYPE("Invalid permission type"), - INVALID_ACTION_TYPE("Invalid action type"); + NO_PERMISSION_FOR_USER("The user is not permitted to edit this item"), + USER_NOT_OWNER_SUBMIT("The user must be the owner to submit the item"), + INVALID_PERMISSION_TYPE("Invalid permission type"), + INVALID_ACTION_TYPE("Invalid action type"); - private String errorMessage; + private String errorMessage; - PermissionsErrorMessages(String errorMessage) { - this.errorMessage = errorMessage; - } + PermissionsErrorMessages(String errorMessage) { + this.errorMessage = errorMessage; + } - public String getErrorMessage() { - return errorMessage; - } + public String getErrorMessage() { + return errorMessage; + } } diff --git a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/errors/PermissionsErrorMessagesBuilder.java b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/errors/PermissionsErrorMessagesBuilder.java index 638a7869d6..d092f5b52d 100644 --- a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/errors/PermissionsErrorMessagesBuilder.java +++ b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/errors/PermissionsErrorMessagesBuilder.java @@ -26,23 +26,22 @@ import org.openecomp.sdc.common.errors.ErrorCode; * Created by ayalaben on 6/28/2017 */ public class PermissionsErrorMessagesBuilder { - public static final String PERMISSIONS_ERROR= "PERMISSIONS_ERROR"; - private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); - /** - * Instantiates a new Submit uncompleted license model error builder. - * - * @param error - */ - public PermissionsErrorMessagesBuilder(PermissionsErrorMessages error) { - builder.withId(PERMISSIONS_ERROR); - builder.withCategory(ErrorCategory.APPLICATION); - builder.withMessage(error.getErrorMessage()); - } - - public ErrorCode build() { - return builder.build(); - } + public static final String PERMISSIONS_ERROR = "PERMISSIONS_ERROR"; + private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); + /** + * Instantiates a new Submit uncompleted license model error builder. + * + * @param error + */ + public PermissionsErrorMessagesBuilder(PermissionsErrorMessages error) { + builder.withId(PERMISSIONS_ERROR); + builder.withCategory(ErrorCategory.APPLICATION); + builder.withMessage(error.getErrorMessage()); + } + public ErrorCode build() { + return builder.build(); + } } diff --git a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/notifications/NotificationConstants.java b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/notifications/NotificationConstants.java index 88cd8de4c2..dcc7365aba 100644 --- a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/notifications/NotificationConstants.java +++ b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/notifications/NotificationConstants.java @@ -24,7 +24,8 @@ package org.openecomp.sdc.itempermissions.notifications; * @since July 10, 2017 */ public class NotificationConstants { - public static final String PERMISSION_CHANGED= "PermissionChanged"; + + public static final String PERMISSION_CHANGED = "PermissionChanged"; public static final String PERMISSION_ITEM = "permission"; public static final String ITEM_ID_PROP = "itemId"; public static final String ITEM_NAME_PROP = "itemName"; diff --git a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/type/ItemPermissionsEntity.java b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/type/ItemPermissionsEntity.java index 81ad393607..638cd853bb 100644 --- a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/type/ItemPermissionsEntity.java +++ b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/type/ItemPermissionsEntity.java @@ -30,21 +30,18 @@ import lombok.Setter; /** * Created by ayalaben on 6/18/2017. */ - @Getter @Setter @NoArgsConstructor @Table(keyspace = "dox", name = "item_permissions") public class ItemPermissionsEntity { - @PartitionKey - @Column(name = "item_id") - private String itemId; - - @ClusteringColumn - @Column(name = "user_id") - private String userId; - - @Column(name = "permission") - private String permission; + @PartitionKey + @Column(name = "item_id") + private String itemId; + @ClusteringColumn + @Column(name = "user_id") + private String userId; + @Column(name = "permission") + private String permission; } |