Search in sources :

Example 1 with LDAPRequestorPoolEntry

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

the class AsimbaService method addRequestorPoolEntry.

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

Example 2 with LDAPRequestorPoolEntry

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

the class AsimbaService method updateRequestorPoolEntry.

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

Example 3 with LDAPRequestorPoolEntry

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

the class AsimbaService method searchRequestorPools.

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

Example 4 with LDAPRequestorPoolEntry

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

the class AsimbaService method loadRequestorPools.

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

Example 5 with LDAPRequestorPoolEntry

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

the class AsimbaService method removeRequestorPoolEntry.

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

Aggregations

LDAPRequestorPoolEntry (org.gluu.asimba.util.ldap.sp.LDAPRequestorPoolEntry)5 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 RequestorPoolEntry (org.gluu.asimba.util.ldap.sp.RequestorPoolEntry)2 Filter (org.gluu.search.filter.Filter)1