Search in sources :

Example 1 with CCAddRemoveModel

use of com.sun.web.ui.model.CCAddRemoveModel in project OpenAM by OpenRock.

the class AMPropertySheetModel method createChild.

public View createChild(View parent, String name, AMModel model) {
    String tagName = (String) childMap.get(name);
    View view = null;
    if (tagName != null) {
        if (tagName.equals(ORDERED_LIST)) {
            CCOrderedListModel m = new CCOrderedListModel();
            view = new CCOrderedList((ContainerView) parent, m, name);
            m.setAddButtonLabel(model.getLocalizedString("addremove.orderable.list.add.button"));
            m.setDeleteButtonLabel(model.getLocalizedString("addremove.orderable.list.delete.button"));
            setModel(name, m);
        } else if (tagName.equals(UNORDERED_LIST)) {
            CCUnOrderedListModel m = new CCUnOrderedListModel();
            view = new CCUnOrderedList((ContainerView) parent, m, name);
            setModel(name, m);
        } else if (tagName.equals(MAP_LIST) || tagName.equals(GLOBAL_MAP_LIST)) {
            CCMapListModel m = new CCMapListModel();
            view = new CCMapList((ContainerView) parent, m, name);
            m.setValueOptionList(mapOptionList.get(name));
            m.setKeyLabel(model.getLocalizedString("maplist.key.label"));
            m.setValueLabel(model.getLocalizedString("maplist.value.label"));
            m.setMsgInvalidEntry(model.getLocalizedString("maplist.msg.invalid.entry"));
            m.setMsgInvalidKey(model.getLocalizedString("maplist.msg.invalid.key"));
            m.setMsgInvalidValue(model.getLocalizedString("maplist.msg.invalid.value"));
            m.setMsgInvalidNoKey(model.getLocalizedString("maplist.msg.invalid.nokey"));
            setModel(name, m);
        } else if (tagName.equals(ADDREMOVE_LIST)) {
            CCAddRemoveModel m = (CCAddRemoveModel) getModel(name);
            if (m == null) {
                setModel(name, new CCAddRemoveModel());
            }
        }
    }
    if (view == null) {
        view = super.createChild(parent, name);
    }
    if (CCEditableList.class.isInstance(view)) {
        CCEditableList editable = (CCEditableList) view;
        CCEditableListModel m = (CCEditableListModel) editable.getModel();
        m.setAddBtnLabel(model.getLocalizedString("editableList.addButtonLabel"));
        m.setRemoveBtnLabel(model.getLocalizedString("editableList.deleteButtonLabel"));
    }
    children.add(view);
    return view;
}
Also used : CCEditableList(com.sun.web.ui.view.editablelist.CCEditableList) CCAddRemoveModel(com.sun.web.ui.model.CCAddRemoveModel) CCMapListModel(com.sun.identity.console.ui.model.CCMapListModel) CCMapList(com.sun.identity.console.ui.view.CCMapList) CCUnOrderedListModel(com.sun.identity.console.ui.model.CCUnOrderedListModel) CCEditableListModel(com.sun.web.ui.model.CCEditableListModel) ContainerView(com.iplanet.jato.view.ContainerView) CCOrderedListModel(com.sun.identity.console.ui.model.CCOrderedListModel) CCOrderedList(com.sun.identity.console.ui.view.CCOrderedList) View(com.iplanet.jato.view.View) ContainerView(com.iplanet.jato.view.ContainerView) CCUnOrderedList(com.sun.identity.console.ui.view.CCUnOrderedList)

Example 2 with CCAddRemoveModel

use of com.sun.web.ui.model.CCAddRemoveModel in project OpenAM by OpenRock.

the class ResponseProviderOpViewBeanBase method createPropertyModel.

private boolean createPropertyModel() {
    boolean init = false;
    HttpServletRequest req = RequestManager.getRequestContext().getRequest();
    String pType = (String) getPageSessionAttribute(PG_SESSION_PROVIDER_TYPE);
    if ((pType == null) || (pType.trim().length() == 0)) {
        pType = req.getParameter(getName() + "." + RESPONSEPROVIDER_TYPE);
        if ((pType != null) && (pType.trim().length() > 0)) {
            setPageSessionAttribute(PG_SESSION_PROVIDER_TYPE, pType);
        }
    }
    String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
    if ((curRealm == null) || (curRealm.trim().length() == 0)) {
        curRealm = req.getParameter(getName() + "." + REALM_NAME);
        if ((curRealm != null) && (curRealm.trim().length() > 0)) {
            setPageSessionAttribute(AMAdminConstants.CURRENT_REALM, curRealm);
        }
    }
    init = (curRealm != null) && (curRealm.trim().length() > 0) && (pType != null) && (pType.trim().length() > 0);
    DelegationConfig dConfig = DelegationConfig.getInstance();
    canModify = dConfig.hasPermission(curRealm, null, AMAdminConstants.PERMISSION_MODIFY, getModel(), getClass().getName());
    if (init) {
        propertySheetModel = new AMPropertySheetModel(getResponseProviderXML(curRealm, pType, !canModify));
        propertySheetModel.clear();
        if (canModify) {
            addRemoveModel = new CCAddRemoveModel();
            addRemoveModel.setShowMoveUpDownButtons("false");
            addRemoveModel.clear();
            propertySheetModel.setModel(VALUES_MULTIPLE_CHOICE_VALUE, addRemoveModel);
        }
    }
    return init;
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) CCAddRemoveModel(com.sun.web.ui.model.CCAddRemoveModel) AMPropertySheetModel(com.sun.identity.console.base.model.AMPropertySheetModel) DelegationConfig(com.sun.identity.console.delegation.model.DelegationConfig)

