Search in sources :

Example 21 with Filter

use of org.gluu.search.filter.Filter in project oxCore by GluuFederation.

the class BaseEntryManager method contains.

protected boolean contains(String baseDN, List<AttributeData> attributes, String[] objectClasses, String... ldapReturnAttributes) {
    Filter[] attributesFilters = createAttributesFilter(attributes);
    Filter attributesFilter = null;
    if (attributesFilters != null) {
        attributesFilter = Filter.createANDFilter(attributesFilters);
    }
    return contains(baseDN, attributesFilter, objectClasses, ldapReturnAttributes);
}
Also used : Filter(org.gluu.search.filter.Filter)

Example 22 with Filter

use of org.gluu.search.filter.Filter in project oxCore by GluuFederation.

the class LookupService method getDisplayNameEntries.

/**
 * Returns list of DisplayNameEntry objects
 *
 * @param baseDn
 *            base DN
 * @param dns
 *            list of display names to find
 * @return list of DisplayNameEntry objects
 */
@SuppressWarnings("unchecked")
public List<DisplayNameEntry> getDisplayNameEntries(String baseDn, List<String> dns) {
    List<String> inums = getInumsFromDns(dns);
    if (inums.size() == 0) {
        return null;
    }
    String key = getCompoundKey(inums);
    List<DisplayNameEntry> entries = (List<DisplayNameEntry>) cacheService.get(OxConstants.CACHE_LOOKUP_NAME, key);
    if (entries == null) {
        Filter searchFilter = buildInumFilter(inums);
        entries = ldapEntryManager.findEntries(baseDn, DisplayNameEntry.class, searchFilter);
        cacheService.put(OxConstants.CACHE_LOOKUP_NAME, key, entries);
    }
    return entries;
}
Also used : Filter(org.gluu.search.filter.Filter) ArrayList(java.util.ArrayList) List(java.util.List) DisplayNameEntry(org.xdi.model.DisplayNameEntry)

Example 23 with Filter

use of org.gluu.search.filter.Filter in project oxCore by GluuFederation.

the class MetricService method getExpiredMetricEntries.

public List<MetricEntry> getExpiredMetricEntries(DefaultBatchOperation<MetricEntry> batchOperation, String baseDnForPeriod, Date expirationDate, int sizeLimit, int chunkSize) {
    Filter expiratioFilter = Filter.createLessOrEqualFilter("oxStartDate", ldapEntryManager.encodeGeneralizedTime(expirationDate));
    List<MetricEntry> metricEntries = ldapEntryManager.findEntries(baseDnForPeriod, MetricEntry.class, expiratioFilter, SearchScope.SUB, new String[] { "uniqueIdentifier" }, batchOperation, 0, sizeLimit, chunkSize);
    return metricEntries;
}
Also used : Filter(org.gluu.search.filter.Filter) MetricEntry(org.xdi.model.metric.ldap.MetricEntry)

Example 24 with Filter

use of org.gluu.search.filter.Filter in project oxCore by GluuFederation.

the class AttributeService method getAttributesByAttribute.

public List<GluuAttribute> getAttributesByAttribute(String attributeName, String attributeValue, String baseDn) {
    String[] targetArray = new String[] { attributeValue };
    Filter filter = Filter.createSubstringFilter(attributeName, null, targetArray, null);
    List<GluuAttribute> result = ldapEntryManager.findEntries(baseDn, GluuAttribute.class, filter);
    return result;
}
Also used : Filter(org.gluu.search.filter.Filter) GluuAttribute(org.xdi.model.GluuAttribute)

Example 25 with Filter

use of org.gluu.search.filter.Filter in project oxAuth by GluuFederation.

the class InumGenerator method contains.

public boolean contains(String inum, IdType type) {
    final String baseDn = baseDn(type);
    final Filter filter = Filter.createEqualityFilter("inum", inum);
    final List<DummyEntry> entries = ldapEntryManager.findEntries(baseDn, DummyEntry.class, filter);
    return entries != null && !entries.isEmpty();
}
Also used : DummyEntry(org.gluu.persist.model.base.DummyEntry) Filter(org.gluu.search.filter.Filter)

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