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();
}
}
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();
}
}
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();
}
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();
}
}
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());
}
}
Aggregations