Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
KEYCLOAK-18061 On Linked account, paged listing of IdPs
- Loading branch information
Showing
4 changed files
with
361 additions
and
67 deletions.
There are no files selected for viewing
71 changes: 71 additions & 0 deletions
71
services/src/main/java/org/keycloak/services/PagedResults.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,71 @@ | ||
package org.keycloak.services; | ||
|
||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize; | ||
|
||
import java.util.Collection; | ||
|
||
@JsonDeserialize(builder = PagedResults.Builder.class) | ||
public class PagedResults<T> { | ||
|
||
private int pageNum; | ||
private int pageSize; | ||
private Long totalHits; | ||
private Collection<T> results; | ||
|
||
private PagedResults(){} | ||
|
||
public int getPageNum() { | ||
return pageNum; | ||
} | ||
|
||
public int getPageSize() { | ||
return pageSize; | ||
} | ||
|
||
public Long getTotalHits() { | ||
return totalHits; | ||
} | ||
|
||
public Collection<T> getResults() { | ||
return results; | ||
} | ||
|
||
public static class Builder<T> { | ||
|
||
private int pageNum; | ||
private int pageSize; | ||
private Long totalHits; | ||
private Collection<T> results; | ||
|
||
|
||
public Builder withResults(Collection<T> results){ | ||
this.results = results; | ||
return this; | ||
} | ||
|
||
public Builder withTotalHits(long totalHits){ | ||
this.totalHits = totalHits; | ||
return this; | ||
} | ||
|
||
public Builder withPageNum(int pageNum){ | ||
this.pageNum = pageNum; | ||
return this; | ||
} | ||
|
||
public Builder withPageSize(int pageSize){ | ||
this.pageSize = pageSize; | ||
return this; | ||
} | ||
|
||
public PagedResults<T> build(){ | ||
PagedResults<T> resultsPage = new PagedResults<T>(); | ||
resultsPage.results = this.results; | ||
resultsPage.totalHits = this.totalHits; | ||
resultsPage.pageNum = this.pageNum; | ||
resultsPage.pageSize = this.pageSize; | ||
return resultsPage; | ||
} | ||
} | ||
|
||
} |
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.