Create an instance of {@link Project.Calendars.Calendar.Exceptions.Exception.TimePeriod }
333476
public Project.Calendars.Calendar.Exceptions.Exception.TimePeriod createProjectCalendarsCalendarExceptionsExceptionTimePeriod()
   {
      return new Project.Calendars.Calendar.Exceptions.Exception.TimePeriod();
   }
389480
@XmlElementDecl(namespace = "http://www.opengis.net/gml", name = "TimePeriod", substitutionHeadNamespace = "http://www.opengis.net/gml", substitutionHeadName = "_TimeGeometricPrimitive")
    public JAXBElement<TimePeriodType> createTimePeriod(TimePeriodType value) {
        return new JAXBElement<TimePeriodType>(_TimePeriod_QNAME, TimePeriodType.class, null, value);
    }
851966
public Document.Calendars.Calendar.WeekDays.WeekDay.TimePeriods.TimePeriod createDocumentCalendarsCalendarWeekDaysWeekDayTimePeriodsTimePeriod()
   {
      return new Document.Calendars.Calendar.WeekDays.WeekDay.TimePeriods.TimePeriod();
   }
1316331
public void Init( CalendarPeriod period, T value )
	{
		for( int i = 0; i < period.getPeriods().size(); i++ )
		{
			Period p = period.getPeriods().get( i );
			periods.add( new PeriodAssociative<T>( p.getFrom(), p.getTo(), value ) );
		}
	}
617572
private void processExceptionDays(ProjectCalendar mpxjCalendar, net.sf.mpxj.planner.schema.Calendar plannerCalendar) throws MPXJException
   {
      Days days = plannerCalendar.getDays();
      if (days != null)
      {
         List<net.sf.mpxj.planner.schema.Day> dayList = days.getDay();
         for (net.sf.mpxj.planner.schema.Day day : dayList)
         {
            if (day.getType().equals("day-type"))
            {
               Date exceptionDate = getDate(day.getDate());
               ProjectCalendarException exception = mpxjCalendar.addCalendarException(exceptionDate, exceptionDate);
               if (getInt(day.getId()) == 0)
               {
                  for (int hoursIndex = 0; hoursIndex < m_defaultWorkingHours.size(); hoursIndex++)
                  {
                     DateRange range = m_defaultWorkingHours.get(hoursIndex);
                     exception.addRange(range);
                  }
               }
            }
         }
      }
   }
1024667
private void addExceptionRange(ProjectCalendarException exception, Date start, Date finish)
   {
      if (start != null && finish != null)
      {
         exception.addRange(new DateRange(start, finish));
      }
   }
22971
public void setResourceCalendar(ProjectCalendar calendar)
   {
      set(ResourceField.CALENDAR, calendar);
      if (calendar == null)
      {
         setResourceCalendarUniqueID(null);
      }
      else
      {
         calendar.setResource(this);
         setResourceCalendarUniqueID(calendar.getUniqueID());
      }
   }
1118375
public void createInstance(
      final String my_instance_id, final String my_config_id, final String my_client_project) {
    // [START instance_admin_client_create_instance]
    final String instanceId = my_instance_id;
    final String configId = my_config_id;
    final String clientProject = my_client_project;

    OperationFuture<Instance, CreateInstanceMetadata> op =
        instanceAdminClient.createInstance(
            InstanceInfo.newBuilder(InstanceId.of(clientProject, instanceId))
                .setInstanceConfigId(InstanceConfigId.of(clientProject, configId))
                .setDisplayName(instanceId)
                .setNodeCount(1)
                .build());
    try {
      op.get();
    } catch (ExecutionException e) {
      throw (SpannerException) e.getCause();
    } catch (InterruptedException e) {
      throw SpannerExceptionFactory.propagateInterrupt(e);
    }
    // [END instance_admin_client_create_instance]
  }
217316
public static BasicPeriodFormatterService getInstance() {
        if (instance == null) {
            PeriodFormatterDataService ds = ResourceBasedPeriodFormatterDataService
                    .getInstance();
            instance = new BasicPeriodFormatterService(ds);
        }
        return instance;
    }
