use of com.sun.identity.console.base.model.QueryResults in project OpenAM by OpenRock.
the class SubjectOpViewBeanBase method beginDisplay.
public void beginDisplay(DisplayEvent event) throws ModelControlException {
super.beginDisplay(event);
String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
String subjectType = (String) getPageSessionAttribute(SubjectOpViewBeanBase.PG_SESSION_SUBJECT_TYPE);
PolicyModel model = (PolicyModel) getModel();
Syntax syntax = model.getSubjectSyntax(realmName, subjectType);
int intSyntax = AMDisplayType.getDisplaySyntax(syntax);
if (!submitCycle) {
String subjectName = (String) getPageSessionAttribute(SubjectOpViewBeanBase.PG_SESSION_SUBJECT_NAME);
propertySheetModel.setValue(SYNTAX, Integer.toString(intSyntax));
propertySheetModel.setValue(SUBJECT_NAME, subjectName);
propertySheetModel.setValue(SUBJECT_TYPE, subjectType);
QueryResults qr = model.getActiveSubjectTypes(realmName);
Map map = (Map) qr.getResults();
String i18nName = (String) map.get(subjectType);
propertySheetModel.setValue(SUBJECT_TYPE_NAME, i18nName);
propertySheetModel.setValue(EXCLUSIVE, isSubjectExclusive() ? "true" : "false");
}
if (intSyntax == AMDisplayType.SYNTAX_MULTIPLE_CHOICE) {
setAddRemoveModel();
}
}
use of com.sun.identity.console.base.model.QueryResults in project OpenAM by OpenRock.
the class SelectSubjectTypeViewBean method getTypeOptions.
protected OptionList getTypeOptions() {
PolicyModel model = (PolicyModel) getModel();
String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
QueryResults qr = model.getActiveSubjectTypes(curRealm);
String strError = qr.getStrError();
if ((strError != null) && (strError.length() > 0)) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", strError);
}
return createOptionList((Map) qr.getResults(), model.getUserLocale());
}
use of com.sun.identity.console.base.model.QueryResults in project OpenAM by OpenRock.
the class PolicyNormalViewBeanBase method beginDisplay.
public void beginDisplay(DisplayEvent event) throws ModelControlException {
super.beginDisplay(event);
try {
populateAttributes();
} catch (AMConsoleException e) {
//NO-OP
/* attribute values will not be populated if cached policy
* cannot be located.
*/
}
CCButton btn = (CCButton) getChild("tblSubjectsButtonDelete");
btn.setDisabled(true);
btn = (CCButton) getChild("tblResponseProvidersButtonDelete");
btn.setDisabled(true);
btn = (CCButton) getChild("tblConditionsButtonDelete");
btn.setDisabled(true);
PolicyModel model = (PolicyModel) getModel();
String realm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
QueryResults subjectsQuery = model.getActiveSubjectTypes(realm);
Map subjects = (Map) subjectsQuery.getResults();
if ((subjects == null) || subjects.isEmpty()) {
((CCButton) getChild("tblSubjectsButtonAdd")).setDisabled(true);
setDisplayFieldValue("tblSubjectsNote", model.getLocalizedString("policy.no.subject.types"));
} else {
setDisplayFieldValue("tblSubjectsNote", "");
}
Map conditions = model.getActiveConditionTypes(realm);
if ((conditions == null) || conditions.isEmpty()) {
((CCButton) getChild("tblConditionsButtonAdd")).setDisabled(true);
setDisplayFieldValue("tblConditionsNote", model.getLocalizedString("policy.no.condition.types"));
} else {
setDisplayFieldValue("tblConditionsNote", "");
}
Map responseProviders = model.getActiveResponseProviderTypes(realm);
if ((responseProviders == null) || responseProviders.isEmpty()) {
((CCButton) getChild("tblResponseProvidersButtonAdd")).setDisabled(true);
setDisplayFieldValue("tblResponseProvidersNote", model.getLocalizedString("policy.no.response.providers.types"));
} else {
setDisplayFieldValue("tblResponseProvidersNote", "");
}
}
use of com.sun.identity.console.base.model.QueryResults in project OpenAM by OpenRock.
the class PolicyOpViewBeanBase method populateSubjectsTable.
protected void populateSubjectsTable() throws AMConsoleException {
tblSubjectsModel.clearAll();
CachedPolicy cachedPolicy = getCachedPolicy();
Policy policy = cachedPolicy.getPolicy();
Set subjectsNames = policy.getSubjectNames();
if ((subjectsNames != null) && !subjectsNames.isEmpty()) {
PolicyModel model = (PolicyModel) getModel();
String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
QueryResults queryResults = model.getActiveSubjectTypes(realmName);
Map localizedSbjTypeNames = (Map) queryResults.getResults();
boolean firstEntry = true;
for (Iterator iter = subjectsNames.iterator(); iter.hasNext(); ) {
if (firstEntry) {
firstEntry = false;
} else {
tblSubjectsModel.appendRow();
}
try {
String name = (String) iter.next();
Subject subject = policy.getSubject(name);
tblSubjectsModel.setValue(TBL_SUBJECTS_DATA_NAME, name);
String sbjTypeName = model.getSubjectTypeName(realmName, subject);
String displayName = (String) localizedSbjTypeNames.get(sbjTypeName);
if (displayName == null) {
displayName = sbjTypeName;
}
tblSubjectsModel.setValue(TBL_SUBJECTS_DATA_TYPE, displayName);
tblSubjectsModel.setValue(TBL_SUBJECTS_ACTION_HREF, stringToHex(name));
} catch (NameNotFoundException e) {
debug.warning("PolicyOpViewBeanBase.populateSubjectsTable", e);
}
}
}
}
use of com.sun.identity.console.base.model.QueryResults 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();
}
}
Aggregations