private static void listTasks ( ProjectFile file ) { SimpleDateFormat df = new SimpleDateFormat ( "dd/MM/yyyy HH:mm z" ) ; for ( Task task : file . getTasks ( ) ) { Date date = task . getStart ( ) ; String text = task . getStartText ( ) ; String startDate = text != null ? text : ( date != null ? df . format ( date ) : "(no start date supplied)" ) ; date = task . getFinish ( ) ; text = task . getFinishText ( ) ; String finishDate = text != null ? text : ( date != null ? df . format ( date ) : "(no finish date supplied)" ) ; Duration dur = task . getDuration ( ) ; text = task . getDurationText ( ) ; String duration = text != null ? text : ( dur != null ? dur . toString ( ) : "(no duration supplied)" ) ; dur = task . getActualDuration ( ) ; String actualDuration = dur != null ? dur . toString ( ) : "(no actual duration supplied)" ; String baselineDuration = task . getBaselineDurationText ( ) ; if ( baselineDuration == null ) { dur = task . getBaselineDuration ( ) ; if ( dur != null ) { baselineDuration = dur . toString ( ) ; } else { baselineDuration = "(no duration supplied)" ; } } System . out . println ( "Task: " + task . getName ( ) + " ID=" + task . getID ( ) + " Unique ID=" + task . getUniqueID ( ) + " (Start Date=" + startDate + " Finish Date=" + finishDate + " Duration=" + duration + " Actual Duration" + actualDuration + " Baseline Duration=" + baselineDuration + " Outline Level=" + task . getOutlineLevel ( ) + " Outline Number=" + task . getOutlineNumber ( ) + " Recurring=" + task . getRecurring ( ) + ")" ) ; } System . out . println ( ) ; }
This method lists all tasks defined in the file .