use of com.sun.identity.console.policy.model.CachedPolicy in project OpenAM by OpenRock.
the class PolicyOpViewBeanBase method beginDisplay.
public void beginDisplay(DisplayEvent event) throws ModelControlException {
super.beginDisplay(event);
try {
populateRulesTable();
CachedPolicy cachedPolicy = getCachedPolicy();
Policy policy = cachedPolicy.getPolicy();
String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
PolicyModel model = (PolicyModel) getModel();
CCButton btn = (CCButton) getChild("tblRulesButtonAdd");
if (!model.canCreateRule(policy, realmName)) {
btn.setDisabled(true);
}
btn = (CCButton) getChild("tblRulesButtonDelete");
btn.setDisabled(true);
Map serviceTypes = model.getServiceTypeNames();
if ((serviceTypes == null) || serviceTypes.isEmpty()) {
((CCButton) getChild("tblRulesButtonDelete")).setDisabled(true);
setDisplayFieldValue("tblRulesNote", model.getLocalizedString("policy.no.service.types"));
} else {
setDisplayFieldValue("tblRulesNote", "");
}
if (!isInlineAlertMessageSet() && cachedPolicy.isPolicyModified() && isProfilePage()) {
setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "policy.unsaved.message");
}
} catch (AMConsoleException e) {
CCButton btn = (CCButton) getChild("tblRulesButtonAdd");
btn.setDisabled(true);
btn = (CCButton) getChild("tblRulesButtonDelete");
btn.setDisabled(true);
}
}
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;
}
use of com.sun.identity.console.policy.model.CachedPolicy in project OpenAM by OpenRock.
the class PolicyOpViewBeanBase method handleTblResponseProvidersEditLinkRequest.
public void handleTblResponseProvidersEditLinkRequest(RequestInvocationEvent event) throws ModelControlException {
PolicyModel model = (PolicyModel) getModel();
String name = hexToString((String) getDisplayFieldValue(TBL_RESPONSE_ATTRIBUTES_ACTION_HREF));
setPageSessionAttribute(ResponseProviderEditViewBean.CALLING_VIEW_BEAN, getClass().getName());
setPageSessionAttribute(ResponseProviderEditViewBean.EDIT_RESPONSEPROVIDER_NAME, name);
try {
CachedPolicy cachedPolicy = getCachedPolicy();
Policy policy = cachedPolicy.getPolicy();
ResponseProvider provider = policy.getResponseProvider(name);
String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
String responseProviderType = model.getResponseProviderTypeName(realmName, provider);
String viewBeanURL = model.getResponseProviderViewBeanURL(realmName, responseProviderType);
unlockPageTrail();
if ((viewBeanURL != null) && (viewBeanURL.trim().length() > 0)) {
forwardToResponseProviderURL(viewBeanURL, name, responseProviderType, realmName, "edit");
} else {
forwardToResponseProviderEditViewBean(model, realmName, name, responseProviderType);
}
} catch (NameNotFoundException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", model.getErrorString(e));
forwardTo();
} catch (AMConsoleException e) {
debug.warning("PolicyOpViewBeanBase.handleTblResponseProvidersEditLinkRequest", e);
redirectToStartURL();
}
}
Aggregations