use of com.dailystudio.dataobject.query.Query in project devbricks by dailystudio.
the class TimeCapsuleQueryBuilder method getQuery.
public Query getQuery(long start, long end, boolean orderByAscending) {
Logger.debug("peroid: start(%s), end(%s), orderByAscending(%s)", CalendarUtils.timeToReadableString(start), CalendarUtils.timeToReadableString(end), orderByAscending);
Query query = getQuery();
if (query != null) {
if (start < end) {
ExpressionToken selection = TimeCapsule.COLUMN_TIME.gte(start).and(TimeCapsule.COLUMN_TIME.lte(end));
if (selection != null) {
query.setSelection(selection);
}
}
OrderingToken orderBy = (orderByAscending ? TimeCapsule.COLUMN_TIME.orderByAscending() : TimeCapsule.COLUMN_TIME.orderByDescending());
if (orderBy != null) {
query.setOrderBy(orderBy);
}
}
return query;
}
Aggregations