use of org.gluu.search.filter.Filter in project oxTrust by GluuFederation.
the class AsimbaService method searchIDPs.
/**
* Search by pattern
*
* @param pattern Pattern
* @param sizeLimit Maximum count of results
* @return List of scopes
* @throws Exception
*/
public List<IDPEntry> searchIDPs(String pattern, int sizeLimit) throws Exception {
// filter
String[] targetArray = new String[] { pattern };
Filter idFilter = Filter.createSubstringFilter(OxTrustConstants.uniqueIdentifier, null, targetArray, null);
Filter friendlyNameFilter = Filter.createSubstringFilter(OxTrustConstants.friendlyName, null, targetArray, null);
Filter descriptionFilter = Filter.createSubstringFilter(OxTrustConstants.description, null, targetArray, null);
Filter inameFilter = Filter.createSubstringFilter(OxTrustConstants.iname, null, targetArray, null);
Filter searchFilter = Filter.createORFilter(idFilter, friendlyNameFilter, descriptionFilter, inameFilter);
// search
final List<LdapIDPEntry> entries = ldapEntryManager.findEntries(getDnForLdapIDPEntry(null), LdapIDPEntry.class, searchFilter, sizeLimit);
// convert result
List<IDPEntry> ret = new ArrayList<IDPEntry>();
for (LdapIDPEntry entry : entries) {
ret.add(entry.getEntry());
}
return ret;
}
use of org.gluu.search.filter.Filter in project oxTrust by GluuFederation.
the class AsimbaService method searchSelectors.
/**
* Search by pattern
*
* @param pattern Pattern
* @param sizeLimit Maximum count of results
* @return List of scopes
* @throws Exception
*/
public List<ApplicationSelectorEntry> searchSelectors(String pattern, int sizeLimit) throws Exception {
// filter
String[] targetArray = new String[] { pattern };
Filter idFilter = Filter.createSubstringFilter(OxTrustConstants.uniqueIdentifier, null, targetArray, null);
Filter friendlyNameFilter = Filter.createSubstringFilter(OxTrustConstants.friendlyName, null, targetArray, null);
Filter descriptionFilter = Filter.createSubstringFilter(OxTrustConstants.description, null, targetArray, null);
Filter inameFilter = Filter.createSubstringFilter(OxTrustConstants.iname, null, targetArray, null);
Filter organizationIdFilter = Filter.createSubstringFilter(OxTrustConstants.organizationId, null, targetArray, null);
Filter searchFilter = Filter.createORFilter(idFilter, friendlyNameFilter, descriptionFilter, inameFilter, organizationIdFilter);
// search
List<LDAPApplicationSelectorEntry> entries = ldapEntryManager.findEntries(getDnForLDAPApplicationSelectorEntry(null), LDAPApplicationSelectorEntry.class, searchFilter, sizeLimit);
// convert result
List<ApplicationSelectorEntry> ret = new ArrayList<ApplicationSelectorEntry>();
for (LDAPApplicationSelectorEntry entry : entries) {
ret.add(entry.getEntry());
}
return ret;
}
use of org.gluu.search.filter.Filter in project oxTrust by GluuFederation.
the class AttributeService method searchAttributes.
/**
* Search groups by pattern
*
* @param pattern
* Pattern
* @param sizeLimit
* Maximum count of results
* @return List of groups
* @throws Exception
*/
public List<GluuAttribute> searchAttributes(String pattern, int sizeLimit) throws Exception {
String[] targetArray = new String[] { pattern };
Filter displayNameFilter = Filter.createSubstringFilter(OxTrustConstants.displayName, null, targetArray, null);
Filter descriptionFilter = Filter.createSubstringFilter(OxTrustConstants.description, null, targetArray, null);
Filter nameFilter = Filter.createSubstringFilter(OxTrustConstants.attributeName, null, targetArray, null);
Filter inameFilter = Filter.createSubstringFilter(OxTrustConstants.iname, null, targetArray, null);
Filter searchFilter = Filter.createORFilter(displayNameFilter, descriptionFilter, inameFilter, nameFilter);
List<GluuAttribute> result = ldapEntryManager.findEntries(getDnForAttribute(null), GluuAttribute.class, searchFilter, sizeLimit);
String customOrigin = getCustomOrigin();
for (GluuAttribute attribute : result) {
attribute.setCustom(customOrigin.equals(attribute.getOrigin()));
}
return result;
}
use of org.gluu.search.filter.Filter in project oxTrust by GluuFederation.
the class AttributeService method searchPersonAttributes.
public List<GluuAttribute> searchPersonAttributes(String pattern, int sizeLimit) throws Exception {
String[] objectClassTypes = appConfiguration.getPersonObjectClassTypes();
String[] targetArray = new String[] { pattern };
List<Filter> originFilters = new ArrayList<Filter>();
Filter displayNameFilter = Filter.createSubstringFilter(OxTrustConstants.displayName, null, targetArray, null);
Filter descriptionFilter = Filter.createSubstringFilter(OxTrustConstants.description, null, targetArray, null);
Filter inameFilter = Filter.createSubstringFilter(OxTrustConstants.iname, null, targetArray, null);
for (String objectClassType : objectClassTypes) {
Filter originFilter = Filter.createEqualityFilter(OxTrustConstants.origin, objectClassType);
originFilters.add(originFilter);
}
Filter searchFilter = Filter.createORFilter(displayNameFilter, descriptionFilter, inameFilter);
Filter originFilter = Filter.createORFilter(originFilters.toArray(new Filter[0]));
Filter filter = Filter.createANDFilter(searchFilter, originFilter);
List<GluuAttribute> result = ldapEntryManager.findEntries(getDnForAttribute(null), GluuAttribute.class, filter, sizeLimit);
return result;
}
use of org.gluu.search.filter.Filter in project oxTrust by GluuFederation.
the class ClientService method searchClients.
/**
* Search clients by pattern
*
* @param pattern Pattern
* @param sizeLimit Maximum count of results
* @return List of clients
*/
public List<OxAuthClient> searchClients(String pattern, int sizeLimit) {
String[] targetArray = new String[] { pattern };
Filter displayNameFilter = Filter.createSubstringFilter(OxTrustConstants.displayName, null, targetArray, null);
Filter descriptionFilter = Filter.createSubstringFilter(OxTrustConstants.description, null, targetArray, null);
Filter inameFilter = Filter.createSubstringFilter(OxTrustConstants.iname, null, targetArray, null);
Filter inumFilter = Filter.createSubstringFilter(OxTrustConstants.inum, null, targetArray, null);
Filter searchFilter = Filter.createORFilter(displayNameFilter, descriptionFilter, inameFilter, inumFilter);
List<OxAuthClient> result = ldapEntryManager.findEntries(getDnForClient(null), OxAuthClient.class, searchFilter, sizeLimit);
return result;
}
Aggregations