use of com.sun.identity.console.policy.model.CachedPolicy in project OpenAM by OpenRock.
the class PolicyNormalEditViewBean method handleButton2Request.
/**
* Handles reset request.
*
* @param event Request invocation event
*/
public void handleButton2Request(RequestInvocationEvent event) {
PolicyModel model = (PolicyModel) getModel();
String cacheID = (String) getPageSessionAttribute(ProfileViewBeanBase.PG_SESSION_POLICY_CACHE_ID);
try {
CachedPolicy cachedPolicy = model.getCachedPolicy(cacheID);
String policyName = cachedPolicy.getTrackPolicyName();
String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
try {
cacheID = model.cachePolicy(curRealm, policyName);
setPageSessionAttribute(PolicyOpViewBeanBase.PG_SESSION_POLICY_CACHE_ID, cacheID);
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
}
forwardTo();
} catch (AMConsoleException e) {
debug.warning("PolicyNormalEditViewBean.handleButton2Request", e);
redirectToStartURL();
}
}
use of com.sun.identity.console.policy.model.CachedPolicy 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.CachedPolicy 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.CachedPolicy 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.CachedPolicy in project OpenAM by OpenRock.
the class PolicyOpViewBeanBase method handleTblResponseProvidersButtonDeleteRequest.
/**
* Handles delete response attribute request.
*
* @param event Request Invocation Event.
*/
public void handleTblResponseProvidersButtonDeleteRequest(RequestInvocationEvent event) throws ModelControlException {
CCActionTable table = (CCActionTable) getChild(TBL_RESPONSE_ATTRIBUTES);
table.restoreStateData();
try {
CachedPolicy cachedPolicy = getCachedPolicy();
Policy policy = cachedPolicy.getPolicy();
Integer[] selected = tblResponseProvidersModel.getSelectedRows();
for (int i = 0; i < selected.length; i++) {
tblResponseProvidersModel.setRowIndex(selected[i].intValue());
String responseProviderName = (String) tblResponseProvidersModel.getValue(TBL_RESPONSE_ATTRIBUTES_DATA_NAME);
policy.removeResponseProvider(responseProviderName);
}
cachedPolicy.setPolicyModified(true);
populateResponseProvidersTable();
forwardTo();
} catch (AMConsoleException e) {
debug.warning("PolicyOpViewBeanBase.handleTblResponseProvidersButtonDeleteRequest", e);
redirectToStartURL();
}
}
Aggregations