
com.xlrit.gears.engine.flowable.CustomTaskListQuery Maven / Gradle / Ivy
package com.xlrit.gears.engine.flowable;
import org.flowable.common.engine.impl.interceptor.CommandContext;
import org.flowable.common.engine.impl.interceptor.CommandExecutor;
import org.flowable.common.engine.impl.query.AbstractQuery;
import org.flowable.engine.impl.util.CommandContextUtil;
import org.flowable.task.api.Task;
import java.util.Collection;
import java.util.List;
import java.util.function.Consumer;
@SuppressWarnings("unused") // fields are used by the queries in CustomTaskMapper.xml
public class CustomTaskListQuery extends AbstractQuery {
private Boolean assigned;
private String assignee;
private String assigneeNot;
private Collection candidateGroups;
private String filter;
public CustomTaskListQuery(CommandExecutor commandExecutor) {
super(commandExecutor);
}
public CustomTaskListQuery assigned(Boolean assigned) {
this.assigned = assigned;
return this;
}
public CustomTaskListQuery assignee(String assignee) {
this.assignee = assignee;
return this;
}
public CustomTaskListQuery assigneeNot(String assigneeNot) {
this.assigneeNot = assigneeNot;
return this;
}
public CustomTaskListQuery candidateGroups(Collection candidateGroups) {
this.candidateGroups = candidateGroups;
return this;
}
public CustomTaskListQuery filter(String filter) {
this.filter = filter == null || filter.isBlank() ? null : filter;
return this;
}
public String getLikeFilter() {
if (filter == null) throw new IllegalStateException("Filter is not set");
return "%" + filter.toLowerCase() + "%"; // TODO escape?
}
public CustomTaskListQuery customize(Consumer customizer) {
customizer.accept(this);
return this;
}
@Override
public long executeCount(CommandContext commandContext) {
return (Long) CommandContextUtil.getDbSqlSession(commandContext).selectOne("countTasks", this);
}
@Override
@SuppressWarnings("unchecked")
public List executeList(CommandContext commandContext) {
return CommandContextUtil.getDbSqlSession(commandContext).selectList("selectTasks", this);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy