use of com.sun.identity.console.policy.model.CachedPolicy in project OpenAM by OpenRock.
the class SubjectEditViewBean method getDefaultValues.
protected Set getDefaultValues() {
Set values = null;
try {
CachedPolicy cachedPolicy = getCachedPolicy();
Policy policy = cachedPolicy.getPolicy();
String subjectName = (String) getPageSessionAttribute(SubjectOpViewBeanBase.PG_SESSION_SUBJECT_NAME);
Subject subject = policy.getSubject(subjectName);
values = subject.getValues();
} catch (NameNotFoundException e) {
debug.warning("SubjectEditViewBean.getDefaultValues", e);
} catch (AMConsoleException e) {
debug.warning("SubjectEditViewBean.getDefaultValues", e);
}
return values;
}
use of com.sun.identity.console.policy.model.CachedPolicy in project OpenAM by OpenRock.
the class SubjectAddViewBean method handleButton2Request.
/**
* Handles create policy's subject request.
*
* @param event Request invocation event
*/
public void handleButton2Request(RequestInvocationEvent event) throws ModelControlException {
boolean forwarded = false;
submitCycle = true;
bFilter = true;
try {
Subject subject = createSubject();
if (subject != null) {
CachedPolicy cachedPolicy = getCachedPolicy();
Policy policy = cachedPolicy.getPolicy();
String name = (String) propertySheetModel.getValue(SUBJECT_NAME);
policy.addSubject(name, subject, isExclusive());
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.console.policy.model.CachedPolicy in project OpenAM by OpenRock.
the class SubjectEditViewBean method isSubjectExclusive.
protected boolean isSubjectExclusive() {
boolean isExclusive = false;
try {
CachedPolicy cachedPolicy = getCachedPolicy();
Policy policy = cachedPolicy.getPolicy();
String subjectName = (String) getPageSessionAttribute(SubjectOpViewBeanBase.PG_SESSION_SUBJECT_NAME);
isExclusive = policy.isSubjectExclusive(subjectName);
} catch (NameNotFoundException e) {
debug.warning("SubjectEditViewBean.isSubjectExclusive", e);
} catch (AMConsoleException e) {
debug.warning("SubjectEditViewBean.isSubjectExclusive", e);
}
return isExclusive;
}
Aggregations