private void readWBS ( ) { Map < Integer , List < MapRow > > levelMap = new HashMap < Integer , List < MapRow > > ( ) ; for ( MapRow row : m_tables . get ( "STR" ) ) { Integer level = row . getInteger ( "LEVEL_NUMBER" ) ; List < MapRow > items = levelMap . get ( level ) ; if ( items == null ) { items = new ArrayList < MapRow > ( ) ; levelMap . put ( level , items ) ; } items . add ( row ) ; } int level = 1 ; while ( true ) { List < MapRow > items = levelMap . get ( Integer . valueOf ( level ++ ) ) ; if ( items == null ) { break ; } for ( MapRow row : items ) { m_wbsFormat . parseRawValue ( row . getString ( "CODE_VALUE" ) ) ; String parentWbsValue = m_wbsFormat . getFormattedParentValue ( ) ; String wbsValue = m_wbsFormat . getFormattedValue ( ) ; row . setObject ( "WBS" , wbsValue ) ; row . setObject ( "PARENT_WBS" , parentWbsValue ) ; } final AlphanumComparator comparator = new AlphanumComparator ( ) ; Collections . sort ( items , new Comparator < MapRow > ( ) { @ Override public int compare ( MapRow o1 , MapRow o2 ) { return comparator . compare ( o1 . getString ( "WBS" ) , o2 . getString ( "WBS" ) ) ; } } ) ; for ( MapRow row : items ) { String wbs = row . getString ( "WBS" ) ; if ( wbs != null && ! wbs . isEmpty ( ) ) { ChildTaskContainer parent = m_wbsMap . get ( row . getString ( "PARENT_WBS" ) ) ; if ( parent == null ) { parent = m_projectFile ; } Task task = parent . addTask ( ) ; String name = row . getString ( "CODE_TITLE" ) ; if ( name == null || name . isEmpty ( ) ) { name = wbs ; } task . setName ( name ) ; task . setWBS ( wbs ) ; task . setSummary ( true ) ; m_wbsMap . put ( wbs , task ) ; } } } }
Read tasks representing the WBS .