boolean includeFake = UtilMethods.isSet(request.getParameter( "includeFake" ))&&request.getParameter( "includeFake" ).equals("true");
try {
String actionId = request.getParameter( "actionId" );
WorkflowAction action = APILocator.getWorkflowAPI().findAction( actionId, getUser() );
Role role = APILocator.getRoleAPI().loadRoleById( action.getNextAssign() );
List<Role> roleList = new ArrayList<Role>();
List<User> userList = new ArrayList<User>();
if ( !role.isUser() ) {
if ( action.isRoleHierarchyForAssign() ) {
userList = APILocator.getRoleAPI().findUsersForRole( role, true );
roleList.addAll( APILocator.getRoleAPI().findRoleHierarchy( role ) );
} else {
userList = APILocator.getRoleAPI().findUsersForRole( role, false );
roleList.add( role );
}
} else {
userList.add( APILocator.getUserAPI().loadUserById( role.getRoleKey(), APILocator.getUserAPI().getSystemUser(), false ) );
}
for ( User user : userList ) {
Role r = APILocator.getRoleAPI().getUserRole( user );
if ( r != null && UtilMethods.isSet( r.getId() ) ) {
roleList.add( r );
}
}
if ( name != null ) {
name = name.toLowerCase().replaceAll( "\\*", "" );
if ( UtilMethods.isSet( name ) ) {
List<Role> newRoleList = new ArrayList<Role>();
for ( Role r : roleList ) {
if ( r.getName().toLowerCase().startsWith( name ) ) {
newRoleList.add( r );
}
}
roleList = newRoleList;
}