Package org.kie.api.task.model

Examples of org.kie.api.task.model.TaskSummary


            jaxbTaskSumList.add(new JaxbTaskSummary(iter.next()));
        }
        JaxbTaskSummaryListResponse jaxbTaskSumListResp = new JaxbTaskSummaryListResponse(jaxbTaskSumList);
        JaxbTaskSummaryListResponse jaxbTaskSumListRespCopy = testRoundTrip(jaxbTaskSumListResp);
        assertEquals( jaxbTaskSumListResp.getList().size(), jaxbTaskSumListRespCopy.getList().size() );
        TaskSummary taskSum = jaxbTaskSumListResp.getList().get(0);
        TaskSummary taskSumCopy = jaxbTaskSumListRespCopy.getList().get(0);
        ComparePair.compareObjectsViaFields(taskSum, taskSumCopy,
                "actualOwner", "createdBy",
                "potentialOwners", // null
                "createdOn", "activationTime", "expirationTime",
                "subTaskStrategy"); // dates
View Full Code Here


            return new ArrayList<TaskSummary>();
        }
        List<TaskSummary> newList = new ArrayList<TaskSummary>(list.size());
        Iterator<TaskSummary> iter = list.iterator();
        while(iter.hasNext()) {
            TaskSummary taskSum = iter.next();
            if( taskSum instanceof JaxbTaskSummary ) {
                newList.add(taskSum);
            } else {
                newList.add(new JaxbTaskSummary(taskSum));
            }
View Full Code Here

        ProcessInstance pi = ksession.getProcessInstance(processInstance.getId());
        System.out.println(pi);
   
    // complete Self Evaluation
    List<TaskSummary> tasks = taskService.getTasksAssignedAsPotentialOwner("krisv", "en-UK");
    TaskSummary task = tasks.get(0);
    System.out.println("'krisv' completing task " + task.getName() + ": " + task.getDescription());
    taskService.start(task.getId(), "krisv");

        Map<String, Object> vars = taskService.getTaskContent(task.getId());

    Map<String, Object> results = new HashMap<String, Object>();
    results.put("performance", "exceeding");
    taskService.complete(task.getId(), "krisv", results);

    // john from HR
    tasks = taskService.getTasksAssignedAsPotentialOwner("john", "en-UK");
    task = tasks.get(0);
    System.out.println("'john' completing task " + task.getName() + ": " + task.getDescription());
    taskService.claim(task.getId(), "john");
    taskService.start(task.getId(), "john");
    results = new HashMap<String, Object>();
    results.put("performance", "acceptable");
    taskService.complete(task.getId(), "john", results);

    // mary from PM
    tasks = taskService.getTasksAssignedAsPotentialOwner("mary", "en-UK");
    task = tasks.get(0);
    System.out.println("'mary' completing task " + task.getName() + ": " + task.getDescription());
    taskService.claim(task.getId(), "mary");
    taskService.start(task.getId(), "mary");
    results = new HashMap<String, Object>();
    results.put("performance", "outstanding");
    taskService.complete(task.getId(), "mary", results);

    System.out.println("Process instance completed");
   
    runtimeManager.disposeRuntimeEngine(runtimeEngine);
    runtimeManager.close();
View Full Code Here

        Map<String, List<?>> parameters = new HashMap<String, List<?>>();
        parameters.put(PROCESS_INSTANCE_ID_LIST, Arrays.asList(processId));
        parameters.put(TASK_STATUS_LIST, Arrays.asList(Status.Ready, Status.Created, Status.Reserved));
        List<TaskSummary> tasks = ((InternalTaskService) taskService).getTasksByVariousFields("john", parameters, false);

        TaskSummary task = null;
        for (TaskSummary t : tasks) {
            if (t.getName().equalsIgnoreCase(taskName)) {
                task = t;
                break;
            }
        }

        assertThat(task, notNullValue(TaskSummary.class));

        taskService.start(task.getId(), "john");
        taskService.complete(task.getId(), "john", null);
    }