465332
private void processCalendarData() throws MPXJException, IOException
   {
      DirectoryEntry calDir = (DirectoryEntry) m_projectDir.getEntry("TBkndCal");
      FixFix calendarFixedData = new FixFix(36, new DocumentInputStream(((DocumentEntry) calDir.getEntry("FixFix   0"))));
      FixDeferFix calendarVarData = new FixDeferFix(new DocumentInputStream(((DocumentEntry) calDir.getEntry("FixDeferFix   0"))));

      ProjectCalendar cal;
      ProjectCalendarHours hours;
      ProjectCalendarException exception;
      String name;
      byte[] baseData;
      byte[] extData;

      int periodCount;
      int index;
      int offset;
      int defaultFlag;
      Date start;
      long duration;
      int exceptionCount;

      //
      // Configure default time ranges
      //
      SimpleDateFormat df = new SimpleDateFormat("HH:mm");
      Date defaultStart1;
      Date defaultEnd1;
      Date defaultStart2;
      Date defaultEnd2;

      try
      {
         defaultStart1 = df.parse("08:00");
         defaultEnd1 = df.parse("12:00");
         defaultStart2 = df.parse("13:00");
         defaultEnd2 = df.parse("17:00");
      }

      catch (ParseException ex)
      {
         throw new MPXJException(MPXJException.INVALID_FORMAT, ex);
      }

      int calendars = calendarFixedData.getItemCount();
      int calendarID;
      int baseCalendarID;
      int periodIndex;
      Day day;
      List<Pair<ProjectCalendar, Integer>> baseCalendars = new LinkedList<Pair<ProjectCalendar, Integer>>();

      for (int loop = 0; loop < calendars; loop++)
      {
         baseData = calendarFixedData.getByteArrayValue(loop);
         calendarID = MPPUtility.getInt(baseData, 0);
         baseCalendarID = MPPUtility.getInt(baseData, 4);
         name = calendarVarData.getUnicodeString(getOffset(baseData, 20));

         //
         // Uncommenting the call to this method is useful when trying
         // to determine the function of unknown task data.
         //
         //dumpUnknownData (name + " " + MPPUtility.getInt(baseData), UNKNOWN_CALENDAR_DATA, baseData);

         //
         // Skip calendars with negative ID values
         //
         if (calendarID < 0)
         {
            continue;
         }

         //
         // Populate the basic calendar
         //
         ExtendedData ed = new ExtendedData(calendarVarData, getOffset(baseData, 32));
         offset = -1 - ed.getInt(Integer.valueOf(8));

         if (offset == -1)
         {
            if (baseCalendarID > 0)
            {
               cal = m_file.addDefaultDerivedCalendar();
               baseCalendars.add(new Pair<ProjectCalendar, Integer>(cal, Integer.valueOf(baseCalendarID)));
            }
            else
            {
               cal = m_file.addDefaultBaseCalendar();
               cal.setName(name);
            }

            cal.setUniqueID(Integer.valueOf(calendarID));
         }
         else
         {
            if (baseCalendarID > 0)
            {
               cal = m_file.addCalendar();
               baseCalendars.add(new Pair<ProjectCalendar, Integer>(cal, Integer.valueOf(baseCalendarID)));
            }
            else
            {
               cal = m_file.addCalendar();
               cal.setName(name);
            }

            cal.setUniqueID(Integer.valueOf(calendarID));

            extData = calendarVarData.getByteArray(offset);

            for (index = 0; index < 7; index++)
            {
               offset = 4 + (40 * index);

               defaultFlag = MPPUtility.getShort(extData, offset);
               day = Day.getInstance(index + 1);

               if (defaultFlag == 1)
               {
                  cal.setWorkingDay(day, DEFAULT_WORKING_WEEK[index]);
                  if (cal.isWorkingDay(day) == true)
                  {
                     hours = cal.addCalendarHours(net.sf.mpxj.Day.getInstance(index + 1));
                     hours.addRange(new DateRange(defaultStart1, defaultEnd1));
                     hours.addRange(new DateRange(defaultStart2, defaultEnd2));
                  }
               }
               else
               {
                  periodCount = MPPUtility.getShort(extData, 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(extData, offset + 8 + (periodIndex * 2));
                        duration = MPPUtility.getDuration(extData, offset + 16 + (periodIndex * 4));
                        hours.addRange(new DateRange(start, new Date(start.getTime() + duration)));
                     }
                  }
               }
            }

            //
            // Handle any exceptions
            //
            exceptionCount = MPPUtility.getShort(extData, 0);
            if (exceptionCount != 0)
            {
               for (index = 0; index < exceptionCount; index++)
               {
                  offset = 4 + (40 * 7) + (index * 44);

                  Date fromDate = MPPUtility.getDate(extData, offset);
                  Date toDate = MPPUtility.getDate(extData, offset + 2);
                  exception = cal.addCalendarException(fromDate, toDate);

                  periodCount = MPPUtility.getShort(extData, offset + 6);
                  if (periodCount != 0)
                  {
                     for (int exceptionPeriodIndex = 0; exceptionPeriodIndex < periodCount; exceptionPeriodIndex++)
                     {
                        start = MPPUtility.getTime(extData, offset + 12 + (exceptionPeriodIndex * 2));
                        duration = MPPUtility.getDuration(extData, offset + 20 + (exceptionPeriodIndex * 4));
                        exception.addRange(new DateRange(start, new Date(start.getTime() + duration)));
                     }
                  }
               }
            }
         }

         m_calendarMap.put(Integer.valueOf(calendarID), cal);
         m_eventManager.fireCalendarReadEvent(cal);
      }

      updateBaseCalendarNames(baseCalendars);
   }
