use of com.sun.identity.console.policy.model.PolicyModel in project OpenAM by OpenRock.
the class PolicyOpViewBeanBase method handleTblSubjectsEditLinkRequest.
public void handleTblSubjectsEditLinkRequest(RequestInvocationEvent event) throws ModelControlException {
PolicyModel model = (PolicyModel) getModel();
String name = hexToString((String) getDisplayFieldValue(TBL_SUBJECTS_ACTION_HREF));
setPageSessionAttribute(SubjectEditViewBean.CALLING_VIEW_BEAN, getClass().getName());
setPageSessionAttribute(SubjectEditViewBean.EDIT_SUBJECT_NAME, name);
try {
CachedPolicy cachedPolicy = getCachedPolicy();
Policy policy = cachedPolicy.getPolicy();
Subject subject = policy.getSubject(name);
String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
String subjectType = model.getSubjectTypeName(realmName, subject);
String viewBeanURL = model.getSubjectViewBeanURL(realmName, subjectType);
unlockPageTrail();
if ((viewBeanURL != null) && (viewBeanURL.trim().length() > 0)) {
forwardToSubjectURL(viewBeanURL, name, subjectType, realmName, "edit");
} else {
forwardToSubjectEditViewBean(model, realmName, name, subjectType);
}
} catch (NameNotFoundException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", model.getErrorString(e));
forwardTo();
} catch (AMConsoleException e) {
debug.warning("PolicyOpViewBeanBase.handleTblSubjectsEditLinkRequest", e);
redirectToStartURL();
}
}
use of com.sun.identity.console.policy.model.PolicyModel in project OpenAM by OpenRock.
the class PolicyOpViewBeanBase method handleTblRulesButtonAddRequest.
/**
* Handles add new rule request.
*
* @param event Request Invocation Event.
*/
public void handleTblRulesButtonAddRequest(RequestInvocationEvent event) throws ModelControlException {
PolicyModel model = (PolicyModel) getModel();
try {
if (!reconstructPolicy()) {
setPageSessionAttribute(SelectServiceTypeViewBean.CALLING_VIEW_BEAN, getClass().getName());
SelectServiceTypeViewBean vb = (SelectServiceTypeViewBean) getViewBean(SelectServiceTypeViewBean.class);
unlockPageTrail();
passPgSessionMap(vb);
vb.forwardTo(getRequestContext());
} else {
forwardTo();
}
} catch (AMConsoleException e) {
debug.warning("PolicyOpViewBeanBase.handleTblRulesButtonAddRequest", e);
redirectToStartURL();
}
}
use of com.sun.identity.console.policy.model.PolicyModel in project OpenAM by OpenRock.
the class PolicyOpViewBeanBase method handleTblSubjectsButtonAddRequest.
public void handleTblSubjectsButtonAddRequest(RequestInvocationEvent event) throws ModelControlException {
String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
PolicyModel model = (PolicyModel) getModel();
try {
if (!reconstructPolicy()) {
QueryResults queryResults = model.getActiveSubjectTypes(curRealm);
Map activeSubjectTypes = (Map) queryResults.getResults();
unlockPageTrail();
if (activeSubjectTypes.size() == 1) {
String subjectType = (String) activeSubjectTypes.keySet().iterator().next();
String viewBeanURL = model.getSubjectViewBeanURL(curRealm, subjectType);
removePageSessionAttribute(WIZARD);
setPageSessionAttribute(SubjectOpViewBeanBase.CALLING_VIEW_BEAN, getClass().getName());
if ((viewBeanURL != null) && (viewBeanURL.trim().length() > 0)) {
forwardToSubjectURL(viewBeanURL, "", subjectType, curRealm, "add");
} else {
forwardToSubjectAddViewBean(curRealm, subjectType);
}
} else {
setPageSessionAttribute(SelectSubjectTypeViewBean.CALLING_VIEW_BEAN, getClass().getName());
SelectSubjectTypeViewBean vb = (SelectSubjectTypeViewBean) getViewBean(SelectSubjectTypeViewBean.class);
setPageSessionAttribute(WIZARD, "true");
passPgSessionMap(vb);
vb.forwardTo(getRequestContext());
}
} else {
forwardTo();
}
} catch (AMConsoleException e) {
debug.warning("PolicyOpViewBeanBase.handleTblSubjectsButtonAddRequest", e);
redirectToStartURL();
}
}
use of com.sun.identity.console.policy.model.PolicyModel in project OpenAM by OpenRock.
the class PolicyOpViewBeanBase method populateResponseProvidersTable.
protected void populateResponseProvidersTable() throws AMConsoleException {
tblResponseProvidersModel.clearAll();
CachedPolicy cachedPolicy = getCachedPolicy();
Policy policy = cachedPolicy.getPolicy();
Set responseProviderNames = policy.getResponseProviderNames();
if ((responseProviderNames != null) && !responseProviderNames.isEmpty()) {
PolicyModel model = (PolicyModel) getModel();
String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
Map localizedRespAttrTypeNames = model.getActiveResponseProviderTypes(realmName);
boolean firstEntry = true;
for (Iterator i = responseProviderNames.iterator(); i.hasNext(); ) {
if (firstEntry) {
firstEntry = false;
} else {
tblResponseProvidersModel.appendRow();
}
try {
String name = (String) i.next();
ResponseProvider provider = policy.getResponseProvider(name);
tblResponseProvidersModel.setValue(TBL_RESPONSE_ATTRIBUTES_DATA_NAME, name);
String respAttrTypeName = model.getResponseProviderTypeName(realmName, provider);
String displayName = (String) localizedRespAttrTypeNames.get(respAttrTypeName);
if (displayName == null) {
displayName = respAttrTypeName;
}
tblResponseProvidersModel.setValue(TBL_RESPONSE_ATTRIBUTES_DATA_TYPE, displayName);
tblResponseProvidersModel.setValue(TBL_RESPONSE_ATTRIBUTES_ACTION_HREF, stringToHex(name));
} catch (NameNotFoundException e) {
debug.warning("PolicyOpViewBeanBase.populateResponseProvidersTable", e);
}
}
}
}
use of com.sun.identity.console.policy.model.PolicyModel in project OpenAM by OpenRock.
the class PolicyOpViewBeanBase method handleTblRulesEditLinkRequest.
/**
* Handles edit rule request.
*
* @param event Request Invocation Event.
*/
public void handleTblRulesEditLinkRequest(RequestInvocationEvent event) throws ModelControlException {
PolicyModel model = (PolicyModel) getModel();
String name = hexToString((String) getDisplayFieldValue(TBL_RULES_ACTION_HREF));
setPageSessionAttribute(RuleEditViewBean.CALLING_VIEW_BEAN, getClass().getName());
setPageSessionAttribute(RuleEditViewBean.EDIT_RULE_NAME, name);
try {
CachedPolicy cachedPolicy = getCachedPolicy();
Policy policy = cachedPolicy.getPolicy();
Rule rule = policy.getRule(name);
RuleEditViewBean vb = null;
String resName = rule.getResourceName();
if ((resName == null) || (resName.length() == 0)) {
vb = (RuleNoResourceEditViewBean) getViewBean(RuleNoResourceEditViewBean.class);
setPageSessionAttribute(RuleOpViewBeanBase.WITH_RESOURCE, Boolean.FALSE);
} else {
String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
String serviceType = rule.getServiceTypeName();
if (model.canCreateNewResource(realmName, serviceType)) {
vb = (RuleEditViewBean) getViewBean(RuleEditViewBean.class);
} else {
vb = (RuleEditViewBean) getViewBean(RuleWithPrefixEditViewBean.class);
}
setPageSessionAttribute(RuleOpViewBeanBase.WITH_RESOURCE, Boolean.TRUE);
}
unlockPageTrail();
passPgSessionMap(vb);
vb.forwardTo(getRequestContext());
} catch (NameNotFoundException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", getModel().getErrorString(e));
forwardTo();
} catch (AMConsoleException e) {
debug.warning("PolicyOpViewBeanBase.handleTblRulesEditLinkRequest", e);
redirectToStartURL();
}
}
Aggregations