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;
}
Aggregations