public Filter getQueueFilter ( PermissionManager permissionManager ) { if ( permissionManager . hasPermission ( FixedPermissions . TECHSUPPORT ) || permissionManager . hasPermission ( FixedPermissions . ADMIN ) ) { return null ; } Set < String > visibleQueues = getVisibleQueues ( permissionManager ) ; Filter filters [ ] = new Filter [ visibleQueues . size ( ) ] ; int i = 0 ; for ( String queueName : visibleQueues ) { filters [ i ++ ] = new Compare . Equal ( "queueName" , queueName ) ; } Filter statusFilter [ ] = new Filter [ 2 ] ; statusFilter [ 0 ] = new Or ( filters ) ; statusFilter [ 1 ] = new Compare . Equal ( "status" , TaskStatus . WAIT ) ; Filter userFilter [ ] = new Filter [ 2 ] ; userFilter [ 0 ] = new Compare . Equal ( "lockedBy" , permissionManager . getCurrentUser ( ) ) ; userFilter [ 1 ] = new Compare . Equal ( "status" , TaskStatus . BUSY ) ; return new Or ( new And ( statusFilter ) , new And ( userFilter ) ) ; }
If we have the TECHSUPPORT or ADMIN permission then return null . Those users can see everything so no filter required . For the rest we only display queues they have permission to see and only processes in WAIT status .