use of com.sun.identity.console.base.model.AMModel in project OpenAM by OpenRock.
the class RealmPropertiesBase method setPageTitle.
/*
* Get the name of the current realm and add it to the title of the
* properties page.
*/
protected void setPageTitle(AMModel model, String title) {
String realm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
AMModel m = getModel();
String startDN = m.getStartDN();
if (isRootRealm(realm, startDN)) {
realm = AMFormatUtils.DNToName(m, m.getStartDSDN());
}
int index = realm.lastIndexOf('/');
if (index != -1) {
realm = realm.substring(index + 1);
}
// unescape the value to display '/' character
String[] tmp = { SMSSchema.unescapeName(realm) };
ptModel.setPageTitleText(MessageFormat.format(model.getLocalizedString(title), (Object[]) tmp));
}
use of com.sun.identity.console.base.model.AMModel in project OpenAM by OpenRock.
the class RMRealmViewBeanBase method createParentagePath.
private CCBreadCrumbs createParentagePath(String name) {
CCBreadCrumbsModel model = null;
AMModel ammodel = (AMModel) getModel();
String curRealm = getCurrentRealm();
if (curRealm.charAt(0) != '/') {
curRealm = "/" + curRealm;
}
String startDN = ammodel.getStartDN();
if (startDN.charAt(0) != '/') {
startDN = "/" + startDN;
}
String startDNString = AMFormatUtils.DNToName(ammodel, ammodel.getStartDSDN());
if (curRealm.equals(startDN)) {
model = new CCBreadCrumbsModel();
setDisplayFieldValue(TXT_ROOT, startDNString);
} else {
int idx = curRealm.indexOf(startDN);
String subRealm = (idx == 0) ? curRealm.substring(startDN.length()) : curRealm;
List list = reverseParentagePath(subRealm);
if (!list.isEmpty()) {
list.remove(list.size() - 1);
}
/*
* The model is initialized with the name of the current realm.
* This entry is not selectable, just displayed as a label.
*/
idx = subRealm.lastIndexOf("/");
if (idx != -1) {
subRealm = subRealm.substring(idx + 1);
}
model = new CCBreadCrumbsModel(SMSSchema.unescapeName(subRealm));
StringBuilder baseDN = new StringBuilder(200);
baseDN.append(startDN);
/*
* each row added to the model is a selectable entry in the
* parentage path
*/
model.appendRow();
model.setValue(CCBreadCrumbsModel.LABEL, SMSSchema.unescapeName(startDNString));
model.setValue(CCBreadCrumbsModel.COMMANDFIELD, PARENTAGE_PATH_HREF);
model.setValue(CCBreadCrumbsModel.HREF_VALUE, baseDN.toString());
for (Iterator iter = list.iterator(); iter.hasNext(); ) {
String tok = (String) iter.next();
if (!baseDN.toString().equals("/")) {
baseDN.append("/").append(tok);
} else {
baseDN.append(tok);
}
model.appendRow();
model.setValue(CCBreadCrumbsModel.LABEL, SMSSchema.unescapeName(tok));
model.setValue(CCBreadCrumbsModel.COMMANDFIELD, PARENTAGE_PATH_HREF);
model.setValue(CCBreadCrumbsModel.HREF_VALUE, baseDN.toString());
}
}
return new CCBreadCrumbs(this, model, name);
}
use of com.sun.identity.console.base.model.AMModel in project OpenAM by OpenRock.
the class SubConfigEditViewBean method getModelInternal.
protected AMModel getModelInternal() {
AMModel model = null;
HttpServletRequest req = RequestManager.getRequestContext().getRequest();
String serviceName = (String) getPageSessionAttribute(AMServiceProfile.SERVICE_NAME);
String parentId = getParentId();
try {
model = new SubConfigModelImpl(req, serviceName, parentId, getPageSessionAttributes());
} catch (AMConsoleException e) {
//
}
return model;
}
Aggregations