Search in sources :

Example 11 with CCAddRemove

use of com.sun.web.ui.view.addremove.CCAddRemove in project OpenAM by OpenRock.

the class SMDiscoveryDescriptionViewBeanBase method getValues.

private SMDescriptionData getValues() throws AMConsoleException {
    SMDescriptionData smData = new SMDescriptionData();
    smData.descriptionID = (String) getDisplayFieldValue(TF_DESCRIPTION_ID);
    if (smData.descriptionID.length() == 0) {
        smData.descriptionID = SAMLUtils.generateID();
    }
    CCAddRemove mechIdChild = (CCAddRemove) getChild(ATTR_NAME_SECURITY_MECH_ID);
    mechIdChild.restoreStateData();
    CCAddRemoveModel mechIdModel = (CCAddRemoveModel) propertySheetModel.getModel(ATTR_NAME_SECURITY_MECH_ID);
    smData.securityMechId = getList(mechIdModel.getSelectedOptionList());
    smData.endPointUrl = ((String) propertySheetModel.getValue(ATTR_NAME_SOAP_HTTP_END_POINT)).trim();
    smData.soapAction = ((String) propertySheetModel.getValue(ATTR_NAME_SOAP_HTTP_ACTION)).trim();
    if (smData.securityMechId.isEmpty()) {
        throw new AMConsoleException("discovery.service.description.missing.securityMechId.message");
    }
    if (smData.endPointUrl.length() == 0) {
        throw new AMConsoleException("discovery.service.description.missing.endPointUrl.message");
    }
    return smData;
}
Also used : CCAddRemoveModel(com.sun.web.ui.model.CCAddRemoveModel) SMDescriptionData(com.sun.identity.console.service.model.SMDescriptionData) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) CCAddRemove(com.sun.web.ui.view.addremove.CCAddRemove)

Example 12 with CCAddRemove

use of com.sun.web.ui.view.addremove.CCAddRemove 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 13 with CCAddRemove

use of com.sun.web.ui.view.addremove.CCAddRemove 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 14 with CCAddRemove

use of com.sun.web.ui.view.addremove.CCAddRemove 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)

Example 15 with CCAddRemove

use of com.sun.web.ui.view.addremove.CCAddRemove in project OpenAM by OpenRock.

the class IdentitySubjectEditViewBean method getPossibleValues.

private Set getPossibleValues(IdentitySubjectModel model, String realmName, Set values) {
    Set possibleValues = null;
    String searchEntityType = (String) getPageSessionAttribute(ENTITY_TYPE);
    if ((searchEntityType != null) && (searchEntityType.length() > 0)) {
        String pattern = (String) propertySheetModel.getValue(FILTER);
        try {
            IdSearchResults results = model.getEntityNames(realmName, searchEntityType, pattern);
            int errorCode = results.getErrorCode();
            switch(errorCode) {
                case IdSearchResults.SIZE_LIMIT_EXCEEDED:
                    setInlineAlertMessage(CCAlert.TYPE_WARNING, "message.warning", "message.sizelimit.exceeded");
                    break;
                case IdSearchResults.TIME_LIMIT_EXCEEDED:
                    setInlineAlertMessage(CCAlert.TYPE_WARNING, "message.warning", "message.timelimit.exceeded");
                    break;
            }
            possibleValues = results.getSearchResults();
            // remove the system users which should not be displayed.
            Set hiddenUsers = model.getSpecialUsers(realmName);
            possibleValues.removeAll(hiddenUsers);
            if ((possibleValues != null) && !possibleValues.isEmpty()) {
                if (submitCycle) {
                    CCAddRemove child = (CCAddRemove) getChild(VALUES_MULTIPLE_CHOICE_VALUE);
                    Set selected = getValues(addRemoveModel.getSelectedOptionList());
                    if ((selected != null) && !selected.isEmpty()) {
                        Set amids = getAMIdentity(model, selected);
                        possibleValues.removeAll(amids);
                    }
                } else if (values != null) {
                    possibleValues.removeAll(values);
                }
            }
        } catch (AMConsoleException e) {
            setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
        }
    }
    return (possibleValues != null) ? possibleValues : Collections.EMPTY_SET;
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) IdSearchResults(com.sun.identity.idm.IdSearchResults) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) CCAddRemove(com.sun.web.ui.view.addremove.CCAddRemove)

Aggregations

CCAddRemove (com.sun.web.ui.view.addremove.CCAddRemove)24 Set (java.util.Set)13 CCAddRemoveModel (com.sun.web.ui.model.CCAddRemoveModel)11 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)10 HashSet (java.util.HashSet)10 Map (java.util.Map)8 OptionList (com.iplanet.jato.view.html.OptionList)7 AMPropertySheet (com.sun.identity.console.base.AMPropertySheet)4 EntitiesModel (com.sun.identity.console.idm.model.EntitiesModel)4 IdentitySubjectModel (com.sun.identity.console.policy.model.IdentitySubjectModel)4 CCDropDownMenu (com.sun.web.ui.view.html.CCDropDownMenu)4 HashMap (java.util.HashMap)4 ArrayList (java.util.ArrayList)3 List (java.util.List)3 FSAuthDomainsModel (com.sun.identity.console.federation.model.FSAuthDomainsModel)2 PolicyModel (com.sun.identity.console.policy.model.PolicyModel)2 ContainerView (com.iplanet.jato.view.ContainerView)1 View (com.iplanet.jato.view.View)1 ViewBean (com.iplanet.jato.view.ViewBean)1 SerializedField (com.sun.identity.console.components.view.html.SerializedField)1