public TimephasedWorkContainer getBaselineWork ( ResourceAssignment assignment , ProjectCalendar calendar , TimephasedWorkNormaliser normaliser , byte [ ] data , boolean raw ) { TimephasedWorkContainer result = null ; if ( data != null && data . length > 0 ) { LinkedList < TimephasedWork > list = null ; //System.out.println(ByteArrayHelper.hexdump(data, false)); int index = 8 ; // 8 byte header int blockSize = 40 ; double previousCumulativeWorkPerformedInMinutes = 0 ; Date blockStartDate = MPPUtility . getTimestampFromTenths ( data , index + 36 ) ; index += blockSize ; TimephasedWork work = null ; while ( index + blockSize <= data . length ) { double cumulativeWorkInMinutes = ( double ) ( ( long ) MPPUtility . getDouble ( data , index + 20 ) ) / 1000 ; if ( ! Duration . durationValueEquals ( cumulativeWorkInMinutes , previousCumulativeWorkPerformedInMinutes ) ) { //double unknownWorkThisPeriodInMinutes = ((long) MPPUtility.getDouble(data, index + 0)) / 1000; double normalActualWorkThisPeriodInMinutes = ( ( double ) MPPUtility . getInt ( data , index + 8 ) ) / 10 ; double normalRemainingWorkThisPeriodInMinutes = ( ( double ) MPPUtility . getInt ( data , index + 28 ) ) / 10 ; double workThisPeriodInMinutes = cumulativeWorkInMinutes - previousCumulativeWorkPerformedInMinutes ; double overtimeWorkThisPeriodInMinutes = workThisPeriodInMinutes - ( normalActualWorkThisPeriodInMinutes + normalRemainingWorkThisPeriodInMinutes ) ; double overtimeFactor = overtimeWorkThisPeriodInMinutes / ( normalActualWorkThisPeriodInMinutes + normalRemainingWorkThisPeriodInMinutes ) ; double normalWorkPerDayInMinutes = 480 ; double overtimeWorkPerDayInMinutes = normalWorkPerDayInMinutes * overtimeFactor ; work = new TimephasedWork ( ) ; work . setFinish ( MPPUtility . getTimestampFromTenths ( data , index + 16 ) ) ; work . setStart ( blockStartDate ) ; work . setTotalAmount ( Duration . getInstance ( workThisPeriodInMinutes , TimeUnit . MINUTES ) ) ; work . setAmountPerDay ( Duration . getInstance ( normalWorkPerDayInMinutes + overtimeWorkPerDayInMinutes , TimeUnit . MINUTES ) ) ; previousCumulativeWorkPerformedInMinutes = cumulativeWorkInMinutes ; if ( list == null ) { list = new LinkedList < TimephasedWork > ( ) ; } list . add ( work ) ; //System.out.println(work); } blockStartDate = MPPUtility . getTimestampFromTenths ( data , index + 36 ) ; index += blockSize ; } if ( list != null ) { if ( work != null ) { work . setFinish ( assignment . getFinish ( ) ) ; } result = new DefaultTimephasedWorkContainer ( calendar , normaliser , list , raw ) ; } } return result ; }
Extracts baseline work from the MPP file for a specific baseline . Returns null if no baseline work is present otherwise returns a list of timephased work items .