Search in sources :

Example 6 with ServicesModel

use of com.sun.identity.console.realm.model.ServicesModel in project OpenAM by OpenRock.

the class ServicesSelectViewBean method beginDisplay.

public void beginDisplay(DisplayEvent event) throws ModelControlException {
    super.beginDisplay(event);
    disableButton("button1", true);
    try {
        ServicesModel model = (ServicesModel) getModel();
        String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
        Map assignables = model.getAssignableServiceNames(curRealm);
        CCRadioButton rb = (CCRadioButton) getChild(ATTR_SERVICE_LIST);
        OptionList optList = AMFormatUtils.getSortedOptionList(assignables, model.getUserLocale());
        rb.setOptions(optList);
        String val = (String) rb.getValue();
        if ((val == null) || (val.length() == 0)) {
            rb.setValue(optList.getValue(0));
        }
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }
}
Also used : CCRadioButton(com.sun.web.ui.view.html.CCRadioButton) ServicesModel(com.sun.identity.console.realm.model.ServicesModel) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) Map(java.util.Map) OptionList(com.iplanet.jato.view.html.OptionList)

Example 7 with ServicesModel

use of com.sun.identity.console.realm.model.ServicesModel in project OpenAM by OpenRock.

the class ServicesViewBean method handleTblDataActionHrefRequest.

/**
     * Forwards request to edit Service view bean.
     *
     * @param serviceName name of the service to be edited
     */
public void handleTblDataActionHrefRequest(String serviceName) {
    ServicesModel model = (ServicesModel) getModel();
    SCUtils utils = new SCUtils(serviceName, model);
    String propertiesViewBeanURL = utils.getServiceDisplayURL();
    if ((propertiesViewBeanURL != null) && (propertiesViewBeanURL.trim().length() > 0)) {
        String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
        if (curRealm == null) {
            curRealm = AMModelBase.getStartDN(getRequestContext().getRequest());
        }
        try {
            String pageTrailID = (String) getPageSessionAttribute(PG_SESSION_PAGE_TRAIL_ID);
            propertiesViewBeanURL += "?ServiceName=" + serviceName + "&Location=" + Locale.URLEncodeField(curRealm, getCharset(model)) + "&Template=true&Op=" + AMAdminConstants.OPERATION_EDIT + "&" + PG_SESSION_PAGE_TRAIL_ID + "=" + pageTrailID;
            HttpServletResponse response = getRequestContext().getResponse();
            response.sendRedirect(propertiesViewBeanURL);
        } catch (UnsupportedEncodingException e) {
            setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
            forwardTo();
        } catch (IOException e) {
            setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
            forwardTo();
        }
    } else {
        ServicesEditViewBean vb = (ServicesEditViewBean) getViewBean(ServicesEditViewBean.class);
        setPageSessionAttribute(ServicesEditViewBean.SERVICE_NAME, serviceName);
        // set save vb to return to this view after selecting back 
        // button in services edit viewbean.
        setPageSessionAttribute(AMAdminConstants.SAVE_VB_NAME, getClass().getName());
        unlockPageTrail();
        passPgSessionMap(vb);
        vb.forwardTo(getRequestContext());
    }
}
Also used : ServicesModel(com.sun.identity.console.realm.model.ServicesModel) HttpServletResponse(javax.servlet.http.HttpServletResponse) UnsupportedEncodingException(java.io.UnsupportedEncodingException) IOException(java.io.IOException) SCUtils(com.sun.identity.console.service.model.SCUtils)

Aggregations

ServicesModel (com.sun.identity.console.realm.model.ServicesModel)7 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)4 SCUtils (com.sun.identity.console.service.model.SCUtils)2 IOException (java.io.IOException)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 Map (java.util.Map)2 HttpServletResponse (javax.servlet.http.HttpServletResponse)2 OptionList (com.iplanet.jato.view.html.OptionList)1 SerializedField (com.sun.identity.console.components.view.html.SerializedField)1 CCButton (com.sun.web.ui.view.html.CCButton)1 CCRadioButton (com.sun.web.ui.view.html.CCRadioButton)1 CCActionTable (com.sun.web.ui.view.table.CCActionTable)1 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1 List (java.util.List)1 Set (java.util.Set)1