Package net.sf.mpxj

Examples of net.sf.mpxj.TimephasedWorkData


    * @param raw flag indicating if this data is to be treated as raw
    * @return timephased work
    */
   public TimephasedWorkData getBaselineWork(ResourceAssignment assignment, ProjectCalendar calendar, TimephasedWorkNormaliser normaliser, byte[] data, boolean raw)
   {
      TimephasedWorkData result = null;

      if (data != null && data.length > 0)
      {
         LinkedList<TimephasedWork> list = null;

         //System.out.println(MPPUtility.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 = ((long) MPPUtility.getDouble(data, index + 20)) / 1000;
            if (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 TimephasedWorkData(calendar, normaliser, list, raw);
         }
      }

      return result;
   }
View Full Code Here


               splitFactory.processSplitData(task, timephasedActualWork, timephasedWork);
            }

            createTimephasedData(file, assignment, timephasedWork, timephasedActualWork);

            assignment.setTimephasedWork(new TimephasedWorkData(calendar, normaliser, timephasedWork, !useRawTimephasedData));
            assignment.setTimephasedActualWork(new TimephasedWorkData(calendar, normaliser, timephasedActualWork, !useRawTimephasedData));
            assignment.setTimephasedActualOvertimeWork(new TimephasedWorkData(calendar, normaliser, timephasedActualOvertimeWork, !useRawTimephasedData));

            if (timephasedWorkData != null)
            {
               if (timephasedFactory.getWorkModified(timephasedWork))
               {
View Full Code Here

            normaliser.normalise(calendar, timephasedPlanned);
            splitFactory.processSplitData(task, timephasedComplete, timephasedPlanned);
            raw = false;
         }

         TimephasedWorkData timephasedCompleteData = new TimephasedWorkData(calendar, normaliser, timephasedComplete, raw);
         TimephasedWorkData timephasedPlannedData = new TimephasedWorkData(calendar, normaliser, timephasedPlanned, raw);

         if (task != null)
         {
            ResourceAssignment mpx = task.addResourceAssignment(resource);
View Full Code Here

TOP

Related Classes of net.sf.mpxj.TimephasedWorkData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.