Example 3 with CCAddRemoveModel

use of com.sun.web.ui.model.CCAddRemoveModel in project OpenAM by OpenRock.

the class SAMLv2AffiliateViewBean method beginDisplay.

public void beginDisplay(DisplayEvent event) throws ModelControlException {
    AMPropertySheet ps = (AMPropertySheet) getChild(PROPERTIES);
    ps.init();
    SAMLv2Model model = (SAMLv2Model) getModel();
    try {
        Map values = getStandardAffiliationValues();
        Set allSPEntities = model.getallSPEntities(realm);
        Set affiliateMembers = (Set) values.get(model.AFFILIATE_MEMBER);
        allSPEntities.removeAll(affiliateMembers);
        if (samladdRemoveModel == null) {
            samladdRemoveModel = new CCAddRemoveModel();
        }
        if ((allSPEntities != null) && !allSPEntities.isEmpty()) {
            samladdRemoveModel.setAvailableOptionList(createOptionList(allSPEntities));
        }
        if ((affiliateMembers != null) && !affiliateMembers.isEmpty()) {
            samladdRemoveModel.setSelectedOptionList(createOptionList(affiliateMembers));
        }
        ps.setAttributeValues(values, model);
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }
    ps.setAttributeValues(getExtendedAffiliationValues(), model);
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) CCAddRemoveModel(com.sun.web.ui.model.CCAddRemoveModel) AMPropertySheet(com.sun.identity.console.base.AMPropertySheet) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) SAMLv2Model(com.sun.identity.console.federation.model.SAMLv2Model) HashMap(java.util.HashMap) Map(java.util.Map)

Example 4 with CCAddRemoveModel

use of com.sun.web.ui.model.CCAddRemoveModel 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 5 with CCAddRemoveModel

use of com.sun.web.ui.model.CCAddRemoveModel in project OpenAM by OpenRock.

the class IDFFAffiliateViewBean method populateValue.

private void populateValue(String name) {
    IDFFModel model = (IDFFModel) getModelInternal();
    try {
        Map values = model.getAffiliateProfileAttributeValues(realm, name);
        Set availableEntities = model.getAllEntityDescriptorNames(realm);
        Set affliliatEntities = model.getAllAffiliateEntityDescriptorNames(realm);
        Set affiliateMembers = model.getAllAffiliateMembers(realm, name);
        availableEntities.removeAll(affiliateMembers);
        availableEntities.removeAll(affliliatEntities);
        if (affiliateMembersModel == null) {
            affiliateMembersModel = new CCAddRemoveModel();
        }
        if ((availableEntities != null) && !availableEntities.isEmpty()) {
            affiliateMembersModel.setAvailableOptionList(createOptionList(availableEntities));
        }
        if ((affiliateMembers != null) && !affiliateMembers.isEmpty()) {
            affiliateMembersModel.setSelectedOptionList(createOptionList(affiliateMembers));
        }
        AMPropertySheet ps = (AMPropertySheet) getChild(PROPERTY_ATTRIBUTES);
        ps.setAttributeValues(values, model);
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }
}
Also used : IDFFModel(com.sun.identity.console.federation.model.IDFFModel) Set(java.util.Set) HashSet(java.util.HashSet) CCAddRemoveModel(com.sun.web.ui.model.CCAddRemoveModel) AMPropertySheet(com.sun.identity.console.base.AMPropertySheet) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) Map(java.util.Map)

Aggregations

CCAddRemoveModel (com.sun.web.ui.model.CCAddRemoveModel)33 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)15 Set (java.util.Set)15 HashSet (java.util.HashSet)14 CCAddRemove (com.sun.web.ui.view.addremove.CCAddRemove)11 Map (java.util.Map)11 AMPropertySheetModel (com.sun.identity.console.base.model.AMPropertySheetModel)9 HashMap (java.util.HashMap)9 AMPropertySheet (com.sun.identity.console.base.AMPropertySheet)8 OptionList (com.iplanet.jato.view.html.OptionList)7 TreeSet (java.util.TreeSet)5 DelegationConfig (com.sun.identity.console.delegation.model.DelegationConfig)4 FSAuthDomainsModel (com.sun.identity.console.federation.model.FSAuthDomainsModel)4 EntitiesModel (com.sun.identity.console.idm.model.EntitiesModel)4 CCOrderedListModel (com.sun.identity.console.ui.model.CCOrderedListModel)4 CCEditableListModel (com.sun.web.ui.model.CCEditableListModel)4 ArrayList (java.util.ArrayList)4 Iterator (java.util.Iterator)4 Option (com.iplanet.jato.view.html.Option)3 SAMLv2Model (com.sun.identity.console.federation.model.SAMLv2Model)3