Search in sources :

Example 26 with CCActionTable

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

the class SMDiscoveryServiceViewBean method handleTblBootstrapResOffButtonDeleteRequest.

/**
     * Handles remove resource offerings request.
     *
     * @param event Request Invocation Event.
     */
public void handleTblBootstrapResOffButtonDeleteRequest(RequestInvocationEvent event) throws ModelControlException {
    setSubmitCycle(true);
    CCActionTable table = (CCActionTable) getChild(AMAdminConstants.DISCOVERY_SERVICE_NAME_BOOTSTRAP_RES_OFF);
    table.restoreStateData();
    CCActionTableModel tblModel = (CCActionTableModel) propertySheetModel.getModel(AMAdminConstants.DISCOVERY_SERVICE_NAME_BOOTSTRAP_RES_OFF);
    Integer[] selected = tblModel.getSelectedRows();
    if ((selected != null) && (selected.length > 0)) {
        try {
            OrderedSet tblValues = (OrderedSet) getPageSessionAttribute(AMAdminConstants.DISCOVERY_SERVICE_NAME_BOOTSTRAP_RES_OFF);
            SMDiscoveryServiceData smEntry = SMDiscoveryServiceData.getEntries(tblValues);
            smEntry.deleteDiscoEntries(selected);
            tblValues = (OrderedSet) smEntry.getDiscoveryEntries();
            setPageSessionAttribute(AMAdminConstants.DISCOVERY_SERVICE_NAME_BOOTSTRAP_RES_OFF, tblValues);
            populateBootstrapResOffTable(tblValues);
        } catch (AMConsoleException e) {
            setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
        }
    }
    forwardTo();
}
Also used : OrderedSet(com.sun.identity.shared.datastruct.OrderedSet) SMDiscoveryServiceData(com.sun.identity.console.service.model.SMDiscoveryServiceData) CCActionTableModel(com.sun.web.ui.model.CCActionTableModel) CCActionTable(com.sun.web.ui.view.table.CCActionTable) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Example 27 with CCActionTable

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

the class AbstractAuditViewBean method handleTblSubConfigButtonDeleteRequest.

/**
     * Called on request from the UI to delete an event handler.
     *
     * @param event Request Invocation Event.
     */
@SuppressWarnings("unused")
public void handleTblSubConfigButtonDeleteRequest(RequestInvocationEvent event) throws ModelControlException {
    submitCycle = true;
    CCActionTable tbl = (CCActionTable) getChild(TBL_SUB_CONFIG);
    tbl.restoreStateData();
    CCActionTableModel tblModel = (CCActionTableModel) tbl.getModel();
    Integer[] selected = tblModel.getSelectedRows();
    SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
    List list = szCache.getSerializedObj();
    Set<String> names = new HashSet<>(selected.length * 2);
    for (Integer index : selected) {
        SMSubConfig sc = (SMSubConfig) list.get(index);
        names.add(sc.getName());
    }
    try {
        AbstractAuditModel model = (AbstractAuditModel) getModel();
        model.deleteEventHandles(names);
        if (selected.length == 1) {
            setInlineAlertMessage(TYPE_INFO, INFORMATION_MESSAGE, "event.handler.message.deleted");
        } else {
            setInlineAlertMessage(TYPE_INFO, INFORMATION_MESSAGE, "event.handler.message.deleted.plural");
        }
    } catch (AMConsoleException e) {
        setInlineAlertMessage(TYPE_ERROR, ERROR_MESSAGE, e.getMessage());
    }
    submitCycle = false;
    forwardTo();
}
Also used : CCActionTableModel(com.sun.web.ui.model.CCActionTableModel) AbstractAuditModel(com.sun.identity.console.audit.model.AbstractAuditModel) SerializedField(com.sun.identity.console.components.view.html.SerializedField) SMSubConfig(com.sun.identity.console.base.model.SMSubConfig) Collections.singletonList(java.util.Collections.singletonList) ArrayList(java.util.ArrayList) List(java.util.List) CCActionTable(com.sun.web.ui.view.table.CCActionTable) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) HashSet(java.util.HashSet)

Example 28 with CCActionTable

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

the class FederationViewBean method handleDeleteCOTButtonRequest.

