Search in sources :

Example 1 with ContainmentPermissionsConstraint

use of com.emc.storageos.db.client.constraint.ContainmentPermissionsConstraint in project coprhd-controller by CoprHD.

the class BourneDbClient method findByPermission.

public <T extends DataObjectWithACLs> Map<URI, Set<String>> findByPermission(Class<T> type, PermissionsKey key, final Set<String> filterBy) throws DataAccessException {
    if (key == null || type == null) {
        return Maps.newHashMap();
    }
    PermissionMapQueryResultList queryResults = new PermissionMapQueryResultList(filterBy);
    ContainmentPermissionsConstraint constraint = ContainmentPermissionsConstraint.Factory.getObjsWithPermissionsConstraint(key.toString(), type);
    try {
        getDbClient().queryByConstraint(constraint, queryResults);
    } catch (DatabaseException e) {
        throw new DataAccessException(e);
    }
    // loops over results and loads into permissionMap
    for (Iterator<URI> iterator = queryResults.iterator(); iterator.hasNext(); iterator.next()) {
    // Do nothing
    }
    return queryResults.getPermissionMap();
}
Also used : ContainmentPermissionsConstraint(com.emc.storageos.db.client.constraint.ContainmentPermissionsConstraint) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) URI(java.net.URI)

Aggregations

ContainmentPermissionsConstraint (com.emc.storageos.db.client.constraint.ContainmentPermissionsConstraint)1 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)1 URI (java.net.URI)1