View Full Code Here

        TaskQueryDataCommand cmd = taskQueryBuilder.createTaskQueryDataCommand()
        List<TaskSummary> taskResult = taskService.execute(cmd);
        assertNotNull( "Null taskResult!", taskResult );
        assertFalse( "No task summaries found.", taskResult.isEmpty() );
   
        TaskSummary taskSum = taskResult.get(0);
        String deploymentId = taskSum.getDeploymentId();
        long procInstId = taskSum.getProcessInstanceId();
      
        Calendar cal = GregorianCalendar.getInstance();
        cal.roll(Calendar.DAY_OF_YEAR, 1);
        Date tomorrow = cal.getTime();
        cal.roll(Calendar.DAY_OF_YEAR, -2);
        Date yesterday = cal.getTime();
        AuditLogService auditLogService = new JPAAuditLogService(getEmf());
       
        logger.debug( "tomorrow: " + QUERY_PARAM_DATE_FORMAT.format(tomorrow) );
        logger.debug( "yesterday: " + QUERY_PARAM_DATE_FORMAT.format(yesterday) );
        taskQueryBuilder.clear();
        taskQueryBuilder
        .deploymentId(deploymentId)
        .startDateMin(yesterday)
        .endDateMax(tomorrow)
        .processInstanceId(procInstId)
        .processInstanceStatus(ProcessInstance.STATE_COMPLETED)
        .processId(PROCESS_ID)
        .taskId(taskSum.getId())
        .taskStatus(Status.Completed)
        .value("check-" + procInstId)
        .variableId("inputStr");
       
        taskResult = taskService.execute(taskQueryBuilder.createTaskQueryDataCommand());
        assertNotNull( "Null taskResult!", taskResult );
        assertFalse( "No task summaries found.", taskResult.isEmpty() );
        assertEquals( "Num task summaries found.", 1, taskResult.size() );
        assertEquals( taskSum.getId(), taskResult.get(0).getId() );
       
        RemoteServicesQueryCommandBuilder varLogQueryBuilder = new RemoteServicesQueryCommandBuilder();
       
        varLogQueryBuilder
        .deploymentId(deploymentId)
        .startDateMin(yesterday)
        .endDateMax(tomorrow)
        .processInstanceId(procInstId)
        .processInstanceStatus(ProcessInstance.STATE_COMPLETED)
        .processId(PROCESS_ID)
        .taskId(taskSum.getId())
        .taskStatus(Status.Completed)
        .like().value("*-" + procInstId)
        .variableId("input*");

        List<org.kie.api.runtime.manager.audit.VariableInstanceLog> varResult
            = ((AuditLogService) engine.getAuditLogService()).queryVariableInstanceLogs(varLogQueryBuilder.getQueryData());

        assertNotNull( "Null var Result!", varResult );
        assertFalse( "No var logs found.", varResult.isEmpty() );
        assertEquals( "Num var logs found.", 1, varResult.size() );
        for( org.kie.api.runtime.manager.audit.VariableInstanceLog log : varResult ) {
            assertTrue( "Incorrect var value: " + log.getValue(), log.getValue().endsWith("-" + procInstId) );
            assertTrue( "Incorrect var name: " + log.getVariableId(), log.getVariableId().startsWith("input") );
        }
       
        RemoteServicesQueryCommandBuilder procLogQueryBuilder = new RemoteServicesQueryCommandBuilder();
      
        ParametrizedQuery<ProcessInstanceLog> procQuery = auditLogService.processInstanceLogQuery().processInstanceId(procInstId).buildQuery();
        List<ProcessInstanceLog> procLogs = procQuery.getResultList();
        assertFalse( "No proc logs?!?", procLogs.isEmpty() );
      
        ParametrizedQuery<org.kie.api.runtime.manager.audit.VariableInstanceLog> varQuery
        = auditLogService.variableInstanceLogQuery()
        .intersect()
        .processInstanceId(procInstId)
        .last()
        .like().value("*-" + procInstId)
        .variableId("input*")
        .buildQuery();
       
        List<org.kie.api.runtime.manager.audit.VariableInstanceLog> varLogs = varQuery.getResultList();
        assertFalse( "No last var logs?!?", varLogs.isEmpty() );
   
        procLogQueryBuilder
        .taskId(taskSum.getId())
        .taskStatus(Status.Completed)
        .like().value("*-" + procInstId)
        .variableId("input*");
       
        List<org.kie.api.runtime.manager.audit.ProcessInstanceLog> procResult