public void handleDeleteCOTButtonRequest(RequestInvocationEvent event) throws ModelControlException {
    CCActionTable tbl = (CCActionTable) getChild(COT_TABLE);
    tbl.restoreStateData();
    CCActionTableModel tableModel = (CCActionTableModel) propertySheetModel.getModel(COT_TABLE);
    // get selected rows
    Integer[] selected = tableModel.getSelectedRows();
    SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
    List list = (List) szCache.getSerializedObj();
    FSAuthDomainsModel model = (FSAuthDomainsModel) getModel();
    StringBuilder deletedNames = new StringBuilder();
    StringBuilder cannotDeleteds = new StringBuilder();
    // each COT is deleted separately as they can be in separate realms
    for (int i = 0; i < selected.length; i++) {
        String str = (String) list.get(selected[i].intValue());
        int pipeIndex = str.indexOf(",");
        String name = str.substring(0, pipeIndex);
        String realm = str.substring(pipeIndex + 1);
        try {
            model.deleteAuthenticationDomain(realm, name);
            if (deletedNames.length() > 0) {
                deletedNames.append(", ");
            }
            deletedNames.append(name);
        } catch (AMConsoleException e) {
            if (cannotDeleteds.length() > 0) {
                cannotDeleteds.append(", ");
            }
            cannotDeleteds.append(e.getMessage());
        }
    }
    StringBuilder message = new StringBuilder();
    if (deletedNames.length() > 0) {
        Object[] params = { deletedNames };
        message.append(MessageFormat.format(model.getLocalizedString("authDomain.message.deleted"), params));
    }
    if (cannotDeleteds.length() > 0) {
        Object[] params = { cannotDeleteds };
        message.append(MessageFormat.format(model.getLocalizedString("generic.error.message"), params));
    }
    if (message.length() > 0) {
        setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", message.toString());
    }
    forwardTo();
}
Also used : CCActionTableModel(com.sun.web.ui.model.CCActionTableModel) FSAuthDomainsModel(com.sun.identity.console.federation.model.FSAuthDomainsModel) CCActionTable(com.sun.web.ui.view.table.CCActionTable) SerializedField(com.sun.identity.console.components.view.html.SerializedField) ArrayList(java.util.ArrayList) OptionList(com.iplanet.jato.view.html.OptionList) List(java.util.List) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Example 29 with CCActionTable

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

the class PolicyOpViewBeanBase method handleTblSubjectsButtonDeleteRequest.

/**
     * Handles delete subject request.
     *
     * @param event Request Invocation Event.
     */
public void handleTblSubjectsButtonDeleteRequest(RequestInvocationEvent event) throws ModelControlException {
    CCActionTable table = (CCActionTable) getChild(TBL_SUBJECTS);
    table.restoreStateData();
    try {
        CachedPolicy cachedPolicy = getCachedPolicy();
        Policy policy = cachedPolicy.getPolicy();
        Integer[] selected = tblSubjectsModel.getSelectedRows();
        for (int i = 0; i < selected.length; i++) {
            tblSubjectsModel.setRowIndex(selected[i].intValue());
            String subjectName = (String) tblSubjectsModel.getValue(TBL_SUBJECTS_DATA_NAME);
            policy.removeSubject(subjectName);
        }
        cachedPolicy.setPolicyModified(true);
        populateSubjectsTable();
        forwardTo();
    } catch (AMConsoleException e) {
        debug.warning("PolicyOpViewBeanBase.handleTblSubjectsButtonDeleteRequest", e);
        redirectToStartURL();
    }
}
Also used : Policy(com.sun.identity.policy.Policy) CachedPolicy(com.sun.identity.console.policy.model.CachedPolicy) CachedPolicy(com.sun.identity.console.policy.model.CachedPolicy) CCActionTable(com.sun.web.ui.view.table.CCActionTable) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Example 30 with CCActionTable

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

the class PolicyOpViewBeanBase method handleTblResponseProvidersButtonDeleteRequest.

/**
     * Handles delete response attribute request.
     *
     * @param event Request Invocation Event.
     */
public void handleTblResponseProvidersButtonDeleteRequest(RequestInvocationEvent event) throws ModelControlException {
    CCActionTable table = (CCActionTable) getChild(TBL_RESPONSE_ATTRIBUTES);
    table.restoreStateData();
    try {
        CachedPolicy cachedPolicy = getCachedPolicy();
        Policy policy = cachedPolicy.getPolicy();
        Integer[] selected = tblResponseProvidersModel.getSelectedRows();
        for (int i = 0; i < selected.length; i++) {
            tblResponseProvidersModel.setRowIndex(selected[i].intValue());
            String responseProviderName = (String) tblResponseProvidersModel.getValue(TBL_RESPONSE_ATTRIBUTES_DATA_NAME);
            policy.removeResponseProvider(responseProviderName);
        }
        cachedPolicy.setPolicyModified(true);
        populateResponseProvidersTable();
        forwardTo();
    } catch (AMConsoleException e) {
        debug.warning("PolicyOpViewBeanBase.handleTblResponseProvidersButtonDeleteRequest", e);
        redirectToStartURL();
    }
}
Also used : Policy(com.sun.identity.policy.Policy) CachedPolicy(com.sun.identity.console.policy.model.CachedPolicy) CachedPolicy(com.sun.identity.console.policy.model.CachedPolicy) CCActionTable(com.sun.web.ui.view.table.CCActionTable) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

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