use of org.kie.internal.task.api.TaskPersistenceContext 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;
}
use of org.kie.internal.task.api.TaskPersistenceContext 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;
}
use of org.kie.internal.task.api.TaskPersistenceContext in project jbpm by kiegroup.
the class GetTasksByVariableNameCommand method execute.
public List<TaskSummary> execute(Context cntxt) {
TaskContext context = (TaskContext) cntxt;
doCallbackUserOperation(userId, context);
if (statuses == null) {
statuses = new ArrayList<Status>();
statuses.add(Status.Ready);
statuses.add(Status.InProgress);
statuses.add(Status.Reserved);
}
if (groupIds == null) {
groupIds = doUserGroupCallbackOperation(userId, null, context);
if (groupIds == null) {
groupIds = new ArrayList<String>();
}
}
TaskPersistenceContext persistenceContext = context.getPersistenceContext();
List<TaskSummary> tasks = (List<TaskSummary>) persistenceContext.queryWithParametersInTransaction("TasksByStatusByVariableName", persistenceContext.addParametersToMap("userId", userId, "groupIds", groupIds, "variableName", variableName, "status", statuses), ClassUtil.<List<TaskSummary>>castClass(List.class));
return tasks;
}
use of org.kie.internal.task.api.TaskPersistenceContext in project jbpm by kiegroup.
the class TaskCountLoadCalculator method getUserTaskLoad.
@Override
public UserTaskLoad getUserTaskLoad(User user, TaskContext context) {
UserTaskLoad load = new UserTaskLoad(getIdentifier(), user);
TaskPersistenceContext persistenceContext = ((org.jbpm.services.task.commands.TaskContext) context).getPersistenceContext();
Map<String, Object> params = new HashMap<>();
params.put("owner", user.getId());
logger.debug("DB query to be used for finding assignments :: '{}'", getSingleUserQuery());
List<Integer> assignmentCounts = persistenceContext.queryStringWithParametersInTransaction(getSingleUserQuery(), params, ClassUtil.<List<Integer>>castClass(List.class));
if (assignmentCounts != null && !assignmentCounts.isEmpty()) {
load.setCalculatedLoad(new Double(assignmentCounts.get(0)));
} else {
load.setCalculatedLoad(new Double(0));
}
return load;
}
use of org.kie.internal.task.api.TaskPersistenceContext in project jbpm by kiegroup.
the class UserGroupCallbackTaskCommand method persistIfNotExists.
protected void persistIfNotExists(final OrganizationalEntity entity, TaskContext context) {
TaskPersistenceContext tpc = context.getPersistenceContext();
OrganizationalEntity orgEntity = tpc.findOrgEntity(entity.getId());
if (orgEntity == null || (orgEntity instanceof Group && entity instanceof User) || (orgEntity instanceof User && entity instanceof Group)) {
tpc.persistOrgEntity(entity);
}
}
Aggregations