Search in sources :

Example 21 with AgentsModel

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

the class AgentsViewBean method handleTblDataActionHrefRequest.

/**
     * Forwards request to edit agent view bean.
     *
     * @param event Request Invocation Event.
     */
public void handleTblDataActionHrefRequest(RequestInvocationEvent event) {
    AgentsModel model = (AgentsModel) getModel();
    String agentType = getDisplayIDType();
    String universalId = hexToString((String) getDisplayFieldValue(TBL_DATA_ACTION_HREF));
    setPageSessionAttribute(AgentProfileViewBean.UNIVERSAL_ID, universalId);
    SSOToken ssoToken = model.getUserSSOToken();
    String realm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
    StringTokenizer st = new StringTokenizer(universalId, "=,");
    st.nextToken();
    String agentName = st.nextToken();
    try {
        AMIdentity amid = new AMIdentity(ssoToken, agentName, IdType.AGENTONLY, realm, null);
        if (agentType.equals(AgentsViewBean.AGENT_WEB) || (agentType.equals(AgentsViewBean.DEFAULT_ID_TYPE))) {
            if (isPropertiesLocallyStored(amid)) {
                setPageSessionAttribute(LOCAL_OR_NOT, PROP_LOCAL);
            } else {
                setPageSessionAttribute(LOCAL_OR_NOT, PROP_CENTRAL);
            }
        }
        Class clazz = getAgentCustomizedViewBean(model.getAgentType(amid));
        AMViewBeanBase vb = (AMViewBeanBase) getViewBean(clazz);
        setPageSessionAttribute(PG_SESSION_SUPERCEDE_AGENT_TYPE, model.getAgentType(amid));
        removePageSessionAttribute(GenericAgentProfileViewBean.PS_TABNAME);
        passPgSessionMap(vb);
        vb.forwardTo(getRequestContext());
    } catch (IdRepoException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", model.getErrorString(e));
        forwardTo();
    } catch (SSOException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", model.getErrorString(e));
        forwardTo();
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", model.getErrorString(e));
        forwardTo();
    } catch (ClassNotFoundException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", model.getErrorString(e));
        forwardTo();
    }
}
Also used : AMViewBeanBase(com.sun.identity.console.base.AMViewBeanBase) StringTokenizer(java.util.StringTokenizer) SSOToken(com.iplanet.sso.SSOToken) AMIdentity(com.sun.identity.idm.AMIdentity) IdRepoException(com.sun.identity.idm.IdRepoException) SSOException(com.iplanet.sso.SSOException) AgentsModel(com.sun.identity.console.agentconfig.model.AgentsModel) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Example 22 with AgentsModel

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

the class AgentAddViewBean method handleButton1Request.

/**
     * Handles create request.
     *
     * @param event Request invocation event
     */
public void handleButton1Request(RequestInvocationEvent event) {
    AgentsModel model = (AgentsModel) getModel();
    String agentType = getAgentType();
    AMPropertySheet prop = (AMPropertySheet) getChild(PROPERTY_ATTRIBUTE);
    String agentName = (String) propertySheetModel.getValue(TF_NAME);
    agentName = agentName.trim();
    String password = (String) propertySheetModel.getValue(TF_PASSWORD);
    String passwordConfirm = (String) propertySheetModel.getValue(TF_PASSWORD_CONFIRM);
    password = password.trim();
    passwordConfirm = passwordConfirm.trim();
    String choice = (String) propertySheetModel.getValue(RADIO_CHOICE);
    if (password.length() > 0) {
        if (password.equals(passwordConfirm)) {
            try {
                String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
                if (agentType.equals(AgentConfiguration.AGENT_TYPE_J2EE) || agentType.equals(AgentConfiguration.AGENT_TYPE_WEB)) {
                    String agentURL = (String) propertySheetModel.getValue(TF_AGENT_URL);
                    agentURL = agentURL.trim();
                    if (choice.equals(AgentsViewBean.PROP_LOCAL)) {
                        model.createAgentLocal(curRealm, agentName, agentType, password, agentURL);
                    } else {
                        String serverURL = (String) propertySheetModel.getValue(TF_SERVER_URL);
                        serverURL = serverURL.trim();
                        model.createAgent(curRealm, agentName, agentType, password, serverURL, agentURL);
                    }
                } else {
                    model.createAgent(curRealm, agentName, agentType, password, choice);
                }
                forwardToAgentsViewBean();
            } catch (AMConsoleException e) {
                setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
                forwardTo();
            }
        } else {
            setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", model.getLocalizedString("agents.passwords.not.match"));
            forwardTo();
        }
    } else {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", model.getLocalizedString("agents.password.blank"));
        forwardTo();
    }
}
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)

Example 23 with AgentsModel

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

the class AgentConfigInheritViewBean 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();
    Map inherit = new HashMap();
    for (Iterator i = list.iterator(); i.hasNext(); ) {
        String name = (String) i.next();
        inherit.put(name, "0");
    }
    for (int i = 0; i < selected.length; i++) {
        String name = (String) list.get(selected[i].intValue());
        inherit.put(name, "1");
    }
    try {
        AgentsModel model = (AgentsModel) getModel();
        String universalId = (String) getPageSessionAttribute(AgentProfileViewBean.UNIVERSAL_ID);
        model.updateAgentConfigInheritance(universalId, inherit);
        setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "agentcfg.inheritance.updated");
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }
    forwardTo();
}
Also used : SerializedField(com.sun.identity.console.components.view.html.SerializedField) HashMap(java.util.HashMap) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) List(java.util.List) AgentsModel(com.sun.identity.console.agentconfig.model.AgentsModel) CCActionTable(com.sun.web.ui.view.table.CCActionTable) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) HashMap(java.util.HashMap) Map(java.util.Map)

Example 24 with AgentsModel

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

the class AgentGroupAddViewBean method handleButton1Request.

/**
     * Handles create request.
     *
     * @param event Request invocation event
     */
public void handleButton1Request(RequestInvocationEvent event) {
    AgentsModel model = (AgentsModel) getModel();
    String agentType = getAgentType();
    AMPropertySheet prop = (AMPropertySheet) getChild(PROPERTY_ATTRIBUTE);
    String agentGroupName = (String) propertySheetModel.getValue(TF_NAME);
    agentGroupName = agentGroupName.trim();
    String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
    try {
        if (agentType.equals(AgentConfiguration.AGENT_TYPE_J2EE) || agentType.equals(AgentConfiguration.AGENT_TYPE_WEB)) {
            String serverURL = (String) propertySheetModel.getValue(TF_SERVER_URL);
            serverURL = serverURL.trim();
            model.createAgentGroup(curRealm, agentGroupName, agentType, serverURL, null);
        } else {
            model.createAgentGroup(curRealm, agentGroupName, agentType);
        }
        forwardToAgentsViewBean();
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
        forwardTo();
    }
}
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)

Example 25 with AgentsModel

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

the class AgentGroupMembersViewBean method setAgentTitle.

protected void setAgentTitle() {
    AgentsModel model = (AgentsModel) getModel();
    String universalId = (String) getPageSessionAttribute(AgentProfileViewBean.UNIVERSAL_ID);
    String title = model.getLocalizedString("edit.agentconfig.group.members.title");
    try {
        String displayName = model.getDisplayName(universalId);
        Object[] param = { displayName };
        ptModel.setPageTitleText(MessageFormat.format(title, param));
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }
}
Also used : AgentsModel(com.sun.identity.console.agentconfig.model.AgentsModel) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

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