Examples of WorkItemImpl


Examples of org.drools.process.instance.impl.WorkItemImpl

  public void TODOtestOnAllSubTasksEndParentEndStrategy() throws Exception {

    TestWorkItemManager manager = new TestWorkItemManager();
    //Create the parent task
    WorkItemImpl workItem = new WorkItemImpl();
    workItem.setName("Human Task");
    workItem.setParameter("TaskName", "TaskNameParent");
    workItem.setParameter("Comment", "CommentParent");
    workItem.setParameter("Priority", "10");
    workItem.setParameter("ActorId", "Darth Vader");
    //Set the subtask policy
    workItem.setParameter("SubTaskStrategies", "OnAllSubTasksEndParentEnd");
    getHandler().executeWorkItem(workItem, manager);


    Thread.sleep(500);

    //Test if the task is succesfully created
    BlockingTaskSummaryResponseHandler responseHandler = new BlockingTaskSummaryResponseHandler();
    getClient().getTasksAssignedAsPotentialOwner("Darth Vader", "en-UK", responseHandler);
    List<TaskSummary> tasks = responseHandler.getResults();
    assertEquals(1, tasks.size());
    TaskSummary task = tasks.get(0);
    assertEquals("TaskNameParent", task.getName());
    assertEquals(10, task.getPriority());
    assertEquals("CommentParent", task.getDescription());
    assertEquals(Status.Reserved, task.getStatus());
    assertEquals("Darth Vader", task.getActualOwner().getId());

    //Create the child task
    workItem = new WorkItemImpl();
    workItem.setName("Human Task");
    workItem.setParameter("TaskName", "TaskNameChild1");
    workItem.setParameter("Comment", "CommentChild1");
    workItem.setParameter("Priority", "10");
    workItem.setParameter("ActorId", "Darth Vader");
    workItem.setParameter("ParentId", task.getId());
    getHandler().executeWorkItem(workItem, manager);

    Thread.sleep(500);

    //Create the child task2
    workItem = new WorkItemImpl();
    workItem.setName("Human Task2");
    workItem.setParameter("TaskName", "TaskNameChild2");
    workItem.setParameter("Comment", "CommentChild2");
    workItem.setParameter("Priority", "10");
    workItem.setParameter("ActorId", "Darth Vader");
    workItem.setParameter("ParentId", task.getId());
    getHandler().executeWorkItem(workItem, manager);

    Thread.sleep(500);

    //Start the parent task
View Full Code Here

Examples of org.drools.process.instance.impl.WorkItemImpl

  public void TODOtestOnParentAbortAllSubTasksEndStrategy() throws Exception {

    TestWorkItemManager manager = new TestWorkItemManager();
    //Create the parent task
    WorkItemImpl workItem = new WorkItemImpl();
    workItem.setName("Human Task");
    workItem.setParameter("TaskName", "TaskNameParent");
    workItem.setParameter("Comment", "CommentParent");
    workItem.setParameter("Priority", "10");
    workItem.setParameter("ActorId", "Darth Vader");
    //Set the subtask policy
    workItem.setParameter("SubTaskStrategies", "OnParentAbortAllSubTasksEnd");
    getHandler().executeWorkItem(workItem, manager);


    Thread.sleep(500);

    //Test if the task is succesfully created
    BlockingTaskSummaryResponseHandler responseHandler = new BlockingTaskSummaryResponseHandler();
    getClient().getTasksAssignedAsPotentialOwner("Darth Vader", "en-UK", responseHandler);
    List<TaskSummary> tasks = responseHandler.getResults();
    assertEquals(1, tasks.size());
    TaskSummary task = tasks.get(0);
    assertEquals("TaskNameParent", task.getName());
    assertEquals(10, task.getPriority());
    assertEquals("CommentParent", task.getDescription());
    assertEquals(Status.Reserved, task.getStatus());
    assertEquals("Darth Vader", task.getActualOwner().getId());

    //Create the child task
    workItem = new WorkItemImpl();
    workItem.setName("Human Task");
    workItem.setParameter("TaskName", "TaskNameChild1");
    workItem.setParameter("Comment", "CommentChild1");
    workItem.setParameter("Priority", "10");
    workItem.setParameter("ActorId", "Darth Vader");
    workItem.setParameter("ParentId", task.getId());
    getHandler().executeWorkItem(workItem, manager);

    Thread.sleep(500);

    //Create the child task2
    workItem = new WorkItemImpl();
    workItem.setName("Human Task2");
    workItem.setParameter("TaskName", "TaskNameChild2");
    workItem.setParameter("Comment", "CommentChild2");
    workItem.setParameter("Priority", "10");
    workItem.setParameter("ActorId", "Darth Vader");
    workItem.setParameter("ParentId", task.getId());
    getHandler().executeWorkItem(workItem, manager);

    Thread.sleep(500);

    //Start the parent task
View Full Code Here

Examples of org.drools.process.instance.impl.WorkItemImpl

    }

    public static WorkItem readWorkItem( MarshallerReaderContext context ) throws IOException {
        ObjectInputStream stream = context.stream;

        WorkItemImpl workItem = new WorkItemImpl();
        workItem.setId( stream.readLong() );
        workItem.setProcessInstanceId( stream.readLong() );
        workItem.setName( stream.readUTF() );
        workItem.setState( stream.readInt() );

        //WorkItem Paramaters
        int nbVariables = stream.readInt();
        if (nbVariables > 0) {

            for (int i = 0; i < nbVariables; i++) {
                String name = stream.readUTF();
                try {
                    int index = stream.readInt();
                    ObjectMarshallingStrategy strategy = null;
                    // Old way of retrieving strategy objects
                    if (index >= 0) {
                        strategy = context.resolverStrategyFactory.getStrategy( index );
                        if (strategy == null) {
                            throw new IllegalStateException( "No strategy of with index " + index + " available." );
                        }
                    }
                    // New way
                    else if (index == -2) {
                        String strategyClassName = stream.readUTF();
                        strategy = context.resolverStrategyFactory.getStrategyObject( strategyClassName );
                        if (strategy == null) {
                            throw new IllegalStateException( "No strategy of type " + strategyClassName + " available." );
                        }
                    }

                    Object value = strategy.read( stream );
                    workItem.setParameter( name,
                                           value );
                } catch (ClassNotFoundException e) {
                    throw new IllegalArgumentException(
                                                        "Could not reload variable " + name );
                }
View Full Code Here

Examples of org.drools.process.instance.impl.WorkItemImpl

        }
    }
   
    protected WorkItem createWorkItem(WorkItemNode workItemNode) {
        Work work = workItemNode.getWork();
        workItem = new WorkItemImpl();
        ((WorkItem) workItem).setName(work.getName());
        ((WorkItem) workItem).setProcessInstanceId(getProcessInstance().getId());
        ((WorkItem) workItem).setParameters(new HashMap<String, Object>(work.getParameters()));
        for (Iterator<Map.Entry<String, String>> iterator = workItemNode.getInMappings().entrySet().iterator(); iterator.hasNext(); ) {
            Map.Entry<String, String> mapping = iterator.next();
View Full Code Here

Examples of org.drools.process.instance.impl.WorkItemImpl

    }

    public static WorkItem readWorkItem(MarshallerReaderContext context) throws IOException {
        ObjectInputStream stream = context.stream;

        WorkItemImpl workItem = new WorkItemImpl();
        workItem.setId( stream.readLong() );
        workItem.setProcessInstanceId( stream.readLong() );
        workItem.setName( stream.readUTF() );
        workItem.setState( stream.readInt() );

        int nbParameters = stream.readInt();

        for ( int i = 0; i < nbParameters; i++ ) {
            String name = stream.readUTF();
            try {
                Object value = stream.readObject();
                workItem.setParameter( name,
                                       value );
            } catch ( ClassNotFoundException e ) {
                throw new IllegalArgumentException( "Could not reload parameter " + name );
            }
        }
View Full Code Here

Examples of org.drools.process.instance.impl.WorkItemImpl

    }

    public static WorkItem readWorkItem( MarshallerReaderContext context ) throws IOException {
        ObjectInputStream stream = context.stream;

        WorkItemImpl workItem = new WorkItemImpl();
        workItem.setId( stream.readLong() );
        workItem.setProcessInstanceId( stream.readLong() );
        workItem.setName( stream.readUTF() );
        workItem.setState( stream.readInt() );

        //WorkItem Paramaters
        int nbVariables = stream.readInt();
        if (nbVariables > 0) {

            for (int i = 0; i < nbVariables; i++) {
                String name = stream.readUTF();
                try {
                    int index = stream.readInt();
                    ObjectMarshallingStrategy strategy = null;
                    // Old way of retrieving strategy objects
                    if (index >= 0) {
                        strategy = context.resolverStrategyFactory.getStrategy( index );
                        if (strategy == null) {
                            throw new IllegalStateException( "No strategy of with index " + index + " available." );
                        }
                    }
                    // New way
                    else if (index == -2) {
                        String strategyClassName = stream.readUTF();
                        strategy = context.resolverStrategyFactory.getStrategyObject( strategyClassName );
                        if (strategy == null) {
                            throw new IllegalStateException( "No strategy of type " + strategyClassName + " available." );
                        }
                    }

                    Object value = strategy.read( stream );
                    workItem.setParameter( name,
                                           value );
                } catch (ClassNotFoundException e) {
                    throw new IllegalArgumentException(
                                                        "Could not reload variable " + name );
                }
View Full Code Here

Examples of org.drools.process.instance.impl.WorkItemImpl

            email.put( "Subject",
                       subject );
            email.put( "Body",
                       body );

            WorkItemImpl workItem = new WorkItemImpl();
            workItem.setParameters( email );

            handler.executeWorkItem( workItem,
                                     manager );

        }
View Full Code Here

Examples of org.drools.process.instance.impl.WorkItemImpl

    }

    public static WorkItem readWorkItem( MarshallerReaderContext context ) throws IOException {
        ObjectInputStream stream = context.stream;

        WorkItemImpl workItem = new WorkItemImpl();
        workItem.setId( stream.readLong() );
        workItem.setProcessInstanceId( stream.readLong() );
        workItem.setName( stream.readUTF() );
        workItem.setState( stream.readInt() );

        //WorkItem Paramaters
        int nbVariables = stream.readInt();
        if (nbVariables > 0) {

            for (int i = 0; i < nbVariables; i++) {
                String name = stream.readUTF();
                try {
                    int index = stream.readInt();
                    ObjectMarshallingStrategy strategy = null;
                    // Old way of retrieving strategy objects
                    if (index >= 0) {
                        strategy = context.resolverStrategyFactory.getStrategy( index );
                        if (strategy == null) {
                            throw new IllegalStateException( "No strategy of with index " + index + " available." );
                        }
                    }
                    // New way
                    else if (index == -2) {
                        String strategyClassName = stream.readUTF();
                        strategy = context.resolverStrategyFactory.getStrategyObject( strategyClassName );
                        if (strategy == null) {
                            throw new IllegalStateException( "No strategy of type " + strategyClassName + " available." );
                        }
                    }

                    Object value = strategy.read( stream );
                    workItem.setParameter( name,
                                           value );
                } catch (ClassNotFoundException e) {
                    throw new IllegalArgumentException(
                                                        "Could not reload variable " + name );
                }
View Full Code Here

Examples of org.drools.process.instance.impl.WorkItemImpl

    }

    public static WorkItem readWorkItem(MarshallerReaderContext context) throws IOException {
        ObjectInputStream stream = context.stream;

        WorkItemImpl workItem = new WorkItemImpl();
        workItem.setId( stream.readLong() );
        workItem.setProcessInstanceId( stream.readLong() );
        workItem.setName( stream.readUTF() );
        workItem.setState( stream.readInt() );

        //WorkItem Paramaters
        int nbVariables = stream.readInt();
            if (nbVariables > 0) {
               
                for (int i = 0; i < nbVariables; i++) {
                    String name = stream.readUTF();
                    try {
                        int index = stream.readInt();
                        ObjectMarshallingStrategy strategy = context.resolverStrategyFactory.getStrategy(index);
                       
                        Object value = strategy.read(stream);
                        workItem.setParameter(name, value);
                    } catch (ClassNotFoundException e) {
                        throw new IllegalArgumentException(
                                "Could not reload variable " + name);
                    }
                }
View Full Code Here

Examples of org.drools.process.instance.impl.WorkItemImpl

    }

    public static WorkItem readWorkItem( MarshallerReaderContext context ) throws IOException {
        ObjectInputStream stream = context.stream;

        WorkItemImpl workItem = new WorkItemImpl();
        workItem.setId( stream.readLong() );
        workItem.setProcessInstanceId( stream.readLong() );
        workItem.setName( stream.readUTF() );
        workItem.setState( stream.readInt() );

        //WorkItem Paramaters
        int nbVariables = stream.readInt();
        if (nbVariables > 0) {

            for (int i = 0; i < nbVariables; i++) {
                String name = stream.readUTF();
                try {
                    int index = stream.readInt();
                    ObjectMarshallingStrategy strategy = null;
                    // Old way of retrieving strategy objects
                    if (index >= 0) {
                        strategy = context.resolverStrategyFactory.getStrategy( index );
                        if (strategy == null) {
                            throw new IllegalStateException( "No strategy of with index " + index + " available." );
                        }
                    }
                    // New way
                    else if (index == -2) {
                        String strategyClassName = stream.readUTF();
                        strategy = context.resolverStrategyFactory.getStrategyObject( strategyClassName );
                        if (strategy == null) {
                            throw new IllegalStateException( "No strategy of type " + strategyClassName + " available." );
                        }
                    }

                    Object value = strategy.read( stream );
                    workItem.setParameter( name,
                                           value );
                } catch (ClassNotFoundException e) {
                    throw new IllegalArgumentException(
                                                        "Could not reload variable " + name );
                }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.