Search in sources :

Example 6 with CCAddRemoveModel

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

the class EntityMembershipViewBean method createAddRemoveModel.

private CCAddRemoveModel createAddRemoveModel() {
    CCAddRemoveModel addRemoveModel = new CCAddRemoveModel();
    addRemoveModel.setOrientation(CCAddRemoveModel.HORIZONTAL);
    addRemoveModel.setListboxHeight(CCAddRemoveModel.DEFAULT_LISTBOX_HEIGHT);
    return addRemoveModel;
}
Also used : CCAddRemoveModel(com.sun.web.ui.model.CCAddRemoveModel)

Example 7 with CCAddRemoveModel

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

the class EntityMembershipViewBean method getMemberships.

private void getMemberships() {
    if (!submitCycle) {
        try {
            String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
            String type = (String) getPageSessionAttribute(PG_SESSION_MEMBER_TYPE);
            String universalId = (String) getPageSessionAttribute(UNIVERSAL_ID);
            if (cacheAssigned != null) {
                assignedMembers = AMAdminUtils.toList(cacheAssigned);
            } else {
                EntitiesModel model = (EntitiesModel) getModel();
                assignedMembers = new ArrayList();
                assignedMembers.addAll(model.getMembership(curRealm, universalId, type));
            }
            if (canModify) {
                CCAddRemoveModel addRemoveModel = (CCAddRemoveModel) propertySheetModel.getModel(ADD_REMOVE_MEMBERS);
                addRemoveModel.clear();
                if (cacheAssigned != null) {
                    addRemoveModel.setSelectedOptionList(cacheAssigned);
                } else {
                    addRemoveModel.setSelectedOptionList(getOptionListForEntities(assignedMembers));
                }
                addRemoveModel.setAvailableOptionList(getAssignableMembership());
            } else {
                propertySheetModel.setValue(ADD_REMOVE_MEMBERS, AMAdminUtils.getString(getEntityDisplayNames(assignedMembers), ",", false));
            }
        } catch (AMConsoleException e) {
            setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
        }
        if (canModify) {
            CCAddRemove addRemove = (CCAddRemove) getChild(ADD_REMOVE_MEMBERS);
            addRemove.resetStateData();
        }
    }
}
Also used : CCAddRemoveModel(com.sun.web.ui.model.CCAddRemoveModel) ArrayList(java.util.ArrayList) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) CCAddRemove(com.sun.web.ui.view.addremove.CCAddRemove) EntitiesModel(com.sun.identity.console.idm.model.EntitiesModel)

Example 8 with CCAddRemoveModel

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

the class CreateCOTViewBean method handleButton1Request.

/**
     * Handles save button request.
     * save
     * @param event Request invocation event
     */
public void handleButton1Request(RequestInvocationEvent event) throws ModelControlException {
    FSAuthDomainsModel model = (FSAuthDomainsModel) getModel();
    AMPropertySheet ps = (AMPropertySheet) getChild(PROPERTIES);
    try {
        Map values = ps.getAttributeValues(model.getDataMap(), false, model);
        String name = (String) getDisplayFieldValue(model.TF_NAME);
        if ((name == null) || (name.length() < 1)) {
            setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", model.getLocalizedString("authdomain.authentication.domain.name.missing.message"));
            psModel.setErrorProperty("nameProperty", true);
            forwardTo();
        } else {
            CCAddRemove addRemoveList = (CCAddRemove) getChild(ADD_REMOVE_PROVIDERS);
            addRemoveList.restoreStateData();
            CCAddRemoveModel addRemoveModel = (CCAddRemoveModel) addRemoveList.getModel();
            Set providers = new HashSet(getSelectedValues(addRemoveModel));
            model.createAuthenticationDomain(values, providers);
            Object[] params = { name };
            String message = MessageFormat.format(model.getLocalizedString("authentication.domain.create.message"), params);
            setPageSessionAttribute(FederationViewBean.MESSAGE_TEXT, message);
            backTrail();
            FederationViewBean vb = (FederationViewBean) getViewBean(FederationViewBean.class);
            passPgSessionMap(vb);
            vb.forwardTo(getRequestContext());
        }
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
        forwardTo();
    }
}
Also used : CCAddRemoveModel(com.sun.web.ui.model.CCAddRemoveModel) TreeSet(java.util.TreeSet) HashSet(java.util.HashSet) Set(java.util.Set) AMPropertySheet(com.sun.identity.console.base.AMPropertySheet) FSAuthDomainsModel(com.sun.identity.console.federation.model.FSAuthDomainsModel) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) HashMap(java.util.HashMap) Map(java.util.Map) CCAddRemove(com.sun.web.ui.view.addremove.CCAddRemove) HashSet(java.util.HashSet)

