diff options
Diffstat (limited to 'openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-core/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/UserPermissionsDaoImpl.java')
-rw-r--r-- | openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-core/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/UserPermissionsDaoImpl.java | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-core/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/UserPermissionsDaoImpl.java b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-core/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/UserPermissionsDaoImpl.java index dad8f25535..8609f2f4a8 100644 --- a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-core/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/UserPermissionsDaoImpl.java +++ b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-core/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/UserPermissionsDaoImpl.java @@ -19,14 +19,15 @@ package org.openecomp.sdc.itempermissions.dao.impl; import com.datastax.driver.core.ResultSet; import com.datastax.driver.mapping.annotations.Accessor; import com.datastax.driver.mapping.annotations.Query; -import org.openecomp.core.nosqldb.api.NoSqlDb; -import org.openecomp.core.nosqldb.factory.NoSqlDbFactory; -import org.openecomp.sdc.itempermissions.dao.UserPermissionsDao; import java.util.Collections; import java.util.HashSet; import java.util.Set; +import org.openecomp.core.nosqldb.api.NoSqlDb; +import org.openecomp.core.nosqldb.factory.NoSqlDbFactory; +import org.openecomp.sdc.itempermissions.dao.UserPermissionsDao; + public class UserPermissionsDaoImpl implements UserPermissionsDao { private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface(); @@ -36,23 +37,23 @@ public class UserPermissionsDaoImpl implements UserPermissionsDao { @Override public Set<String> listUserPermittedItems(String userId, String permission) { - ResultSet resultSet = accessor.getUserPermissionItems(userId,permission); - if(resultSet.isExhausted()){ + ResultSet resultSet = accessor.getUserPermissionItems(userId, permission); + if (resultSet.isExhausted()) { return new HashSet<>(); } else { - return resultSet.one().getSet(0,String.class); + return resultSet.one().getSet(0, String.class); } } @Override public void updatePermissions(String itemId, String permission, Set<String> addedUsersIds, - Set<String> removedUsersIds) { + Set<String> removedUsersIds) { Set<String> itemSet = Collections.singleton(itemId); addedUsersIds.forEach(userId -> - accessor.addItem(itemSet, userId,permission)); + accessor.addItem(itemSet, userId, permission)); removedUsersIds.forEach(userId -> - accessor.removeItem(itemSet,userId,permission)); + accessor.removeItem(itemSet, userId, permission)); } @Accessor |