-
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.
use PagingOptions argument instead of separate arguments
- Loading branch information
blevine
committed
Oct 10, 2024
1 parent
366f0a7
commit f517ef7
Showing
18 changed files
with
292 additions
and
107 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
44 changes: 44 additions & 0 deletions
44
graphql/src/main/java/net/brianlevine/keycloak/graphql/types/ClientPolicyConditionType.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,44 @@ | ||
package net.brianlevine.keycloak.graphql.types; | ||
|
||
import com.fasterxml.jackson.databind.JsonNode; | ||
import io.leangen.graphql.annotations.types.GraphQLType; | ||
import org.keycloak.representations.idm.ClientPolicyConditionRepresentation; | ||
|
||
import java.util.Objects; | ||
|
||
@GraphQLType | ||
@SuppressWarnings("unused") | ||
public class ClientPolicyConditionType { | ||
private final ClientPolicyConditionRepresentation delegate; | ||
|
||
public ClientPolicyConditionType(ClientPolicyConditionRepresentation clientPolicyConditionRepresentation) { | ||
this.delegate = clientPolicyConditionRepresentation; | ||
} | ||
|
||
public String getConditionProviderId() { | ||
return delegate.getConditionProviderId(); | ||
} | ||
|
||
public void setConditionProviderId(String conditionProviderId) { | ||
delegate.setConditionProviderId(conditionProviderId); | ||
} | ||
|
||
public JsonNode getConfiguration() { | ||
return delegate.getConfiguration(); | ||
} | ||
|
||
public void setConfiguration(JsonNode configuration) { | ||
delegate.setConfiguration(configuration); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (delegate.getClass() != o.getClass()) return false; | ||
return delegate.equals(o); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return delegate.hashCode(); | ||
} | ||
} |
79 changes: 79 additions & 0 deletions
79
graphql/src/main/java/net/brianlevine/keycloak/graphql/types/ClientPolicyType.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,79 @@ | ||
package net.brianlevine.keycloak.graphql.types; | ||
|
||
import io.leangen.graphql.annotations.GraphQLArgument; | ||
import io.leangen.graphql.annotations.GraphQLQuery; | ||
import io.leangen.graphql.annotations.types.GraphQLType; | ||
import net.brianlevine.keycloak.graphql.util.Page; | ||
import org.keycloak.representations.idm.ClientPolicyConditionRepresentation; | ||
import org.keycloak.representations.idm.ClientPolicyRepresentation; | ||
|
||
import java.util.List; | ||
|
||
@GraphQLType | ||
@SuppressWarnings("unused") | ||
public class ClientPolicyType { | ||
private final ClientPolicyRepresentation delegate; | ||
|
||
public ClientPolicyType(ClientPolicyRepresentation clientPolicyRepresentation) { | ||
this.delegate = clientPolicyRepresentation; | ||
} | ||
|
||
public String getName() { | ||
return delegate.getName(); | ||
} | ||
|
||
public void setName(String name) { | ||
delegate.setName(name); | ||
} | ||
|
||
public String getDescription() { | ||
return delegate.getDescription(); | ||
} | ||
|
||
public void setDescription(String description) { | ||
delegate.setDescription(description); | ||
} | ||
|
||
public Boolean isEnabled() { | ||
return delegate.isEnabled(); | ||
} | ||
|
||
public void setEnabled(Boolean enabled) { | ||
delegate.setEnabled(enabled); | ||
} | ||
|
||
@GraphQLQuery | ||
public Page<ClientPolicyConditionType> getConditions(@GraphQLArgument PagingOptions options) { | ||
List<ClientPolicyConditionRepresentation> reps = delegate.getConditions(); | ||
List<ClientPolicyConditionType> conditions = reps.stream() | ||
.skip(options.start) | ||
.limit(options.limit) | ||
.map(ClientPolicyConditionType::new) | ||
.toList(); | ||
|
||
return new Page<>(reps.size(), options.limit, conditions); | ||
} | ||
|
||
public void setConditions(List<ClientPolicyConditionRepresentation> conditions) { | ||
delegate.setConditions(conditions); | ||
} | ||
|
||
public List<String> getProfiles() { | ||
return delegate.getProfiles(); | ||
} | ||
|
||
public void setProfiles(List<String> profiles) { | ||
delegate.setProfiles(profiles); | ||
} | ||
|
||
@SuppressWarnings("com.intellij.jpb.inspection.EqualsDoesntCheckParameterClassInspection") | ||
@Override | ||
public boolean equals(Object o) { | ||
return delegate.equals(o); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return delegate.hashCode(); | ||
} | ||
} |
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
Oops, something went wrong.