Search in sources :

Example 11 with CCActionTable

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

the class ServerSiteViewBean method handleTblServerButtonCloneRequest.

/**
     * Forwards request to server clone view bean.
     *
     * @param event Request Invocation Event.
     */
public void handleTblServerButtonCloneRequest(RequestInvocationEvent event) throws ModelControlException {
    CCActionTable table = (CCActionTable) getChild(TBL_SERVERS);
    table.restoreStateData();
    Integer[] selected = tblServerModel.getSelectedRows();
    SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
    List list = (List) szCache.getSerializedObj();
    String serverName = (String) list.get(selected[0].intValue());
    ServerCloneViewBean vb = (ServerCloneViewBean) getViewBean(ServerCloneViewBean.class);
    unlockPageTrail();
    setPageSessionAttribute(ServerCloneViewBean.PG_ATTR_SERVER_NAME, serverName);
    passPgSessionMap(vb);
    vb.forwardTo(getRequestContext());
}
Also used : 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)

Example 12 with CCActionTable

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

the class FSSAMLServiceViewBean method handleTblTargetURLsButtonDeleteRequest.

public void handleTblTargetURLsButtonDeleteRequest(RequestInvocationEvent event) throws ModelControlException {
    Map modifiedValues = null;
    try {
        modifiedValues = getValues(false, false);
    } catch (AMConsoleException e) {
    /* exception will not be thrown because we are instructing
             * AMPropertySheet to return values without doing password
             * validation.
             */
    }
    CCActionTable tbl = (CCActionTable) getChild(TABLE_TARGET_URLS);
    tbl.restoreStateData();
    Integer[] selected = tblTargetURLsModel.getSelectedRows();
    if ((selected != null) && (selected.length > 0)) {
        OrderedSet tblValues = (OrderedSet) modifiedValues.get(TABLE_TARGET_URLS);
        tblValues.removeAll(selected);
        modifiedValues.put(TABLE_TARGET_URLS, tblValues);
    }
    setPageSessionAttribute(PROPERTY_ATTRIBUTE, (HashMap) modifiedValues);
    setPageSessionAttribute(MODIFIED, "1");
    setValues();
    forwardTo();
}
Also used : OrderedSet(com.sun.identity.shared.datastruct.OrderedSet) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) CCActionTable(com.sun.web.ui.view.table.CCActionTable) HashMap(java.util.HashMap) Map(java.util.Map)

Example 13 with CCActionTable

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

the class RMRealmViewBean method handleTblButtonDeleteRequest.

/**
     * Deletes realms.
     *
     * @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();
    String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
    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++) {
        String name = (String) list.get(selected[i].intValue());
        /* 
             * make sure the realm name starts with / to give it a
             * fully qualified look. This value will be set in the log file
             */
        if (!name.startsWith("/")) {
            name = "/" + name;
        }
        names.add(name);
    }
    try {
        RMRealmModel model = (RMRealmModel) getModel();
        model.deleteSubRealms(curRealm, names);
        if (selected.length == 1) {
            setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "realm.message.deleted");
        } else {
            setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "realm.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) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) RMRealmModel(com.sun.identity.console.realm.model.RMRealmModel) HashSet(java.util.HashSet)

Example 14 with CCActionTable

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

the class STSHomeViewBean method createChild.

protected View createChild(String name) {
    View view;
    if (name.equals(TBL_REST_STS_INSTANCES)) {
        Set<String> publishedInstances = getPublishedInstancesFromCache(REST_STS_PUBLISHED_INSTANCES_CACHE_KEY);
        if (!CollectionUtils.isEmpty(publishedInstances)) {
            populateRestSTSTableModel(publishedInstances);
        } else {
            setRestSTSInstanceNamesInTable();
        }
        view = new CCActionTable(this, tblModelRestSTSInstances, name);
    } else if (name.equals(TBL_SOAP_STS_INSTANCES)) {
        Set<String> publishedInstances = getPublishedInstancesFromCache(SOAP_STS_PUBLISHED_INSTANCES_CACHE_KEY);
        if (!CollectionUtils.isEmpty(publishedInstances)) {
            populateSoapSTSTableModel(publishedInstances);
        } else {
            setSoapSTSInstanceNamesInTable();
        }
        view = new CCActionTable(this, tblModelSoapSTSInstances, name);
    } else if (name.equals(PAGETITLE)) {
        view = new CCPageTitle(this, ptModel, name);
    } else if (tblModelRestSTSInstances.isChildSupported(name)) {
        view = tblModelRestSTSInstances.createChild(this, name);
    } else if (tblModelSoapSTSInstances.isChildSupported(name)) {
        view = tblModelSoapSTSInstances.createChild(this, name);
    } else if (ptModel.isChildSupported(name)) {
        view = ptModel.createChild(this, name);
    } else {
        view = super.createChild(name);
    }
    return view;
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) CCActionTable(com.sun.web.ui.view.table.CCActionTable) View(com.iplanet.jato.view.View) CCPageTitle(com.sun.web.ui.view.pagetitle.CCPageTitle)

Example 15 with CCActionTable

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

the class STSHomeViewBean method handleTblRestSTSInstancesButtonDeleteRequest.

public void handleTblRestSTSInstancesButtonDeleteRequest(RequestInvocationEvent event) throws ModelControlException {
    CCActionTable table = (CCActionTable) getChild(TBL_REST_STS_INSTANCES);
    table.restoreStateData();
    Integer[] selected = tblModelRestSTSInstances.getSelectedRows();
    Set<String> instanceNames = new HashSet<>(selected.length);
    for (int i = 0; i < selected.length; i++) {
        tblModelRestSTSInstances.setRowIndex(selected[i].intValue());
        instanceNames.add((String) tblModelRestSTSInstances.getValue(TBL_REST_STS_INSTANCES_DATA_NAME));
    }
    try {
        STSHomeViewBeanModel model = (STSHomeViewBeanModel) getModel();
        model.deleteInstances(STSType.REST, instanceNames);
        if (selected.length == 1) {
            setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "rest.sts.home.instance.deleted");
        } else {
            setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "rest.sts.home.instances.deleted");
        }
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }
    forwardTo();
}
Also used : CCActionTable(com.sun.web.ui.view.table.CCActionTable) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) HashSet(java.util.HashSet) STSHomeViewBeanModel(com.sun.identity.console.sts.model.STSHomeViewBeanModel)

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