use of com.sun.identity.console.service.model.MAPDeviceProfileModel in project OpenAM by OpenRock.
the class MAPDeviceProfileViewBean method handleButton1Request.
/**
* Handles create device request.
*
* @param event Request Invocation Event.
*/
public void handleButton1Request(RequestInvocationEvent event) throws ModelControlException {
submitCycle = true;
AMPropertySheet ps = (AMPropertySheet) getChild(PROPERTY_ATTRIBUTE);
MAPDeviceProfileModel model = (MAPDeviceProfileModel) getModel();
deviceName = (String) getDisplayFieldValue(TF_DEVICE_NAME);
Map orig = model.getAttributeValues(deviceName, (String) getDisplayFieldValue(TF_CLASSIFICATION));
try {
Map values = ps.getAttributeValues(orig, true, model);
model.modifyProfile(deviceName, values);
setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "message.updated");
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
}
forwardTo();
}
use of com.sun.identity.console.service.model.MAPDeviceProfileModel in project OpenAM by OpenRock.
the class MAPDeviceProfileViewBean method initializedClassificationDropDownList.
private void initializedClassificationDropDownList() {
MAPDeviceProfileModel model = (MAPDeviceProfileModel) getModel();
String[] classification = model.getAttributeClassification(deviceName);
if (classification != null) {
Map localizedLabels = model.getLocalizedClassificationLabels(classification);
OptionList optList = new OptionList();
for (int i = 0; i < classification.length; i++) {
String c = classification[i];
String label = (String) localizedLabels.get(c);
if ((label == null) || (label.trim().length() == 0)) {
label = c;
}
optList.add(label, c);
}
CCDropDownMenu cb = (CCDropDownMenu) getChild(SINGLECHOICE_CLASSIFICATION);
cb.setOptions(optList);
String value = (String) cb.getValue();
if ((value == null) || (value.length() == 0)) {
cb.setValue(classification[0]);
setDisplayFieldValue(TF_CLASSIFICATION, classification[0]);
} else {
setDisplayFieldValue(TF_CLASSIFICATION, value);
}
}
}
use of com.sun.identity.console.service.model.MAPDeviceProfileModel in project OpenAM by OpenRock.
the class MAPDeviceProfileViewBean method createPropertyModel.
private void createPropertyModel(String deviceName, String classification) {
MAPDeviceProfileModel model = (MAPDeviceProfileModel) getModel();
try {
propertySheetModel = new AMPropertySheetModel(model.getProfilePropertyXML(deviceName, classification));
propertySheetModel.clear();
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
}
}
use of com.sun.identity.console.service.model.MAPDeviceProfileModel in project OpenAM by OpenRock.
the class MAPDeviceProfileViewBean method beginDisplay.
public void beginDisplay(DisplayEvent event) throws ModelControlException {
super.beginDisplay(event);
setDisplayFieldValue(TF_DEVICE_NAME, deviceName);
ptModel.setPageTitleText(deviceName);
initializedClassificationDropDownList();
MAPDeviceProfileModel model = (MAPDeviceProfileModel) getModel();
Map attributeValues = model.getAttributeValues(deviceName, (String) getDisplayFieldValue(TF_CLASSIFICATION));
Set attributeNames = (!submitCycle) ? attributeValues.keySet() : model.getReadOnlyAttributeNames(deviceName, attributeValues.keySet());
for (Iterator iter = attributeNames.iterator(); iter.hasNext(); ) {
String name = (String) iter.next();
propertySheetModel.setValues(name, ((Set) attributeValues.get(name)).toArray(), model);
}
}
Aggregations