Search in sources :

Example 66 with Filter

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;
}
Also used : Filter(org.gluu.search.filter.Filter) ArrayList(java.util.ArrayList) LdapIDPEntry(org.gluu.asimba.util.ldap.idp.LdapIDPEntry) LdapIDPEntry(org.gluu.asimba.util.ldap.idp.LdapIDPEntry) IDPEntry(org.gluu.asimba.util.ldap.idp.IDPEntry)

Example 67 with Filter

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;
}
Also used : Filter(org.gluu.search.filter.Filter) LDAPApplicationSelectorEntry(org.gluu.asimba.util.ldap.selector.LDAPApplicationSelectorEntry) ApplicationSelectorEntry(org.gluu.asimba.util.ldap.selector.ApplicationSelectorEntry) ArrayList(java.util.ArrayList) LDAPApplicationSelectorEntry(org.gluu.asimba.util.ldap.selector.LDAPApplicationSelectorEntry)

Example 68 with Filter

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;
}
Also used : Filter(org.gluu.search.filter.Filter) GluuAttribute(org.xdi.model.GluuAttribute)

Example 69 with Filter

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;
}
Also used : Filter(org.gluu.search.filter.Filter) ArrayList(java.util.ArrayList) GluuAttribute(org.xdi.model.GluuAttribute)

Example 70 with Filter

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;
}
Also used : Filter(org.gluu.search.filter.Filter) OxAuthClient(org.gluu.oxtrust.model.OxAuthClient)

Aggregations

Filter (org.gluu.search.filter.Filter)122 ArrayList (java.util.ArrayList)34 GluuCustomPerson (org.gluu.oxtrust.model.GluuCustomPerson)9 EntryPersistenceException (org.gluu.persist.exception.mapping.EntryPersistenceException)7 MappingException (org.gluu.persist.exception.mapping.MappingException)7 EntryPersistenceException (org.gluu.persist.exception.EntryPersistenceException)6 SearchException (org.gluu.persist.exception.operation.SearchException)6 List (java.util.List)5 GluuAttribute (org.gluu.model.GluuAttribute)5 PropertyAnnotation (org.gluu.persist.model.PropertyAnnotation)5 SearchResult (com.unboundid.ldap.sdk.SearchResult)4 ParseException (java.text.ParseException)4 GluuGroup (org.gluu.oxtrust.model.GluuGroup)4 PersistenceEntryManager (org.gluu.persist.PersistenceEntryManager)4 AuthenticationException (org.gluu.persist.exception.operation.AuthenticationException)4 ConnectionException (org.gluu.persist.exception.operation.ConnectionException)4 SearchScopeException (org.gluu.persist.exception.operation.SearchScopeException)4 GluuAttribute (org.xdi.model.GluuAttribute)4 SearchResultEntry (com.unboundid.ldap.sdk.SearchResultEntry)3 Date (java.util.Date)3