public ItemState findItemState ( String id , Boolean isPersisted , int ... states ) throws IllegalPathException { List < ItemState > allStates = getAllStates ( ) ; // search from the end for state for ( int i = allStates . size ( ) - 1 ; i >= 0 ; i -- ) { ItemState istate = allStates . get ( i ) ; boolean byState = false ; if ( states != null ) { for ( int state : states ) { if ( istate . getState ( ) == state ) { byState = true ; break ; } } } else { byState = true ; } if ( byState && ( isPersisted != null ? istate . isPersisted ( ) == isPersisted : true ) && istate . getData ( ) . getIdentifier ( ) . equals ( id ) ) { return istate ; } } return null ; }
Search for an item state of item with given id and filter parameters .