-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
512 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
up-core/src/main/java/com/github/restup/query/BasicPagination.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package com.github.restup.query; | ||
|
||
/** | ||
* Represents Pagination for default settings and requests | ||
* | ||
* @author abuttaro | ||
*/ | ||
class BasicPagination implements Pagination { | ||
|
||
// pagination | ||
private final Integer limit; | ||
private final Integer offset; | ||
private final boolean pagingDisabled; | ||
private final boolean withTotalsDisabled; | ||
|
||
/** | ||
* Paging enabled with provided limit, offset, totalsEnabled | ||
* @param limit | ||
* @param offset | ||
* @param withTotalsDisabled | ||
*/ | ||
BasicPagination(Integer limit, Integer offset, boolean withTotalsDisabled) { | ||
super(); | ||
this.limit = limit; | ||
this.offset = offset; | ||
this.withTotalsDisabled = withTotalsDisabled; | ||
this.pagingDisabled = false; | ||
} | ||
|
||
/** | ||
* Paging & totals disabled & null limit & offset | ||
*/ | ||
BasicPagination() { | ||
super(); | ||
this.limit = null; | ||
this.offset = null; | ||
this.pagingDisabled = true; | ||
this.withTotalsDisabled = true; | ||
} | ||
|
||
public Integer getLimit() { | ||
return limit; | ||
} | ||
|
||
public Integer getOffset() { | ||
return offset; | ||
} | ||
|
||
public boolean isPagingDisabled() { | ||
return pagingDisabled; | ||
} | ||
|
||
public boolean isWithTotalsDisabled() { | ||
return withTotalsDisabled; | ||
} | ||
|
||
} |
52 changes: 52 additions & 0 deletions
52
up-core/src/main/java/com/github/restup/query/BasicResourceSort.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package com.github.restup.query; | ||
|
||
import java.util.Objects; | ||
import com.github.restup.path.ResourcePath; | ||
import com.github.restup.registry.Resource; | ||
import com.github.restup.util.Assert; | ||
|
||
/** | ||
* Specifies sort behavior for a resource query | ||
*/ | ||
class BasicResourceSort implements ResourceSort { | ||
|
||
private final ResourcePath path; | ||
private final Boolean ascending; | ||
|
||
BasicResourceSort(ResourcePath path, Boolean ascending) { | ||
super(); | ||
Assert.notNull(path, "path cannot be null"); | ||
this.path = path; | ||
this.ascending = ascending; | ||
} | ||
|
||
BasicResourceSort(ResourcePath path) { | ||
this(path, true); | ||
} | ||
|
||
BasicResourceSort(Resource<?, ?> resource, String beanPath) { | ||
this(ResourcePath.path(resource, beanPath)); | ||
} | ||
|
||
/** | ||
* @return true if ascending is true or null, false otherwise | ||
*/ | ||
public boolean isAscending() { | ||
return !Objects.equals(Boolean.FALSE, ascending); | ||
} | ||
|
||
/** | ||
* true if ascending, false if descending, null if unspecified | ||
*/ | ||
public Boolean getAscending() { | ||
return ascending; | ||
} | ||
|
||
/** | ||
* @return path to be sorted | ||
*/ | ||
public ResourcePath getPath() { | ||
return path; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.