use of com.sun.identity.policy.NameAlreadyExistsException 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.policy.NameAlreadyExistsException in project OpenAM by OpenRock.
the class ReferralAddViewBean method handleButton2Request.
/**
* Handles create policy request.
*
* @param event Request invocation event
*/
public void handleButton2Request(RequestInvocationEvent event) throws ModelControlException {
boolean forwarded = false;
submitCycle = true;
try {
Referral referral = createReferral();
if (referral != null) {
CachedPolicy cachedPolicy = getCachedPolicy();
Policy policy = cachedPolicy.getPolicy();
String name = (String) propertySheetModel.getValue(REFERRAL_NAME);
policy.addReferral(name, referral);
backTrail();
forwardToPolicyViewBean();
forwarded = 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 (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
} finally {
if (!forwarded) {
forwardTo();
}
}
}
use of com.sun.identity.policy.NameAlreadyExistsException in project OpenAM by OpenRock.
the class SubjectEditViewBean method handleButton1Request.
private void handleButton1Request(CachedPolicy cachedPolicy) throws ModelControlException {
submitCycle = true;
Subject deleted = null;
String origName = (String) getPageSessionAttribute(EDIT_SUBJECT_NAME);
Policy policy = cachedPolicy.getPolicy();
try {
Subject subject = createSubject();
if (subject != null) {
String name = (String) propertySheetModel.getValue(SUBJECT_NAME);
if (origName.equals(name)) {
policy.replaceSubject(name, subject, isExclusive());
} else {
deleted = policy.removeSubject(origName);
policy.addSubject(name, subject, isExclusive());
}
deleted = null;
setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "policy.subject.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.addSubject(origName, deleted);
} catch (NameAlreadyExistsException e) {
debug.warning("SubjectEditViewBean.handleButton1Request", e);
} catch (InvalidNameException e) {
debug.warning("SubjectEditViewBean.handleButton1Request", e);
}
}
}
forwardTo();
}
use of com.sun.identity.policy.NameAlreadyExistsException 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.policy.NameAlreadyExistsException in project OpenAM by OpenRock.
the class ConditionAddViewBean method handleButton2Request.
/**
* Handles create policy's condition request.
*
* @param event Request invocation event
*/
public void handleButton2Request(RequestInvocationEvent event) throws ModelControlException {
submitCycle = true;
try {
Condition condition = createCondition();
if (condition != null) {
CachedPolicy cachedPolicy = getCachedPolicy();
Policy policy = cachedPolicy.getPolicy();
String name = (String) propertySheetModel.getValue(CONDITION_NAME);
policy.addCondition(name, condition);
backTrail();
forwardToPolicyViewBean();
} else {
forwardTo();
}
} catch (NameAlreadyExistsException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", getModel().getErrorString(e));
forwardTo();
} catch (InvalidNameException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", getModel().getErrorString(e));
forwardTo();
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
forwardTo();
}
}
Aggregations