Search in sources :

Example 26 with CCAddRemoveModel

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

the class FSAuthDomainsEditViewBean method beginDisplay.

public void beginDisplay(DisplayEvent event) throws ModelControlException {
    super.beginDisplay(event);
    String name = (String) getDisplayFieldValue(FSAuthDomainsModel.TF_NAME);
    setPageSessionAttribute(FSAuthDomainsModel.TF_NAME, name);
    FSAuthDomainsModel model = (FSAuthDomainsModel) getModel();
    try {
        String realm = model.getRealm(name);
        Map values = model.getAttributeValues(realm, name);
        AMPropertySheet ps = (AMPropertySheet) getChild(PROPERTY_ATTRIBUTE);
        ps.setAttributeValues(values, model);
        if (addRemoveModel == null) {
            addRemoveModel = new CCAddRemoveModel();
        }
        Set providers = model.getAllProviderNames(realm);
        List selectedProviders = new ArrayList(model.getTrustedProviderNames(realm, name));
        if ((selectedProviders != null) || (!selectedProviders.isEmpty())) {
            providers.removeAll(selectedProviders);
            Map displayNames = FSAuthDomainsOpViewBeanBase.getProviderDisplayNames(model, selectedProviders);
            addRemoveModel.setSelectedOptionList(createOptionList(replacePipeWithComma(displayNames)));
        }
        Map displayNames = FSAuthDomainsOpViewBeanBase.getProviderDisplayNames(model, providers);
        addRemoveModel.setAvailableOptionList(createOptionList(replacePipeWithComma(displayNames)));
        propertySheetModel.setModel(ADD_REMOVE_PROVIDERS, addRemoveModel);
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }
}
Also used : CCAddRemoveModel(com.sun.web.ui.model.CCAddRemoveModel) HashSet(java.util.HashSet) Set(java.util.Set) 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)

Example 27 with CCAddRemoveModel

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

the class CreateCOTViewBean method beginDisplay.

public void beginDisplay(DisplayEvent event) throws ModelControlException {
    super.beginDisplay(event);
    AMPropertySheet ps = (AMPropertySheet) getChild(PROPERTIES);
    ps.init();
    populateRealmData();
    FSAuthDomainsModel model = (FSAuthDomainsModel) getModel();
    String realm = "/";
    try {
        if (addRemoveModel == null) {
            addRemoveModel = new CCAddRemoveModel();
        }
        Set providers = model.getAllProviderNames(realm);
        Map displayNames = FSAuthDomainsOpViewBeanBase.getProviderDisplayNames(model, providers);
        addRemoveModel.setAvailableOptionList(createOptionList(replacePipeWithComma(displayNames)));
        psModel.setModel(ADD_REMOVE_PROVIDERS, addRemoveModel);
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }
}
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)

Example 28 with CCAddRemoveModel

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

the class CreateCOTViewBean method createPropertyModel.

private void createPropertyModel() {
    psModel = new AMPropertySheetModel(getClass().getClassLoader().getResourceAsStream("com/sun/identity/console/createCOTPropertySheet.xml"));
    if (addRemoveModel == null) {
        addRemoveModel = new CCAddRemoveModel();
    }
    psModel.setModel(ADD_REMOVE_PROVIDERS, addRemoveModel);
    psModel.clear();
}
Also used : CCAddRemoveModel(com.sun.web.ui.model.CCAddRemoveModel) AMPropertySheetModel(com.sun.identity.console.base.model.AMPropertySheetModel)

Example 29 with CCAddRemoveModel

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

the class EntityMembersViewBean method getMemberNames.

private void getMemberNames() {
    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.getMembers(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(getAssignableMembers());
            } 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 30 with CCAddRemoveModel

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

the class EntityMembersViewBean method handleButton1Request.

public void handleButton1Request(RequestInvocationEvent event) {
    submitCycle = true;
    CCAddRemove child = (CCAddRemove) getChild(ADD_REMOVE_MEMBERS);
    child.restoreStateData();
    CCAddRemoveModel addRemoveModel = (CCAddRemoveModel) propertySheetModel.getModel(ADD_REMOVE_MEMBERS);
    OptionList os = addRemoveModel.getSelectedOptionList();
    EntitiesModel model = (EntitiesModel) getModel();
    String universalId = (String) getPageSessionAttribute(UNIVERSAL_ID);
    String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
    String type = (String) getPageSessionAttribute(PG_SESSION_MEMBER_TYPE);
    try {
        Set entities = getEntitiesID(model.getMembers(curRealm, universalId, type));
        Set selected = getValues(os);
        Set toAdd = new HashSet(selected);
        toAdd.removeAll(entities);
        entities.removeAll(selected);
        if (!toAdd.isEmpty()) {
            model.addMembers(universalId, toAdd);
        }
        if (!entities.isEmpty()) {
            model.removeMembers(universalId, entities);
        }
        setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "message.updated");
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }
    forwardTo();
}
Also used : CCAddRemoveModel(com.sun.web.ui.model.CCAddRemoveModel) Set(java.util.Set) HashSet(java.util.HashSet) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) CCAddRemove(com.sun.web.ui.view.addremove.CCAddRemove) OptionList(com.iplanet.jato.view.html.OptionList) EntitiesModel(com.sun.identity.console.idm.model.EntitiesModel) HashSet(java.util.HashSet)

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