use of com.enonic.xp.query.filter.RangeFilter in project xp by enonic.
the class CleanUpAuditLogCommand method createQuery.
private NodeQuery createQuery() {
final NodeQuery.Builder builder = NodeQuery.create().addQueryFilter(ValueFilter.create().fieldName(NodeIndexPath.NODE_TYPE.toString()).addValue(ValueFactory.newString(AuditLogConstants.NODE_TYPE.toString())).build());
final RangeFilter timeToFilter = RangeFilter.create().fieldName(AuditLogConstants.TIME.toString()).to(ValueFactory.newDateTime(until)).build();
builder.addQueryFilter(timeToFilter);
builder.addOrderBy(FieldOrderExpr.create(AuditLogConstants.TIME, OrderExpr.Direction.ASC)).size(BATCH_SIZE);
return builder.build();
}
use of com.enonic.xp.query.filter.RangeFilter in project xp by enonic.
the class VersionTableVacuumCommand method createQuery.
private NodeVersionQuery createQuery(NodeVersionId lastVersionId) {
final NodeVersionQuery.Builder builder = NodeVersionQuery.create();
if (lastVersionId != null) {
final RangeFilter versionIdFilter = RangeFilter.create().fieldName(VersionIndexPath.VERSION_ID.getPath()).gt(ValueFactory.newString(lastVersionId.toString())).build();
builder.addQueryFilter(versionIdFilter);
}
final RangeFilter mustBeOlderThanFilter = RangeFilter.create().fieldName(VersionIndexPath.TIMESTAMP.getPath()).to(ValueFactory.newDateTime(until)).build();
return builder.addQueryFilter(mustBeOlderThanFilter).addOrderBy(FieldOrderExpr.create(VersionIndexPath.VERSION_ID, OrderExpr.Direction.ASC)).size(batchSize).build();
}
Aggregations