forked from keycloak/keycloak
-
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.
Merge pull request keycloak#4574 from patriot1burke/master
KEYCLOAK-5701
- Loading branch information
Showing
5 changed files
with
54 additions
and
22 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
36 changes: 36 additions & 0 deletions
36
...inispan/src/main/java/org/keycloak/models/cache/infinispan/stream/GroupListPredicate.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,36 @@ | ||
package org.keycloak.models.cache.infinispan.stream; | ||
|
||
import org.keycloak.models.cache.infinispan.entities.GroupListQuery; | ||
import org.keycloak.models.cache.infinispan.entities.Revisioned; | ||
|
||
import java.io.Serializable; | ||
import java.util.Map; | ||
import java.util.function.Predicate; | ||
|
||
/** | ||
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a> | ||
* @version $Revision: 1 $ | ||
*/ | ||
public class GroupListPredicate implements Predicate<Map.Entry<String, Revisioned>>, Serializable { | ||
private String realm; | ||
|
||
public static GroupListPredicate create() { | ||
return new GroupListPredicate(); | ||
} | ||
|
||
public GroupListPredicate realm(String realm) { | ||
this.realm = realm; | ||
return this; | ||
} | ||
|
||
@Override | ||
public boolean test(Map.Entry<String, Revisioned> entry) { | ||
Object value = entry.getValue(); | ||
if (value == null) return false; | ||
if (value instanceof GroupListQuery) { | ||
GroupListQuery groupList = (GroupListQuery)value; | ||
if (groupList.getRealm().equals(realm)) return true; | ||
} | ||
return false; | ||
} | ||
} |
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