Search in sources :

Example 1 with LocalDateTimeValue

use of org.kie.server.api.model.taskassigning.LocalDateTimeValue in project droolsjbpm-integration by kiegroup.

the class TaskAssigningRuntimeServiceQueryHelper method buildQueryParams.

List<QueryParam> buildQueryParams(Map<String, Object> params) {
    List<QueryParam> queryParams = new ArrayList<>();
    if (params.get(FROM_TASK_ID) instanceof Number) {
        Long fromTaskId = ((Number) params.get(FROM_TASK_ID)).longValue();
        queryParams.add(QueryParam.greaterOrEqualTo(AbstractTaskAssigningQueryMapper.TASK_QUERY_COLUMN.TASK_ID.columnName(), fromTaskId));
    }
    if (params.get(TO_TASK_ID) instanceof Number) {
        Long toTaskId = ((Number) params.get(TO_TASK_ID)).longValue();
        queryParams.add(QueryParam.lowerOrEqualTo(AbstractTaskAssigningQueryMapper.TASK_QUERY_COLUMN.TASK_ID.columnName(), toTaskId));
    }
    if (params.containsKey(FROM_LAST_MODIFICATION_DATE)) {
        LocalDateTime fromLastModificationDate;
        if (params.get(FROM_LAST_MODIFICATION_DATE) instanceof LocalDateTimeValue) {
            fromLastModificationDate = ((LocalDateTimeValue) params.get(FROM_LAST_MODIFICATION_DATE)).getValue();
        } else {
            fromLastModificationDate = (LocalDateTime) params.get(FROM_LAST_MODIFICATION_DATE);
        }
        if (fromLastModificationDate != null) {
            Date lastModificationDateValue = Date.from(fromLastModificationDate.atZone(ZoneId.systemDefault()).toInstant());
            queryParams.add(QueryParam.greaterOrEqualTo(AbstractTaskAssigningQueryMapper.TASK_QUERY_COLUMN.LAST_MODIFICATION_DATE.columnName(), lastModificationDateValue));
        }
    }
    List<String> status = (List<String>) params.get(STATUS);
    if (status != null && !status.isEmpty()) {
        queryParams.add(QueryParam.equalsTo(AbstractTaskAssigningQueryMapper.TASK_QUERY_COLUMN.STATUS.columnName(), status.toArray(new String[0])));
    }
    return queryParams;
}
Also used : LocalDateTime(java.time.LocalDateTime) QueryParam(org.jbpm.services.api.query.model.QueryParam) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) LocalDateTimeValue(org.kie.server.api.model.taskassigning.LocalDateTimeValue) Date(java.util.Date)

Aggregations

LocalDateTime (java.time.LocalDateTime)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 List (java.util.List)1 QueryParam (org.jbpm.services.api.query.model.QueryParam)1 LocalDateTimeValue (org.kie.server.api.model.taskassigning.LocalDateTimeValue)1