public void generateWBS ( Task parent ) { String wbs ; if ( parent == null ) { if ( NumberHelper . getInt ( getUniqueID ( ) ) == 0 ) { wbs = "0" ; } else { wbs = Integer . toString ( getParentFile ( ) . getChildTasks ( ) . size ( ) + 1 ) ; } } else { wbs = parent . getWBS ( ) ; // // Apparently I added the next lines to support MPX files generated by Artemis, back in 2005 // Unfortunately I have no test data which exercises this code, and it now breaks // otherwise valid WBS values read (in this case) from XER files. So it's commented out // until someone complains about their 2005-era Artemis MPX files not working! // // int index = wbs.lastIndexOf(".0"); // if (index != -1) // { // wbs = wbs.substring(0, index); // } int childTaskCount = parent . getChildTasks ( ) . size ( ) + 1 ; if ( wbs . equals ( "0" ) ) { wbs = Integer . toString ( childTaskCount ) ; } else { wbs += ( "." + childTaskCount ) ; } } setWBS ( wbs ) ; }
This method is used to automatically generate a value for the WBS field of this task .