Search in sources :

Example 56 with OptionList

use of com.iplanet.jato.view.html.OptionList 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)

Example 57 with OptionList

use of com.iplanet.jato.view.html.OptionList in project OpenAM by OpenRock.

the class EntityMembersViewBean method getAssignableMembers.

private OptionList getAssignableMembers() {
    OptionList avail = null;
    EntitiesModel model = (EntitiesModel) getModel();
    if ((filter == null) || (filter.trim().length() == 0)) {
        filter = "*";
        setDisplayFieldValue(TF_FILTER, "*");
    }
    setDisplayFieldValue(TF_FILTER, filter);
    try {
        String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
        String searchType = (String) getPageSessionAttribute(EntityMembersViewBean.PG_SESSION_MEMBER_TYPE);
        IdSearchResults results = model.getEntityNames(curRealm, searchType, filter);
        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;
        }
        // assignable will contain users which shouldn't be displayed in
        // the console (dsameuser, etc...)
        Set assignable = results.getSearchResults();
        assignable.removeAll(model.getSpecialUsers(curRealm));
        String universalId = (String) getPageSessionAttribute(EntityEditViewBean.UNIVERSAL_ID);
        removeAlreadyAssignedMembers(assignable);
        avail = getOptionListForEntities(assignable);
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }
    return avail;
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) IdSearchResults(com.sun.identity.idm.IdSearchResults) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) OptionList(com.iplanet.jato.view.html.OptionList) EntitiesModel(com.sun.identity.console.idm.model.EntitiesModel)

Example 58 with OptionList

use of com.iplanet.jato.view.html.OptionList in project OpenAM by OpenRock.

the class EntityMembershipViewBean 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.getMembership(curRealm, universalId, type));
        Set selected = getValues(os);
        Set toAdd = new HashSet(selected);
        toAdd.removeAll(entities);
        entities.removeAll(selected);
        if (!toAdd.isEmpty()) {
            model.addMemberships(universalId, toAdd);
        }
        if (!entities.isEmpty()) {
            model.removeMemberships(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)

Example 59 with OptionList

use of com.iplanet.jato.view.html.OptionList in project OpenAM by OpenRock.

the class EntityMembershipViewBean method getAssignableMembership.

private OptionList getAssignableMembership() {
    OptionList avail = null;
    EntitiesModel model = (EntitiesModel) getModel();
    if ((filter == null) || (filter.trim().length() == 0)) {
        filter = "*";
        setDisplayFieldValue(TF_FILTER, "*");
    }
    setDisplayFieldValue(TF_FILTER, filter);
    try {
        String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
        String searchType = (String) getPageSessionAttribute(EntityMembersViewBean.PG_SESSION_MEMBER_TYPE);
        IdSearchResults results = model.getEntityNames(curRealm, searchType, filter);
        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;
        }
        Set members = results.getSearchResults();
        String universalId = (String) getPageSessionAttribute(EntityEditViewBean.UNIVERSAL_ID);
        removeAlreadyAssignedMembers(members);
        avail = getOptionListForEntities(members);
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }
    return avail;
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) IdSearchResults(com.sun.identity.idm.IdSearchResults) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) OptionList(com.iplanet.jato.view.html.OptionList) EntitiesModel(com.sun.identity.console.idm.model.EntitiesModel)

Example 60 with OptionList

use of com.iplanet.jato.view.html.OptionList in project OpenAM by OpenRock.

the class SelectRealmViewBean method beginDisplay.

public void beginDisplay(DisplayEvent event) throws ModelControlException {
    super.beginDisplay(event);
    disableButton("button1", true);
    setDisplayFieldValue(TXT_EMPTY_REALM, getModel().getLocalizedString("policy.condition.null.realm"));
    String filter = (String) getDisplayFieldValue(ATTR_FILTER);
    if ((filter == null) || (filter.trim().length() == 0)) {
        setDisplayFieldValue(AuthToRealmHelper.ATTR_FILTER, "*");
        filter = "*";
    }
    Set realmNames = getRealmNames(filter);
    if ((realmNames != null) && !realmNames.isEmpty()) {
        CCSelect sl = (CCSelect) getChild(ATTR_REALM_NAMES);
        sl.setOptions(createOptionList(getLabelValueMap(realmNames)));
        String realm = null;
        if (!bRealmSelect) {
            realm = "";
            sl.setValue(realm);
        } else {
            realm = (String) sl.getValue();
        }
        setSchemes(realm);
    } else {
        CCSelect sl = (CCSelect) getChild(ATTR_SCHEMES);
        sl.setOptions(new OptionList());
    }
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) CCSelect(com.sun.web.ui.view.html.CCSelect) OptionList(com.iplanet.jato.view.html.OptionList)

Aggregations

OptionList (com.iplanet.jato.view.html.OptionList)75 Set (java.util.Set)35 Iterator (java.util.Iterator)27 CCDropDownMenu (com.sun.web.ui.view.html.CCDropDownMenu)25 Map (java.util.Map)24 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)21 HashSet (java.util.HashSet)17 List (java.util.List)15 HashMap (java.util.HashMap)13 ArrayList (java.util.ArrayList)9 Option (com.iplanet.jato.view.html.Option)7 CCAddRemoveModel (com.sun.web.ui.model.CCAddRemoveModel)7 CCAddRemove (com.sun.web.ui.view.addremove.CCAddRemove)7 EntitiesModel (com.sun.identity.console.idm.model.EntitiesModel)6 PolicyModel (com.sun.identity.console.policy.model.PolicyModel)6 CCRadioButton (com.sun.web.ui.view.html.CCRadioButton)6 TreeSet (java.util.TreeSet)6 IdentitySubjectModel (com.sun.identity.console.policy.model.IdentitySubjectModel)5 TaskModel (com.sun.identity.console.task.model.TaskModel)5 CCSelect (com.sun.web.ui.view.html.CCSelect)5