use of com.sun.identity.console.policy.model.IdentitySubjectModel 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.sun.identity.console.policy.model.IdentitySubjectModel 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.sun.identity.console.policy.model.IdentitySubjectModel in project OpenAM by OpenRock.
the class IdentityMembershipConditionAddViewBean method beginDisplay.
/**
* Sets the values to UI model.
*
* @param event Display Event.
* @throws ModelControlException if the default UI model is not accessible.
*/
public void beginDisplay(DisplayEvent event) throws ModelControlException {
IdentitySubjectModel subjectModel = getSubjectModel();
PolicyModel model = (PolicyModel) getModel();
super.beginDisplay(event);
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 = helper.createOptionList(model.getUserSSOToken(), model.getUserLocale(), this, getPossibleValues(subjectModel, realmName));
child.resetStateData();
addRemoveModel.setAvailableOptionList(possible);
}
use of com.sun.identity.console.policy.model.IdentitySubjectModel in project OpenAM by OpenRock.
the class IdentityMembershipConditionEditViewBean method beginDisplay.
/**
* Sets the values to UI model.
*
* @param event Display Event.
*/
public void beginDisplay(DisplayEvent event) throws ModelControlException {
IdentitySubjectModel subjectModel = getSubjectModel();
PolicyModel model = (PolicyModel) getModel();
super.beginDisplay(event);
if (!canModify) {
Map mapValues = getDefaultValues();
if ((mapValues != null) && !mapValues.isEmpty()) {
Set values = (Set) mapValues.get(AMIdentityMembershipCondition.AM_IDENTITY_NAME);
Set identityNames = helper.getAMIdentityNames(model.getUserSSOToken(), values);
propertySheetModel.setValue(VALUES_MULTIPLE_CHOICE_VALUE, AMAdminUtils.getString(identityNames, ",", false));
}
} else {
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("");
CCAddRemove child = (CCAddRemove) getChild(VALUES_MULTIPLE_CHOICE_VALUE);
child.restoreStateData();
if (!submitCycle) {
helper.setSelectedIdentities(child, model.getUserSSOToken(), model.getUserLocale(), this, getDefaultValues());
} else {
// initialize the available/selected component
OptionList possible = helper.createOptionList(model.getUserSSOToken(), model.getUserLocale(), this, getPossibleValues(subjectModel, realmName));
OptionList selected = addRemoveModel.getSelectedOptionList();
List selectedIds = AMAdminUtils.toList(selected);
child.resetStateData();
addRemoveModel.setAvailableOptionList(possible);
addRemoveModel.setSelectedOptionList(helper.createOptionList(model.getUserSSOToken(), model.getUserLocale(), this, selectedIds));
}
}
}
use of com.sun.identity.console.policy.model.IdentitySubjectModel in project OpenAM by OpenRock.
the class IdentitySubjectEditViewBean method beginDisplay.
public void beginDisplay(DisplayEvent event) throws ModelControlException {
IdentitySubjectModel model = (IdentitySubjectModel) getModel();
String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
Set values = null;
if (bFilter) {
Set defaultValue = getValues();
if (defaultValue != null) {
values = getAMIdentity(model, defaultValue);
}
} else {
values = getAMIdentity(model, getDefaultValues(model));
}
super.beginDisplay(event);
if (canModify) {
Map supportedEntityTypes = model.getSupportedEntityTypes(realmName);
CCDropDownMenu menu = (CCDropDownMenu) getChild(FILTER_TYPE);
OptionList entityTypes = createOptionList(supportedEntityTypes);
entityTypes.add(0, "policy.subject.select.identity.type", "");
menu.setOptions(entityTypes);
menu.setValue("");
CCAddRemove child = (CCAddRemove) getChild(VALUES_MULTIPLE_CHOICE_VALUE);
child.restoreStateData();
OptionList selected = addRemoveModel.getSelectedOptionList();
child.resetStateData();
addRemoveModel.setAvailableOptionList(createOptionList(getPossibleValues(model, realmName, values)));
if (submitCycle) {
addRemoveModel.setSelectedOptionList(selected);
} else {
addRemoveModel.setSelectedOptionList(createOptionList(values));
}
} else {
propertySheetModel.setValue(VALUES_MULTIPLE_CHOICE_VALUE, AMAdminUtils.getString(getDefaultValues(), ",", false));
}
}
Aggregations