use of com.sun.identity.console.realm.model.ServicesModel in project OpenAM by OpenRock.
the class ServicesSelectViewBean method beginDisplay.
public void beginDisplay(DisplayEvent event) throws ModelControlException {
super.beginDisplay(event);
disableButton("button1", true);
try {
ServicesModel model = (ServicesModel) getModel();
String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
Map assignables = model.getAssignableServiceNames(curRealm);
CCRadioButton rb = (CCRadioButton) getChild(ATTR_SERVICE_LIST);
OptionList optList = AMFormatUtils.getSortedOptionList(assignables, model.getUserLocale());
rb.setOptions(optList);
String val = (String) rb.getValue();
if ((val == null) || (val.length() == 0)) {
rb.setValue(optList.getValue(0));
}
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
}
}
use of com.sun.identity.console.realm.model.ServicesModel in project OpenAM by OpenRock.
the class ServicesViewBean method handleTblDataActionHrefRequest.
/**
* Forwards request to edit Service view bean.
*
* @param serviceName name of the service to be edited
*/
public void handleTblDataActionHrefRequest(String serviceName) {
ServicesModel model = (ServicesModel) getModel();
SCUtils utils = new SCUtils(serviceName, model);
String propertiesViewBeanURL = utils.getServiceDisplayURL();
if ((propertiesViewBeanURL != null) && (propertiesViewBeanURL.trim().length() > 0)) {
String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
if (curRealm == null) {
curRealm = AMModelBase.getStartDN(getRequestContext().getRequest());
}
try {
String pageTrailID = (String) getPageSessionAttribute(PG_SESSION_PAGE_TRAIL_ID);
propertiesViewBeanURL += "?ServiceName=" + serviceName + "&Location=" + Locale.URLEncodeField(curRealm, getCharset(model)) + "&Template=true&Op=" + AMAdminConstants.OPERATION_EDIT + "&" + PG_SESSION_PAGE_TRAIL_ID + "=" + pageTrailID;
HttpServletResponse response = getRequestContext().getResponse();
response.sendRedirect(propertiesViewBeanURL);
} catch (UnsupportedEncodingException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
forwardTo();
} catch (IOException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
forwardTo();
}
} else {
ServicesEditViewBean vb = (ServicesEditViewBean) getViewBean(ServicesEditViewBean.class);
setPageSessionAttribute(ServicesEditViewBean.SERVICE_NAME, serviceName);
// set save vb to return to this view after selecting back
// button in services edit viewbean.
setPageSessionAttribute(AMAdminConstants.SAVE_VB_NAME, getClass().getName());
unlockPageTrail();
passPgSessionMap(vb);
vb.forwardTo(getRequestContext());
}
}
Aggregations