Search in sources :

Example 11 with TaskImpl

use of org.jbpm.services.task.impl.model.TaskImpl in project jbpm by kiegroup.

the class TaskSummaryQueryCriteriaUtil method getEntityField.

/*
     * (non-Javadoc)
     * @see org.jbpm.query.jpa.impl.QueryCriteriaUtil#getEntityField(javax.persistence.criteria.CriteriaQuery, java.lang.Class, java.lang.String)
     */
@Override
protected <T> Expression getEntityField(CriteriaQuery<T> query, String listId, Attribute attr) {
    if (attr == null) {
        return null;
    }
    Root<TaskImpl> taskRoot = null;
    Join<TaskImpl, TaskDataImpl> taskDataJoin = null;
    Join<TaskImpl, PeopleAssignmentsImpl> peopAssignJoin = null;
    for (Root root : query.getRoots()) {
        if (TaskImpl.class.equals(root.getJavaType())) {
            taskRoot = (Root<TaskImpl>) root;
            for (Join<TaskImpl, ?> join : taskRoot.getJoins()) {
                if (TaskDataImpl.class.equals(join.getJavaType())) {
                    taskDataJoin = (Join<TaskImpl, TaskDataImpl>) join;
                } else if (PeopleAssignmentsImpl.class.equals(join.getJavaType())) {
                    peopAssignJoin = (Join<TaskImpl, PeopleAssignmentsImpl>) join;
                }
            }
        }
    }
    assert taskRoot != null : "Unable to find TaskImpl Root in query!";
    if (taskDataJoin == null) {
        taskDataJoin = taskRoot.join(TaskImpl_.taskData);
    }
    assert taskDataJoin != null : "Unable to find TaskDataImpl Join in query!";
    return taskImplSpecificGetEntityField(query, taskRoot, taskDataJoin, peopAssignJoin, listId, attr);
}
Also used : PeopleAssignmentsImpl(org.jbpm.services.task.impl.model.PeopleAssignmentsImpl) Root(javax.persistence.criteria.Root) TaskImpl(org.jbpm.services.task.impl.model.TaskImpl) Join(javax.persistence.criteria.Join) ListJoin(javax.persistence.criteria.ListJoin) TaskDataImpl(org.jbpm.services.task.impl.model.TaskDataImpl)

Aggregations

TaskImpl (org.jbpm.services.task.impl.model.TaskImpl)11 ArrayList (java.util.ArrayList)4 TaskDataImpl (org.jbpm.services.task.impl.model.TaskDataImpl)4 Test (org.junit.Test)4 Task (org.kie.api.task.model.Task)4 CriteriaBuilder (javax.persistence.criteria.CriteriaBuilder)3 Predicate (javax.persistence.criteria.Predicate)3 Status (org.kie.api.task.model.Status)3 TaskSummary (org.kie.api.task.model.TaskSummary)3 StringReader (java.io.StringReader)2 ProcessDefinition (org.jbpm.services.api.model.ProcessDefinition)2 HumanTaskServicesBaseTest (org.jbpm.services.task.HumanTaskServicesBaseTest)2 PeopleAssignmentsImpl (org.jbpm.services.task.impl.model.PeopleAssignmentsImpl)2 InternalTaskData (org.kie.internal.task.api.model.InternalTaskData)2 Matchers.anyString (org.mockito.Matchers.anyString)2 Date (java.util.Date)1 List (java.util.List)1 Query (javax.persistence.Query)1 Tuple (javax.persistence.Tuple)1 CriteriaQuery (javax.persistence.criteria.CriteriaQuery)1