Package org.drools.process.instance.timer

Examples of org.drools.process.instance.timer.TimerInstance


    }

    public static TimerInstance readTimer(MarshallerReaderContext context) throws IOException {
        ObjectInputStream stream = context.stream;

        TimerInstance timer = new TimerInstance();
        timer.setId( stream.readLong() );
        timer.setTimerId( stream.readLong() );
        timer.setDelay( stream.readLong() );
        timer.setPeriod( stream.readLong() );
        timer.setProcessInstanceId( stream.readLong() );
        timer.setActivated( new Date( stream.readLong() ) );
        if ( stream.readBoolean() ) {
            timer.setLastTriggered( new Date( stream.readLong() ) );
        }
        return timer;
    }
View Full Code Here


    public void internalTrigger(NodeInstance from, String type) {
        if (!org.drools.workflow.core.Node.CONNECTION_DEFAULT_TYPE.equals(type)) {
            throw new IllegalArgumentException(
                "A TimerNode only accepts default incoming connections!");
        }
        TimerInstance timer = createTimerInstance();
        if (getTimerInstances() == null) {
          addTimerListener();
        }
        ((ProcessInstance) getProcessInstance()).getWorkingMemory().getTimerManager()
            .registerTimer(timer, (ProcessInstance) getProcessInstance());
        timerId = timer.getId();
    }
View Full Code Here

        timerId = timer.getId();
    }
   
    protected TimerInstance createTimerInstance() {
      Timer timer = getTimerNode().getTimer();
      TimerInstance timerInstance = new TimerInstance();
      timerInstance.setDelay(timer.getDelay());
      timerInstance.setPeriod(timer.getPeriod());
      timerInstance.setTimerId(timer.getId());
      return timerInstance;
    }
View Full Code Here

      return timerInstance;
    }

    public void signalEvent(String type, Object event) {
      if ("timerTriggered".equals(type)) {
        TimerInstance timer = (TimerInstance) event;
            if (timer.getId() == timerId) {
                triggerCompleted(timer.getPeriod() == 0);
            }
      }
    }
View Full Code Here

    if (timers != null) {
      addTimerListener();
      timerInstances = new ArrayList<Long>(timers.size());
      TimerManager timerManager = ((ProcessInstance) getProcessInstance()).getWorkingMemory().getTimerManager();
      for (Timer timer: timers.keySet()) {
        TimerInstance timerInstance = createTimerInstance(timer);
        timerManager.registerTimer(timerInstance, (ProcessInstance) getProcessInstance());
        timerInstances.add(timerInstance.getId());
      }
    }
  }
View Full Code Here

      }
    }
  }
 
    protected TimerInstance createTimerInstance(Timer timer) {
      TimerInstance timerInstance = new TimerInstance();
      timerInstance.setDelay(timer.getDelay());
      timerInstance.setPeriod(timer.getPeriod());
      timerInstance.setTimerId(timer.getId());
      return timerInstance;
    }
View Full Code Here

      return timerInstance;
    }

    public void signalEvent(String type, Object event) {
      if ("timerTriggered".equals(type)) {
        TimerInstance timerInstance = (TimerInstance) event;
            if (timerInstances.contains(timerInstance.getId())) {
                triggerTimer(timerInstance);
            }
      }
    }
View Full Code Here

        // still need to think on how to fix this.
//        TimerService service = (TimerService) stream.readObject();
//        timerManager.setTimerService( service );

        while ( stream.readShort() == PersisterEnums.TIMER ) {
            TimerInstance timer = readTimer( context );
            timerManager.internalAddTimer( timer );
        }
    }
View Full Code Here

    }

    public static TimerInstance readTimer(MarshallerReaderContext context) throws IOException {
        ObjectInputStream stream = context.stream;

        TimerInstance timer = new TimerInstance();
        timer.setId( stream.readLong() );
        timer.setTimerId( stream.readLong() );
        timer.setDelay( stream.readLong() );
        timer.setPeriod( stream.readLong() );
        timer.setProcessInstanceId( stream.readLong() );
        timer.setActivated( new Date( stream.readLong() ) );
        if ( stream.readBoolean() ) {
            timer.setLastTriggered( new Date( stream.readLong() ) );
        }
        return timer;
    }
View Full Code Here

    if (timers != null) {
      addTimerListener();
      timerInstances = new ArrayList<Long>(timers.size());
      TimerManager timerManager = ((ProcessInstance) getProcessInstance()).getWorkingMemory().getTimerManager();
      for (Timer timer: timers.keySet()) {
        TimerInstance timerInstance = createTimerInstance(timer);
        timerManager.registerTimer(timerInstance, (ProcessInstance) getProcessInstance());
        timerInstances.add(timerInstance.getId());
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.drools.process.instance.timer.TimerInstance

Copyright © 2018 www.massapicom. 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.