
org.jobrunr.storage.Paging Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jobrunr Show documentation
Show all versions of jobrunr Show documentation
An easy way to perform background processing on the JVM. Backed by persistent storage. Open and free for commercial use.
package org.jobrunr.storage;
import org.jobrunr.storage.navigation.AmountRequest;
import org.jobrunr.storage.navigation.OffsetBasedPageRequest;
public class Paging {
private Paging() {
} // for sonarqube
public static class AmountBasedList {
public static AmountRequest ascOnUpdatedAt(int amount) {
return new AmountRequest(StorageProviderUtils.Jobs.FIELD_UPDATED_AT + ":ASC", amount);
}
public static AmountRequest descOnUpdatedAt(int amount) {
return new AmountRequest(StorageProviderUtils.Jobs.FIELD_UPDATED_AT + ":DESC", amount);
}
public static AmountRequest ascOnCreatedAt(int amount) {
return new AmountRequest(StorageProviderUtils.Jobs.FIELD_CREATED_AT + ":ASC", amount);
}
}
public static class OffsetBasedPage {
public static OffsetBasedPageRequest next(Page page) {
return OffsetBasedPageRequest.fromString(page.getNextPage());
}
public static OffsetBasedPageRequest previous(Page page) {
return OffsetBasedPageRequest.fromString(page.getPreviousPage());
}
public static OffsetBasedPageRequest ascOnUpdatedAt(int amount) {
return ascOnUpdatedAt(0, amount);
}
public static OffsetBasedPageRequest ascOnUpdatedAt(int offset, int amount) {
return new OffsetBasedPageRequest(StorageProviderUtils.Jobs.FIELD_UPDATED_AT + ":ASC", offset, amount);
}
public static OffsetBasedPageRequest descOnUpdatedAt(int amount) {
return descOnUpdatedAt(0, amount);
}
public static OffsetBasedPageRequest descOnUpdatedAt(int offset, int amount) {
return new OffsetBasedPageRequest(StorageProviderUtils.Jobs.FIELD_UPDATED_AT + ":DESC", offset, amount);
}
public static OffsetBasedPageRequest ascOnScheduledAt(int amount) {
return ascOnScheduledAt(0, amount);
}
public static OffsetBasedPageRequest ascOnScheduledAt(int offset, int amount) {
return new OffsetBasedPageRequest(StorageProviderUtils.Jobs.FIELD_SCHEDULED_AT + ":ASC", offset, amount);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy