use of com.sun.identity.console.policy.model.PolicyModel in project OpenAM by OpenRock.
the class PolicyReferralEditViewBean method getBreadCrumbDisplayName.
protected String getBreadCrumbDisplayName() {
PolicyModel model = (PolicyModel) getModel();
try {
CachedPolicy cachedPolicy = getCachedPolicy();
String[] arg = { cachedPolicy.getTrackPolicyName() };
return MessageFormat.format(model.getLocalizedString("breadcrumbs.editPolicy"), (Object[]) arg);
} catch (AMConsoleException e) {
debug.warning("PolicyReferralEditViewBean.getBreadCrumbDisplayName", e);
// Bread Crumb will not be set if cached policy cannot be located.
return "";
}
}
use of com.sun.identity.console.policy.model.PolicyModel in project OpenAM by OpenRock.
the class PolicyReferralEditViewBean 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("PolicyReferralEditViewBean.handleButton1Request", e);
redirectToStartURL();
}
}
use of com.sun.identity.console.policy.model.PolicyModel in project OpenAM by OpenRock.
the class PolicyReferralEditViewBean 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("PolicyReferralEditViewBean.handleButton2Request", e);
redirectToStartURL();
}
}
use of com.sun.identity.console.policy.model.PolicyModel in project OpenAM by OpenRock.
the class PolicyNormalAddViewBean 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 {
reconstructPolicy();
CachedPolicy cachedPolicy = getCachedPolicy();
PolicyModel model = (PolicyModel) getModel();
String name = cachedPolicy.getPolicy().getName();
if (name.equals(model.getLocalizedString("policy.create.name"))) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", model.getLocalizedString("policy.name.change"));
forwardTo();
} else {
try {
model.createPolicy(currentRealm, cachedPolicy.getPolicy());
backTrail();
forwardToPolicyViewBean();
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
forwardTo();
}
}
} catch (AMConsoleException e) {
redirectToStartURL();
}
}
use of com.sun.identity.console.policy.model.PolicyModel 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();
}
}
Aggregations