I noticed that the following function from the StandardRDBMSAdapter would not 
work in SQLServer

public void revokePermission(Connection connection, Uri uri, NodePermission 
permission)

The SQLServerRDBMSAdapter does not implement this function and therefore it 
uses the StandardRDBMSAdapter, which executes a non-SQLSERVER compliant SQL 
statement. 
However I did the correction, I extended the function in the 
SQLServerRDBMSAdapter. You may be take this into account for future releases. I 
paste the solution below.
Regards,
   Máximo


   public void revokePermission(Connection connection, Uri uri, NodePermission 
permission)
    throws ServiceAccessException {
    if (permission == null) return;
    StringBuffer sql = new StringBuffer("delete PERMISSIONS from PERMISSIONS p, 
URI ou, URI su, URI au WHERE ou.URI_STRING = ? and su.URI_STRING = ? and 
au.URI_STRING = ? " +
        "   and p.SUBJECT_ID=su.URI_ID and p.OBJECT_ID=ou.URI_ID and 
p.ACTION_ID=au.URI_ID");
    PreparedStatement statement = null;
    try {
        final NodeRevisionNumber revisionNumber;
        revisionNumber = permission.getRevisionNumber();
        // generate proper sql based on content of revision number
        if (revisionNumber != null) {
            sql.append(" and VERSION_NO = ?");
        } else {
            sql.append(" and VERSION_NO IS NULL");
        }
        statement = connection.prepareStatement(sql.toString());
        statement.setString(1, uri.toString());
        statement.setString(2, permission.getSubjectUri());
        statement.setString(3, permission.getActionUri());
        if (revisionNumber != null) {
            statement.setString(4, revisionNumber.toString());
        }
        statement.executeUpdate();
    } catch (SQLException e) {
        throw createException(e, uri.toString());
    } finally {
        close(statement);
    }
}





Reply via email to