Package org.drools.core.process.instance

Examples of org.drools.core.process.instance.WorkItem


    }

    private WorkItem internalGetWorkItem(WorkItemInfo workItemInfo) {
        Environment env = kruntime.getEnvironment();
        InternalRuleBase ruleBase = (InternalRuleBase) ((KnowledgeBaseImpl) kruntime.getKieBase()).getRuleBase();
        WorkItem workItem = workItemInfo.getWorkItem(env, ruleBase);
        return workItem;
    }
View Full Code Here


    public WorkItemHandler getWorkItemHandler(String name) {
      return this.workItemHandlers.get(name);
    }

    public void retryWorkItem(long workItemId) {
      WorkItem workItem = workItems.get(workItemId);
      if (workItem != null) {
            WorkItemHandler handler = this.workItemHandlers.get(workItem.getName());
            if (handler != null) {
                handler.executeWorkItem(workItem, this);
            } else throw new WorkItemHandlerNotFoundException( "Could not find work item handler for " + workItem.getName(),
                                                        workItem.getName() );
      }
    }
View Full Code Here

    public WorkItem getWorkItem(long id) {
        return workItems.get(id);
    }

    public void completeWorkItem(long id, Map<String, Object> results) {
        WorkItem workItem = workItems.get(new Long(id));
        // work item may have been aborted
        if (workItem != null) {
            (workItem).setResults(results);
            ProcessInstance processInstance = kruntime.getProcessInstance(workItem.getProcessInstanceId());
            (workItem).setState(WorkItem.COMPLETED);
            // process instance may have finished already
            if (processInstance != null) {
                processInstance.signalEvent("workItemCompleted", workItem);
            }
View Full Code Here

                                501l,
                                WorkItem.ACTIVE };

    @Test
    public void basicMarshallingTest() throws IOException {
        WorkItem workItem = createWorkItem(input);
       
        ObjectMarshallingStrategy[] strats
            = new ObjectMarshallingStrategy[] { MarshallerFactory.newSerializeMarshallingStrategy() };

        // marshall/serialize workItem
View Full Code Here

        checkWorkItem(workItem, input);
    }
   
    @Test
    public void multipleStrategyDifferentOrderMarshallingTest() throws IOException {
        WorkItem workItem = createWorkItem(input);
      
        // marshall/serialize workItem
        byte [] byteArray;
        {
            ObjectMarshallingStrategy[] strats
View Full Code Here

        checkWorkItem(workItem, input);
    }

    @Test
    public void multipleStrategyOneLessMarshallingTest() throws IOException {
        WorkItem workItem = createWorkItem(input);
   
        // marshall/serialize workItem
        byte [] byteArray;
        {
            ObjectMarshallingStrategy[] strats
View Full Code Here

        checkWorkItem(workItem, input);
    }

    @Test
    public void multipleStrategyNoneLeftMarshallingTest() throws IOException {
        WorkItem workItem = createWorkItem(input);
   
        // marshall/serialize workItem
        byte [] byteArray;
        {
            ObjectMarshallingStrategy[] strats
View Full Code Here

        }
    }
  
    @Test
    public void backwardsCompatibleWorkItemMarshalling() throws IOException {
        WorkItem workItem = createWorkItem(input);
       
        // marshall/serialize workItem
        byte [] byteArray;
        {
            ObjectMarshallingStrategy[] strats
View Full Code Here

    public WorkItemHandler getWorkItemHandler(String name) {
      return this.workItemHandlers.get(name);
    }
   
    public void retryWorkItem(long workItemId) {
      WorkItem workItem = getWorkItem(workItemId);
      if (workItem != null) {
            WorkItemHandler handler = (WorkItemHandler) this.workItemHandlers.get(workItem.getName());
            if (handler != null) {
                handler.executeWorkItem(workItem, this);
            } else {
                throwWorkItemNotFoundException( workItem );
            }
View Full Code Here

            workItemInfo = context.findWorkItemInfo( id );
        }
       
        // work item may have been aborted
        if (workItemInfo != null) {
            WorkItem workItem = internalGetWorkItem(workItemInfo);
            workItem.setResults(results);
            ProcessInstance processInstance = kruntime.getProcessInstance(workItem.getProcessInstanceId());
            workItem.setState(WorkItem.COMPLETED);
            // process instance may have finished already
            if (processInstance != null) {
                processInstance.signalEvent("workItemCompleted", workItem);
            }
            context.remove(workItemInfo);
            if (workItems != null) {
                this.workItems.remove(workItem.getId());
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.drools.core.process.instance.WorkItem

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.