@PreAuthorize("hasRole('" + StandardEntitlement.GROUP_SEARCH + "')") @Transactional(readOnly = true) @Override public Pair<Integer, List<GroupTO>> search( final SearchCond searchCond, final int page, final int size, final List<OrderByClause> orderBy, final String realm, final boolean details) { int count = searchDAO.count( RealmUtils.getEffective(SyncopeConstants.FULL_ADMIN_REALMS, realm), searchCond == null ? groupDAO.getAllMatchingCond() : searchCond, AnyTypeKind.GROUP); List<Group> matching = searchDAO.search( RealmUtils.getEffective(SyncopeConstants.FULL_ADMIN_REALMS, realm), searchCond == null ? groupDAO.getAllMatchingCond() : searchCond, page, size, orderBy, AnyTypeKind.GROUP); List<GroupTO> result = matching.stream(). map(group -> binder.getGroupTO(group, details)).collect(Collectors.toList()); return Pair.of(count, result); }
@Transactional(readOnly = true) @Override public Pair<Integer, List<AnyObjectTO>> search( final SearchCond searchCond, final int page, final int size, final List<OrderByClause> orderBy, final String realm, final boolean details) { if (searchCond.hasAnyTypeCond() == null) { throw new UnsupportedOperationException("Need to specify " + AnyType.class.getSimpleName()); } Set<String> effectiveRealms = RealmUtils.getEffective( AuthContextUtils.getAuthorizations().get(AnyEntitlement.SEARCH.getFor(searchCond.hasAnyTypeCond())), realm); int count = searchDAO.count(effectiveRealms, searchCond, AnyTypeKind.ANY_OBJECT); List<AnyObject> matching = searchDAO.search( effectiveRealms, searchCond, page, size, orderBy, AnyTypeKind.ANY_OBJECT); List<AnyObjectTO> result = matching.stream(). map(anyObject -> binder.getAnyObjectTO(anyObject, details)).collect(Collectors.toList()); return Pair.of(count, result); }
private int count() { return StringUtils.isBlank(conf.getMatchingCond()) ? userDAO.count() : searchDAO.count(SyncopeConstants.FULL_ADMIN_REALMS, SearchCondConverter.convert(conf.getMatchingCond()), AnyTypeKind.USER); }
private int count() { return StringUtils.isBlank(conf.getMatchingCond()) ? groupDAO.count() : searchDAO.count(SyncopeConstants.FULL_ADMIN_REALMS, SearchCondConverter.convert(conf.getMatchingCond()), AnyTypeKind.GROUP); }
@PreAuthorize("hasRole('" + StandardEntitlement.USER_SEARCH + "')") @Transactional(readOnly = true) @Override public Pair<Integer, List<UserTO>> search( final SearchCond searchCond, final int page, final int size, final List<OrderByClause> orderBy, final String realm, final boolean details) { int count = searchDAO.count(RealmUtils.getEffective( AuthContextUtils.getAuthorizations().get(StandardEntitlement.USER_SEARCH), realm), searchCond == null ? userDAO.getAllMatchingCond() : searchCond, AnyTypeKind.USER); List<User> matching = searchDAO.search(RealmUtils.getEffective( AuthContextUtils.getAuthorizations().get(StandardEntitlement.USER_SEARCH), realm), searchCond == null ? userDAO.getAllMatchingCond() : searchCond, page, size, orderBy, AnyTypeKind.USER); List<UserTO> result = matching.stream(). map(user -> binder.returnUserTO(binder.getUserTO(user, details))). collect(Collectors.toList()); return Pair.of(count, result); }
int count = searchDAO.count(SyncopeConstants.FULL_ADMIN_REALMS, searchCond, AnyTypeKind.GROUP);
SearchCond cond = SearchCondConverter.convert(this.conf.getUserMatchingCond()); int total = searchDAO.count(SyncopeConstants.FULL_ADMIN_REALMS, cond, AnyTypeKind.USER); int pages = (total / AnyDAO.DEFAULT_PAGE_SIZE) + 1; SearchCond cond = SearchCondConverter.convert(this.conf.getUserMatchingCond()); int total = searchDAO.count(SyncopeConstants.FULL_ADMIN_REALMS, cond, AnyTypeKind.GROUP); int pages = (total / AnyDAO.DEFAULT_PAGE_SIZE) + 1; SearchCondConverter.convert(this.conf.getAnyObjectMatchingCond())); int total = searchDAO.count(SyncopeConstants.FULL_ADMIN_REALMS, cond, AnyTypeKind.ANY_OBJECT); int pages = (total / AnyDAO.DEFAULT_PAGE_SIZE) + 1;
keyCond.setSchema("key"); SearchCond allMatchingCond = SearchCond.getLeafCond(keyCond); int users = searchDAO.count(adminRealms, allMatchingCond, AnyTypeKind.USER); int groups = searchDAO.count(adminRealms, allMatchingCond, AnyTypeKind.GROUP); int anyObjects = searchDAO.count(adminRealms, allMatchingCond, AnyTypeKind.ANY_OBJECT);
if (merged.getUDynMembership() != null) { SearchCond cond = buildDynMembershipCond(merged.getUDynMembership().getFIQLCond(), merged.getRealm()); int count = searchDAO.count( Collections.<String>singleton(merged.getRealm().getFullPath()), cond, AnyTypeKind.USER); for (int page = 1; page <= (count / AnyDAO.DEFAULT_PAGE_SIZE) + 1; page++) { merged.getADynMemberships().forEach(memb -> { SearchCond cond = buildDynMembershipCond(memb.getFIQLCond(), merged.getRealm()); int count = searchDAO.count( Collections.<String>singleton(merged.getRealm().getFullPath()), cond, AnyTypeKind.ANY_OBJECT); for (int page = 1; page <= (count / AnyDAO.DEFAULT_PAGE_SIZE) + 1; page++) {
keyCond.setSchema("key"); SearchCond allMatchingCond = SearchCond.getLeafCond(keyCond); int users = searchDAO.count(adminRealms, allMatchingCond, AnyTypeKind.USER); int groups = searchDAO.count(adminRealms, allMatchingCond, AnyTypeKind.GROUP); int anyObjects = searchDAO.count(adminRealms, allMatchingCond, AnyTypeKind.ANY_OBJECT);
? anyDAO.getAllMatchingCond() : SearchCondConverter.convert(filter); int count = searchDAO.count( Collections.singleton(profile.getTask().getSourceRealm().getFullPath()), cond,