Search in sources :

Example 51 with CachedPolicy

use of com.sun.identity.console.policy.model.CachedPolicy in project OpenAM by OpenRock.

the class SubjectEditViewBean method getDefaultValues.

protected Set getDefaultValues() {
    Set values = null;
    try {
        CachedPolicy cachedPolicy = getCachedPolicy();
        Policy policy = cachedPolicy.getPolicy();
        String subjectName = (String) getPageSessionAttribute(SubjectOpViewBeanBase.PG_SESSION_SUBJECT_NAME);
        Subject subject = policy.getSubject(subjectName);
        values = subject.getValues();
    } catch (NameNotFoundException e) {
        debug.warning("SubjectEditViewBean.getDefaultValues", e);
    } catch (AMConsoleException e) {
        debug.warning("SubjectEditViewBean.getDefaultValues", e);
    }
    return values;
}
Also used : Policy(com.sun.identity.policy.Policy) CachedPolicy(com.sun.identity.console.policy.model.CachedPolicy) 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)

Example 52 with CachedPolicy

use of com.sun.identity.console.policy.model.CachedPolicy in project OpenAM by OpenRock.

the class SubjectAddViewBean method handleButton2Request.

/**
     * Handles create policy's subject request.
     *
     * @param event Request invocation event
     */
public void handleButton2Request(RequestInvocationEvent event) throws ModelControlException {
    boolean forwarded = false;
    submitCycle = true;
    bFilter = true;
    try {
        Subject subject = createSubject();
        if (subject != null) {
            CachedPolicy cachedPolicy = getCachedPolicy();
            Policy policy = cachedPolicy.getPolicy();
            String name = (String) propertySheetModel.getValue(SUBJECT_NAME);
            policy.addSubject(name, subject, isExclusive());
            backTrail();
            forwardToPolicyViewBean();
            forwarded = true;
        }
    } catch (NameAlreadyExistsException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", getModel().getErrorString(e));
    } catch (InvalidNameException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", getModel().getErrorString(e));
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    } finally {
        if (!forwarded) {
            forwardTo();
        }
    }
}
Also used : Policy(com.sun.identity.policy.Policy) CachedPolicy(com.sun.identity.console.policy.model.CachedPolicy) InvalidNameException(com.sun.identity.policy.InvalidNameException) CachedPolicy(com.sun.identity.console.policy.model.CachedPolicy) NameAlreadyExistsException(com.sun.identity.policy.NameAlreadyExistsException) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) Subject(com.sun.identity.policy.interfaces.Subject)

Example 53 with CachedPolicy

use of com.sun.identity.console.policy.model.CachedPolicy in project OpenAM by OpenRock.

the class SubjectEditViewBean method isSubjectExclusive.

protected boolean isSubjectExclusive() {
    boolean isExclusive = false;
    try {
        CachedPolicy cachedPolicy = getCachedPolicy();
        Policy policy = cachedPolicy.getPolicy();
        String subjectName = (String) getPageSessionAttribute(SubjectOpViewBeanBase.PG_SESSION_SUBJECT_NAME);
        isExclusive = policy.isSubjectExclusive(subjectName);
    } catch (NameNotFoundException e) {
        debug.warning("SubjectEditViewBean.isSubjectExclusive", e);
    } catch (AMConsoleException e) {
        debug.warning("SubjectEditViewBean.isSubjectExclusive", e);
    }
    return isExclusive;
}
Also used : Policy(com.sun.identity.policy.Policy) CachedPolicy(com.sun.identity.console.policy.model.CachedPolicy) NameNotFoundException(com.sun.identity.policy.NameNotFoundException) CachedPolicy(com.sun.identity.console.policy.model.CachedPolicy) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Aggregations

CachedPolicy (com.sun.identity.console.policy.model.CachedPolicy)53 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)38 Policy (com.sun.identity.policy.Policy)37 PolicyModel (com.sun.identity.console.policy.model.PolicyModel)26 NameNotFoundException (com.sun.identity.policy.NameNotFoundException)21 NameAlreadyExistsException (com.sun.identity.policy.NameAlreadyExistsException)10 InvalidNameException (com.sun.identity.policy.InvalidNameException)9 Map (java.util.Map)9 Set (java.util.Set)9 PolicyCache (com.sun.identity.console.policy.model.PolicyCache)6 Condition (com.sun.identity.policy.interfaces.Condition)6 Subject (com.sun.identity.policy.interfaces.Subject)6 HashMap (java.util.HashMap)6 Iterator (java.util.Iterator)6 Referral (com.sun.identity.policy.interfaces.Referral)5 ResponseProvider (com.sun.identity.policy.interfaces.ResponseProvider)5 CCActionTable (com.sun.web.ui.view.table.CCActionTable)5 Rule (com.sun.identity.policy.Rule)4 QueryResults (com.sun.identity.console.base.model.QueryResults)1 SimpleTimeCondition (com.sun.identity.policy.plugins.SimpleTimeCondition)1