Package net.sf.mpxj

Examples of net.sf.mpxj.ProjectCalendarHours


    */
   private void processWorkingHours(ProjectCalendar mpxjCalendar, Sequence uniqueID, Day day, List<OverriddenDayType> typeList)
   {
      if (isWorkingDay(mpxjCalendar, day))
      {
         ProjectCalendarHours mpxjHours = mpxjCalendar.getCalendarHours(day);
         if (mpxjHours != null)
         {
            OverriddenDayType odt = m_factory.createOverriddenDayType();
            typeList.add(odt);
            odt.setId(getIntegerString(uniqueID.next()));
View Full Code Here


               }
               else
               {
                  calendar.setWorkingDay(day, true);

                  ProjectCalendarHours calendarHours = calendar.addCalendarHours(day);
                  for (WorkTimeType work : workTime)
                  {
                     if (work != null)
                     {
                        calendarHours.addRange(new DateRange(work.getStart(), work.getFinish()));
                     }
                  }
               }
            }
         }
View Full Code Here

         case MPXConstants.BASE_CALENDAR_HOURS_RECORD_NUMBER :
         {
            if (m_lastBaseCalendar != null)
            {
               ProjectCalendarHours hours = m_lastBaseCalendar.addCalendarHours();
               populateCalendarHours(record, hours);
            }

            break;
         }

         case MPXConstants.BASE_CALENDAR_EXCEPTION_RECORD_NUMBER :
         {
            if (m_lastBaseCalendar != null)
            {
               populateCalendarException(record, m_lastBaseCalendar);
            }

            break;
         }

         case MPXConstants.PROJECT_HEADER_RECORD_NUMBER :
         {
            populateProjectHeader(record, m_projectFile.getProjectHeader());
            m_formats.update();
            break;
         }

         case MPXConstants.RESOURCE_MODEL_TEXT_RECORD_NUMBER :
         {
            if ((m_resourceTableDefinition == false) && (m_ignoreTextModels == false))
            {
               m_resourceModel.update(record, true);
               m_resourceTableDefinition = true;
            }

            break;
         }

         case MPXConstants.RESOURCE_MODEL_NUMERIC_RECORD_NUMBER :
         {
            if (m_resourceTableDefinition == false)
            {
               m_resourceModel.update(record, false);
               m_resourceTableDefinition = true;
            }

            break;
         }

         case MPXConstants.RESOURCE_RECORD_NUMBER :
         {
            m_lastResource = m_projectFile.addResource();
            populateResource(m_lastResource, record);
            m_projectFile.fireResourceReadEvent(m_lastResource);
            break;
         }

         case MPXConstants.RESOURCE_NOTES_RECORD_NUMBER :
         {
            if (m_lastResource != null)
            {
               m_lastResource.setNotes(record.getString(0));
            }

            break;
         }

         case MPXConstants.RESOURCE_CALENDAR_RECORD_NUMBER :
         {
            if (m_lastResource != null)
            {
               m_lastResourceCalendar = m_lastResource.addResourceCalendar();
               populateCalendar(record, m_lastResourceCalendar, false);
            }

            break;
         }

         case MPXConstants.RESOURCE_CALENDAR_HOURS_RECORD_NUMBER :
         {
            if (m_lastResourceCalendar != null)
            {
               ProjectCalendarHours hours = m_lastResourceCalendar.addCalendarHours();
               populateCalendarHours(record, hours);
            }

            break;
         }
