use of org.jbpm.services.task.audit.impl.model.TaskVariableImpl in project jbpm by kiegroup.
the class PersonTaskVariablesIndexer method index.
@Override
public List<TaskVariable> index(String name, Object variable) {
Person person = (Person) variable;
List<TaskVariable> indexed = new ArrayList<TaskVariable>();
TaskVariableImpl personNameVar = new TaskVariableImpl();
personNameVar.setName("person.name");
personNameVar.setValue(person.getName());
indexed.add(personNameVar);
TaskVariableImpl personAgeVar = new TaskVariableImpl();
personAgeVar.setName("person.age");
personAgeVar.setValue(person.getAge() + "");
indexed.add(personAgeVar);
return indexed;
}
use of org.jbpm.services.task.audit.impl.model.TaskVariableImpl in project jbpm by kiegroup.
the class StringTaskVariableIndexer method index.
@Override
public List<TaskVariable> index(String name, Object variable) {
List<TaskVariable> indexed = new ArrayList<TaskVariable>();
TaskVariableImpl taskVariable = new TaskVariableImpl();
taskVariable.setName(name);
taskVariable.setValue(variable.toString());
indexed.add(taskVariable);
return indexed;
}
use of org.jbpm.services.task.audit.impl.model.TaskVariableImpl in project jbpm by kiegroup.
the class TaskAuditQueryModificationService method createPredicate.
/*
* (non-Javadoc)
* @see org.jbpm.query.jpa.service.QueryModificationService#createPredicate(org.jbpm.query.jpa.data.QueryCriteria, javax.persistence.criteria.CriteriaQuery, javax.persistence.criteria.CriteriaBuilder)
*/
public <R> Predicate createPredicate(QueryCriteria criteria, CriteriaQuery<R> query, CriteriaBuilder builder) {
// subquery and root
Root<TaskImpl> taskRoot = getRoot(query, TaskImpl.class);
Subquery<Long> subQuery = query.subquery(Long.class);
Root<TaskVariableImpl> taskVarRoot = subQuery.from(TaskVariableImpl.class);
subQuery.select(taskVarRoot.get(TaskVariableImpl_.taskId));
// task variable predicate (in subquery)
Predicate taskVariablePredicate = null;
String listId = criteria.getListId();
if (TASK_VARIABLE_COMBINED_ID.equals(listId)) {
List<QueryCriteria> taskVarSubCriteriaList = criteria.getCriteria();
int size = taskVarSubCriteriaList.size();
Predicate[] taskVarSubPredicates = new Predicate[size];
for (int i = 0; i < size; ++i) {
taskVarSubPredicates[i] = createSingleTaskVariableCriteriaPredicate(builder, taskVarRoot, taskVarSubCriteriaList.get(i));
}
taskVariablePredicate = builder.and(taskVarSubPredicates);
} else {
taskVariablePredicate = createSingleTaskVariableCriteriaPredicate(builder, taskVarRoot, criteria);
}
// add predicate to subquery
subQuery.where(taskVariablePredicate);
// create predicate for actual query that references subquery
return taskRoot.get(TaskImpl_.id).in(subQuery);
}
Aggregations