private void populateResourceAssignment ( Record record , ResourceAssignment assignment ) throws MPXJException { // // Handle malformed MPX files - ensure that we can locate the resource // using either the Unique ID attribute or the ID attribute. // Resource resource = m_projectFile . getResourceByUniqueID ( record . getInteger ( 12 ) ) ; if ( resource == null ) { resource = m_projectFile . getResourceByID ( record . getInteger ( 0 ) ) ; } assignment . setUnits ( record . getUnits ( 1 ) ) ; assignment . setWork ( record . getDuration ( 2 ) ) ; assignment . setBaselineWork ( record . getDuration ( 3 ) ) ; assignment . setActualWork ( record . getDuration ( 4 ) ) ; assignment . setOvertimeWork ( record . getDuration ( 5 ) ) ; assignment . setCost ( record . getCurrency ( 6 ) ) ; assignment . setBaselineCost ( record . getCurrency ( 7 ) ) ; assignment . setActualCost ( record . getCurrency ( 8 ) ) ; assignment . setStart ( record . getDateTime ( 9 ) ) ; assignment . setFinish ( record . getDateTime ( 10 ) ) ; assignment . setDelay ( record . getDuration ( 11 ) ) ; // // Calculate the remaining work // Duration work = assignment . getWork ( ) ; Duration actualWork = assignment . getActualWork ( ) ; if ( work != null && actualWork != null ) { if ( work . getUnits ( ) != actualWork . getUnits ( ) ) { actualWork = actualWork . convertUnits ( work . getUnits ( ) , m_projectFile . getProjectProperties ( ) ) ; } assignment . setRemainingWork ( Duration . getInstance ( work . getDuration ( ) - actualWork . getDuration ( ) , work . getUnits ( ) ) ) ; } if ( resource != null ) { assignment . setResourceUniqueID ( resource . getUniqueID ( ) ) ; resource . addResourceAssignment ( assignment ) ; } m_eventManager . fireAssignmentReadEvent ( assignment ) ; }
Populate a resource assignment .