Search in sources :

Example 1 with LDAPRequestorEntry

use of org.gluu.asimba.util.ldap.sp.LDAPRequestorEntry in project oxTrust by GluuFederation.

the class AsimbaService method searchRequestors.

/**
    * Search by pattern
    * 
    * @param pattern Pattern
    * @param sizeLimit Maximum count of results
    * @return List of scopes
    * @throws Exception
    */
public List<RequestorEntry> searchRequestors(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
    List<LDAPRequestorEntry> entries = ldapEntryManager.findEntries(getDnForLDAPRequestorEntry(null), LDAPRequestorEntry.class, searchFilter, sizeLimit);
    // convert result
    List<RequestorEntry> ret = new ArrayList<RequestorEntry>();
    for (LDAPRequestorEntry entry : entries) {
        ret.add(entry.getEntry());
    }
    return ret;
}
Also used : Filter(com.unboundid.ldap.sdk.Filter) LDAPRequestorEntry(org.gluu.asimba.util.ldap.sp.LDAPRequestorEntry) LDAPRequestorEntry(org.gluu.asimba.util.ldap.sp.LDAPRequestorEntry) RequestorEntry(org.gluu.asimba.util.ldap.sp.RequestorEntry) ArrayList(java.util.ArrayList)

Example 2 with LDAPRequestorEntry

use of org.gluu.asimba.util.ldap.sp.LDAPRequestorEntry in project oxTrust by GluuFederation.

the class AsimbaService method addRequestorEntry.

/**
    * Add new LDAPRequestorEntry.
    * 
    * @param entry LDAPRequestorEntry
    */
public void addRequestorEntry(RequestorEntry entry) {
    entry.setLastModified(new Date());
    LDAPRequestorEntry ldapEntry = new LDAPRequestorEntry();
    ldapEntry.setEntry(entry);
    String inum = generateInum();
    ldapEntry.setInum(inum);
    ldapEntry.setDn(getDnForLDAPRequestorEntry(inum));
    ldapEntryManager.persist(ldapEntry);
}
Also used : LDAPRequestorEntry(org.gluu.asimba.util.ldap.sp.LDAPRequestorEntry) Date(java.util.Date)

Example 3 with LDAPRequestorEntry

use of org.gluu.asimba.util.ldap.sp.LDAPRequestorEntry in project oxTrust by GluuFederation.

the class AsimbaService method loadRequestors.

public List<RequestorEntry> loadRequestors() {
    List<LDAPRequestorEntry> entries = ldapEntryManager.findEntries(getDnForLDAPRequestorEntry(null), LDAPRequestorEntry.class, null);
    List<RequestorEntry> result = new ArrayList<RequestorEntry>();
    for (LDAPRequestorEntry entry : entries) {
        result.add(entry.getEntry());
    }
    return result;
}
Also used : LDAPRequestorEntry(org.gluu.asimba.util.ldap.sp.LDAPRequestorEntry) LDAPRequestorEntry(org.gluu.asimba.util.ldap.sp.LDAPRequestorEntry) RequestorEntry(org.gluu.asimba.util.ldap.sp.RequestorEntry) ArrayList(java.util.ArrayList)

Example 4 with LDAPRequestorEntry

use of org.gluu.asimba.util.ldap.sp.LDAPRequestorEntry in project oxTrust by GluuFederation.

the class AsimbaService method removeRequestorEntry.

/**
    * Remove LDAPRequestorEntry.
    * 
    * @param entry LDAPRequestorEntry
    */
public void removeRequestorEntry(RequestorEntry entry) {
    LDAPRequestorEntry ldapEntry = ldapEntryManager.find(LDAPRequestorEntry.class, getDnForLDAPRequestorEntry(entry.getInum()));
    ldapEntry.setEntry(entry);
    ldapEntryManager.remove(ldapEntry);
}
Also used : LDAPRequestorEntry(org.gluu.asimba.util.ldap.sp.LDAPRequestorEntry)

Example 5 with LDAPRequestorEntry

use of org.gluu.asimba.util.ldap.sp.LDAPRequestorEntry in project oxTrust by GluuFederation.

the class AsimbaService method updateRequestorEntry.

/**
    * Update LDAPRequestorEntry.
    * 
    * @param entry LDAPRequestorEntry
    */
public void updateRequestorEntry(RequestorEntry entry) {
    entry.setLastModified(new Date());
    LDAPRequestorEntry ldapEntry = ldapEntryManager.find(LDAPRequestorEntry.class, getDnForLDAPRequestorEntry(entry.getInum()));
    ldapEntry.setEntry(entry);
    ldapEntryManager.merge(ldapEntry);
}
Also used : LDAPRequestorEntry(org.gluu.asimba.util.ldap.sp.LDAPRequestorEntry) Date(java.util.Date)

Aggregations

LDAPRequestorEntry (org.gluu.asimba.util.ldap.sp.LDAPRequestorEntry)5 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 RequestorEntry (org.gluu.asimba.util.ldap.sp.RequestorEntry)2 Filter (com.unboundid.ldap.sdk.Filter)1