use of com.sun.web.ui.model.CCAddRemoveModel in project OpenAM by OpenRock.
the class EntityMembershipViewBean method createAddRemoveModel.
private CCAddRemoveModel createAddRemoveModel() {
CCAddRemoveModel addRemoveModel = new CCAddRemoveModel();
addRemoveModel.setOrientation(CCAddRemoveModel.HORIZONTAL);
addRemoveModel.setListboxHeight(CCAddRemoveModel.DEFAULT_LISTBOX_HEIGHT);
return addRemoveModel;
}
use of com.sun.web.ui.model.CCAddRemoveModel in project OpenAM by OpenRock.
the class EntityMembershipViewBean method getMemberships.
private void getMemberships() {
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.getMembership(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(getAssignableMembership());
} 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 CreateCOTViewBean method handleButton1Request.
/**
* Handles save button request.
* save
* @param event Request invocation event
*/
public void handleButton1Request(RequestInvocationEvent event) throws ModelControlException {
FSAuthDomainsModel model = (FSAuthDomainsModel) getModel();
AMPropertySheet ps = (AMPropertySheet) getChild(PROPERTIES);
try {
Map values = ps.getAttributeValues(model.getDataMap(), false, model);
String name = (String) getDisplayFieldValue(model.TF_NAME);
if ((name == null) || (name.length() < 1)) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", model.getLocalizedString("authdomain.authentication.domain.name.missing.message"));
psModel.setErrorProperty("nameProperty", true);
forwardTo();
} else {
CCAddRemove addRemoveList = (CCAddRemove) getChild(ADD_REMOVE_PROVIDERS);
addRemoveList.restoreStateData();
CCAddRemoveModel addRemoveModel = (CCAddRemoveModel) addRemoveList.getModel();
Set providers = new HashSet(getSelectedValues(addRemoveModel));
model.createAuthenticationDomain(values, providers);
Object[] params = { name };
String message = MessageFormat.format(model.getLocalizedString("authentication.domain.create.message"), params);
setPageSessionAttribute(FederationViewBean.MESSAGE_TEXT, message);
backTrail();
FederationViewBean vb = (FederationViewBean) getViewBean(FederationViewBean.class);
passPgSessionMap(vb);
vb.forwardTo(getRequestContext());
}
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
forwardTo();
}
}
use of com.sun.web.ui.model.CCAddRemoveModel in project OpenAM by OpenRock.
the class FSAuthDomainsEditViewBean method createPropertyModel.
private void createPropertyModel() {
DelegationConfig dConfig = DelegationConfig.getInstance();
String startDN = AMModelBase.getStartDN(getRequestContext().getRequest());
boolean canModify = dConfig.hasPermission(startDN, null, AMAdminConstants.PERMISSION_MODIFY, getRequestContext().getRequest(), getClass().getName());
// TBD: need to have one propertysheet which is read_only
String xmlFile = (canModify) ? "com/sun/identity/console/propertyCOTEdit.xml" : "com/sun/identity/console/propertyCOTEdit.xml";
propertySheetModel = new AMPropertySheetModel(getClass().getClassLoader().getResourceAsStream(xmlFile));
if (addRemoveModel == null)
addRemoveModel = new CCAddRemoveModel();
propertySheetModel.setModel(ADD_REMOVE_PROVIDERS, addRemoveModel);
propertySheetModel.clear();
}
use of com.sun.web.ui.model.CCAddRemoveModel in project OpenAM by OpenRock.
the class FSAuthDomainsEditViewBean method handleButton1Request.
/**
* Handles create authentication domains view bean.
*
* @param event Request invocation event
*/
public void handleButton1Request(RequestInvocationEvent event) throws ModelControlException {
FSAuthDomainsModel model = (FSAuthDomainsModel) getModel();
String name = (String) getDisplayFieldValue(model.TF_NAME);
AMPropertySheet ps = (AMPropertySheet) getChild(PROPERTY_ATTRIBUTE);
try {
String realm = model.getRealm(name);
Map values = ps.getAttributeValues(model.getDataMap(), false, model);
model.setAttributeValues(realm, name, values);
SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
FederationViewBean vb = (FederationViewBean) getViewBean(FederationViewBean.class);
CCAddRemove addRemoveList = (CCAddRemove) getChild(ADD_REMOVE_PROVIDERS);
addRemoveList.restoreStateData();
CCAddRemoveModel addRemoveModel = (CCAddRemoveModel) addRemoveList.getModel();
List list = new ArrayList(getSelectedValues(addRemoveModel));
model.addProviders(realm, name, list);
setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "authentication.domain.updated");
forwardTo();
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
forwardTo();
}
}
Aggregations