1191539
private Calendar createCalendar(long time)
    {
        // The specification accounts for gregorian dates only.
        Calendar cal = new GregorianCalendar(timeZone); // d639610
        cal.setTimeInMillis(time);

        return cal;
    }
798268
private void addCalendarExceptions(Table table, ProjectCalendar calendar, Integer exceptionID)
   {
      Integer currentExceptionID = exceptionID;
      while (true)
      {
         MapRow row = table.find(currentExceptionID);
         if (row == null)
         {
            break;
         }

         Date date = row.getDate("DATE");
         ProjectCalendarException exception = calendar.addCalendarException(date, date);
         if (row.getBoolean("WORKING"))
         {
            exception.addRange(ProjectCalendarWeek.DEFAULT_WORKING_MORNING);
            exception.addRange(ProjectCalendarWeek.DEFAULT_WORKING_AFTERNOON);
         }

         currentExceptionID = row.getInteger("NEXT_CALENDAR_EXCEPTION_ID");
      }
   }
264373
public static XMLGregorianCalendar createCalendar(String isoDate) throws Exception {
        if (isoDate == null) {
            SimpleDateFormat format = new SimpleDateFormat(DATETIME_FORMAT);
            isoDate = format.format(new Date());
        }

        DatatypeFactory df = DatatypeFactory.newInstance();
        return df.newXMLGregorianCalendar(isoDate);
    }
1214424
public static Calendar toCalendar(final long millis)
	{
		final Calendar calendar = Calendar.getInstance();
		calendar.setTimeInMillis(millis);
		return calendar;
	}
890417
public Project.Calendars.Calendar.WeekDays.WeekDay.WorkingTimes createProjectCalendarsCalendarWeekDaysWeekDayWorkingTimes()
   {
      return new Project.Calendars.Calendar.WeekDays.WeekDay.WorkingTimes();
   }
1342061
static TaskInstance createTaskInstance(Long taskId, String masterOwnerId,
            String title, String comment, Instant due, Long userId, Long secondaryOwner)
    throws ServiceException, DataAccessException {
        CodeTimer timer = new CodeTimer("createTaskInstance()", true);
        TaskTemplate task = TaskTemplateCache.getTaskTemplate(taskId);
        TaskInstance ti = createTaskInstance(taskId,  masterOwnerId, OwnerType.USER, userId,
                (secondaryOwner != null ? OwnerType.DOCUMENT : null), secondaryOwner,
                task.getTaskName(), title, comment, due, 0);

        TaskWorkflowHelper helper = new TaskWorkflowHelper(ti);

        if (due!=null) {
            String alertIntervalString = task.getAttribute(TaskAttributeConstant.ALERT_INTERVAL);
            int alertInterval = StringHelper.isEmpty(alertIntervalString) ? 0 : Integer.parseInt(alertIntervalString);
            helper.scheduleTaskSlaEvent(Date.from(due), alertInterval, false);
        }
        // create instance groups for template based tasks
        List<String> groups = helper.determineWorkgroups(null);
        if (groups != null && groups.size() > 0)
            new TaskDataAccess().setTaskInstanceGroups(ti.getTaskInstanceId(), StringHelper.toStringArray(groups));

        helper.notifyTaskAction(TaskAction.CREATE, null, null);   // notification/observer/auto-assign
        helper.auditLog("Create", "MDW");
        timer.stopAndLogTiming("");
        return ti;
    }
788507
private Periodic newPeriodic() {
        Periodic periodic = new Periodic();
        periodic.db = this.db;
        periodic.log = this.log;
        periodic.terminationGuard = this.terminationGuard;
        return periodic;
    }