View Full Code Here

                  }
                  else
                  {
                     calendar.setWorkingDay(day, true);
                     // Read hours
                     ProjectCalendarHours hours = calendar.addCalendarHours(day);
                     for (Record recWorkingHours : recHours)
                     {
                        if (recWorkingHours.getValue() != null)
                        {
                           String[] wh = recWorkingHours.getValue().split("\\|");
                           try
                           {
                              Date start = m_calendarTimeFormat.parse(wh[1]);
                              Date end = m_calendarTimeFormat.parse(wh[3]);
                              hours.addRange(new DateRange(start, end));
                           }
                           catch (ParseException e)
                           {
                              // silently ignore date parse exceptions
                           }
View Full Code Here

            if (odt != null)
            {
               List<Interval> intervalList = odt.getInterval();
               if (intervalList != null)
               {
                  ProjectCalendarHours mondayHours = null;
                  ProjectCalendarHours tuesdayHours = null;
                  ProjectCalendarHours wednesdayHours = null;
                  ProjectCalendarHours thursdayHours = null;
                  ProjectCalendarHours fridayHours = null;
                  ProjectCalendarHours saturdayHours = null;
                  ProjectCalendarHours sundayHours = null;

                  if (mpxjCalendar.isWorkingDay(Day.MONDAY))
                  {
                     mondayHours = mpxjCalendar.addCalendarHours(Day.MONDAY);
                  }

                  if (mpxjCalendar.isWorkingDay(Day.TUESDAY))
                  {
                     tuesdayHours = mpxjCalendar.addCalendarHours(Day.TUESDAY);
                  }

                  if (mpxjCalendar.isWorkingDay(Day.WEDNESDAY))
                  {
                     wednesdayHours = mpxjCalendar.addCalendarHours(Day.WEDNESDAY);
                  }

                  if (mpxjCalendar.isWorkingDay(Day.THURSDAY))
                  {
                     thursdayHours = mpxjCalendar.addCalendarHours(Day.THURSDAY);
                  }

                  if (mpxjCalendar.isWorkingDay(Day.FRIDAY))
                  {
                     fridayHours = mpxjCalendar.addCalendarHours(Day.FRIDAY);
                  }

                  if (mpxjCalendar.isWorkingDay(Day.SATURDAY))
                  {
                     saturdayHours = mpxjCalendar.addCalendarHours(Day.SATURDAY);
                  }

                  if (mpxjCalendar.isWorkingDay(Day.SUNDAY))
                  {
                     sundayHours = mpxjCalendar.addCalendarHours(Day.SUNDAY);
                  }

                  for (Interval interval : intervalList)
                  {
                     Date startTime = getTime(interval.getStart());
                     Date endTime = getTime(interval.getEnd());

                     m_defaultWorkingHours.add(new DateRange(startTime, endTime));

                     if (mondayHours != null)
                     {
                        mondayHours.addRange(new DateRange(startTime, endTime));
                     }

                     if (tuesdayHours != null)
                     {
                        tuesdayHours.addRange(new DateRange(startTime, endTime));
                     }

                     if (wednesdayHours != null)
                     {
                        wednesdayHours.addRange(new DateRange(startTime, endTime));
                     }

                     if (thursdayHours != null)
                     {
                        thursdayHours.addRange(new DateRange(startTime, endTime));
                     }

                     if (fridayHours != null)
                     {
                        fridayHours.addRange(new DateRange(startTime, endTime));
                     }

                     if (saturdayHours != null)
                     {
                        saturdayHours.addRange(new DateRange(startTime, endTime));
                     }

                     if (sundayHours != null)
                     {
                        sundayHours.addRange(new DateRange(startTime, endTime));
                     }
                  }
               }
            }
         }
View Full Code Here

   {
      // Dump out the calendar related data and fields.
      //MPPUtility.dataDump(data, true, false, false, false, true, false, true);

      int offset;
      ProjectCalendarHours hours;
      int periodCount;
      int periodIndex;
      int index;
      int defaultFlag;
      Date start;
      long duration;
      Day day;

      for (index = 0; index < 7; index++)
      {
         offset = 4 + (60 * index);
         defaultFlag = data==null ? 1 : MPPUtility.getShort(data, offset);
         day = Day.getInstance(index + 1);

         if (defaultFlag == 1)
         {
            if (isBaseCalendar)
            {
               if (defaultCalendar == null)
               {
                  cal.setWorkingDay(day, DEFAULT_WORKING_WEEK[index]);
                  if (cal.isWorkingDay(day))
                  {
                     hours = cal.addCalendarHours(Day.getInstance(index + 1));
                     hours.addRange(ProjectCalendarWeek.DEFAULT_WORKING_MORNING);
                     hours.addRange(ProjectCalendarWeek.DEFAULT_WORKING_AFTERNOON);
                  }
               }
               else
               {
                  boolean workingDay = defaultCalendar.isWorkingDay(day);
                  cal.setWorkingDay(day, workingDay);
                  if (workingDay)
                  {
                     hours = cal.addCalendarHours(Day.getInstance(index + 1));
                     for (DateRange range : defaultCalendar.getHours(day))
                     {
                        hours.addRange(range);
                     }
                  }
               }
            }
            else
            {
               cal.setWorkingDay(day, DayType.DEFAULT);
            }
         }
         else
         {
            periodCount = MPPUtility.getShort(data, offset + 2);
            if (periodCount == 0)
            {
               cal.setWorkingDay(day, false);
            }
            else
            {
               cal.setWorkingDay(day, true);
               hours = cal.addCalendarHours(Day.getInstance(index + 1));

               for (periodIndex = 0; periodIndex < periodCount; periodIndex++)
               {
                  start = MPPUtility.getTime(data, offset + 8 + (periodIndex * 2));
                  duration = MPPUtility.getDuration(data, offset + 20 + (periodIndex * 4));
                  hours.addRange(new DateRange(start, new Date(start.getTime() + duration)));
               }
            }
         }
      }
   }
View Full Code Here

TOP

Related Classes of net.sf.mpxj.ProjectCalendarHours

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.