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;
}
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);
}
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;
}
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);
}
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);
}
Aggregations