use of org.kie.api.runtime.Calendars in project drools by kiegroup.
the class PhreakTimerNode method doLeftUpdates.
public void doLeftUpdates(TimerNode timerNode, TimerNodeMemory tm, PathMemory pmem, SegmentMemory smem, LeftTupleSink sink, InternalAgenda agenda, TupleSets<LeftTuple> srcLeftTuples, TupleSets<LeftTuple> trgLeftTuples, TupleSets<LeftTuple> stagedLeftTuples) {
Timer timer = timerNode.getTimer();
// Variables may have changed for ExpressionIntervalTimer, so it must be rescheduled
TimerService timerService = agenda.getWorkingMemory().getTimerService();
long timestamp = timerService.getCurrentTime();
String[] calendarNames = timerNode.getCalendarNames();
Calendars calendars = agenda.getWorkingMemory().getCalendars();
for (LeftTuple leftTuple = srcLeftTuples.getUpdateFirst(); leftTuple != null; ) {
LeftTuple next = leftTuple.getStagedNext();
DefaultJobHandle jobHandle = (DefaultJobHandle) leftTuple.getContextObject();
if (jobHandle != null) {
// jobHandle can be null, if the time fired straight away, and never ended up scheduling a job
timerService.removeJob(jobHandle);
}
scheduleLeftTuple(timerNode, tm, pmem, smem, sink, agenda, timer, timerService, timestamp, calendarNames, calendars, leftTuple, trgLeftTuples, stagedLeftTuples);
leftTuple.clearStaged();
leftTuple = next;
}
}
use of org.kie.api.runtime.Calendars in project drools by kiegroup.
the class PhreakTimerNode method doLeftInserts.
public void doLeftInserts(TimerNode timerNode, TimerNodeMemory tm, PathMemory pmem, SegmentMemory smem, LeftTupleSink sink, InternalAgenda agenda, TupleSets<LeftTuple> srcLeftTuples, TupleSets<LeftTuple> trgLeftTuples) {
Timer timer = timerNode.getTimer();
TimerService timerService = agenda.getWorkingMemory().getTimerService();
long timestamp = timerService.getCurrentTime();
String[] calendarNames = timerNode.getCalendarNames();
Calendars calendars = agenda.getWorkingMemory().getCalendars();
for (LeftTuple leftTuple = srcLeftTuples.getInsertFirst(); leftTuple != null; ) {
LeftTuple next = leftTuple.getStagedNext();
scheduleLeftTuple(timerNode, tm, pmem, smem, sink, agenda, timer, timerService, timestamp, calendarNames, calendars, leftTuple, trgLeftTuples, null);
leftTuple.clearStaged();
leftTuple = next;
}
}
use of org.kie.api.runtime.Calendars in project drools by kiegroup.
the class CompositeMaxDurationTimer method createTrigger.
public Trigger createTrigger(Activation item, InternalWorkingMemory wm) {
long timestamp = wm.getTimerService().getCurrentTime();
String[] calendarNames = item.getRule().getCalendars();
Calendars calendars = wm.getCalendars();
return createTrigger(getMaxTimestamp(item.getTuple(), timestamp), calendarNames, calendars);
}
use of org.kie.api.runtime.Calendars in project drools by kiegroup.
the class DurationTimer method createTrigger.
public Trigger createTrigger(Activation item, InternalWorkingMemory wm) {
long timestamp;
if (eventFactHandle != null) {
Tuple leftTuple = item.getTuple();
EventFactHandle fh = (EventFactHandle) leftTuple.get(eventFactHandle);
timestamp = fh.getStartTimestamp();
} else {
timestamp = wm.getTimerService().getCurrentTime();
}
String[] calendarNames = item.getRule().getCalendars();
Calendars calendars = wm.getCalendars();
return createTrigger(timestamp, calendarNames, calendars);
}
Aggregations