Search in sources :

Example 1 with DurationBusinessCalendar

use of org.activiti.engine.impl.calendar.DurationBusinessCalendar in project Activiti by Activiti.

the class ProcessEngineConfigurationImpl method initBusinessCalendarManager.

protected void initBusinessCalendarManager() {
    if (businessCalendarManager == null) {
        MapBusinessCalendarManager mapBusinessCalendarManager = new MapBusinessCalendarManager();
        mapBusinessCalendarManager.addBusinessCalendar(DurationBusinessCalendar.NAME, new DurationBusinessCalendar(this.clock));
        mapBusinessCalendarManager.addBusinessCalendar(DueDateBusinessCalendar.NAME, new DueDateBusinessCalendar(this.clock));
        mapBusinessCalendarManager.addBusinessCalendar(CycleBusinessCalendar.NAME, new CycleBusinessCalendar(this.clock));
        businessCalendarManager = mapBusinessCalendarManager;
    }
}
Also used : DurationBusinessCalendar(org.activiti.engine.impl.calendar.DurationBusinessCalendar) MapBusinessCalendarManager(org.activiti.engine.impl.calendar.MapBusinessCalendarManager) DueDateBusinessCalendar(org.activiti.engine.impl.calendar.DueDateBusinessCalendar) CycleBusinessCalendar(org.activiti.engine.impl.calendar.CycleBusinessCalendar)

Example 2 with DurationBusinessCalendar

use of org.activiti.engine.impl.calendar.DurationBusinessCalendar in project Activiti by Activiti.

the class DurationBusinessCalendarTest method testSimpleDuration.

public void testSimpleDuration() throws Exception {
    Clock testingClock = new DefaultClockImpl();
    DurationBusinessCalendar businessCalendar = new DurationBusinessCalendar(testingClock);
    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy MM dd - HH:mm");
    Date now = simpleDateFormat.parse("2010 06 11 - 17:23");
    testingClock.setCurrentTime(now);
    Date duedate = businessCalendar.resolveDuedate("P2DT5H70M");
    Date expectedDuedate = simpleDateFormat.parse("2010 06 13 - 23:33");
    assertEquals(expectedDuedate, duedate);
}
Also used : DurationBusinessCalendar(org.activiti.engine.impl.calendar.DurationBusinessCalendar) DefaultClockImpl(org.activiti.engine.impl.util.DefaultClockImpl) Clock(org.activiti.engine.runtime.Clock) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date)

Aggregations

DurationBusinessCalendar (org.activiti.engine.impl.calendar.DurationBusinessCalendar)2 SimpleDateFormat (java.text.SimpleDateFormat)1 Date (java.util.Date)1 CycleBusinessCalendar (org.activiti.engine.impl.calendar.CycleBusinessCalendar)1 DueDateBusinessCalendar (org.activiti.engine.impl.calendar.DueDateBusinessCalendar)1 MapBusinessCalendarManager (org.activiti.engine.impl.calendar.MapBusinessCalendarManager)1 DefaultClockImpl (org.activiti.engine.impl.util.DefaultClockImpl)1 Clock (org.activiti.engine.runtime.Clock)1