Search in sources :

Example 36 with SerializedField

use of com.sun.identity.console.components.view.html.SerializedField in project OpenAM by OpenRock.

the class ServerConfigInheritViewBean method populatePropertyNameTableModel.

private void populatePropertyNameTableModel(Collection propertyNames) {
    if (!submitCycle && (propertyNames != null)) {
        tblPropertyNamesModel.clearAll();
        SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
        String serverName = (String) getPageSessionAttribute(ServerEditViewBeanBase.PG_ATTR_SERVER_NAME);
        ServerSiteModel model = (ServerSiteModel) getModel();
        Map defaultValues = model.getServerDefaults();
        ArrayList cache = new ArrayList();
        try {
            Map serverProperties = model.getServerConfiguration(serverName);
            int counter = 0;
            boolean first = false;
            for (Iterator iter = propertyNames.iterator(); iter.hasNext(); counter++) {
                if (counter > 0) {
                    tblPropertyNamesModel.appendRow();
                }
                String name = (String) iter.next();
                String displayName = name.substring(3);
                displayName = "amconfig." + displayName.replaceAll("-", ".");
                String actualPropertyName = ServerEditViewBeanBase.getActualPropertyName(name);
                tblPropertyNamesModel.setValue(TBL_DATA_PROPERTY_NAME, displayName);
                tblPropertyNamesModel.setValue(TBL_DATA_VALUE, (String) defaultValues.get(actualPropertyName));
                tblPropertyNamesModel.setSelectionVisible(counter, true);
                tblPropertyNamesModel.setRowSelected(!serverProperties.containsKey(actualPropertyName));
                cache.add(name);
            }
            szCache.setValue(cache);
        } catch (AMConsoleException e) {
            setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
        }
    }
}
Also used : SerializedField(com.sun.identity.console.components.view.html.SerializedField) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) ServerSiteModel(com.sun.identity.console.service.model.ServerSiteModel) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) Map(java.util.Map)

Example 37 with SerializedField

use of com.sun.identity.console.components.view.html.SerializedField in project OpenAM by OpenRock.

the class ServerConfigInheritViewBean method handleButton1Request.

/**
     * Handles save profile request.
     *
     * @param event Request invocation event
     */
public void handleButton1Request(RequestInvocationEvent event) throws ModelControlException {
    submitCycle = true;
    CCActionTable table = (CCActionTable) getChild(TBL_PROPERTY_NAMES);
    table.restoreStateData();
    Integer[] selected = tblPropertyNamesModel.getSelectedRows();
    SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
    List list = (List) szCache.getSerializedObj();
    Set toInherit = new HashSet(selected.length * 2);
    for (int i = 0; i < selected.length; i++) {
        String name = (String) list.get(selected[i].intValue());
        toInherit.add(ServerEditViewBeanBase.getActualPropertyName(name));
    }
    Set notToInherit = new HashSet(list.size() * 2);
    for (Iterator i = list.iterator(); i.hasNext(); ) {
        String name = (String) i.next();
        notToInherit.add(ServerEditViewBeanBase.getActualPropertyName(name));
    }
    notToInherit.removeAll(toInherit);
    try {
        ServerSiteModel model = (ServerSiteModel) getModel();
        String serverName = (String) getPageSessionAttribute(ServerEditViewBeanBase.PG_ATTR_SERVER_NAME);
        model.updateServerConfigInheritance(serverName, toInherit, notToInherit);
        setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "servercfg.inheritance.updated");
    } 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) Iterator(java.util.Iterator) ServerSiteModel(com.sun.identity.console.service.model.ServerSiteModel) 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 38 with SerializedField

use of com.sun.identity.console.components.view.html.SerializedField in project OpenAM by OpenRock.

the class ServerConfigInheritViewBean method createChild.

protected View createChild(String name) {
    View view = null;
    if (name.equals(TBL_PROPERTY_NAMES)) {
        SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
        populatePropertyNameTableModel((List) szCache.getSerializedObj());
        view = new CCActionTable(this, tblPropertyNamesModel, name);
    } else if (name.equals(PGTITLE_THREE_BTNS)) {
        view = new CCPageTitle(this, ptModel, name);
    } else if (tblPropertyNamesModel.isChildSupported(name)) {
        view = tblPropertyNamesModel.createChild(this, name);
    } else if (ptModel.isChildSupported(name)) {
        view = ptModel.createChild(this, name);
    } else if (name.equals(CHILD_STATICTEXT)) {
        view = new CCStaticTextField(this, name, null);
    } else {
        view = super.createChild(name);
    }
    return view;
}
Also used : SerializedField(com.sun.identity.console.components.view.html.SerializedField) CCActionTable(com.sun.web.ui.view.table.CCActionTable) View(com.iplanet.jato.view.View) CCPageTitle(com.sun.web.ui.view.pagetitle.CCPageTitle) CCStaticTextField(com.sun.web.ui.view.html.CCStaticTextField)

