Search in sources :

Example 1 with MAPDeviceProfileModel

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();
}
Also used : AMPropertySheet(com.sun.identity.console.base.AMPropertySheet) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) Map(java.util.Map) MAPDeviceProfileModel(com.sun.identity.console.service.model.MAPDeviceProfileModel)

Example 2 with MAPDeviceProfileModel

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);
        }
    }
}
Also used : Map(java.util.Map) CCDropDownMenu(com.sun.web.ui.view.html.CCDropDownMenu) MAPDeviceProfileModel(com.sun.identity.console.service.model.MAPDeviceProfileModel) OptionList(com.iplanet.jato.view.html.OptionList)

Example 3 with MAPDeviceProfileModel

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());
    }
}
Also used : AMPropertySheetModel(com.sun.identity.console.base.model.AMPropertySheetModel) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) MAPDeviceProfileModel(com.sun.identity.console.service.model.MAPDeviceProfileModel)

Example 4 with MAPDeviceProfileModel

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);
    }
}
Also used : Set(java.util.Set) Iterator(java.util.Iterator) Map(java.util.Map) MAPDeviceProfileModel(com.sun.identity.console.service.model.MAPDeviceProfileModel)

Aggregations

MAPDeviceProfileModel (com.sun.identity.console.service.model.MAPDeviceProfileModel)4 Map (java.util.Map)3 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)2 OptionList (com.iplanet.jato.view.html.OptionList)1 AMPropertySheet (com.sun.identity.console.base.AMPropertySheet)1 AMPropertySheetModel (com.sun.identity.console.base.model.AMPropertySheetModel)1 CCDropDownMenu (com.sun.web.ui.view.html.CCDropDownMenu)1 Iterator (java.util.Iterator)1 Set (java.util.Set)1