private void addXMLWorkflowRoles(Collection thisCollection, String baseURL, HashMap<String, Role> roles, Table rolesTable) throws WingException, SQLException {
Row tableRow;
if(roles != null){
//ROLES: show group name instead of role name
for(String roleId: roles.keySet()){
Role role = roles.get(roleId);
if (role.getScope() == Role.Scope.COLLECTION || role.getScope() == Role.Scope.REPOSITORY) {
tableRow = rolesTable.addRow(Row.ROLE_DATA);
tableRow.addCell(Cell.ROLE_HEADER).addContent(role.getName());
Group roleGroup = WorkflowUtils.getRoleGroup(context, thisCollection.getID(), role);
if (roleGroup != null) {
if(role.getScope() == Role.Scope.REPOSITORY){
if(AuthorizeManager.isAdmin(context)){
tableRow.addCell().addXref(baseURL + "&submit_edit_wf_role_" + roleId, roleGroup.getName());
}else{
Cell cell = tableRow.addCell();
cell.addContent(roleGroup.getName());
cell.addHighlight("fade").addContent(T_sysadmins_only_repository_role);
}
}else{
tableRow.addCell().addXref(baseURL + "&submit_edit_wf_role_" + roleId, roleGroup.getName());
}
if (role.getScope() == Role.Scope.COLLECTION) {
addAdministratorOnlyButton(tableRow.addCell(), "submit_delete_wf_role_" + roleId, T_delete);
} else {
tableRow.addCell();
}
} else {
tableRow.addCell().addContent(T_no_role);
if (role.getScope() == Role.Scope.COLLECTION || role.getScope() == Role.Scope.REPOSITORY) {
addAdministratorOnlyButton(tableRow.addCell(), "submit_create_wf_role_" + roleId, T_create);
} else {
tableRow.addCell();
}
}
// help and directions row
tableRow = rolesTable.addRow(Row.ROLE_DATA);
tableRow.addCell();
if (role.getDescription() != null){
tableRow.addCell(1,2).addHighlight("fade offset").addContent(role.getDescription());
}
} else {
tableRow = rolesTable.addRow(Row.ROLE_DATA);
tableRow.addCell(Cell.ROLE_HEADER).addContent(role.getName());
tableRow.addCell().addContent(T_no_role);
tableRow.addCell();
// help and directions row
tableRow = rolesTable.addRow(Row.ROLE_DATA);
tableRow.addCell();
if (role.getDescription() != null){
tableRow.addCell(1,2).addHighlight("fade offset").addContent(role.getDescription());
}
}
}
}
}