Search in sources :

Example 66 with CCActionTable

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

the class PolicyOpViewBeanBase method handleTblRulesButtonDeleteRequest.

/**
     * Handles delete rule request.
     *
     * @param event Request Invocation Event.
     */
public void handleTblRulesButtonDeleteRequest(RequestInvocationEvent event) throws ModelControlException {
    CCActionTable table = (CCActionTable) getChild(TBL_RULES);
    table.restoreStateData();
    try {
        CachedPolicy cachedPolicy = getCachedPolicy();
        Policy policy = cachedPolicy.getPolicy();
        Integer[] selected = tblRulesModel.getSelectedRows();
        for (int i = 0; i < selected.length; i++) {
            tblRulesModel.setRowIndex(selected[i].intValue());
            String ruleName = (String) tblRulesModel.getValue(TBL_RULES_DATA_NAME);
            policy.removeRule(ruleName);
        }
        cachedPolicy.setPolicyModified(true);
        forwardTo();
    } catch (AMConsoleException e) {
        debug.warning("PolicyOpViewBeanBase.handleTblRulesButtonDeleteRequest", 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 67 with CCActionTable

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

the class PolicyOpViewBeanBase method handleTblConditionsButtonDeleteRequest.

/**
     * Handles delete condition request.
     *
     * @param event Request Invocation Event.
     */
public void handleTblConditionsButtonDeleteRequest(RequestInvocationEvent event) throws ModelControlException {
    CCActionTable table = (CCActionTable) getChild(TBL_CONDITIONS);
    table.restoreStateData();
    try {
        CachedPolicy cachedPolicy = getCachedPolicy();
        Policy policy = cachedPolicy.getPolicy();
        Integer[] selected = tblConditionsModel.getSelectedRows();
        for (int i = 0; i < selected.length; i++) {
            tblConditionsModel.setRowIndex(selected[i].intValue());
            String conditionName = (String) tblConditionsModel.getValue(TBL_CONDITIONS_DATA_NAME);
            policy.removeCondition(conditionName);
        }
        cachedPolicy.setPolicyModified(true);
        populateConditionsTable();
        forwardTo();
    } catch (AMConsoleException e) {
        debug.warning("PolicyOpViewBeanBase.handleTblConditionsButtonDeleteRequest", 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 68 with CCActionTable

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

the class SessionPropertyConditionAddViewBean method handleTblPolicySessionButtonDeleteRequest.

public void handleTblPolicySessionButtonDeleteRequest(RequestInvocationEvent event) throws ModelControlException {
    Map map = (Map) getPageSessionAttribute(SessionPropertyConditionHelper.PG_SESSION_PROPERTY_VALUES);
    CCActionTable tbl = (CCActionTable) getChild(SessionPropertyConditionHelper.ATTR_VALUES);
    tbl.restoreStateData();
    Integer[] selected = tblValuesModel.getSelectedRows();
    for (int i = 0; i < selected.length; i++) {
        int idx = selected[i].intValue();
        tblValuesModel.setLocation(idx);
        String propertyName = hexToString((String) tblValuesModel.getValue(SessionPropertyConditionHelper.TBL_DATA_ACTION));
        map.remove(propertyName);
        tblValuesModel.removeRow(idx);
    }
    tbl.resetStateData();
    helper.populateTable(map, propertySheetModel);
    forwardTo();
}
Also used : CCActionTable(com.sun.web.ui.view.table.CCActionTable) HashMap(java.util.HashMap) Map(java.util.Map)

Example 69 with CCActionTable

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

the class RuleOpViewBeanBase method createChild.

protected View createChild(String name) {
    View view = null;
    if (name.equals(ACTIONS_TILED_VIEW)) {
        view = new ActionTiledView(this, tblActionsModel, name);
    } else if (ptModel.isChildSupported(name)) {
        view = ptModel.createChild(this, name);
    } else if (name.equals(TBL_ACTIONS)) {
        CCActionTable table = new CCActionTable(this, tblActionsModel, name);
        table.setTiledView((ActionTiledView) getChild(ACTIONS_TILED_VIEW));
        view = table;
    } else if (name.equals(PROPERTY_ATTRIBUTE)) {
        view = new AMPropertySheet(this, propertySheetModel, name);
    } else if (propertySheetModel.isChildSupported(name)) {
        view = propertySheetModel.createChild(this, name, getModel());
    } else {
        view = super.createChild(name);
    }
    return view;
}
Also used : AMPropertySheet(com.sun.identity.console.base.AMPropertySheet) CCActionTable(com.sun.web.ui.view.table.CCActionTable) View(com.iplanet.jato.view.View)

Example 70 with CCActionTable

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

the class IDRepoViewBean method handleTblButtonDeleteRequest.

/**
     * Deletes ID Repo.
     *
     * @param event Request Invocation Event.
     * @throws ModelControlException if table model cannot be restored.
     */
public void handleTblButtonDeleteRequest(RequestInvocationEvent event) throws ModelControlException {
    CCActionTable table = (CCActionTable) getChild(TBL_SEARCH);
    table.restoreStateData();
    Integer[] selected = tblModel.getSelectedRows();
    SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
    List list = (List) szCache.getSerializedObj();
    Set names = new HashSet(selected.length * 2);
    for (int i = 0; i < selected.length; i++) {
        names.add(list.get(selected[i].intValue()));
    }
    try {
        IDRepoModel model = (IDRepoModel) getModel();
        String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
        model.deleteIDRepos(curRealm, names);
        if (selected.length == 1) {
            setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "idRepo.message.deleted");
        } else {
            setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "idRepo.message.deleted.pural");
        }
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }
    forwardTo();
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) SerializedField(com.sun.identity.console.components.view.html.SerializedField) ArrayList(java.util.ArrayList) List(java.util.List) CCActionTable(com.sun.web.ui.view.table.CCActionTable) IDRepoModel(com.sun.identity.console.realm.model.IDRepoModel) 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