Search in sources :

Example 1 with PeopleAssignmentsImpl

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

the class TaskImpl method readExternal.

public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
    id = in.readLong();
    priority = in.readInt();
    archived = in.readShort();
    taskType = in.readUTF();
    formName = in.readUTF();
    names = CollectionUtils.readI18NTextList(in);
    subjects = CollectionUtils.readI18NTextList(in);
    descriptions = CollectionUtils.readI18NTextList(in);
    if (in.readBoolean()) {
        subTaskStrategy = SubTasksStrategy.valueOf(in.readUTF());
    }
    if (in.readBoolean()) {
        peopleAssignments = new PeopleAssignmentsImpl();
        peopleAssignments.readExternal(in);
    }
    if (in.readBoolean()) {
        delegation = new DelegationImpl();
        delegation.readExternal(in);
    }
    if (in.readBoolean()) {
        taskData = new TaskDataImpl();
        taskData.readExternal(in);
    }
    if (in.readBoolean()) {
        deadlines = new DeadlinesImpl();
        deadlines.readExternal(in);
    }
}
Also used : PeopleAssignmentsImpl(org.jbpm.services.task.impl.model.PeopleAssignmentsImpl) DelegationImpl(org.jbpm.services.task.impl.model.DelegationImpl) TaskDataImpl(org.jbpm.services.task.impl.model.TaskDataImpl) DeadlinesImpl(org.jbpm.services.task.impl.model.DeadlinesImpl)

Example 2 with PeopleAssignmentsImpl

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

the class DistincVsJoinPerformanceTest method doJoinQuery.

private long doJoinQuery(EntityManager em, String userId, List<String> groupIds, int total) {
    CriteriaBuilder builder = em.getCriteriaBuilder();
    CriteriaQuery<TaskImpl> joinQuery = builder.createQuery(TaskImpl.class);
    Root<TaskImpl> taskRoot = joinQuery.from(TaskImpl.class);
    Join<TaskImpl, TaskDataImpl> join = taskRoot.join(TaskImpl_.taskData);
    Selection select = getTaskSummarySelect(builder, taskRoot);
    joinQuery.select(select);
    Join<TaskImpl, PeopleAssignmentsImpl> peopleAssign = taskRoot.join(TaskImpl_.peopleAssignments);
    ListJoin<PeopleAssignmentsImpl, OrganizationalEntityImpl> busAdmins = peopleAssign.join(PeopleAssignmentsImpl_.businessAdministrators, JoinType.LEFT);
    ListJoin<PeopleAssignmentsImpl, OrganizationalEntityImpl> potOwners = peopleAssign.join(PeopleAssignmentsImpl_.potentialOwners, JoinType.LEFT);
    ListJoin<PeopleAssignmentsImpl, OrganizationalEntityImpl> stakeHols = peopleAssign.join(PeopleAssignmentsImpl_.taskStakeholders, JoinType.LEFT);
    List<Predicate> predicates = new ArrayList<Predicate>();
    predicates.add(builder.equal(taskRoot.get(TaskImpl_.taskData).get(TaskDataImpl_.actualOwner).get(UserImpl_.id), userId));
    predicates.add(builder.equal(taskRoot.get(TaskImpl_.taskData).get(TaskDataImpl_.createdBy).get(UserImpl_.id), userId));
    predicates.add(builder.or(builder.equal(busAdmins.get(OrganizationalEntityImpl_.id), userId), busAdmins.get(OrganizationalEntityImpl_.id).in(groupIds)));
    predicates.add(builder.or(builder.equal(potOwners.get(OrganizationalEntityImpl_.id), userId), potOwners.get(OrganizationalEntityImpl_.id).in(groupIds)));
    predicates.add(builder.or(builder.equal(stakeHols.get(OrganizationalEntityImpl_.id), userId), stakeHols.get(OrganizationalEntityImpl_.id).in(groupIds)));
    if (!predicates.isEmpty()) {
        joinQuery.where(builder.or(predicates.toArray(new Predicate[predicates.size()])));
    }
    return timeQueryExecution(em, joinQuery, null, total);
}
Also used : CriteriaBuilder(javax.persistence.criteria.CriteriaBuilder) OrganizationalEntityImpl(org.jbpm.services.task.impl.model.OrganizationalEntityImpl) TaskImpl(org.jbpm.services.task.impl.model.TaskImpl) Selection(javax.persistence.criteria.Selection) ArrayList(java.util.ArrayList) TaskDataImpl(org.jbpm.services.task.impl.model.TaskDataImpl) Predicate(javax.persistence.criteria.Predicate) PeopleAssignmentsImpl(org.jbpm.services.task.impl.model.PeopleAssignmentsImpl)

Example 3 with PeopleAssignmentsImpl

use of org.jbpm.services.task.impl.model.PeopleAssignmentsImpl 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

PeopleAssignmentsImpl (org.jbpm.services.task.impl.model.PeopleAssignmentsImpl)3 TaskDataImpl (org.jbpm.services.task.impl.model.TaskDataImpl)3 TaskImpl (org.jbpm.services.task.impl.model.TaskImpl)2 ArrayList (java.util.ArrayList)1 CriteriaBuilder (javax.persistence.criteria.CriteriaBuilder)1 Join (javax.persistence.criteria.Join)1 ListJoin (javax.persistence.criteria.ListJoin)1 Predicate (javax.persistence.criteria.Predicate)1 Root (javax.persistence.criteria.Root)1 Selection (javax.persistence.criteria.Selection)1 DeadlinesImpl (org.jbpm.services.task.impl.model.DeadlinesImpl)1 DelegationImpl (org.jbpm.services.task.impl.model.DelegationImpl)1 OrganizationalEntityImpl (org.jbpm.services.task.impl.model.OrganizationalEntityImpl)1