EventAnalyticsUtils { public static List<Map<String, EventAnalyticsDimensionalItem>> generateEventDataPermutations( Map<String, List<EventAnalyticsDimensionalItem>> dataOptionMap ) { List<Map<String, EventAnalyticsDimensionalItem>> list = new LinkedList<>(); getCombinations( dataOptionMap, list ); return list; }  static void recurse( Map<String, List<EventAnalyticsDimensionalItem>> map, ListIterator<String> iter,
        TreeMap<String, EventAnalyticsDimensionalItem> cur, List<Map<String, EventAnalyticsDimensionalItem>> list ); static List<Map<String, EventAnalyticsDimensionalItem>> generateEventDataPermutations(
        Map<String, List<EventAnalyticsDimensionalItem>> dataOptionMap ); static Map<String, Object> getAggregatedEventDataMapping( Grid grid ); static void addValues( List<List<String>> ids, Grid grid, Grid outputGrid );  }
@Test public void testGenerateEventDataPermutations() { Map<String, List<EventAnalyticsDimensionalItem>> tableRows = new LinkedHashMap<>(); Grid grid = new ListGrid( ); DataElement deA = createDataElement( 'A' ); deA.setValueType( ValueType.BOOLEAN ); grid.addMetaData( deA.getUid(), deA ); TrackedEntityAttribute trackedEntityAttribute = createTrackedEntityAttribute( 'B' ); OptionSet optionSet = new OptionSet( ); optionSet.addOption( new Option( "name", "code" ) ); trackedEntityAttribute.setOptionSet( optionSet ); grid.addMetaData( trackedEntityAttribute.getUid(), trackedEntityAttribute ); List<EventAnalyticsDimensionalItem> objects = new ArrayList<>( ); Option t = new Option(); t.setCode( "1" ); t.setName( "Yes" ); Option f = new Option(); f.setCode( "0" ); f.setName( "No" ); objects.add( new EventAnalyticsDimensionalItem( t, deA.getUid() ) ); objects.add( new EventAnalyticsDimensionalItem( f, deA.getUid() ) ); objects.add( new EventAnalyticsDimensionalItem( new Option( "name", "code" ), trackedEntityAttribute.getUid() ) ); tableRows.put( deA.getUid(), objects ); tableRows.put( trackedEntityAttribute.getDimensionItem(), objects); List<Map<String, EventAnalyticsDimensionalItem>> rowPermutations = EventAnalyticsUtils.generateEventDataPermutations( tableRows ); assertEquals( 9, rowPermutations.size() ); }