use of com.sun.identity.console.service.model.MAPCreateDeviceModel in project OpenAM by OpenRock.
the class MAPCreateDeviceTwoViewBean method beginDisplay.
public void beginDisplay(DisplayEvent event) throws ModelControlException {
super.beginDisplay(event);
if (!submitCycle) {
MAPCreateDeviceModel model = (MAPCreateDeviceModel) getModel();
Map defaultValues = model.getCreateDeviceDefaultValues();
for (Iterator i = defaultValues.keySet().iterator(); i.hasNext(); ) {
String attrName = (String) i.next();
DisplayField f = (DisplayField) getChild(attrName);
f.setValues(((Set) defaultValues.get(attrName)).toArray());
}
setDisplayFieldValue(TF_PARENTID, attrParentId);
setDisplayFieldValue(TF_CLIENT_TYPE, attrClientType);
}
}
use of com.sun.identity.console.service.model.MAPCreateDeviceModel in project OpenAM by OpenRock.
the class MAPCreateDeviceTwoViewBean method createPropertyModel.
private boolean createPropertyModel() {
boolean init = false;
HttpServletRequest req = RequestManager.getRequestContext().getRequest();
if ((attrParentId == null) || (attrParentId.trim().length() == 0)) {
attrParentId = req.getParameter("MAPCreateDeviceTwo." + TF_PARENTID);
}
if ((attrClientType == null) || (attrClientType.trim().length() == 0)) {
attrClientType = req.getParameter("MAPCreateDeviceTwo." + TF_CLIENT_TYPE);
}
init = (attrParentId != null) && (attrParentId.trim().length() > 0) && (attrClientType != null) && (attrClientType.trim().length() > 0);
if (init) {
MAPCreateDeviceModel model = (MAPCreateDeviceModel) getModel();
try {
propertySheetModel = new AMPropertySheetModel(model.getCreateDevicePropertyXML(attrClientType, attrParentId));
propertySheetModel.clear();
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
}
}
return init;
}
use of com.sun.identity.console.service.model.MAPCreateDeviceModel in project OpenAM by OpenRock.
the class MAPCreateDeviceTwoViewBean method handleButton2Request.
/**
* Handles create device request.
*
* @param event Request Invocation Event.
*/
public void handleButton2Request(RequestInvocationEvent event) throws ModelControlException {
submitCycle = true;
MAPCreateDeviceModel model = (MAPCreateDeviceModel) getModel();
AMPropertySheet ps = (AMPropertySheet) getChild(PROPERTY_ATTRIBUTE);
try {
Map values = ps.getAttributeValues(model.getCreateDeviceAttributeNames());
Set setParentId = new HashSet(2);
setParentId.add(attrParentId);
values.put("parentId", setParentId);
model.createDevice(values);
MAPDeviceProfileViewBean vb = (MAPDeviceProfileViewBean) getViewBean(MAPDeviceProfileViewBean.class);
vb.deviceName = (String) AMAdminUtils.getValue((Set) values.get(MAPCreateDeviceModel.ATTRIBUTE_NAME_CLIENT_TYPE));
passPgSessionMap(vb);
vb.forwardTo(getRequestContext());
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
forwardTo();
}
}
use of com.sun.identity.console.service.model.MAPCreateDeviceModel in project OpenAM by OpenRock.
the class MAPCreateDeviceViewBean method beginDisplay.
public void beginDisplay(DisplayEvent event) throws ModelControlException {
super.beginDisplay(event);
disableButton("button1", true);
MAPCreateDeviceModel model = (MAPCreateDeviceModel) getModel();
String profileName = (String) getPageSessionAttribute(MAPClientManagerViewBean.PAGE_SESSION_PROFILE_NAME);
Set styles = model.getStyleNames(profileName);
if ((styles != null) && !styles.isEmpty()) {
CCRadioButton btn = (CCRadioButton) getChild(RADIO_STYLE);
OptionList styleList = new OptionList();
for (Iterator iter = styles.iterator(); iter.hasNext(); ) {
String name = (String) iter.next();
styleList.add(name, name);
}
btn.setOptions(styleList);
String value = (String) getDisplayFieldValue(RADIO_STYLE);
if ((value == null) || (value.trim().length() == 0)) {
setDisplayFieldValue(RADIO_STYLE, (String) styles.iterator().next());
}
}
}
Aggregations