Example 9 with CCAddRemoveModel

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

the class FSAuthDomainsEditViewBean method createPropertyModel.

private void createPropertyModel() {
    DelegationConfig dConfig = DelegationConfig.getInstance();
    String startDN = AMModelBase.getStartDN(getRequestContext().getRequest());
    boolean canModify = dConfig.hasPermission(startDN, null, AMAdminConstants.PERMISSION_MODIFY, getRequestContext().getRequest(), getClass().getName());
    // TBD: need to have one propertysheet which is read_only
    String xmlFile = (canModify) ? "com/sun/identity/console/propertyCOTEdit.xml" : "com/sun/identity/console/propertyCOTEdit.xml";
    propertySheetModel = new AMPropertySheetModel(getClass().getClassLoader().getResourceAsStream(xmlFile));
    if (addRemoveModel == null)
        addRemoveModel = new CCAddRemoveModel();
    propertySheetModel.setModel(ADD_REMOVE_PROVIDERS, addRemoveModel);
    propertySheetModel.clear();
}
Also used : CCAddRemoveModel(com.sun.web.ui.model.CCAddRemoveModel) AMPropertySheetModel(com.sun.identity.console.base.model.AMPropertySheetModel) DelegationConfig(com.sun.identity.console.delegation.model.DelegationConfig)

Example 10 with CCAddRemoveModel

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

the class FSAuthDomainsEditViewBean method handleButton1Request.

/**
     * Handles create authentication domains view bean.
     *
     * @param event Request invocation event
     */
public void handleButton1Request(RequestInvocationEvent event) throws ModelControlException {
    FSAuthDomainsModel model = (FSAuthDomainsModel) getModel();
    String name = (String) getDisplayFieldValue(model.TF_NAME);
    AMPropertySheet ps = (AMPropertySheet) getChild(PROPERTY_ATTRIBUTE);
    try {
        String realm = model.getRealm(name);
        Map values = ps.getAttributeValues(model.getDataMap(), false, model);
        model.setAttributeValues(realm, name, values);
        SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
        FederationViewBean vb = (FederationViewBean) getViewBean(FederationViewBean.class);
        CCAddRemove addRemoveList = (CCAddRemove) getChild(ADD_REMOVE_PROVIDERS);
        addRemoveList.restoreStateData();
        CCAddRemoveModel addRemoveModel = (CCAddRemoveModel) addRemoveList.getModel();
        List list = new ArrayList(getSelectedValues(addRemoveModel));
        model.addProviders(realm, name, list);
        setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "authentication.domain.updated");
        forwardTo();
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
        forwardTo();
    }
}
Also used : CCAddRemoveModel(com.sun.web.ui.model.CCAddRemoveModel) SerializedField(com.sun.identity.console.components.view.html.SerializedField) AMPropertySheet(com.sun.identity.console.base.AMPropertySheet) ArrayList(java.util.ArrayList) FSAuthDomainsModel(com.sun.identity.console.federation.model.FSAuthDomainsModel) ArrayList(java.util.ArrayList) List(java.util.List) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) HashMap(java.util.HashMap) Map(java.util.Map) CCAddRemove(com.sun.web.ui.view.addremove.CCAddRemove)

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