use of com.sun.web.ui.view.html.CCDropDownMenu in project OpenAM by OpenRock.
the class CreateFedletViewBean method beginDisplay.
public void beginDisplay(DisplayEvent e) {
HttpServletRequest req = getRequestContext().getRequest();
populateTableModel();
Set userAttrNames = AMAdminUtils.getUserAttributeNames();
userAttrNames.remove("iplanet-am-user-account-life");
CCDropDownMenu menuUserAttribute = (CCDropDownMenu) getChild("menuUserAttributes");
OptionList optList = createOptionList(userAttrNames);
optList.add(0, "name.attribute.mapping.select", "");
menuUserAttribute.setOptions(optList);
try {
TaskModel model = (TaskModel) getModel();
Map map = model.getRealmCotWithHostedIDPs();
Set realms = new TreeSet();
realms.addAll(map.keySet());
CCDropDownMenu menuRealm = (CCDropDownMenu) getChild(REALM);
menuRealm.setOptions(createOptionList(realms));
String realm = req.getParameter("realm");
if ((realm != null) && (realm.trim().length() > 0)) {
setDisplayFieldValue(REALM, realm);
} else {
if (!realms.isEmpty()) {
realm = (String) realms.iterator().next();
}
}
if ((realm != null) && (realm.trim().length() > 0)) {
Map mapCots = (Map) map.get(realm);
Set cots = new TreeSet();
cots.addAll(mapCots.keySet());
CCDropDownMenu menuCOT = (CCDropDownMenu) getChild("choiceCOT");
menuCOT.setOptions(createOptionList(cots));
String cot = req.getParameter("cot");
if ((cot != null) && (cot.trim().length() > 0)) {
setDisplayFieldValue("choiceCOT", cot);
} else {
if (!cots.isEmpty()) {
cot = (String) cots.iterator().next();
}
}
if ((cot != null) && (cot.trim().length() > 0)) {
Set idps = new TreeSet();
idps.addAll((Set) mapCots.get(cot));
CCDropDownMenu menuIDP = (CCDropDownMenu) getChild("choiceIDP");
menuIDP.setOptions(createOptionList(idps));
String idp = req.getParameter("entityId");
if ((idp != null) && (idp.trim().length() > 0)) {
setDisplayFieldValue("choiceIDP", idp);
}
}
}
} catch (AMConsoleException ex) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", ex.getMessage());
}
String cot = req.getParameter("cot");
if ((cot != null) && (cot.trim().length() > 0)) {
setDisplayFieldValue(COT_CHOICE, cot);
}
}
use of com.sun.web.ui.view.html.CCDropDownMenu in project OpenAM by OpenRock.
the class ValidateSAML2SetupViewBean method populateTableModel.
private void populateTableModel() {
tableModel.clearAll();
TaskModel model = (TaskModel) getModel();
int invalid = 0;
try {
String realm = getRequestContext().getRequest().getParameter("realm");
if ((realm == null) || (realm.length() == 0)) {
realm = "/";
}
CCDropDownMenu menu = (CCDropDownMenu) getChild("tfRealm");
Set realms = model.getRealms();
menu.setOptions(createOptionList(realms));
menu.setValue(realm);
bOneRealm = (realms.size() == 1);
Set cots = model.getCircleOfTrusts(realm);
setCOTs = new TreeSet();
setCOTs.addAll(cots);
int counter = 0;
for (Iterator i = setCOTs.iterator(); i.hasNext(); ) {
String cotName = (String) i.next();
if (counter > 0) {
tableModel.appendRow();
}
counter++;
int nHostedIDP = model.getHostedIDP(realm, cotName).size();
int nRemoteIDP = model.getRemoteIDP(realm, cotName).size();
int nHostedSP = model.getHostedSP(realm, cotName).size();
int nRemoteSP = model.getRemoteSP(realm, cotName).size();
boolean valid = ((nHostedIDP > 0) && (nRemoteSP > 0)) || ((nRemoteIDP > 0) && (nHostedSP > 0));
tableModel.setValue("NameValue", cotName);
tableModel.setSelectionVisible(valid);
if (!valid) {
invalid++;
}
tableModel.setValue("HostedIDPValue", Integer.toString(nHostedIDP));
tableModel.setValue("RemoteIDPValue", Integer.toString(nRemoteIDP));
tableModel.setValue("HostedSPValue", Integer.toString(nHostedSP));
tableModel.setValue("RemoteSPValue", Integer.toString(nRemoteSP));
}
} catch (AMConsoleException ex) {
setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", ex.getMessage());
}
if ((setCOTs.size() - invalid) == 0) {
setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "no.providers.to.validate");
}
}
Aggregations