Examples of BusinessCalendar


Examples of org.camunda.bpm.engine.impl.calendar.BusinessCalendar

    }

  }

  private Date calculateRepeat() {
    BusinessCalendar businessCalendar = Context
        .getProcessEngineConfiguration()
        .getBusinessCalendarManager()
        .getBusinessCalendar(CycleBusinessCalendar.NAME);
    return businessCalendar.resolveDuedate(repeat);
  }
View Full Code Here

Examples of org.camunda.bpm.engine.impl.calendar.BusinessCalendar

      if(dueDate != null) {
        if (dueDate instanceof Date) {
          task.setDueDate((Date) dueDate);

        } else if (dueDate instanceof String) {
          BusinessCalendar businessCalendar = Context
            .getProcessEngineConfiguration()
            .getBusinessCalendarManager()
            .getBusinessCalendar(DueDateBusinessCalendar.NAME);

          task.setDueDate(businessCalendar.resolveDuedate((String) dueDate));

        } else {
          throw new ProcessEngineException("Due date expression does not resolve to a Date or Date string: " +
              dueDateExpression.getExpressionText());
        }
View Full Code Here

Examples of org.camunda.bpm.engine.impl.calendar.BusinessCalendar

    return eventScopeActivityId;
  }

  protected TimerEntity newJobInstance(ExecutionEntity execution) {

    BusinessCalendar businessCalendar = Context
        .getProcessEngineConfiguration()
        .getBusinessCalendarManager()
        .getBusinessCalendar(type.calendarName);

    if (description==null) {
      // Prevent NPE from happening in the next line
      throw new ProcessEngineException("Timer '"+execution.getActivityId()+"' was not configured with a valid duration/time");
    }

    String dueDateString = null;
    Date duedate = null;

    // ACT-1415: timer-declaration on start-event may contain expressions NOT
    // evaluating variables but other context, evaluating should happen nevertheless
    VariableScope<?> scopeForExpression = execution;
    if(scopeForExpression == null) {
      scopeForExpression = StartProcessVariableScope.getSharedInstance();
    }

    Object dueDateValue = description.getValue(scopeForExpression);
    if (dueDateValue instanceof String) {
      dueDateString = (String)dueDateValue;
    }
    else if (dueDateValue instanceof Date) {
      duedate = (Date)dueDateValue;
    }
    else {
      throw new ProcessEngineException("Timer '"+execution.getActivityId()+"' was not configured with a valid duration/time, either hand in a java.util.Date or a String in format 'yyyy-MM-dd'T'hh:mm:ss'");
    }

    if (duedate==null) {
      duedate = businessCalendar.resolveDuedate(dueDateString);
    }

    TimerEntity timer = new TimerEntity(this);
    timer.setDuedate(duedate);
    if (execution != null) {
View Full Code Here

Examples of org.jbpm.cal.BusinessCalendar

    Environment.getCurrent().get(JobSession.class).save(timer);

    // we prepare the JobExecutor notification
    long delay = 0;
    if (timer.getRepeat() != null) {
      BusinessCalendar businessCalendar = new BusinessCalendar();
      Duration duration = new Duration(timer.getRepeat());
      delay = businessCalendar.add(new Date(0), duration).getTime();
    }

    toBeScheduledTimers.put(timer.getDbid(),
        new NotificationInfo(timer.getEligibleDate(), delay));
  }
View Full Code Here

Examples of org.jbpm.cal.BusinessCalendar

    log.info("Re-initialize TimerService");
    // the timers were persisted. We have to schedule notifications
    Collection<Timer> timers =
      Environment.getCurrent().get(JobSession.class)
      .findAllTimers();
    BusinessCalendar businessCalendar = new BusinessCalendar();
    for (Timer timer : timers) {
      Duration duration = new Duration(timer.getRepeat());
      long delay = businessCalendar.add(new Date(0), duration).getTime();
      NotificationInfo notificationInfo =
        new NotificationInfo(timer.getEligibleDate(), delay);

      toBeScheduledTimers.put(timer.getDbid(), notificationInfo);
    }
View Full Code Here

Examples of org.jbpm.cal.BusinessCalendar

    ExecutionTask task = new ExecutionTask(timer);

    long repeatDelay = 0;
    if (timer.getRepeat() != null) {
      BusinessCalendar businessCalendar = new BusinessCalendar();
      Duration duration = new Duration(timer.getRepeat());
      repeatDelay = businessCalendar.add(new Date(0), duration).getTime();
    }
    try {
      Date eligibleDate = timer.getEligibleDate();
      if (repeatDelay > 0) {
        task.setRepeat();
View Full Code Here

Examples of org.jbpm.cal.BusinessCalendar

  public static BusinessCalendar parseBusinessCalendarFromXmlString(String xmlString) {
    return (BusinessCalendar) getInstance().parseXmlString(xmlString);
  }

  public Object parseDocumentElement(Element element, Parse parse) {
    BusinessCalendar businessCalendar = new BusinessCalendar();
   
    TimeZone timeZone = null;
    if (element.hasAttribute("timezone")) {
      timeZone = TimeZone.getTimeZone(element.getAttribute("timezone"));
    } else {
      timeZone = TimeZone.getDefault();
    }
    businessCalendar.setTimeZone(timeZone);
   
    String hourFormatText = "HH:mm";
    if (element.hasAttribute("hour-format")) {
      hourFormatText = element.getAttribute("hour-format");
    }
    DateFormat hourFormat = new SimpleDateFormat(hourFormatText);

    Day[] days = new Day[8];
    Element daysElement = XmlUtil.element(element, "days");
    if (daysElement!=null) {
      days[Calendar.SUNDAY] = parseDay(daysElement, "sunday", hourFormat, businessCalendar, parse);
      days[Calendar.MONDAY] = parseDay(daysElement, "monday", hourFormat, businessCalendar, parse);
      days[Calendar.TUESDAY] = parseDay(daysElement, "tuesday", hourFormat, businessCalendar, parse);
      days[Calendar.WEDNESDAY] = parseDay(daysElement, "wednesday", hourFormat, businessCalendar, parse);
      days[Calendar.THURSDAY] = parseDay(daysElement, "thursday", hourFormat, businessCalendar, parse);
      days[Calendar.FRIDAY] = parseDay(daysElement, "friday", hourFormat, businessCalendar, parse);
      days[Calendar.SATURDAY] = parseDay(daysElement, "saturday", hourFormat, businessCalendar, parse);
    }
    businessCalendar.setDays(days);

    String dayFormatText = "dd/MM/yyyy";
    if (element.hasAttribute("day-format")) {
      dayFormatText = element.getAttribute("day-format");
    }
    DateFormat dayFormat = new SimpleDateFormat(dayFormatText);

    Holiday[] holidays = null;
    List<Element> holidayElements = XmlUtil.elements(element, "holiday");
    if (holidayElements!=null) {
      holidays = new Holiday[holidayElements.size()];
      for (int i=0; i<holidayElements.size(); i++) {
        holidays[i] = parseHoliday(holidayElements.get(i), dayFormat, businessCalendar, parse);
      }
    }
    businessCalendar.setHolidays(holidays);
   
    return businessCalendar;
  }
View Full Code Here

Examples of org.jbpm.calendar.BusinessCalendar

    createTimer(dueDate);
  }

  public void createTimer(String duration) {
    TimerService timerService = entityContext.getTimerService();
    BusinessCalendar businessCalendar = new BusinessCalendar();
    Date dueDateTime = businessCalendar.add(new Date(), new Duration(duration));
    timerService.createTimer(dueDateTime, null);
  }
View Full Code Here

Examples of org.jbpm.calendar.BusinessCalendar

        {
          dueDate = baseDate;
        }
        else
        {
          BusinessCalendar businessCalendar = new BusinessCalendar();
          dueDate = businessCalendar.add(baseDate, new Duration(durationString));
        }
        taskInstance.setDueDate(dueDate);
      }

      try
View Full Code Here

Examples of org.jbpm.calendar.BusinessCalendar

                            || (signal==TaskNode.SIGNAL_FIRST_WAIT )
                            || (signal==TaskNode.SIGNAL_LAST_WAIT )
                          );
    }
    if (task.getDueDate()!=null) {
      BusinessCalendar businessCalendar = new BusinessCalendar();
      this.dueDate = businessCalendar.add(new Date(), new Duration(task.getDueDate()));
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.