private Gantt createGenericGantt ( final List < T > assignmentList , final Function < T , String > roleMapping , final StepMapping < T > stepMapping ) { final Map < String , List < T > > assignmentListMap = assignmentList . stream ( ) . collect ( Collectors . groupingBy ( roleMapping , TreeMap :: new , Collectors . toList ( ) ) ) ; final Gantt gantt = createGantt ( ) ; if ( ! assignmentList . isEmpty ( ) ) { gantt . setStartDate ( stepMapping . getFromDate ( assignmentList . get ( 0 ) ) ) ; gantt . setEndDate ( stripDatesAfterCurrentDate ( stepMapping . getToDate ( assignmentList . get ( assignmentList . size ( ) - 1 ) ) ) ) ; for ( final Entry < String , List < T > > entry : entriesSortedByValues ( assignmentListMap , stepMapping ) ) { final String stepName = entry . getKey ( ) ; final Step step = new Step ( stepName , CaptionMode . HTML ) ; step . setDescription ( stepName ) ; final List < T > assignments = entry . getValue ( ) ; Collections . sort ( assignments , getComparator ( ) ) ; addViewGenericRoleMemberToStep ( stepName , step , assignments , stepMapping ) ; gantt . addStep ( step ) ; } } return gantt ; }
Creates the generic gantt .