Search in sources :

Example 1 with IdentitySubjectModel

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

the class IdentitySubjectAddViewBean method beginDisplay.

public void beginDisplay(DisplayEvent event) throws ModelControlException {
    IdentitySubjectModel model = (IdentitySubjectModel) getModel();
    Set values = null;
    if (bFilter) {
        Set defaultValue = getValues();
        if (defaultValue != null) {
            values = getAMIdentity(model, defaultValue);
        }
    }
    super.beginDisplay(event);
    String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
    // initialize the 'Filter' drop down menu
    // supportedEntityTypes is a map of entity name to its
    // localized value
    CCDropDownMenu menu = (CCDropDownMenu) getChild(FILTER_TYPE);
    Map supportedEntityTypes = model.getSupportedEntityTypes(realmName);
    OptionList entityTypes = createOptionList(supportedEntityTypes);
    entityTypes.add(0, "policy.subject.select.identity.type", "");
    menu.setOptions(entityTypes);
    menu.setValue("");
    // initialize the available/selected component
    CCAddRemove child = (CCAddRemove) getChild(VALUES_MULTIPLE_CHOICE_VALUE);
    child.restoreStateData();
    OptionList selected = addRemoveModel.getSelectedOptionList();
    OptionList possible = createOptionList(getPossibleValues(model, realmName));
    child.resetStateData();
    addRemoveModel.setAvailableOptionList(possible);
    List selectedIds = AMAdminUtils.toList(selected);
    addRemoveModel.setSelectedOptionList(createOptionList(getAMIdentity(model, selectedIds)));
}
Also used : IdentitySubjectModel(com.sun.identity.console.policy.model.IdentitySubjectModel) HashSet(java.util.HashSet) Set(java.util.Set) OptionList(com.iplanet.jato.view.html.OptionList) List(java.util.List) CCDropDownMenu(com.sun.web.ui.view.html.CCDropDownMenu) HashMap(java.util.HashMap) Map(java.util.Map) CCAddRemove(com.sun.web.ui.view.addremove.CCAddRemove) OptionList(com.iplanet.jato.view.html.OptionList)

Example 2 with IdentitySubjectModel

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

the class IdentitySubjectAddViewBean method createOptionList.

/**
     * Creates an OptionList based on a set of AMIdentity objects.
     */
protected OptionList createOptionList(Set values) {
    OptionList optList = new OptionList();
    if ((values != null) && !values.isEmpty()) {
        /*
             * Need to convert to AMIdentity object if the set contains
             * universal Ids
             */
        Set amIdentity = (values.iterator().next() instanceof String) ? getAMIdentity((IdentitySubjectModel) getModel(), values) : values;
        Map entries = new HashMap(values.size() * 2);
        for (Iterator iter = amIdentity.iterator(); iter.hasNext(); ) {
            AMIdentity identity = (AMIdentity) iter.next();
            entries.put(IdUtils.getUniversalId(identity), PolicyUtils.getDNDisplayString(identity.getName()));
        }
        optList = createOptionList(entries);
    }
    return optList;
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) IdentitySubjectModel(com.sun.identity.console.policy.model.IdentitySubjectModel) HashMap(java.util.HashMap) AMIdentity(com.sun.identity.idm.AMIdentity) Iterator(java.util.Iterator) HashMap(java.util.HashMap) Map(java.util.Map) OptionList(com.iplanet.jato.view.html.OptionList)

Example 3 with IdentitySubjectModel

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

the class IdentityMembershipConditionAddViewBean method beginDisplay.

/**
     * Sets the values to UI model.
     *
     * @param event Display Event.
     * @throws ModelControlException if the default UI model is not accessible.
     */
public void beginDisplay(DisplayEvent event) throws ModelControlException {
    IdentitySubjectModel subjectModel = getSubjectModel();
    PolicyModel model = (PolicyModel) getModel();
    super.beginDisplay(event);
    CCDropDownMenu menu = (CCDropDownMenu) getChild(FILTER_TYPE);
    Map supportedEntityTypes = model.getSupportedEntityTypes(realmName);
    OptionList entityTypes = createOptionList(supportedEntityTypes);
    entityTypes.add(0, "policy.subject.select.identity.type", "");
    menu.setOptions(entityTypes);
    menu.setValue("");
    // initialize the available/selected component
    CCAddRemove child = (CCAddRemove) getChild(VALUES_MULTIPLE_CHOICE_VALUE);
    child.restoreStateData();
    OptionList selected = addRemoveModel.getSelectedOptionList();
    OptionList possible = helper.createOptionList(model.getUserSSOToken(), model.getUserLocale(), this, getPossibleValues(subjectModel, realmName));
    child.resetStateData();
    addRemoveModel.setAvailableOptionList(possible);
}
Also used : IdentitySubjectModel(com.sun.identity.console.policy.model.IdentitySubjectModel) PolicyModel(com.sun.identity.console.policy.model.PolicyModel) CCDropDownMenu(com.sun.web.ui.view.html.CCDropDownMenu) Map(java.util.Map) CCAddRemove(com.sun.web.ui.view.addremove.CCAddRemove) OptionList(com.iplanet.jato.view.html.OptionList)

Example 4 with IdentitySubjectModel

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

the class IdentityMembershipConditionEditViewBean method beginDisplay.

/**
     * Sets the values to UI model.
     *
     * @param event Display Event.
     */
