use of com.sun.web.ui.model.CCAddRemoveModel in project OpenAM by OpenRock.
the class FSAuthDomainsEditViewBean method beginDisplay.
public void beginDisplay(DisplayEvent event) throws ModelControlException {
super.beginDisplay(event);
String name = (String) getDisplayFieldValue(FSAuthDomainsModel.TF_NAME);
setPageSessionAttribute(FSAuthDomainsModel.TF_NAME, name);
FSAuthDomainsModel model = (FSAuthDomainsModel) getModel();
try {
String realm = model.getRealm(name);
Map values = model.getAttributeValues(realm, name);
AMPropertySheet ps = (AMPropertySheet) getChild(PROPERTY_ATTRIBUTE);
ps.setAttributeValues(values, model);
if (addRemoveModel == null) {
addRemoveModel = new CCAddRemoveModel();
}
Set providers = model.getAllProviderNames(realm);
List selectedProviders = new ArrayList(model.getTrustedProviderNames(realm, name));
if ((selectedProviders != null) || (!selectedProviders.isEmpty())) {
providers.removeAll(selectedProviders);
Map displayNames = FSAuthDomainsOpViewBeanBase.getProviderDisplayNames(model, selectedProviders);
addRemoveModel.setSelectedOptionList(createOptionList(replacePipeWithComma(displayNames)));
}
Map displayNames = FSAuthDomainsOpViewBeanBase.getProviderDisplayNames(model, providers);
addRemoveModel.setAvailableOptionList(createOptionList(replacePipeWithComma(displayNames)));
propertySheetModel.setModel(ADD_REMOVE_PROVIDERS, addRemoveModel);
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
}
}
use of com.sun.web.ui.model.CCAddRemoveModel in project OpenAM by OpenRock.
the class CreateCOTViewBean method beginDisplay.
public void beginDisplay(DisplayEvent event) throws ModelControlException {
super.beginDisplay(event);
AMPropertySheet ps = (AMPropertySheet) getChild(PROPERTIES);
ps.init();
populateRealmData();
FSAuthDomainsModel model = (FSAuthDomainsModel) getModel();
String realm = "/";
try {
if (addRemoveModel == null) {
addRemoveModel = new CCAddRemoveModel();
}
Set providers = model.getAllProviderNames(realm);
Map displayNames = FSAuthDomainsOpViewBeanBase.getProviderDisplayNames(model, providers);
addRemoveModel.setAvailableOptionList(createOptionList(replacePipeWithComma(displayNames)));
psModel.setModel(ADD_REMOVE_PROVIDERS, addRemoveModel);
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
}
}
use of com.sun.web.ui.model.CCAddRemoveModel in project OpenAM by OpenRock.
the class CreateCOTViewBean method createPropertyModel.
private void createPropertyModel() {
psModel = new AMPropertySheetModel(getClass().getClassLoader().getResourceAsStream("com/sun/identity/console/createCOTPropertySheet.xml"));
if (addRemoveModel == null) {
addRemoveModel = new CCAddRemoveModel();
}
psModel.setModel(ADD_REMOVE_PROVIDERS, addRemoveModel);
psModel.clear();
}
use of com.sun.web.ui.model.CCAddRemoveModel in project OpenAM by OpenRock.
the class EntityMembersViewBean method getMemberNames.
private void getMemberNames() {
if (!submitCycle) {
try {
String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
String type = (String) getPageSessionAttribute(PG_SESSION_MEMBER_TYPE);
String universalId = (String) getPageSessionAttribute(UNIVERSAL_ID);
if (cacheAssigned != null) {
assignedMembers = AMAdminUtils.toList(cacheAssigned);
} else {
EntitiesModel model = (EntitiesModel) getModel();
assignedMembers = new ArrayList();
assignedMembers.addAll(model.getMembers(curRealm, universalId, type));
}
if (canModify) {
CCAddRemoveModel addRemoveModel = (CCAddRemoveModel) propertySheetModel.getModel(ADD_REMOVE_MEMBERS);
addRemoveModel.clear();
if (cacheAssigned != null) {
addRemoveModel.setSelectedOptionList(cacheAssigned);
} else {
addRemoveModel.setSelectedOptionList(getOptionListForEntities(assignedMembers));
}
addRemoveModel.setAvailableOptionList(getAssignableMembers());
} else {
propertySheetModel.setValue(ADD_REMOVE_MEMBERS, AMAdminUtils.getString(getEntityDisplayNames(assignedMembers), ",", false));
}
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
}
if (canModify) {
CCAddRemove addRemove = (CCAddRemove) getChild(ADD_REMOVE_MEMBERS);
addRemove.resetStateData();
}
}
}
use of com.sun.web.ui.model.CCAddRemoveModel in project OpenAM by OpenRock.
the class EntityMembersViewBean method handleButton1Request.
public void handleButton1Request(RequestInvocationEvent event) {
submitCycle = true;
CCAddRemove child = (CCAddRemove) getChild(ADD_REMOVE_MEMBERS);
child.restoreStateData();
CCAddRemoveModel addRemoveModel = (CCAddRemoveModel) propertySheetModel.getModel(ADD_REMOVE_MEMBERS);
OptionList os = addRemoveModel.getSelectedOptionList();
EntitiesModel model = (EntitiesModel) getModel();
String universalId = (String) getPageSessionAttribute(UNIVERSAL_ID);
String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
String type = (String) getPageSessionAttribute(PG_SESSION_MEMBER_TYPE);
try {
Set entities = getEntitiesID(model.getMembers(curRealm, universalId, type));
Set selected = getValues(os);
Set toAdd = new HashSet(selected);
toAdd.removeAll(entities);
entities.removeAll(selected);
if (!toAdd.isEmpty()) {
model.addMembers(universalId, toAdd);
}
if (!entities.isEmpty()) {
model.removeMembers(universalId, entities);
}
setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "message.updated");
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
}
forwardTo();
}
Aggregations