Search in sources :

Example 6 with TaskContext

use of org.kie.internal.task.api.TaskContext in project jbpm by kiegroup.

the class GetAllAuditTasksByStatusCommand method execute.

@Override
public List<AuditTask> execute(Context context) {
    TaskPersistenceContext persistenceContext = ((TaskContext) context).getPersistenceContext();
    List<AuditTask> groupTasks = persistenceContext.queryWithParametersInTransaction("getAllAuditTasksByStatus", persistenceContext.addParametersToMap("owner", userId, "statuses", filter.getParams().get("statuses"), "firstResult", filter.getOffset(), "maxResults", filter.getCount()), ClassUtil.<List<AuditTask>>castClass(List.class));
    return groupTasks;
}
Also used : TaskContext(org.kie.internal.task.api.TaskContext) List(java.util.List) TaskPersistenceContext(org.kie.internal.task.api.TaskPersistenceContext) AuditTask(org.kie.internal.task.api.AuditTask)

Example 7 with TaskContext

use of org.kie.internal.task.api.TaskContext in project jbpm by kiegroup.

the class GetAllGroupAuditTasksByUserCommand method execute.

@Override
public List<AuditTask> execute(Context context) {
    TaskPersistenceContext persistenceContext = ((TaskContext) context).getPersistenceContext();
    boolean userExists = doCallbackUserOperation(userId, (TaskContext) context);
    List<String> groupIds = doUserGroupCallbackOperation(userId, null, (TaskContext) context);
    groupIds.add(userId);
    List<AuditTask> groupTasks = persistenceContext.queryWithParametersInTransaction("getAllGroupAuditTasksByUser", persistenceContext.addParametersToMap("potentialOwners", groupIds, "firstResult", filter.getOffset(), "maxResults", filter.getCount()), ClassUtil.<List<AuditTask>>castClass(List.class));
    return groupTasks;
}
Also used : TaskContext(org.kie.internal.task.api.TaskContext) List(java.util.List) TaskPersistenceContext(org.kie.internal.task.api.TaskPersistenceContext) AuditTask(org.kie.internal.task.api.AuditTask)

Example 8 with TaskContext

use of org.kie.internal.task.api.TaskContext in project jbpm by kiegroup.

the class GetTasksForProcessCommand method execute.

@Override
public List<TaskSummary> execute(Context context) {
    TaskContext ctx = (TaskContext) context;
    TaskPersistenceContext persistenceContext = ctx.getPersistenceContext();
    List<TaskSummary> tasks = (List<TaskSummary>) persistenceContext.queryWithParametersInTransaction("TasksByStatusByProcessId", persistenceContext.addParametersToMap("processInstanceId", processInstanceId, "status", statuses), ClassUtil.<List<TaskSummary>>castClass(List.class));
    return tasks;
}
Also used : TaskContext(org.kie.internal.task.api.TaskContext) TaskSummary(org.kie.api.task.model.TaskSummary) List(java.util.List) TaskPersistenceContext(org.kie.internal.task.api.TaskPersistenceContext)

Example 9 with TaskContext

use of org.kie.internal.task.api.TaskContext in project jbpm by kiegroup.

the class CleanUpCommand method execute.

@Override
public Void execute(Context context) {
    TaskPersistenceContext persistenceContext = ((TaskContext) context).getPersistenceContext();
    persistenceContext.executeUpdateString("delete from  NodeInstanceLog nid");
    persistenceContext.executeUpdateString("delete from  ProcessInstanceLog pid");
    persistenceContext.executeUpdateString("delete from  VariableInstanceLog vsd");
    persistenceContext.executeUpdateString("delete from  AuditTaskImpl vsd");
    return null;
}
Also used : TaskContext(org.kie.internal.task.api.TaskContext) TaskPersistenceContext(org.kie.internal.task.api.TaskPersistenceContext)

Aggregations

TaskContext (org.kie.internal.task.api.TaskContext)9 TaskPersistenceContext (org.kie.internal.task.api.TaskPersistenceContext)9 List (java.util.List)6 HashMap (java.util.HashMap)4 AuditTask (org.kie.internal.task.api.AuditTask)3 Arrays (java.util.Arrays)2 Date (java.util.Date)2 Map (java.util.Map)2 Collectors (java.util.stream.Collectors)2 EntityManagerFactory (javax.persistence.EntityManagerFactory)2 AuditTaskImpl (org.jbpm.services.task.audit.impl.model.AuditTaskImpl)2 TaskEventImpl (org.jbpm.services.task.audit.impl.model.TaskEventImpl)2 TaskIndexerManager (org.jbpm.services.task.audit.variable.TaskIndexerManager)2 TaskLifeCycleEventListener (org.jbpm.services.task.lifecycle.listeners.TaskLifeCycleEventListener)2 PersistableEventListener (org.jbpm.services.task.persistence.PersistableEventListener)2 ClassUtil (org.jbpm.services.task.utils.ClassUtil)2 TaskEvent (org.kie.api.task.TaskEvent)2 OrganizationalEntity (org.kie.api.task.model.OrganizationalEntity)2 Task (org.kie.api.task.model.Task)2 TaskVariable (org.kie.internal.task.api.TaskVariable)2