public void beginDisplay(DisplayEvent event) throws ModelControlException {
    IdentitySubjectModel subjectModel = getSubjectModel();
    PolicyModel model = (PolicyModel) getModel();
    super.beginDisplay(event);
    if (!canModify) {
        Map mapValues = getDefaultValues();
        if ((mapValues != null) && !mapValues.isEmpty()) {
            Set values = (Set) mapValues.get(AMIdentityMembershipCondition.AM_IDENTITY_NAME);
            Set identityNames = helper.getAMIdentityNames(model.getUserSSOToken(), values);
            propertySheetModel.setValue(VALUES_MULTIPLE_CHOICE_VALUE, AMAdminUtils.getString(identityNames, ",", false));
        }
    } else {
        CCDropDownMenu menu = (CCDropDownMenu) getChild(FILTER_TYPE);
        Map supportedEntityTypes = model.getSupportedEntityTypes(realmName);
        OptionList entityTypes = createOptionList(supportedEntityTypes);
        entityTypes.add(0, "policy.subject.select.identity.type", "");
        menu.setOptions(entityTypes);
        menu.setValue("");
        CCAddRemove child = (CCAddRemove) getChild(VALUES_MULTIPLE_CHOICE_VALUE);
        child.restoreStateData();
        if (!submitCycle) {
            helper.setSelectedIdentities(child, model.getUserSSOToken(), model.getUserLocale(), this, getDefaultValues());
        } else {
            // initialize the available/selected component
            OptionList possible = helper.createOptionList(model.getUserSSOToken(), model.getUserLocale(), this, getPossibleValues(subjectModel, realmName));
            OptionList selected = addRemoveModel.getSelectedOptionList();
            List selectedIds = AMAdminUtils.toList(selected);
            child.resetStateData();
            addRemoveModel.setAvailableOptionList(possible);
            addRemoveModel.setSelectedOptionList(helper.createOptionList(model.getUserSSOToken(), model.getUserLocale(), this, selectedIds));
        }
    }
}
Also used : IdentitySubjectModel(com.sun.identity.console.policy.model.IdentitySubjectModel) Set(java.util.Set) PolicyModel(com.sun.identity.console.policy.model.PolicyModel) OptionList(com.iplanet.jato.view.html.OptionList) List(java.util.List) Map(java.util.Map) CCDropDownMenu(com.sun.web.ui.view.html.CCDropDownMenu) CCAddRemove(com.sun.web.ui.view.addremove.CCAddRemove) OptionList(com.iplanet.jato.view.html.OptionList)

Example 5 with IdentitySubjectModel

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

the class IdentitySubjectEditViewBean method beginDisplay.

public void beginDisplay(DisplayEvent event) throws ModelControlException {
    IdentitySubjectModel model = (IdentitySubjectModel) getModel();
    String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
    Set values = null;
    if (bFilter) {
        Set defaultValue = getValues();
        if (defaultValue != null) {
            values = getAMIdentity(model, defaultValue);
        }
    } else {
        values = getAMIdentity(model, getDefaultValues(model));
    }
    super.beginDisplay(event);
    if (canModify) {
        Map supportedEntityTypes = model.getSupportedEntityTypes(realmName);
        CCDropDownMenu menu = (CCDropDownMenu) getChild(FILTER_TYPE);
        OptionList entityTypes = createOptionList(supportedEntityTypes);
        entityTypes.add(0, "policy.subject.select.identity.type", "");
        menu.setOptions(entityTypes);
        menu.setValue("");
        CCAddRemove child = (CCAddRemove) getChild(VALUES_MULTIPLE_CHOICE_VALUE);
        child.restoreStateData();
        OptionList selected = addRemoveModel.getSelectedOptionList();
        child.resetStateData();
        addRemoveModel.setAvailableOptionList(createOptionList(getPossibleValues(model, realmName, values)));
        if (submitCycle) {
            addRemoveModel.setSelectedOptionList(selected);
        } else {
            addRemoveModel.setSelectedOptionList(createOptionList(values));
        }
    } else {
        propertySheetModel.setValue(VALUES_MULTIPLE_CHOICE_VALUE, AMAdminUtils.getString(getDefaultValues(), ",", false));
    }
}
Also used : IdentitySubjectModel(com.sun.identity.console.policy.model.IdentitySubjectModel) HashSet(java.util.HashSet) Set(java.util.Set) Map(java.util.Map) CCDropDownMenu(com.sun.web.ui.view.html.CCDropDownMenu) CCAddRemove(com.sun.web.ui.view.addremove.CCAddRemove) OptionList(com.iplanet.jato.view.html.OptionList)

Aggregations

OptionList (com.iplanet.jato.view.html.OptionList)5 IdentitySubjectModel (com.sun.identity.console.policy.model.IdentitySubjectModel)5 Map (java.util.Map)5 CCAddRemove (com.sun.web.ui.view.addremove.CCAddRemove)4 CCDropDownMenu (com.sun.web.ui.view.html.CCDropDownMenu)4 Set (java.util.Set)4 HashSet (java.util.HashSet)3 PolicyModel (com.sun.identity.console.policy.model.PolicyModel)2 HashMap (java.util.HashMap)2 List (java.util.List)2 AMIdentity (com.sun.identity.idm.AMIdentity)1 Iterator (java.util.Iterator)1