Search in sources :

Example 41 with CCActionTable

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

the class EntityServicesViewBean method handleTblButtonDeleteRequest.

public void handleTblButtonDeleteRequest(RequestInvocationEvent event) throws ModelControlException {
    CCActionTable table = (CCActionTable) getChild(TBL_SEARCH);
    table.restoreStateData();
    Integer[] selected = tblModel.getSelectedRows();
    Set names = new HashSet(selected.length * 2);
    SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
    List cache = (List) szCache.getSerializedObj();
    if (selected.length > 0) {
        for (int i = 0; i < selected.length; i++) {
            names.add((String) cache.get(selected[i].intValue()));
        }
        try {
            EntitiesModel model = (EntitiesModel) getModel();
            String universalId = (String) getPageSessionAttribute(EntityEditViewBean.UNIVERSAL_ID);
            model.unassignServices(universalId, names);
            if (selected.length == 1) {
                setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "entities.message.service.unassigned");
            } else {
                setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "entities.message.service.unassigned.pural");
            }
        } catch (AMConsoleException e) {
            setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
        }
    } else {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", "entities.message.service.unassigned.non.selected");
    }
    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) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) HashSet(java.util.HashSet) EntitiesModel(com.sun.identity.console.idm.model.EntitiesModel)

Example 42 with CCActionTable

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

the class EntityResourceOfferingViewBean method handleTblButtonDeleteRequest.

public void handleTblButtonDeleteRequest(RequestInvocationEvent event) throws ModelControlException {
    CCActionTable table = (CCActionTable) getChild(TBL_ENTRIES);
    table.restoreStateData();
    EntityResourceOfferingModel model = (EntityResourceOfferingModel) getModel();
    String univId = (String) getPageSessionAttribute(EntityEditViewBean.UNIVERSAL_ID);
    DiscoveryDataCache cache = DiscoveryDataCache.getInstance();
    String cacheID = (String) getPageSessionAttribute(EntityResourceOfferingViewBean.DATA_ID);
    SMDiscoveryServiceData smEntry = cache.getData(model.getUserSSOToken(), cacheID);
    Integer[] selected = tblModel.getSelectedRows();
    smEntry.deleteDiscoEntries(selected);
    try {
        model.setEntityDiscoEntry(univId, smEntry);
        if (selected.length == 1) {
            setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "discovery.service.table.entry.deleted");
        } else {
            setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "discovery.service.table.entry.deleted.pural");
        }
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }
    forwardTo();
}
Also used : SMDiscoveryServiceData(com.sun.identity.console.service.model.SMDiscoveryServiceData) EntityResourceOfferingModel(com.sun.identity.console.idm.model.EntityResourceOfferingModel) CCActionTable(com.sun.web.ui.view.table.CCActionTable) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) DiscoveryDataCache(com.sun.identity.console.service.model.DiscoveryDataCache)

Example 43 with CCActionTable

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

the class RuleOpViewBeanBase method getActionValues.

private Map getActionValues(String serviceType, boolean withResource) throws ModelControlException {
    Map actionValues = new HashMap();
    PolicyModel model = (PolicyModel) getModel();
    String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
    try {
        Map mapActionSchemas = mapActionSchemaNameToActionSchema(model.getActionSchemas(getCachedPolicy().getPolicy(), realmName, serviceType, withResource));
        CCActionTable table = (CCActionTable) getChild(TBL_ACTIONS);
        table.restoreStateData();
        List actionSchemaNames = (List) getPageSessionAttribute(PG_SESSION_ACTION_SCHEMA_NAMES);
        if ((actionSchemaNames != null) && !actionSchemaNames.isEmpty()) {
            HttpServletRequest req = getRequestContext().getRequest();
            String chkName = getName() + "." + SELECTION_CHKBOX_NAME;
            int sz = actionSchemaNames.size();
            for (int i = 0; i < sz; i++) {
                String chkValue = req.getParameter(chkName + i);
                if ((chkValue != null) && chkValue.equals("true")) {
                    String actionSchemaName = (String) actionSchemaNames.get(i);
                    ActionSchema actionSchema = (ActionSchema) mapActionSchemas.get(actionSchemaName);
                    Set values = getActionSchemaValues(actionSchema, i);
                    actionValues.put(actionSchemaName, values);
                }
            }
        }
        if (actionValues.isEmpty()) {
            setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", "policy.missing.actionValues");
            actionValues = null;
        }
    } catch (AMConsoleException e) {
        debug.warning("RuleOpViewBeanBase.getActionValues", e);
    //NO-OP
    }
    return actionValues;
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) Set(java.util.Set) HashMap(java.util.HashMap) PolicyModel(com.sun.identity.console.policy.model.PolicyModel) CCSelectableList(com.sun.web.ui.view.html.CCSelectableList) 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) HashMap(java.util.HashMap) Map(java.util.Map) ActionSchema(com.sun.identity.policy.ActionSchema)

Example 44 with CCActionTable

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

the class SessionPropertyConditionEditViewBean 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 45 with CCActionTable

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

the class RealmResourceOfferingViewBean method handleTblButtonDeleteRequest.

public void handleTblButtonDeleteRequest(RequestInvocationEvent event) throws ModelControlException {
    CCActionTable table = (CCActionTable) getChild(TBL_ENTRIES);
    table.restoreStateData();
    RealmResourceOfferingModel model = (RealmResourceOfferingModel) getModel();
    String realm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
    DiscoveryDataCache cache = DiscoveryDataCache.getInstance();
    String cacheID = (String) getPageSessionAttribute(RealmResourceOfferingViewBean.DATA_ID);
    SMDiscoveryServiceData smEntry = cache.getData(model.getUserSSOToken(), cacheID);
    Integer[] selected = tblModel.getSelectedRows();
    smEntry.deleteDiscoEntries(selected);
    try {
        model.setRealmDiscoEntry(realm, smEntry);
        if (selected.length == 1) {
            setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "discovery.service.table.entry.deleted");
        } else {
            setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "discovery.service.table.entry.deleted.pural");
        }
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }
    forwardTo();
}
Also used : SMDiscoveryServiceData(com.sun.identity.console.service.model.SMDiscoveryServiceData) CCActionTable(com.sun.web.ui.view.table.CCActionTable) RealmResourceOfferingModel(com.sun.identity.console.realm.model.RealmResourceOfferingModel) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) DiscoveryDataCache(com.sun.identity.console.service.model.DiscoveryDataCache)

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