1 package org.jbpm.scheduler.exe; 2 3 import java.util.ArrayList ; 4 import java.util.List ; 5 6 import org.jbpm.graph.exe.ProcessInstance; 7 import org.jbpm.graph.exe.Token; 8 import org.jbpm.module.exe.ModuleInstance; 9 10 13 public class SchedulerInstance extends ModuleInstance { 14 15 private static final long serialVersionUID = 1L; 16 17 private boolean isProcessEnded = false; 18 private List scheduledTimers = new ArrayList (); 19 private List cancelledTimerNames = new ArrayList (); 20 21 public SchedulerInstance() { 22 } 23 24 public SchedulerInstance(ProcessInstance processInstance) { 25 setProcessInstance(processInstance); 26 } 27 28 31 public void schedule( Timer timer ) { 32 scheduledTimers.add(timer); 33 } 34 35 public static class CancelledTimer { 36 String timerName; 37 Token token; 38 public CancelledTimer(String timerName, Token token) { 39 this.timerName = timerName; 40 this.token = token; 41 } 42 public String getTimerName() { 43 return timerName; 44 } 45 public Token getToken() { 46 return token; 47 } 48 } 49 50 53 public void cancel(String timerName, Token token) { 54 cancelledTimerNames.add(new CancelledTimer(timerName, token)); 55 } 56 57 public List getScheduledTimers() { 58 return scheduledTimers; 59 } 60 61 public List getCancelledTimerNames() { 62 return cancelledTimerNames; 63 } 64 public boolean isProcessEnded() { 65 return isProcessEnded; 66 } 67 public void setProcessEnded(boolean isProcessEnded) { 68 this.isProcessEnded = isProcessEnded; 69 } 70 } 71 | Popular Tags |