List < String > getRuleFlowNames ( HttpServletRequest req ) { final String [ ] projectAndBranch = getProjectAndBranchNames ( req ) ; // Query RuleFlowGroups for asset project and branch List < RefactoringPageRow > results = queryService . query ( DesignerFindRuleFlowNamesQuery . NAME , new HashSet < ValueIndexTerm > ( ) { { add ( new ValueSharedPartIndexTerm ( "*" , PartType . RULEFLOW_GROUP , TermSearchType . WILDCARD ) ) ; add ( new ValueModuleNameIndexTerm ( projectAndBranch [ 0 ] ) ) ; if ( projectAndBranch [ 1 ] != null ) { add ( new ValueBranchNameIndexTerm ( projectAndBranch [ 1 ] ) ) ; } } } ) ; final List < String > ruleFlowGroupNames = new ArrayList < String > ( ) ; for ( RefactoringPageRow row : results ) { ruleFlowGroupNames . add ( ( String ) row . getValue ( ) ) ; } Collections . sort ( ruleFlowGroupNames ) ; // Query RuleFlowGroups for all projects and branches results = queryService . query ( DesignerFindRuleFlowNamesQuery . NAME , new HashSet < ValueIndexTerm > ( ) { { add ( new ValueSharedPartIndexTerm ( "*" , PartType . RULEFLOW_GROUP , TermSearchType . WILDCARD ) ) ; } } ) ; final List < String > otherRuleFlowGroupNames = new LinkedList < String > ( ) ; for ( RefactoringPageRow row : results ) { String ruleFlowGroupName = ( String ) row . getValue ( ) ; if ( ! ruleFlowGroupNames . contains ( ruleFlowGroupName ) ) { // but only add the new ones otherRuleFlowGroupNames . add ( ruleFlowGroupName ) ; } } Collections . sort ( otherRuleFlowGroupNames ) ; ruleFlowGroupNames . addAll ( otherRuleFlowGroupNames ) ; return ruleFlowGroupNames ; }
package scope in order to test the method