Skip to content

Commit

Permalink
filtering attributes by realm (#55)
Browse files Browse the repository at this point in the history
Signed-off-by: Garth <[email protected]>
  • Loading branch information
xgp authored Apr 17, 2024
1 parent 9bd4c85 commit 76852a7
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,15 @@ public static List<String> loadConfigurations(
EntityManager em = session.getProvider(JpaConnectionProvider.class).getEntityManager();
TypedQuery<RealmAttributeEntity> query =
em.createQuery(
"SELECT ra FROM RealmAttributeEntity ra WHERE ra.name LIKE :name ORDER BY ra.name",
"SELECT ra FROM RealmAttributeEntity ra WHERE ra.realm.name = :realm AND ra.name LIKE :name ORDER BY ra.name",
RealmAttributeEntity.class);
query.setParameter("name", "" + getKey(providerId) + "%");
return query.getResultStream().map(RealmAttributeEntity::getValue).collect(Collectors.toList());
query.setParameter("realm", realm);
return query
.getResultStream()
.filter(e -> realm.equals(e.getRealm().getName()))
.map(RealmAttributeEntity::getValue)
.collect(Collectors.toList());
}

private static String getKey(String providerId) {
Expand Down

0 comments on commit 76852a7

Please sign in to comment.