final int role_name = 1;
final int is_grantable = 2;
PersistentStore store = t.getRowStore(session);
if (isGrantable) {
Set roles = database.getGranteeManager().getRoleNames();
Iterator it = roles.iterator();
while (it.hasNext()) {
String roleName = (String) it.next();
Object[] row = t.getEmptyRowData();
row[grantee] = role.getName().getNameString();
row[role_name] = roleName;
row[is_grantable] = Tokens.T_YES;
t.insertSys(session, store, row);
}
} else {
OrderedHashSet roles = role.getDirectRoles();
for (int i = 0; i < roles.size(); i++) {
String roleName = (String) roles.get(i);
Object[] row = t.getEmptyRowData();
row[grantee] = role.getName().getNameString();
row[role_name] = roleName;
row[is_grantable] = Tokens.T_NO;