Search in sources :

Example 1 with Syntax

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

the class PolicyModelImpl method getActiveReferralTypes.

/**
     * Returns a map of active referral types for a realm to its display name.
     *
     * @param realmName Name of Realm.
     * @return a map of active referral types for a realm to its display name.
     */
public Map getActiveReferralTypes(String realmName) {
    Map referralTypes = null;
    try {
        PolicyManager policyMgr = getPolicyManager(realmName);
        if (policyMgr != null) {
            ReferralTypeManager referralTypeMgr = policyMgr.getReferralTypeManager();
            if (referralTypeMgr != null) {
                Set types = referralTypeMgr.getSelectedReferralTypeNames();
                referralTypes = new HashMap(types.size() * 2);
                for (Iterator iter = types.iterator(); iter.hasNext(); ) {
                    String rName = (String) iter.next();
                    Referral referral = referralTypeMgr.getReferral(rName);
                    if (referral != null) {
                        Syntax syntax = referral.getValueSyntax(getUserSSOToken());
                        if (!syntax.equals(Syntax.NONE)) {
                            referralTypes.put(rName, referralTypeMgr.getDisplayName(rName));
                        }
                    }
                }
            }
        }
    } catch (AMConsoleException e) {
        debug.warning("PolicyModelImpl.getActiveReferralTypes", e);
    } catch (SSOException e) {
        debug.warning("PolicyModelImpl.getActiveReferralTypes", e);
    } catch (NameNotFoundException e) {
        debug.warning("PolicyModelImpl.getActiveReferralTypes", e);
    } catch (PolicyException e) {
        debug.warning("PolicyModelImpl.getActiveReferralTypes", e);
    }
    return (referralTypes == null) ? Collections.EMPTY_MAP : referralTypes;
}
Also used : ReferralTypeManager(com.sun.identity.policy.ReferralTypeManager) PolicyManager(com.sun.identity.policy.PolicyManager) Set(java.util.Set) HashSet(java.util.HashSet) HashMap(java.util.HashMap) NameNotFoundException(com.sun.identity.policy.NameNotFoundException) SSOException(com.iplanet.sso.SSOException) Referral(com.sun.identity.policy.interfaces.Referral) PolicyException(com.sun.identity.policy.PolicyException) Iterator(java.util.Iterator) Syntax(com.sun.identity.policy.Syntax) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) Map(java.util.Map) HashMap(java.util.HashMap)

Example 2 with Syntax

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

the class SubjectOpViewBeanBase method getValues.

protected Set getValues(String subjectType, boolean bAlert) throws ModelControlException {
    PolicyModel model = (PolicyModel) getModel();
    String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
    Syntax syntax = model.getSubjectSyntax(realmName, subjectType);
    Set values = getActionSchemaValues(syntax);
    if (bAlert && values.isEmpty()) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", "policy.missing.subject.value");
        values = null;
    }
    return values;
}
Also used : Set(java.util.Set) PolicyModel(com.sun.identity.console.policy.model.PolicyModel) Syntax(com.sun.identity.policy.Syntax)

Example 3 with Syntax

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

the class ReferralOpViewBeanBase method beginDisplay.

public void beginDisplay(DisplayEvent event) throws ModelControlException {
    super.beginDisplay(event);
    if (!submitCycle) {
        String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
        PolicyModel model = (PolicyModel) getModel();
        String referralName = (String) getPageSessionAttribute(PG_SESSION_REFERRAL_NAME);
        String referralType = (String) getPageSessionAttribute(PG_SESSION_REFERRAL_TYPE);
        Syntax syntax = model.getReferralSyntax(realmName, referralType);
        propertySheetModel.setValue(SYNTAX, Integer.toString(AMDisplayType.getDisplaySyntax(syntax)));
        propertySheetModel.setValue(REFERRAL_NAME, referralName);
        propertySheetModel.setValue(REFERRAL_TYPE, referralType);
        Map map = model.getActiveReferralTypes(realmName);
        String i18nName = (String) map.get(referralType);
        propertySheetModel.setValue(REFERRAL_TYPE_NAME, i18nName);
    }
}
Also used : PolicyModel(com.sun.identity.console.policy.model.PolicyModel) Syntax(com.sun.identity.policy.Syntax) Map(java.util.Map)

Example 4 with Syntax

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

the class SubjectOpViewBeanBase method beginDisplay.

public void beginDisplay(DisplayEvent event) throws ModelControlException {
    super.beginDisplay(event);
    String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
    String subjectType = (String) getPageSessionAttribute(SubjectOpViewBeanBase.PG_SESSION_SUBJECT_TYPE);
    PolicyModel model = (PolicyModel) getModel();
    Syntax syntax = model.getSubjectSyntax(realmName, subjectType);
    int intSyntax = AMDisplayType.getDisplaySyntax(syntax);
    if (!submitCycle) {
        String subjectName = (String) getPageSessionAttribute(SubjectOpViewBeanBase.PG_SESSION_SUBJECT_NAME);
        propertySheetModel.setValue(SYNTAX, Integer.toString(intSyntax));
        propertySheetModel.setValue(SUBJECT_NAME, subjectName);
        propertySheetModel.setValue(SUBJECT_TYPE, subjectType);
        QueryResults qr = model.getActiveSubjectTypes(realmName);
        Map map = (Map) qr.getResults();
        String i18nName = (String) map.get(subjectType);
        propertySheetModel.setValue(SUBJECT_TYPE_NAME, i18nName);
        propertySheetModel.setValue(EXCLUSIVE, isSubjectExclusive() ? "true" : "false");
    }
    if (intSyntax == AMDisplayType.SYNTAX_MULTIPLE_CHOICE) {
        setAddRemoveModel();
    }
}
Also used : PolicyModel(com.sun.identity.console.policy.model.PolicyModel) Syntax(com.sun.identity.policy.Syntax) Map(java.util.Map) QueryResults(com.sun.identity.console.base.model.QueryResults)

Example 5 with Syntax

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

the class PolicyOpViewBeanBase method subjectHasValueSyntax.

private boolean subjectHasValueSyntax(String realmName, String subjectType) {
    PolicyModel model = (PolicyModel) getModel();
    Syntax syntax = model.getSubjectSyntax(realmName, subjectType);
    int displaySyntax = AMDisplayType.getDisplaySyntax(syntax);
    return (displaySyntax == AMDisplayType.SYNTAX_TEXT) || (displaySyntax == AMDisplayType.SYNTAX_SINGLE_CHOICE) || (displaySyntax == AMDisplayType.SYNTAX_MULTIPLE_CHOICE);
}
Also used : PolicyModel(com.sun.identity.console.policy.model.PolicyModel) Syntax(com.sun.identity.policy.Syntax)

Aggregations

Syntax (com.sun.identity.policy.Syntax)11 PolicyModel (com.sun.identity.console.policy.model.PolicyModel)5 PolicyException (com.sun.identity.policy.PolicyException)5 SSOException (com.iplanet.sso.SSOException)4 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)4 NameNotFoundException (com.sun.identity.policy.NameNotFoundException)4 PolicyManager (com.sun.identity.policy.PolicyManager)4 Map (java.util.Map)4 Set (java.util.Set)4 QueryResults (com.sun.identity.console.base.model.QueryResults)2 ReferralTypeManager (com.sun.identity.policy.ReferralTypeManager)2 SubjectTypeManager (com.sun.identity.policy.SubjectTypeManager)2 Referral (com.sun.identity.policy.interfaces.Referral)2 Subject (com.sun.identity.policy.interfaces.Subject)2 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 Iterator (java.util.Iterator)2