use of com.iplanet.jato.view.html.OptionList in project OpenAM by OpenRock.
the class IdentityMembershipHelper method getSelectedIdentities.
/**
* Returns a map of
* <code>AMIdentityMembershipCondition.AM_IDENTITY_NAME</code> to a set
* of identity IDs.
*
* @param child Add Remove Child Component which contains the selected
* identity IDs.
* @return a map of
* <code>AMIdentityMembershipCondition.AM_IDENTITY_NAME</code>
* to a set of identity IDs.
*/
public static Map getSelectedIdentities(CCAddRemove child) {
Map map = new HashMap(2);
child.restoreStateData();
CCAddRemoveModel addRemoveModel = (CCAddRemoveModel) child.getModel();
OptionList selected = addRemoveModel.getSelectedOptionList();
Set setValues = new HashSet();
for (int i = 0; i < selected.size(); i++) {
Option opt = selected.get(i);
setValues.add(opt.getValue());
}
map.put(AMIdentityMembershipCondition.AM_IDENTITY_NAME, setValues);
return map;
}
use of com.iplanet.jato.view.html.OptionList in project OpenAM by OpenRock.
the class IdentitySubjectAddViewBean method beginDisplay.
public void beginDisplay(DisplayEvent event) throws ModelControlException {
IdentitySubjectModel model = (IdentitySubjectModel) getModel();
Set values = null;
if (bFilter) {
Set defaultValue = getValues();
if (defaultValue != null) {
values = getAMIdentity(model, defaultValue);
}
}
super.beginDisplay(event);
String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
// initialize the 'Filter' drop down menu
// supportedEntityTypes is a map of entity name to its
// localized value
CCDropDownMenu menu = (CCDropDownMenu) getChild(FILTER_TYPE);
Map supportedEntityTypes = model.getSupportedEntityTypes(realmName);
OptionList entityTypes = createOptionList(supportedEntityTypes);
entityTypes.add(0, "policy.subject.select.identity.type", "");
menu.setOptions(entityTypes);
menu.setValue("");
// initialize the available/selected component
CCAddRemove child = (CCAddRemove) getChild(VALUES_MULTIPLE_CHOICE_VALUE);
child.restoreStateData();
OptionList selected = addRemoveModel.getSelectedOptionList();
OptionList possible = createOptionList(getPossibleValues(model, realmName));
child.resetStateData();
addRemoveModel.setAvailableOptionList(possible);
List selectedIds = AMAdminUtils.toList(selected);
addRemoveModel.setSelectedOptionList(createOptionList(getAMIdentity(model, selectedIds)));
}
use of com.iplanet.jato.view.html.OptionList in project OpenAM by OpenRock.
the class IdentitySubjectAddViewBean method createOptionList.
/**
* Creates an OptionList based on a set of AMIdentity objects.
*/
protected OptionList createOptionList(Set values) {
OptionList optList = new OptionList();
if ((values != null) && !values.isEmpty()) {
/*
* Need to convert to AMIdentity object if the set contains
* universal Ids
*/
Set amIdentity = (values.iterator().next() instanceof String) ? getAMIdentity((IdentitySubjectModel) getModel(), values) : values;
Map entries = new HashMap(values.size() * 2);
for (Iterator iter = amIdentity.iterator(); iter.hasNext(); ) {
AMIdentity identity = (AMIdentity) iter.next();
entries.put(IdUtils.getUniversalId(identity), PolicyUtils.getDNDisplayString(identity.getName()));
}
optList = createOptionList(entries);
}
return optList;
}
use of com.iplanet.jato.view.html.OptionList in project OpenAM by OpenRock.
the class IdentitySubjectEditViewBean method createOptionList.
protected OptionList createOptionList(Set values) {
OptionList optList = new OptionList();
if ((values != null) && !values.isEmpty()) {
for (Iterator iter = values.iterator(); iter.hasNext(); ) {
AMIdentity identity = (AMIdentity) iter.next();
optList.add(PolicyUtils.getDNDisplayString(identity.getName()), IdUtils.getUniversalId(identity));
}
}
return optList;
}
use of com.iplanet.jato.view.html.OptionList in project OpenAM by OpenRock.
the class AuthToServiceAddViewBean method beginDisplay.
/**
* Set the realm names and service names.
*
* @param event Display event.
* @throws ModelControlException if default <code>JATO</code> cannot be
* instantiated.
*/
public void beginDisplay(DisplayEvent event) throws ModelControlException {
super.beginDisplay(event);
String filter = (String) getDisplayFieldValue(AuthToServiceHelper.ATTR_FILTER);
if ((filter == null) || (filter.trim().length() == 0)) {
setDisplayFieldValue(AuthToServiceHelper.ATTR_FILTER, "*");
}
Set realmNames = getRealmNames(filter);
if ((realmNames != null) && !realmNames.isEmpty()) {
realmNames.add("");
CCSelect sl = (CCSelect) getChild(AuthToServiceHelper.ATTR_REALM);
sl.setOptions(createOptionList(getLabelValueMap(realmNames)));
String realm = null;
if (!bRealmSelect) {
realm = (String) realmNames.iterator().next();
sl.setValue(realm);
} else {
realm = (String) sl.getValue();
}
setServiceNames(realm);
} else {
CCSelect slService = (CCSelect) getChild(AuthToServiceHelper.ATTR_SERVICE);
slService.setOptions(new OptionList());
}
}
Aggregations