public static ProjectFilterSettings fromEncodedString ( String s ) { ProjectFilterSettings result = new ProjectFilterSettings ( ) ; if ( s . length ( ) > 0 ) { int bar = s . indexOf ( FIELD_DELIMITER ) ; String minPriority ; if ( bar >= 0 ) { minPriority = s . substring ( 0 , bar ) ; s = s . substring ( bar + 1 ) ; } else { minPriority = s ; s = "" ; } if ( priorityNameToValueMap . get ( minPriority ) == null ) { minPriority = DEFAULT_PRIORITY ; } result . setMinPriority ( minPriority ) ; } if ( s . length ( ) > 0 ) { int bar = s . indexOf ( FIELD_DELIMITER ) ; String categories ; if ( bar >= 0 ) { categories = s . substring ( 0 , bar ) ; s = s . substring ( bar + 1 ) ; } else { categories = s ; s = "" ; } StringTokenizer t = new StringTokenizer ( categories , LISTITEM_DELIMITER ) ; while ( t . hasMoreTokens ( ) ) { String category = t . nextToken ( ) ; // 'result' probably already contains 'category', since // it contains all known bug category keys by default. // But add it to the set anyway in case it is an unknown key. result . addCategory ( category ) ; } } if ( s . length ( ) > 0 ) { int bar = s . indexOf ( FIELD_DELIMITER ) ; String displayFalseWarnings ; if ( bar >= 0 ) { displayFalseWarnings = s . substring ( 0 , bar ) ; s = s . substring ( bar + 1 ) ; } else { displayFalseWarnings = s ; s = "" ; } result . setDisplayFalseWarnings ( Boolean . valueOf ( displayFalseWarnings ) . booleanValue ( ) ) ; } if ( s . length ( ) > 0 ) { int bar = s . indexOf ( FIELD_DELIMITER ) ; String minRankStr ; if ( bar >= 0 ) { minRankStr = s . substring ( 0 , bar ) ; // s = s.substring(bar + 1); } else { minRankStr = s ; // s = ""; } result . setMinRank ( Integer . parseInt ( minRankStr ) ) ; } // if (s.length() > 0) { // // Can add other fields here... // assert true; // } return result ; }
Create ProjectFilterSettings from an encoded string .