Search in sources :

Example 1 with DisplayNameEntry

use of org.gluu.model.DisplayNameEntry in project oxCore by GluuFederation.

the class LookupService method getDisplayNameEntriesByEntries.

public List<DisplayNameEntry> getDisplayNameEntriesByEntries(String baseDn, List<? extends Entry> entries) throws Exception {
    if (entries == null) {
        return null;
    }
    Class objectClass = DisplayNameEntry.class;
    List<String> dns = new ArrayList<String>(entries.size());
    for (Entry entry : entries) {
        dns.add(entry.getDn());
        objectClass = objectClass.getClass();
    }
    return getDisplayNameEntries(baseDn, objectClass, dns);
}
Also used : DisplayNameEntry(org.gluu.model.DisplayNameEntry) Entry(org.gluu.persist.model.base.Entry) ArrayList(java.util.ArrayList) DisplayNameEntry(org.gluu.model.DisplayNameEntry)

Example 2 with DisplayNameEntry

use of org.gluu.model.DisplayNameEntry in project oxCore by GluuFederation.

the class LookupService method getDisplayNameEntry.

/**
 * Returns DisplayNameEntry based on display name
 *
 * @param dn
 *            display name
 * @return DisplayNameEntry object
 */
public DisplayNameEntry getDisplayNameEntry(String dn, String objectClass) throws Exception {
    String key = "l_" + objectClass + "_" + dn;
    DisplayNameEntry entry = (DisplayNameEntry) cacheService.get(OxConstants.CACHE_LOOKUP_NAME, key);
    if (entry == null) {
        // Prepare sample for search
        DisplayNameEntry sample = new DisplayNameEntry();
        sample.setBaseDn(dn);
        sample.setCustomObjectClasses(new String[] { objectClass });
        List<DisplayNameEntry> entries = persistenceEntryManager.findEntries(sample, 1);
        if (entries.size() == 1) {
            entry = entries.get(0);
        }
        cacheService.put(OxConstants.CACHE_LOOKUP_NAME, key, entry);
    }
    return entry;
}
Also used : DisplayNameEntry(org.gluu.model.DisplayNameEntry)

Example 3 with DisplayNameEntry

use of org.gluu.model.DisplayNameEntry in project oxTrust by GluuFederation.

the class UpdateClientAction method acceptSelectClaims.

public void acceptSelectClaims() {
    if (this.availableClaims == null) {
        return;
    }
    Set<String> addedClaimInums = new HashSet<String>();
    for (DisplayNameEntry claim : claims) {
        addedClaimInums.add(claim.getInum());
    }
    for (GluuAttribute aClaim : this.availableClaims) {
        if (aClaim.isSelected() && !addedClaimInums.contains(aClaim.getInum())) {
            addClaim(aClaim);
        }
    }
    this.searchAvailableClaimPattern = "";
}
Also used : DisplayNameEntry(org.gluu.model.DisplayNameEntry) HashSet(java.util.HashSet) GluuAttribute(org.gluu.model.GluuAttribute)

Example 4 with DisplayNameEntry

use of org.gluu.model.DisplayNameEntry in project oxTrust by GluuFederation.

the class UpdateClientAction method updateClaims.

private void updateClaims() {
    if (this.claims == null || this.claims.size() == 0) {
        this.client.setOxAuthClaims(null);
        return;
    }
    List<String> tmpClaims = new ArrayList<String>();
    for (DisplayNameEntry claim : this.claims) {
        tmpClaims.add(claim.getDn());
    }
    this.client.setOxAuthClaims(tmpClaims);
}
Also used : ArrayList(java.util.ArrayList) DisplayNameEntry(org.gluu.model.DisplayNameEntry)

Example 5 with DisplayNameEntry

use of org.gluu.model.DisplayNameEntry in project oxTrust by GluuFederation.

the class UpdateClientAction method addClaim.

private void addClaim(GluuAttribute claim) {
    DisplayNameEntry oneClaim = new DisplayNameEntry(claim.getDn(), claim.getInum(), claim.getDisplayName());
    this.claims.add(oneClaim);
}
Also used : DisplayNameEntry(org.gluu.model.DisplayNameEntry)

Aggregations

DisplayNameEntry (org.gluu.model.DisplayNameEntry)16 ArrayList (java.util.ArrayList)7 CustomScript (org.gluu.model.custom.script.model.CustomScript)2 HashSet (java.util.HashSet)1 GluuAttribute (org.gluu.model.GluuAttribute)1 UmaResource (org.gluu.oxauth.model.uma.persistence.UmaResource)1 OxAuthClient (org.gluu.oxtrust.model.OxAuthClient)1 BasePersistenceException (org.gluu.persist.exception.BasePersistenceException)1 Entry (org.gluu.persist.model.base.Entry)1 Scope (org.oxauth.persistence.model.Scope)1