Search in sources :

Example 1 with MAPCreateDeviceModel

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);
    }
}
Also used : DisplayField(com.iplanet.jato.view.DisplayField) MAPCreateDeviceModel(com.sun.identity.console.service.model.MAPCreateDeviceModel) Iterator(java.util.Iterator) Map(java.util.Map)

Example 2 with MAPCreateDeviceModel

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

Example 3 with MAPCreateDeviceModel

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

Example 4 with MAPCreateDeviceModel

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

Aggregations

MAPCreateDeviceModel (com.sun.identity.console.service.model.MAPCreateDeviceModel)4 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)2 Iterator (java.util.Iterator)2 Map (java.util.Map)2 Set (java.util.Set)2 DisplayField (com.iplanet.jato.view.DisplayField)1 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 CCRadioButton (com.sun.web.ui.view.html.CCRadioButton)1 HashSet (java.util.HashSet)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1