Search in sources :

Example 81 with CCActionTable

use of com.sun.web.ui.view.table.CCActionTable in project OpenAM by OpenRock.

the class FederationViewBean method handleDeleteEntityButtonRequest.

public void handleDeleteEntityButtonRequest(RequestInvocationEvent event) throws ModelControlException {
    CCActionTable table = (CCActionTable) getChild(ENTITY_TABLE);
    table.restoreStateData();
    EntityModel model = getEntityModel();
    CCActionTableModel cctablemodel = (CCActionTableModel) propertySheetModel.getModel(ENTITY_TABLE);
    List entitiesList = (ArrayList) getPageSessionAttribute(ENTITY_TABLE);
    Integer[] selected = cctablemodel.getSelectedRows();
    List successList = new ArrayList();
    List failureList = new ArrayList();
    String name = null;
    for (int i = 0; i < selected.length; i++) {
        String selectedRow = (String) entitiesList.get(selected[i].intValue());
        int pos = selectedRow.indexOf(",");
        name = selectedRow.substring(0, pos);
        String protStr = selectedRow.substring(pos + 1);
        int posProtocol = protStr.indexOf(",");
        String protocol = protStr.substring(0, posProtocol);
        String realmStr = protStr.substring(posProtocol + 1);
        int posrealm = realmStr.indexOf(",");
        String realm = realmStr.substring(0, posrealm);
        try {
            model.deleteEntities(name, protocol, realm);
            successList.add(name);
        } catch (AMConsoleException e) {
            failureList.add(name);
        }
    }
    String finalStr = printDeleteMessage(model, successList, failureList);
    setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", finalStr);
    forwardTo();
}
Also used : CCActionTableModel(com.sun.web.ui.model.CCActionTableModel) EntityModel(com.sun.identity.console.federation.model.EntityModel) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) OptionList(com.iplanet.jato.view.html.OptionList) List(java.util.List) CCActionTable(com.sun.web.ui.view.table.CCActionTable) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Example 82 with CCActionTable

use of com.sun.web.ui.view.table.CCActionTable in project OpenAM by OpenRock.

the class FederationViewBean method handleDeleteTPButtonRequest.

/**
     * Handles the delete trusted partner request. The items which are
     * selected in the SAML table will be removed. After the processing is
     * complete a message will be displayed indicating the process succeeded,
     * or what failed if it didn't succeed.
     *
     * @param event Request Invocation Event.
     */
public void handleDeleteTPButtonRequest(RequestInvocationEvent event) throws ModelControlException {
    CCActionTable tbl = (CCActionTable) getChild(SAML_TABLE);
    tbl.restoreStateData();
    CCActionTableModel tblModel = (CCActionTableModel) propertySheetModel.getModel(SAML_TABLE);
    // get selected rows here
    Integer[] selected = tblModel.getSelectedRows();
    List currentList = (List) getPageSessionAttribute(SAML_TABLE_ATTRIBUTE);
    Set selectedSet = new HashSet();
    for (int i = 0; i < selected.length; i++) {
        selectedSet.add(currentList.get(selected[i].intValue()));
    }
    try {
        FSSAMLServiceModel model = (FSSAMLServiceModel) getSAMLModel();
        model.deleteTrustPartners(selectedSet);
        if (selected.length == 1) {
            setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "saml.message.trusted.partner.deleted");
        } else {
            setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "saml.message.trusted.partner.deleted.pural");
        }
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }
    forwardTo();
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) OrderedSet(com.sun.identity.shared.datastruct.OrderedSet) CCActionTableModel(com.sun.web.ui.model.CCActionTableModel) ArrayList(java.util.ArrayList) OptionList(com.iplanet.jato.view.html.OptionList) List(java.util.List) FSSAMLServiceModel(com.sun.identity.console.federation.model.FSSAMLServiceModel) CCActionTable(com.sun.web.ui.view.table.CCActionTable) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) HashSet(java.util.HashSet)

Aggregations

CCActionTable (com.sun.web.ui.view.table.CCActionTable)82 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)40 SerializedField (com.sun.identity.console.components.view.html.SerializedField)28 ArrayList (java.util.ArrayList)25 List (java.util.List)23 CCActionTableModel (com.sun.web.ui.model.CCActionTableModel)22 HashSet (java.util.HashSet)19 Set (java.util.Set)17 View (com.iplanet.jato.view.View)16 OrderedSet (com.sun.identity.shared.datastruct.OrderedSet)15 CCPageTitle (com.sun.web.ui.view.pagetitle.CCPageTitle)13 HashMap (java.util.HashMap)13 Map (java.util.Map)13 OptionList (com.iplanet.jato.view.html.OptionList)6 SMSubConfig (com.sun.identity.console.base.model.SMSubConfig)6 CachedPolicy (com.sun.identity.console.policy.model.CachedPolicy)5 ServerSiteModel (com.sun.identity.console.service.model.ServerSiteModel)5 Policy (com.sun.identity.policy.Policy)5 AMPropertySheet (com.sun.identity.console.base.AMPropertySheet)4 SMDiscoveryServiceData (com.sun.identity.console.service.model.SMDiscoveryServiceData)4