use of com.sun.identity.console.policy.model.CachedPolicy in project OpenAM by OpenRock.
the class ConditionEditViewBean method handleButton1Request.
private void handleButton1Request(CachedPolicy cachedPolicy) throws ModelControlException {
submitCycle = true;
boolean forwarded = false;
Condition deleted = null;
String origName = (String) getPageSessionAttribute(EDIT_CONDITION_NAME);
Policy policy = cachedPolicy.getPolicy();
try {
Condition condition = createCondition();
if (condition != null) {
String name = (String) propertySheetModel.getValue(CONDITION_NAME);
if (origName.equals(name)) {
policy.replaceCondition(name, condition);
} else {
deleted = policy.removeCondition(origName);
policy.addCondition(name, condition);
}
deleted = null;
setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "policy.condition.updated");
cachedPolicy.setPolicyModified(true);
}
} catch (NameAlreadyExistsException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", getModel().getErrorString(e));
} catch (InvalidNameException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", getModel().getErrorString(e));
} catch (NameNotFoundException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", getModel().getErrorString(e));
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
} finally {
if (deleted != null) {
try {
policy.addCondition(origName, deleted);
} catch (NameAlreadyExistsException e) {
debug.warning("ConditionEditViewBean.handleButton1Request", e);
} catch (InvalidNameException e) {
debug.warning("ConditionEditViewBean.handleButton1Request", e);
}
}
}
forwardTo();
}
use of com.sun.identity.console.policy.model.CachedPolicy in project OpenAM by OpenRock.
the class ResponseProviderEditViewBean method getDefaultValues.
protected Map getDefaultValues() {
Map values = null;
String providerName = (String) getPageSessionAttribute(ResponseProviderOpViewBeanBase.PG_SESSION_PROVIDER_NAME);
try {
CachedPolicy cachedPolicy = getCachedPolicy();
Policy policy = cachedPolicy.getPolicy();
ResponseProvider provider = policy.getResponseProvider(providerName);
values = provider.getProperties();
} catch (NameNotFoundException e) {
debug.warning("ResponseProviderEditViewBean.getDefaultValues", e);
} catch (AMConsoleException e) {
debug.warning("ResponseProviderEditViewBean.getDefaultValues", e);
}
return values;
}
use of com.sun.identity.console.policy.model.CachedPolicy in project OpenAM by OpenRock.
the class ResponseProviderOpViewBeanBase method getCachedPolicy.
protected CachedPolicy getCachedPolicy() throws AMConsoleException {
CachedPolicy policy = null;
String cacheID = (String) getPageSessionAttribute(ProfileViewBeanBase.PG_SESSION_POLICY_CACHE_ID);
if (cacheID != null) {
PolicyCache cache = PolicyCache.getInstance();
PolicyModel model = (PolicyModel) getModel();
policy = model.getCachedPolicy(cacheID);
}
return policy;
}
use of com.sun.identity.console.policy.model.CachedPolicy in project OpenAM by OpenRock.
the class ResponseProviderAddViewBean method handleButton2Request.
/**
* Handles create policy request.
*
* @param event Request invocation event
*/
public void handleButton2Request(RequestInvocationEvent event) throws ModelControlException {
boolean forwarded = false;
submitCycle = true;
try {
ResponseProvider provider = createResponseProvider();
if (provider != null) {
CachedPolicy cachedPolicy = getCachedPolicy();
Policy policy = cachedPolicy.getPolicy();
String name = (String) propertySheetModel.getValue(RESPONSEPROVIDER_NAME);
policy.addResponseProvider(name, provider);
backTrail();
forwardToPolicyViewBean();
forwarded = true;
}
} catch (NameAlreadyExistsException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", getModel().getErrorString(e));
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
}
if (!forwarded) {
forwardTo();
}
}
use of com.sun.identity.console.policy.model.CachedPolicy in project OpenAM by OpenRock.
the class ReferralEditViewBean method getDefaultValues.
protected Set getDefaultValues() {
Set values = null;
try {
CachedPolicy cachedPolicy = getCachedPolicy();
Policy policy = cachedPolicy.getPolicy();
String referralName = (String) getPageSessionAttribute(PG_SESSION_REFERRAL_NAME);
Referral referral = policy.getReferral(referralName);
values = referral.getValues();
} catch (NameNotFoundException e) {
debug.warning("ReferralEditViewBean.getDefaultValues", e);
} catch (AMConsoleException e) {
debug.warning("ReferralEditViewBean.getDefaultValues", e);
}
return values;
}
Aggregations