View Full Code Here

        assertFalse( "empty result", result.getTaskInfoList().isEmpty() );
        assertTrue( "more than 1 result", result.getTaskInfoList().size() == 1 );
        JaxbQueryTaskInfo taskInfo = result.getTaskInfoList().get(0);
        assertEquals( "more than 1 task sum", 1, taskInfo.getTaskSummaries().size() );
        assertEquals( "more than 1 variable", 1, taskInfo.getVariables().size() );
        TaskSummary taskSum = taskInfo.getTaskSummaries().get(0);
        assertNotNull( taskSum );
        assertEquals( taskId, taskSum.getId().longValue() );
        JaxbVariableInfo varInfo = taskInfo.getVariables().get(0);
        assertEquals( "inputStr", varInfo.getName() );
     
        roundTripJson(result);
        roundTripXml(result);
View Full Code Here

        ProcessInstance pi = ksession.getProcessInstance(processInstance.getId());
        System.out.println(pi);
   
    // complete Self Evaluation
    List<TaskSummary> tasks = taskService.getTasksAssignedAsPotentialOwner("krisv", "en-UK");
    TaskSummary task = tasks.get(0);
    System.out.println("'krisv' completing task " + task.getName() + ": " + task.getDescription());
    taskService.start(task.getId(), "krisv");

        Map<String, Object> vars = taskService.getTaskContent(task.getId());

    Map<String, Object> results = new HashMap<String, Object>();
    results.put("performance", "exceeding");
    taskService.complete(task.getId(), "krisv", results);

    // john from HR
    tasks = taskService.getTasksAssignedAsPotentialOwner("john", "en-UK");
    task = tasks.get(0);
    System.out.println("'john' completing task " + task.getName() + ": " + task.getDescription());
    taskService.claim(task.getId(), "john");
    taskService.start(task.getId(), "john");
    results = new HashMap<String, Object>();
    results.put("performance", "acceptable");
    taskService.complete(task.getId(), "john", results);

    // mary from PM
    tasks = taskService.getTasksAssignedAsPotentialOwner("mary", "en-UK");
    task = tasks.get(0);
    System.out.println("'mary' completing task " + task.getName() + ": " + task.getDescription());
    taskService.claim(task.getId(), "mary");
    taskService.start(task.getId(), "mary");
    results = new HashMap<String, Object>();
    results.put("performance", "outstanding");
    taskService.complete(task.getId(), "mary", results);

    System.out.println("Process instance completed");
   
    runtimeManager.disposeRuntimeEngine(runtimeEngine);
    runtimeManager.close();
View Full Code Here

        ProcessInstance pi = ksession.getProcessInstance(processInstance.getId());
        System.out.println(pi);
   
    // complete Self Evaluation
    List<TaskSummary> tasks = taskService.getTasksAssignedAsPotentialOwner("krisv", "en-UK");
    TaskSummary task = tasks.get(0);
    System.out.println("'krisv' completing task " + task.getName() + ": " + task.getDescription());
    taskService.start(task.getId(), "krisv");

        Map<String, Object> vars = taskService.getTaskContent(task.getId());

    Map<String, Object> results = new HashMap<String, Object>();
    results.put("performance", "exceeding");
    taskService.complete(task.getId(), "krisv", results);

    // john from HR
    tasks = taskService.getTasksAssignedAsPotentialOwner("john", "en-UK");
    task = tasks.get(0);
    System.out.println("'john' completing task " + task.getName() + ": " + task.getDescription());
    taskService.claim(task.getId(), "john");
    taskService.start(task.getId(), "john");
    results = new HashMap<String, Object>();
    results.put("performance", "acceptable");
    taskService.complete(task.getId(), "john", results);

    // mary from PM
    tasks = taskService.getTasksAssignedAsPotentialOwner("mary", "en-UK");
    task = tasks.get(0);
    System.out.println("'mary' completing task " + task.getName() + ": " + task.getDescription());
    taskService.claim(task.getId(), "mary");
    taskService.start(task.getId(), "mary");
    results = new HashMap<String, Object>();
    results.put("performance", "outstanding");
    taskService.complete(task.getId(), "mary", results);

    System.out.println("Process instance completed");
   
    runtimeManager.disposeRuntimeEngine(runtimeEngine);
    runtimeManager.close();
View Full Code Here

TOP

Related Classes of org.kie.api.task.model.TaskSummary

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.