use of org.gluu.asimba.util.ldap.idp.LdapIDPEntry in project oxTrust by GluuFederation.
the class AsimbaService method loadIDPs.
public List<IDPEntry> loadIDPs() {
List<LdapIDPEntry> entries = ldapEntryManager.findEntries(getDnForLdapIDPEntry(null), LdapIDPEntry.class, null);
List<IDPEntry> result = new ArrayList<IDPEntry>();
for (LdapIDPEntry entry : entries) {
result.add(entry.getEntry());
}
return result;
}
use of org.gluu.asimba.util.ldap.idp.LdapIDPEntry in project oxTrust by GluuFederation.
the class AsimbaService method updateIDPEntry.
/**
* Update IDPEntry.
*
* @param entry IDPEntry
*/
public void updateIDPEntry(IDPEntry entry) {
entry.setLastModified(new Date());
LdapIDPEntry ldapEntry = ldapEntryManager.find(LdapIDPEntry.class, getDnForLdapIDPEntry(entry.getInum()));
ldapEntry.setEntry(entry);
ldapEntryManager.merge(ldapEntry);
}
use of org.gluu.asimba.util.ldap.idp.LdapIDPEntry in project oxTrust by GluuFederation.
the class AsimbaService method removeIDPEntry.
/**
* Remove IDPEntry.
*
* @param entry IDPEntry
*/
public void removeIDPEntry(IDPEntry entry) {
LdapIDPEntry ldapEntry = ldapEntryManager.find(LdapIDPEntry.class, getDnForLdapIDPEntry(entry.getInum()));
ldapEntry.setEntry(entry);
ldapEntryManager.remove(ldapEntry);
}
use of org.gluu.asimba.util.ldap.idp.LdapIDPEntry in project oxTrust by GluuFederation.
the class AsimbaService method addIDPEntry.
/**
* Add new IDPEntry.
*
* @param entry IDPEntry
*/
public void addIDPEntry(IDPEntry entry) {
log.info("addIDPEntry() call");
try {
entry.setLastModified(new Date());
LdapIDPEntry ldapEntry = new LdapIDPEntry();
ldapEntry.setEntry(entry);
String inum = generateInum();
ldapEntry.setInum(inum);
log.info("getDnForLdapIDPEntry(inum) retsult: " + getDnForLdapIDPEntry(inum));
ldapEntry.setDn(getDnForLdapIDPEntry(inum));
ldapEntryManager.persist(ldapEntry);
} catch (Exception e) {
log.error("addIDPEntry() exception", e);
}
}
use of org.gluu.asimba.util.ldap.idp.LdapIDPEntry 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;
}
Aggregations