Example 39 with SerializedField

use of com.sun.identity.console.components.view.html.SerializedField in project OpenAM by OpenRock.

the class ServerSiteViewBean method populateSiteTableModel.

private void populateSiteTableModel(Map siteToURL) {
    tblSiteModel.clearAll();
    SerializedField szCache = (SerializedField) getChild(SZ_CACHE_1);
    SerializedField szCacheSite = (SerializedField) getChild(SZ_CACHE_SITE);
    ServerSiteModel model = (ServerSiteModel) getModel();
    tblServerModel.setMaxRows(model.getPageSize());
    HashMap cacheSite = new HashMap();
    ArrayList cache = new ArrayList();
    if ((siteToURL != null) && !siteToURL.isEmpty()) {
        int counter = 0;
        for (Iterator iter = siteToURL.keySet().iterator(); iter.hasNext(); counter++) {
            if (counter > 0) {
                tblSiteModel.appendRow();
            }
            String name = (String) iter.next();
            String[] params = (String[]) siteToURL.get(name);
            String url = params[0];
            String assigned = params[1];
            tblSiteModel.setValue(TBL_DATA_SITE_ACTION_HREF, stringToHex(name));
            tblSiteModel.setValue(TBL_DATA_SITE_NAME, name);
            tblSiteModel.setValue(TBL_DATA_SITE_URL, url);
            tblSiteModel.setValue(TBL_DATA_SITE_SERVERS, assigned);
            tblSiteModel.setSelectionVisible(counter, true);
            cacheSite.put(name, params);
            cache.add(name);
        }
        szCacheSite.setValue(cacheSite);
        szCache.setValue(cache);
    } else {
        szCache.setValue(null);
        szCacheSite.setValue(null);
    }
}
Also used : SerializedField(com.sun.identity.console.components.view.html.SerializedField) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) ServerSiteModel(com.sun.identity.console.service.model.ServerSiteModel)

Example 40 with SerializedField

use of com.sun.identity.console.components.view.html.SerializedField in project OpenAM by OpenRock.

the class STSHomeViewBean method populateRestSTSTableModel.

private void populateRestSTSTableModel(Set<String> publishedInstances) {
    tblModelRestSTSInstances.clearAll();
    SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
    Map<String, Set<String>> cacheMap = (Map<String, Set<String>>) szCache.getSerializedObj();
    if (cacheMap == null) {
        cacheMap = new HashMap<>();
    }
    if ((publishedInstances != null) && !publishedInstances.isEmpty()) {
        boolean firstEntry = true;
        for (String instanceName : publishedInstances) {
            if (firstEntry) {
                firstEntry = false;
            } else {
                tblModelRestSTSInstances.appendRow();
            }
            tblModelRestSTSInstances.setValue(TBL_REST_STS_INSTANCES_DATA_NAME, instanceName);
            tblModelRestSTSInstances.setValue(TBL_REST_STS_INSTANCES_DATA_ACTION_HREF, instanceName);
        }
        cacheMap.put(REST_STS_PUBLISHED_INSTANCES_CACHE_KEY, publishedInstances);
        szCache.setValue(cacheMap);
    } else {
        szCache.setValue(null);
    }
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) SerializedField(com.sun.identity.console.components.view.html.SerializedField) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

SerializedField (com.sun.identity.console.components.view.html.SerializedField)57 ArrayList (java.util.ArrayList)33 List (java.util.List)31 CCActionTable (com.sun.web.ui.view.table.CCActionTable)28 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)19 Iterator (java.util.Iterator)19 HashSet (java.util.HashSet)17 Set (java.util.Set)17 Map (java.util.Map)15 HashMap (java.util.HashMap)14 View (com.iplanet.jato.view.View)10 SMSubConfig (com.sun.identity.console.base.model.SMSubConfig)9 CCPageTitle (com.sun.web.ui.view.pagetitle.CCPageTitle)9 CCActionTableModel (com.sun.web.ui.model.CCActionTableModel)8 AgentsModel (com.sun.identity.console.agentconfig.model.AgentsModel)6 ServerSiteModel (com.sun.identity.console.service.model.ServerSiteModel)6 EntitiesModel (com.sun.identity.console.idm.model.EntitiesModel)5 IdRepoException (com.sun.identity.idm.IdRepoException)4 SSOToken (com.iplanet.sso.SSOToken)3 AMPropertySheet (com.sun.identity.console.base.AMPropertySheet)3