Search in sources :

Example 46 with Subject

use of com.sun.identity.policy.interfaces.Subject in project OpenAM by OpenRock.

the class Subjects method removeSubject.

/**
     * Removes the <code>Subject</code> object identified by
     * object's <code>equals</code> method. If a subject instance
     * does not exist, the method will return silently.
     *
     * @param subject subject object that
     * will be removed from the user collection
     * @return the subject that was just removed
     */
public Subject removeSubject(Subject subject) {
    Subject s = null;
    String subjectName = getSubjectName(subject);
    if (subjectName != null) {
        QualifiedSubject qualifiedSubject = (QualifiedSubject) users.remove(subjectName);
        if (qualifiedSubject != null) {
            s = qualifiedSubject.getSubject();
        }
    }
    return s;
}
Also used : Subject(com.sun.identity.policy.interfaces.Subject)

Example 47 with Subject

use of com.sun.identity.policy.interfaces.Subject in project OpenAM by OpenRock.

the class IdentitySubjectEditViewBean method getDefaultValues.

protected Set getDefaultValues(IdentitySubjectModel model) {
    Set values = null;
    String subjectName = (String) getPageSessionAttribute(SubjectOpViewBeanBase.PG_SESSION_SUBJECT_NAME);
    try {
        CachedPolicy cachedPolicy = getCachedPolicy();
        Policy policy = cachedPolicy.getPolicy();
        Subject subject = policy.getSubject(subjectName);
        values = subject.getValues();
    } catch (NameNotFoundException e) {
        debug.warning("IdentitySubjectEditViewBean.getDefaultValues", e);
    } catch (AMConsoleException e) {
        debug.warning("IdentitySubjectEditViewBean.getDefaultValues", e);
    }
    return (values != null) ? values : Collections.EMPTY_SET;
}
Also used : Policy(com.sun.identity.policy.Policy) CachedPolicy(com.sun.identity.console.policy.model.CachedPolicy) HashSet(java.util.HashSet) Set(java.util.Set) NameNotFoundException(com.sun.identity.policy.NameNotFoundException) CachedPolicy(com.sun.identity.console.policy.model.CachedPolicy) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) Subject(com.sun.identity.policy.interfaces.Subject)

Aggregations

Subject (com.sun.identity.policy.interfaces.Subject)47 HashSet (java.util.HashSet)18 PolicyException (com.sun.identity.policy.PolicyException)17 SSOException (com.iplanet.sso.SSOException)14 Policy (com.sun.identity.policy.Policy)14 Set (java.util.Set)12 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)11 NameNotFoundException (com.sun.identity.policy.NameNotFoundException)11 SubjectTypeManager (com.sun.identity.policy.SubjectTypeManager)11 EntitlementSubject (com.sun.identity.entitlement.EntitlementSubject)8 Rule (com.sun.identity.policy.Rule)8 Iterator (java.util.Iterator)8 PolicyManager (com.sun.identity.policy.PolicyManager)7 CachedPolicy (com.sun.identity.console.policy.model.CachedPolicy)6 AMException (com.iplanet.am.sdk.AMException)5 InvalidAuthContextException (com.sun.identity.authentication.internal.InvalidAuthContextException)5 ConfigurationException (com.sun.identity.common.configuration.ConfigurationException)5 UnknownPropertyNameException (com.sun.identity.common.configuration.UnknownPropertyNameException)5 SMSException (com.sun.identity.sm.SMSException)5 FileNotFoundException (java.io.FileNotFoundException)5