Search in sources :

Example 41 with SerializedField

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

the class STSHomeViewBean method getPublishedInstancesFromCache.

private Set<String> getPublishedInstancesFromCache(String cacheKey) {
    SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
    Map<String, Set<String>> instancesCache = (Map<String, Set<String>>) szCache.getSerializedObj();
    if (instancesCache != null) {
        return instancesCache.get(cacheKey);
    } else {
        return Collections.emptySet();
    }
}
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)

Example 42 with SerializedField

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

the class SMProfileViewBean method createChild.

/**
     * Creates user interface components used by this view bean.
     *
     * @param name of component
     * @return child component
     */
protected View createChild(String name) {
    View view = null;
    if (name.equals(TBL_SESSIONS)) {
        SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
        populateTableModel((List) szCache.getSerializedObj());
        view = new CCActionTable(this, tblModel, name);
    } else if (name.equals(PAGETITLE)) {
        view = new CCPageTitle(this, ptModel, name);
    } else if (tblModel.isChildSupported(name)) {
        view = tblModel.createChild(this, name);
    } else if (name.equals(CHILD_SERVER_NAME_MENU)) {
        view = new CCDropDownMenu(this, name, null);
    } else if (name.equals(LOGOUT_URL)) {
        return new CCStaticTextField(this, LOGOUT_URL, "");
    } else if (name.equals(CHILD_SERVER_NAME_HREF)) {
        view = new CCHref(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) CCHref(com.sun.web.ui.view.html.CCHref) View(com.iplanet.jato.view.View) CCPageTitle(com.sun.web.ui.view.pagetitle.CCPageTitle) CCDropDownMenu(com.sun.web.ui.view.html.CCDropDownMenu) CCStaticTextField(com.sun.web.ui.view.html.CCStaticTextField)

Example 43 with SerializedField

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

the class AgentsViewBean method populateTableModelEx.

private void populateTableModelEx() {
    if (!tblModelPopulated) {
        tblModelPopulated = true;
        SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
        Map cache = (Map) szCache.getSerializedObj();
        if ((cache != null) && !cache.isEmpty()) {
            AgentsModel model = (AgentsModel) getModel();
            SSOToken ssoToken = model.getUserSSOToken();
            List cacheAgents = (List) cache.get(CACHE_AGENTS);
            List cacheAgentGroups = (List) cache.get(CACHE_AGENT_GROUPS);
            Map mapCache = new HashMap(4);
            if ((cacheAgents != null) && !cacheAgents.isEmpty()) {
                List list = new ArrayList(cacheAgents.size());
                for (Iterator i = cacheAgents.iterator(); i.hasNext(); ) {
                    String id = (String) i.next();
                    try {
                        list.add(IdUtils.getIdentity(ssoToken, id));
                    } catch (IdRepoException e) {
                    //ignore since ID is not found.
                    }
                }
                mapCache.put(CACHE_AGENTS, list);
            }
            if ((cacheAgentGroups != null) && !cacheAgentGroups.isEmpty()) {
                List list = new ArrayList(cacheAgentGroups.size());
                for (Iterator i = cacheAgentGroups.iterator(); i.hasNext(); ) {
                    String id = (String) i.next();
                    try {
                        list.add(IdUtils.getIdentity(ssoToken, id));
                    } catch (IdRepoException e) {
                    //ignore since ID is not found.
                    }
                }
                mapCache.put(CACHE_AGENT_GROUPS, list);
            }
            populateTableModel(mapCache);
        }
    }
}
Also used : SSOToken(com.iplanet.sso.SSOToken) SerializedField(com.sun.identity.console.components.view.html.SerializedField) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) IdRepoException(com.sun.identity.idm.IdRepoException) List(java.util.List) ArrayList(java.util.ArrayList) AgentsModel(com.sun.identity.console.agentconfig.model.AgentsModel) Map(java.util.Map) HashMap(java.util.HashMap)

Example 44 with SerializedField

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

the class AgentsViewBean method handleTblButtonGroupDeleteRequest.

/**
     * Deletes agent groups.
     *
     * @param event Request Invocation Event.
     * @throws ModelControlException if table model cannot be restored.
     */
public void handleTblButtonGroupDeleteRequest(RequestInvocationEvent event) throws ModelControlException {
    CCActionTable table = (CCActionTable) getChild(TBL_SEARCH_GROUP);
    table.restoreStateData();
    Integer[] selected = tblGroupModel.getSelectedRows();
    Set names = new HashSet(selected.length * 2);
    SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
    Map mapCache = (Map) szCache.getSerializedObj();
    List cache = (List) mapCache.get(CACHE_AGENT_GROUPS);
    for (int i = 0; i < selected.length; i++) {
        names.add((String) cache.get(selected[i].intValue()));
    }
    try {
        AgentsModel model = (AgentsModel) getModel();
        String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
        model.deleteAgentGroups(curRealm, names);
        if (selected.length == 1) {
            setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", model.getLocalizedString("agent.groups.message.deleted"));
        } else {
            setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", model.getLocalizedString("agent.groups.message.deleted.pural"));
        }
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }
    forwardTo();
}
Also used : Set(java.util.Set) TreeSet(java.util.TreeSet) HashSet(java.util.HashSet) SerializedField(com.sun.identity.console.components.view.html.SerializedField) List(java.util.List) ArrayList(java.util.ArrayList) AgentsModel(com.sun.identity.console.agentconfig.model.AgentsModel) CCActionTable(com.sun.web.ui.view.table.CCActionTable) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) Map(java.util.Map) HashMap(java.util.HashMap) HashSet(java.util.HashSet)

Example 45 with SerializedField

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

the class AgentsViewBean method handleTblButtonDeleteRequest.

/**
     * Deletes agents.
     *
     * @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();
    Set names = new HashSet(selected.length * 2);
    SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
    Map mapCache = (Map) szCache.getSerializedObj();
    List cache = (List) mapCache.get(CACHE_AGENTS);
    for (int i = 0; i < selected.length; i++) {
        names.add((String) cache.get(selected[i].intValue()));
    }
    try {
        AgentsModel model = (AgentsModel) getModel();
        String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
        model.deleteAgents(curRealm, names);
        if (selected.length == 1) {
            setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", model.getLocalizedString("agents.message.deleted"));
        } else {
            setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", model.getLocalizedString("agents.message.deleted.pural"));
        }
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }
    forwardTo();
}
Also used : Set(java.util.Set) TreeSet(java.util.TreeSet) HashSet(java.util.HashSet) SerializedField(com.sun.identity.console.components.view.html.SerializedField) List(java.util.List) ArrayList(java.util.ArrayList) AgentsModel(com.sun.identity.console.agentconfig.model.AgentsModel) CCActionTable(com.sun.web.ui.view.table.CCActionTable) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) Map(java.util.Map) HashMap(java.util.HashMap) HashSet(java.util.HashSet)

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