Search in sources :

Example 1 with Referral

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

the class ReferralEditViewBean method getDefaultValues.

protected Set getDefaultValues() {
    Set values = null;
    try {
        CachedPolicy cachedPolicy = getCachedPolicy();
        Policy policy = cachedPolicy.getPolicy();
        String referralName = (String) getPageSessionAttribute(PG_SESSION_REFERRAL_NAME);
        Referral referral = policy.getReferral(referralName);
        values = referral.getValues();
    } catch (NameNotFoundException e) {
        debug.warning("ReferralEditViewBean.getDefaultValues", e);
    } catch (AMConsoleException e) {
        debug.warning("ReferralEditViewBean.getDefaultValues", e);
    }
    return values;
}
Also used : Policy(com.sun.identity.policy.Policy) CachedPolicy(com.sun.identity.console.policy.model.CachedPolicy) Set(java.util.Set) Referral(com.sun.identity.policy.interfaces.Referral) NameNotFoundException(com.sun.identity.policy.NameNotFoundException) CachedPolicy(com.sun.identity.console.policy.model.CachedPolicy) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Example 2 with Referral

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

the class ReferralOpViewBeanBase method createReferral.

protected Referral createReferral() throws ModelControlException, AMConsoleException {
    Referral referral = null;
    String referralType = (String) propertySheetModel.getValue(REFERRAL_TYPE);
    String referralName = getReferralName();
    if (referralName != null) {
        Set values = getValues(referralType);
        if (values != null) {
            String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
            PolicyModel model = (PolicyModel) getModel();
            referral = model.createReferral(realmName, referralType, values);
        }
    }
    return referral;
}
Also used : Set(java.util.Set) Referral(com.sun.identity.policy.interfaces.Referral) PolicyModel(com.sun.identity.console.policy.model.PolicyModel)

Example 3 with Referral

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

the class ReferralAddViewBean method handleButton2Request.

/**
     * Handles create policy request.
     *
     * @param event Request invocation event
     */
public void handleButton2Request(RequestInvocationEvent event) throws ModelControlException {
    boolean forwarded = false;
    submitCycle = true;
    try {
        Referral referral = createReferral();
        if (referral != null) {
            CachedPolicy cachedPolicy = getCachedPolicy();
            Policy policy = cachedPolicy.getPolicy();
            String name = (String) propertySheetModel.getValue(REFERRAL_NAME);
            policy.addReferral(name, referral);
            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) Referral(com.sun.identity.policy.interfaces.Referral) CachedPolicy(com.sun.identity.console.policy.model.CachedPolicy) NameAlreadyExistsException(com.sun.identity.policy.NameAlreadyExistsException) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Example 4 with Referral

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

the class PolicyOpViewBeanBase method handleTblReferralsEditLinkRequest.

public void handleTblReferralsEditLinkRequest(RequestInvocationEvent event) throws ModelControlException {
    PolicyModel model = (PolicyModel) getModel();
    String name = hexToString((String) getDisplayFieldValue(TBL_REFERRALS_ACTION_HREF));
    setPageSessionAttribute(ReferralEditViewBean.CALLING_VIEW_BEAN, getClass().getName());
    setPageSessionAttribute(ReferralEditViewBean.EDIT_REFERRAL_NAME, name);
    try {
        CachedPolicy cachedPolicy = getCachedPolicy();
        Policy policy = cachedPolicy.getPolicy();
        Referral referral = policy.getReferral(name);
        String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
        String referralType = referral.getReferralTypeName();
        String viewBeanURL = model.getReferralViewBeanURL(realmName, referralType);
        unlockPageTrail();
        if ((viewBeanURL != null) && (viewBeanURL.trim().length() > 0)) {
            forwardToReferralURL(viewBeanURL, name, referralType, realmName, "edit");
        } else {
            forwardToReferralEditViewBean(model, realmName, name, referralType);
        }
    } catch (NameNotFoundException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", getModel().getErrorString(e));
        forwardTo();
    } catch (AMConsoleException e) {
        debug.warning("PolicyOpViewBeanBase.handleTblReferralsEditLinkRequest", e);
        redirectToStartURL();
    }
}
Also used : Policy(com.sun.identity.policy.Policy) CachedPolicy(com.sun.identity.console.policy.model.CachedPolicy) Referral(com.sun.identity.policy.interfaces.Referral) NameNotFoundException(com.sun.identity.policy.NameNotFoundException) CachedPolicy(com.sun.identity.console.policy.model.CachedPolicy) PolicyModel(com.sun.identity.console.policy.model.PolicyModel) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Example 5 with Referral

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

the class PolicyModelImpl method getReferralPossibleValues.

/**
     * Returns a set of possible values for a referral type.
     *
     * @param realmName Name of Realm.
     * @param referralType Name of Referral Type.
     * @param filter wildcards for filtering the results.
     * @return a set of possible values for a referral type.
     */
public ValidValues getReferralPossibleValues(String realmName, String referralType, String filter) {
    ValidValues values = null;
    try {
        PolicyManager policyMgr = getPolicyManager(realmName);
        if (policyMgr != null) {
            ReferralTypeManager referralTypeMgr = policyMgr.getReferralTypeManager();
            Referral referral = referralTypeMgr.getReferral(referralType);
            values = referral.getValidValues(getUserSSOToken(), filter);
        }
    } catch (AMConsoleException e) {
        debug.warning("PolicyModelImpl.getReferralPossibleValues", e);
    } catch (NameNotFoundException e) {
        debug.warning("PolicyModelImpl.getReferralPossibleValues", e);
    } catch (SSOException e) {
        debug.warning("PolicyModelImpl.getReferralPossibleValues", e);
    } catch (PolicyException e) {
        debug.warning("PolicyModelImpl.getReferralPossibleValues", e);
    }
    return values;
}
Also used : ReferralTypeManager(com.sun.identity.policy.ReferralTypeManager) PolicyManager(com.sun.identity.policy.PolicyManager) ValidValues(com.sun.identity.policy.ValidValues) Referral(com.sun.identity.policy.interfaces.Referral) NameNotFoundException(com.sun.identity.policy.NameNotFoundException) PolicyException(com.sun.identity.policy.PolicyException) SSOException(com.iplanet.sso.SSOException) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Aggregations

Referral (com.sun.identity.policy.interfaces.Referral)23 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)10 NameNotFoundException (com.sun.identity.policy.NameNotFoundException)10 Set (java.util.Set)10 OrgReferral (com.sun.identity.policy.plugins.OrgReferral)8 HashSet (java.util.HashSet)8 Iterator (java.util.Iterator)8 PolicyManager (com.sun.identity.policy.PolicyManager)7 ReferralTypeManager (com.sun.identity.policy.ReferralTypeManager)7 Policy (com.sun.identity.policy.Policy)6 PolicyException (com.sun.identity.policy.PolicyException)6 CachedPolicy (com.sun.identity.console.policy.model.CachedPolicy)5 HashMap (java.util.HashMap)5 Map (java.util.Map)5 SSOException (com.iplanet.sso.SSOException)4 PolicyModel (com.sun.identity.console.policy.model.PolicyModel)3 InvalidNameException (com.sun.identity.policy.InvalidNameException)2 NameAlreadyExistsException (com.sun.identity.policy.NameAlreadyExistsException)2 Syntax (com.sun.identity.policy.Syntax)2 SSOToken (com.iplanet.sso.SSOToken)1