use of com.sun.identity.console.base.AMPostViewBean in project OpenAM by OpenRock.
the class AgentProfileViewBean method handleButton1Request.
/**
* Handles Save button click.
*
* @param event Request Invocation Event.
* @throws ModelControlException if cannot access to framework model.
*/
public void handleButton1Request(RequestInvocationEvent event) throws ModelControlException {
submitCycle = true;
boolean bRefresh = false;
AgentsModel model = (AgentsModel) getModel();
String universalId = (String) getPageSessionAttribute(UNIVERSAL_ID);
String type = getAgentType();
String choice = (String) getPageSessionAttribute(AgentsViewBean.LOCAL_OR_NOT);
try {
Map values = getFormValues();
if (checkAgentType(type)) {
if (!isGroup && !is2dot2Agent() && !isAgentAuthenticator() && (choice != null) && !choice.equals(AgentsViewBean.PROP_LOCAL)) {
for (Iterator i = inheritedPropertyNames.iterator(); i.hasNext(); ) {
values.remove(i.next());
}
if (type.equals(AgentsViewBean.DEFAULT_ID_TYPE)) {
Iterator itr = values.keySet().iterator();
while (itr.hasNext()) {
String name = (String) itr.next();
Set v = (Set) values.get(name);
if ((v != null) && !v.isEmpty() && (v.size() == 1)) {
Iterator itr2 = v.iterator();
while (itr2.hasNext()) {
String subv = (String) itr2.next();
subv.trim();
if (subv.length() == 0) {
values.put(name, null);
break;
}
}
}
}
}
}
} else {
if (!isGroup && !is2dot2Agent() && !isAgentAuthenticator()) {
for (Iterator i = inheritedPropertyNames.iterator(); i.hasNext(); ) {
values.remove(i.next());
}
}
}
model.setAttributeValues(universalId, values);
String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
if (checkAgentType(type)) {
if (!isGroup && !is2dot2Agent() && isFirstTab() && !isAgentAuthenticator() && (choice != null) && !choice.equals(AgentsViewBean.PROP_LOCAL)) {
String agentGroup = getDisplayFieldStringValue(CHILD_AGENT_GROUP);
bRefresh = model.setGroup(curRealm, universalId, agentGroup);
String status = getDisplayFieldStringValue(AgentsViewBean.ATTR_CONFIG_REPO);
if (status.equals("local")) {
setPageSessionAttribute(AgentsViewBean.LOCAL_OR_NOT, AgentsViewBean.PROP_LOCAL);
bRefresh = true;
}
}
} else {
if (!isGroup && !is2dot2Agent() && !isAgentAuthenticator() && isFirstTab()) {
String agentGroup = getDisplayFieldStringValue(CHILD_AGENT_GROUP);
bRefresh = model.setGroup(curRealm, universalId, agentGroup);
}
}
setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "message.updated");
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
bRefresh = false;
}
if (bRefresh) {
setPageSessionAttribute(UPDATED_PROFILE, "true");
AMPostViewBean vb = (AMPostViewBean) getViewBean(AMPostViewBean.class);
passPgSessionMap(vb);
String url = this.getDefaultDisplayURL();
int idx = url.indexOf("/", 1);
url = ".." + url.substring(idx);
vb.setTargetViewBeanURL(url);
vb.forwardTo(getRequestContext());
} else {
forwardTo();
}
}
use of com.sun.identity.console.base.AMPostViewBean in project OpenAM by OpenRock.
the class EntityEditViewBean method handleMembersViewForwarding.
private void handleMembersViewForwarding(int nodeID, EntitiesModel model) {
String type = (String) getPageSessionAttribute(ENTITY_TYPE);
String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
try {
Set memberOfs = model.getIdTypeMemberOf(curRealm, type);
IdType idType = getIdType(nodeID);
if (idType != null) {
/*
* 20050328 Dennis
* bug 6246346
*/
String viewURL = null;
if (memberOfs.contains(idType)) {
viewURL = "../idm/EntityMembership";
} else {
viewURL = (model.canAddMember(curRealm, type, idType.getName())) ? "../idm/EntityMembers" : "../idm/EntityMembersFilteredIdentity";
}
AMPostViewBean vb = (AMPostViewBean) getViewBean(AMPostViewBean.class);
setPageSessionAttribute(PG_SESSION_MEMBER_TYPE, idType.getName());
passPgSessionMap(vb);
vb.setTargetViewBeanURL(viewURL);
vb.forwardTo(getRequestContext());
} else {
forwardTo();
}
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
forwardTo();
}
}
use of com.sun.identity.console.base.AMPostViewBean in project OpenAM by OpenRock.
the class SubSchemaTypeSelectViewBean method handleButton2Request.
/**
* Handles cancel request.
*
* @param event Request invocation event
*/
public void handleButton2Request(RequestInvocationEvent event) {
List urls = (List) getPageSessionAttribute(AMServiceProfile.PG_SESSION_PROFILE_VIEWBEANS);
String url = (String) urls.remove(0);
AMPostViewBean vb = (AMPostViewBean) getViewBean(AMPostViewBean.class);
backTrail();
passPgSessionMap(vb);
vb.setTargetViewBeanURL(url);
vb.forwardTo(getRequestContext());
}
use of com.sun.identity.console.base.AMPostViewBean in project OpenAM by OpenRock.
the class SubConfigAddViewBean method backToProfileViewBean.
private void backToProfileViewBean() {
List urls = (List) getPageSessionAttribute(AMServiceProfile.PG_SESSION_PROFILE_VIEWBEANS);
String url = (String) urls.remove(0);
AMPostViewBean vb = (AMPostViewBean) getViewBean(AMPostViewBean.class);
backTrail();
passPgSessionMap(vb);
vb.setTargetViewBeanURL(url);
vb.forwardTo(getRequestContext());
}
Aggregations