private static void listAssignmentsByResource ( ProjectFile file ) { for ( Resource resource : file . getResources ( ) ) { System . out . println ( "Assignments for resource " + resource . getName ( ) + ":" ) ; for ( ResourceAssignment assignment : resource . getTaskAssignments ( ) ) { Task task = assignment . getTask ( ) ; System . out . println ( " " + task . getName ( ) ) ; } } System . out . println ( ) ; }
This method displays the resource assignments for each resource . This time rather than just iterating through the list of all assignments in the file we extract the assignments on a resource - by - resource basis .