use of com.sun.identity.console.policy.model.PolicyModel in project OpenAM by OpenRock.
the class PolicyNormalEditViewBean method handleButton1Request.
/**
* Handles create policy request.
*
* @param event Request invocation event
*/
public void handleButton1Request(RequestInvocationEvent event) throws ModelControlException {
String currentRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
try {
if (reconstructPolicy()) {
// error message set in PolicyOpViewBeanBase
} else {
CachedPolicy cachedPolicy = getCachedPolicy();
PolicyModel model = (PolicyModel) getModel();
try {
model.replacePolicy(currentRealm, cachedPolicy.getPolicy());
setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "policy.modified.message");
cachedPolicy.setPolicyModified(false);
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
}
}
forwardTo();
} catch (AMConsoleException e) {
debug.warning("PolicyNormalEditViewBean.handleButton1Request", e);
redirectToStartURL();
}
}
use of com.sun.identity.console.policy.model.PolicyModel in project OpenAM by OpenRock.
the class PolicyNormalEditViewBean method getBreadCrumbDisplayName.
protected String getBreadCrumbDisplayName() {
try {
PolicyModel model = (PolicyModel) getModel();
CachedPolicy cachedPolicy = getCachedPolicy();
String[] arg = { cachedPolicy.getTrackPolicyName() };
return MessageFormat.format(model.getLocalizedString("breadcrumbs.editPolicy"), (Object[]) arg);
} catch (AMConsoleException e) {
debug.warning("PolicyNormalEditViewBean.getBreadCrumbDisplayName", e);
return "";
}
}
use of com.sun.identity.console.policy.model.PolicyModel in project OpenAM by OpenRock.
the class PolicyOpViewBeanBase method handleTblReferralsEditLinkRequest.
public void handleTblReferralsEditLinkRequest(RequestInvocationEvent event) throws ModelControlException {
PolicyModel model = (PolicyModel) getModel();
String name = hexToString((String) getDisplayFieldValue(TBL_REFERRALS_ACTION_HREF));
setPageSessionAttribute(ReferralEditViewBean.CALLING_VIEW_BEAN, getClass().getName());
setPageSessionAttribute(ReferralEditViewBean.EDIT_REFERRAL_NAME, name);
try {
CachedPolicy cachedPolicy = getCachedPolicy();
Policy policy = cachedPolicy.getPolicy();
Referral referral = policy.getReferral(name);
String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
String referralType = referral.getReferralTypeName();
String viewBeanURL = model.getReferralViewBeanURL(realmName, referralType);
unlockPageTrail();
if ((viewBeanURL != null) && (viewBeanURL.trim().length() > 0)) {
forwardToReferralURL(viewBeanURL, name, referralType, realmName, "edit");
} else {
forwardToReferralEditViewBean(model, realmName, name, referralType);
}
} catch (NameNotFoundException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", getModel().getErrorString(e));
forwardTo();
} catch (AMConsoleException e) {
debug.warning("PolicyOpViewBeanBase.handleTblReferralsEditLinkRequest", e);
redirectToStartURL();
}
}
use of com.sun.identity.console.policy.model.PolicyModel in project OpenAM by OpenRock.
the class PolicyOpViewBeanBase method handleTblResponseProvidersButtonAddRequest.
public void handleTblResponseProvidersButtonAddRequest(RequestInvocationEvent event) throws ModelControlException {
String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
PolicyModel model = (PolicyModel) getModel();
try {
if (!reconstructPolicy()) {
Map activeTypes = model.getActiveResponseProviderTypes(curRealm);
unlockPageTrail();
if (activeTypes.size() == 1) {
String respAttrType = (String) activeTypes.keySet().iterator().next();
String viewBeanURL = model.getResponseProviderViewBeanURL(curRealm, respAttrType);
removePageSessionAttribute(WIZARD);
setPageSessionAttribute(ResponseProviderOpViewBeanBase.CALLING_VIEW_BEAN, getClass().getName());
if ((viewBeanURL != null) && (viewBeanURL.trim().length() > 0)) {
forwardToResponseProviderURL(viewBeanURL, "", respAttrType, curRealm, "add");
} else {
forwardToResponseProviderAddViewBean(curRealm, respAttrType);
}
} else {
setPageSessionAttribute(SelectResponseProviderTypeViewBean.CALLING_VIEW_BEAN, getClass().getName());
SelectResponseProviderTypeViewBean vb = (SelectResponseProviderTypeViewBean) getViewBean(SelectResponseProviderTypeViewBean.class);
setPageSessionAttribute(WIZARD, "true");
passPgSessionMap(vb);
vb.forwardTo(getRequestContext());
}
} else {
forwardTo();
}
} catch (AMConsoleException e) {
debug.warning("PolicyOpViewBeanBase.handleTblResponseProvidersButtonAddRequest", e);
redirectToStartURL();
}
}
use of com.sun.identity.console.policy.model.PolicyModel in project OpenAM by OpenRock.
the class PolicyOpViewBeanBase method handleTblReferralsButtonAddRequest.
public void handleTblReferralsButtonAddRequest(RequestInvocationEvent event) throws ModelControlException {
String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
PolicyModel model = (PolicyModel) getModel();
try {
if (!reconstructPolicy()) {
unlockPageTrail();
Map activeReferralTypes = model.getActiveReferralTypes(curRealm);
if (activeReferralTypes.size() == 1) {
String referralType = (String) activeReferralTypes.keySet().iterator().next();
String viewBeanURL = model.getReferralViewBeanURL(curRealm, referralType);
removePageSessionAttribute(WIZARD);
setPageSessionAttribute(ReferralOpViewBeanBase.CALLING_VIEW_BEAN, getClass().getName());
if ((viewBeanURL != null) && (viewBeanURL.trim().length() > 0)) {
forwardToReferralURL(viewBeanURL, "", referralType, curRealm, "add");
} else {
forwardToReferralAddViewBean(referralType);
}
} else {
setPageSessionAttribute(SelectReferralTypeViewBean.CALLING_VIEW_BEAN, getClass().getName());
SelectReferralTypeViewBean vb = (SelectReferralTypeViewBean) getViewBean(SelectReferralTypeViewBean.class);
setPageSessionAttribute(WIZARD, "true");
passPgSessionMap(vb);
vb.forwardTo(getRequestContext());
}
} else {
forwardTo();
}
} catch (AMConsoleException e) {
debug.warning("PolicyOpViewBeanBase.handleTblReferralsButtonAddRequest", e);
redirectToStartURL();
}
}
Aggregations