use of com.sun.identity.console.policy.model.PolicyModel in project OpenAM by OpenRock.
the class SubjectEditViewBean method getBreadCrumbDisplayName.
protected String getBreadCrumbDisplayName() {
PolicyModel model = (PolicyModel) getModel();
String origName = (String) getPageSessionAttribute(EDIT_SUBJECT_NAME);
String[] arg = { origName };
return MessageFormat.format(model.getLocalizedString("breadcrumbs.editSubject"), (Object[]) arg);
}
use of com.sun.identity.console.policy.model.PolicyModel 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.policy.model.PolicyModel in project OpenAM by OpenRock.
the class PolicyOpViewBeanBase method subjectHasValueSyntax.
private boolean subjectHasValueSyntax(String realmName, String subjectType) {
PolicyModel model = (PolicyModel) getModel();
Syntax syntax = model.getSubjectSyntax(realmName, subjectType);
int displaySyntax = AMDisplayType.getDisplaySyntax(syntax);
return (displaySyntax == AMDisplayType.SYNTAX_TEXT) || (displaySyntax == AMDisplayType.SYNTAX_SINGLE_CHOICE) || (displaySyntax == AMDisplayType.SYNTAX_MULTIPLE_CHOICE);
}
use of com.sun.identity.console.policy.model.PolicyModel 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.policy.model.PolicyModel 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);
}
}
}
}
Aggregations