Search in sources :

Example 11 with AgentsModel

use of com.sun.identity.console.agentconfig.model.AgentsModel in project OpenAM by OpenRock.

the class AgentsViewBean method beginDisplay.

/**
     * Sets the agent title and populates the agent and agent group
     * action table.
     *
     * @param event Display Event.
     * @throws ModelControlException if cannot access to framework model.
     */
public void beginDisplay(DisplayEvent event) throws ModelControlException {
    super.beginDisplay(event, false);
    resetButtonState(TBL_BUTTON_DELETE);
    AgentsModel model = (AgentsModel) getModel();
    String agentType = getDisplayIDType();
    Object[] param = { agentType };
    ptModel.setPageTitleText(model.getLocalizedString("agenttype." + agentType));
    ptModel.setPageTitleHelpMessage(model.getLocalizedString("agenttype." + agentType + ".help"));
    tblModel.setTitle(MessageFormat.format(model.getLocalizedString("table.agents.title.name"), param));
    tblModel.setTitleLabel(MessageFormat.format(model.getLocalizedString("table.agents.summary"), param));
    tblModel.setSummary(MessageFormat.format(model.getLocalizedString("table.agents.summary"), param));
    tblGroupModel.setTitle(MessageFormat.format(model.getLocalizedString("table.agent.groups.title.name"), param));
    tblGroupModel.setTitleLabel(MessageFormat.format(model.getLocalizedString("table.agent.groups.summary"), param));
    tblGroupModel.setSummary(MessageFormat.format(model.getLocalizedString("table.agent.groups.summary"), param));
    getAgentNames();
    CCButton b = (CCButton) getChild(TBL_BUTTON_DELETE);
    b.setDisabled(true);
    b = (CCButton) getChild(TBL_BUTTON_DELETE_GROUP);
    b.setDisabled(true);
}
Also used : CCButton(com.sun.web.ui.view.html.CCButton) AgentsModel(com.sun.identity.console.agentconfig.model.AgentsModel)

Example 12 with AgentsModel

use of com.sun.identity.console.agentconfig.model.AgentsModel in project OpenAM by OpenRock.

the class GenericAgentProfileViewBean method createTabModel.

protected void createTabModel() {
    String agentType = getAgentType();
    if (isLocalConfig(agentType)) {
        agentType = AgentsViewBean.AGENT_2_2;
    }
    if (agentType != null) {
        super.createTabModel();
        AgentsModel model = (AgentsModel) getModel();
        AgentTabManager mgr = AgentTabManager.getInstance();
        List tabs = mgr.getTabs(agentType);
        if ((tabs != null) && !tabs.isEmpty()) {
            for (int i = 0; i < tabs.size(); i++) {
                String tabName = (String) tabs.get(i);
                tabModel.addNode(new CCNavNode(Integer.parseInt(TAB_PREFIX + i), model.getLocalizedString("tab.label." + agentType + "." + tabName), "", ""));
            }
        } else {
            tabModel.addNode(new CCNavNode(TAB_GENERAL_ID, "tab.general", "", ""));
        }
        String group = (String) getPageSessionAttribute(IS_GROUP);
        if ((group != null) && group.equals("true")) {
            tabModel.addNode(new CCNavNode(TAB_GROUP_ID, "tab.group", "", ""));
        }
    }
}
Also used : CCNavNode(com.sun.web.ui.model.CCNavNode) List(java.util.List) AgentsModel(com.sun.identity.console.agentconfig.model.AgentsModel)

Example 13 with AgentsModel

use of com.sun.identity.console.agentconfig.model.AgentsModel 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 14 with AgentsModel

use of com.sun.identity.console.agentconfig.model.AgentsModel in project OpenAM by OpenRock.

the class GenericAgentProfileViewBean method createPropertySheetModel.

protected AMPropertySheetModel createPropertySheetModel(String type) {
    String agentType = getAgentType();
    AgentsModel model = (AgentsModel) getModel();
    String tabName = (String) getPageSessionAttribute(PS_TABNAME);
    String choice = (String) getPageSessionAttribute(AgentsViewBean.LOCAL_OR_NOT);
    AgentPropertyXMLBuilder blder = null;
    try {
        if (isLocalConfig(agentType)) {
            blder = new AgentPropertyXMLBuilder(agentType, isGroup, true, tabName, model);
        } else {
            blder = new AgentPropertyXMLBuilder(agentType, isGroup, is2dot2Agent() || isAgentAuthenticator(), tabName, model);
        }
        attributeSchemas = blder.getAttributeSchemas();
        return new AMPropertySheetModel(blder.getXML(inheritedPropertyNames, choice));
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    } catch (SMSException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    } catch (SSOException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }
    return null;
}
Also used : SMSException(com.sun.identity.sm.SMSException) AMPropertySheetModel(com.sun.identity.console.base.model.AMPropertySheetModel) SSOException(com.iplanet.sso.SSOException) AgentsModel(com.sun.identity.console.agentconfig.model.AgentsModel) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) AgentPropertyXMLBuilder(com.sun.identity.console.property.AgentPropertyXMLBuilder)

Example 15 with AgentsModel

use of com.sun.identity.console.agentconfig.model.AgentsModel in project OpenAM by OpenRock.

the class GenericAgentProfileViewBean method setDefaultValues.

protected void setDefaultValues(String type) throws AMConsoleException {
    if (propertySheetModel != null) {
        AgentsModel model = (AgentsModel) getModel();
        String universalId = (String) getPageSessionAttribute(UNIVERSAL_ID);
        try {
            if (!submitCycle) {
                String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
                // !isGroup should that we do not inherit value is
                // the identity is a group.
                Map attrValues = model.getAttributeValues(curRealm, universalId, !isGroup);
                removeAgentRootURLKey(attrValues);
                propertySheetModel.clear();
                AMPropertySheet prop = (AMPropertySheet) getChild(PROPERTY_ATTRIBUTE);
                prop.setAttributeValues(attrValues, model);
            }
        } catch (AMConsoleException e) {
            setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
            disableButton("button1", true);
        }
        String[] uuid = { universalId };
        propertySheetModel.setValues(PROPERTY_UUID, uuid, model);
    }
}
Also used : AMPropertySheet(com.sun.identity.console.base.AMPropertySheet) AgentsModel(com.sun.identity.console.agentconfig.model.AgentsModel) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) Map(java.util.Map)

Aggregations

AgentsModel (com.sun.identity.console.agentconfig.model.AgentsModel)25 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)18 Map (java.util.Map)10 HashMap (java.util.HashMap)8 SerializedField (com.sun.identity.console.components.view.html.SerializedField)6 ArrayList (java.util.ArrayList)6 Iterator (java.util.Iterator)6 List (java.util.List)6 Set (java.util.Set)6 HashSet (java.util.HashSet)5 TreeSet (java.util.TreeSet)5 AMIdentity (com.sun.identity.idm.AMIdentity)4 SSOException (com.iplanet.sso.SSOException)3 SSOToken (com.iplanet.sso.SSOToken)3 AMPropertySheet (com.sun.identity.console.base.AMPropertySheet)3 CCActionTable (com.sun.web.ui.view.table.CCActionTable)3 AMViewBeanBase (com.sun.identity.console.base.AMViewBeanBase)2 AMViewConfig (com.sun.identity.console.base.AMViewConfig)2 AMPropertySheetModel (com.sun.identity.console.base.model.AMPropertySheetModel)2 IdRepoException (com.sun.identity.idm.IdRepoException)2