Search in sources :

Example 1 with SCUtils

use of com.sun.identity.console.service.model.SCUtils in project OpenAM by OpenRock.

the class ServicesSelectViewBean method handleButton2Request.

/**
     * Handles next button request.
     *
     * @param event Request invocation event.
     */
public void handleButton2Request(RequestInvocationEvent event) throws ModelControlException {
    ServicesModel model = (ServicesModel) getModel();
    String serviceName = (String) getDisplayFieldValue(ATTR_SERVICE_LIST);
    serviceName = serviceName.trim();
    if (serviceName.length() > 0) {
        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=" + stringToHex(curRealm) + "&Template=true&Op=" + AMAdminConstants.OPERATION_ADD + "&" + PG_SESSION_PAGE_TRAIL_ID + "=" + pageTrailID;
                HttpServletResponse response = getRequestContext().getResponse();
                backTrail();
                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 {
            ServicesAddViewBean vb = (ServicesAddViewBean) getViewBean(ServicesAddViewBean.class);
            setPageSessionAttribute(ServicesAddViewBean.SERVICE_NAME, serviceName);
            unlockPageTrailForSwapping();
            passPgSessionMap(vb);
            vb.forwardTo(getRequestContext());
        }
    } else {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", "services.missing.servicename");
        forwardTo();
    }
}
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)

Example 2 with SCUtils

use of com.sun.identity.console.service.model.SCUtils in project OpenAM by OpenRock.

the class EntityServicesViewBean method handleTblDataActionHrefRequest.

public void handleTblDataActionHrefRequest(String serviceName) throws ModelControlException {
    EntitiesModel model = (EntitiesModel) getModel();
    SCUtils utils = new SCUtils(serviceName, model);
    String propertiesViewBeanURL = utils.getServiceDisplayURL();
    String universalId = (String) getPageSessionAttribute(EntityEditViewBean.UNIVERSAL_ID);
    // This is not needed in 7.0, but is still used by old 6.3 console.
    if (serviceName.equals(AMAdminConstants.AUTH_CONFIG_SERVICE)) {
        propertiesViewBeanURL = null;
    }
    if ((propertiesViewBeanURL != null) && (propertiesViewBeanURL.trim().length() > 0)) {
        try {
            String realm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
            String pageTrailID = (String) getPageSessionAttribute(PG_SESSION_PAGE_TRAIL_ID);
            setPageSessionAttribute(getTrackingTabIDName(), Integer.toString(TAB_SERVICES));
            propertiesViewBeanURL += "?ServiceName=" + serviceName + "&User=" + Locale.URLEncodeField(stringToHex(universalId), getCharset(model)) + "&Op=" + AMAdminConstants.OPERATION_EDIT + "&realm=" + Locale.URLEncodeField(realm, getCharset(model)) + "&" + 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);
        unlockPageTrail();
        passPgSessionMap(vb);
        vb.forwardTo(getRequestContext());
    }
}
Also used : HttpServletResponse(javax.servlet.http.HttpServletResponse) UnsupportedEncodingException(java.io.UnsupportedEncodingException) IOException(java.io.IOException) EntitiesModel(com.sun.identity.console.idm.model.EntitiesModel) SCUtils(com.sun.identity.console.service.model.SCUtils)

Example 3 with SCUtils

use of com.sun.identity.console.service.model.SCUtils in project OpenAM by OpenRock.

the class ServicesSelectViewBean method fowardToAddServiceViewBean.

private void fowardToAddServiceViewBean(EntitiesModel model, String universalId, String serviceName) {
    SCUtils utils = new SCUtils(serviceName, model);
    String propertiesViewBeanURL = utils.getServiceDisplayURL();
    String type = (String) getPageSessionAttribute(EntityEditViewBean.ENTITY_TYPE);
    String realm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
    if (realm == null) {
        realm = "/";
    }
    // This is not needed in 7.0, but is still used by old 6.3 console.
    if (serviceName.equals(AMAdminConstants.AUTH_CONFIG_SERVICE)) {
        propertiesViewBeanURL = null;
    }
    if ((propertiesViewBeanURL != null) && (propertiesViewBeanURL.trim().length() > 0)) {
        try {
            String charset = getCharset(model);
            propertiesViewBeanURL += "?ServiceName=" + serviceName + "&type=" + Locale.URLEncodeField(type, charset) + "&realm=" + Locale.URLEncodeField(stringToHex(realm), charset) + "&User=" + Locale.URLEncodeField(stringToHex(universalId), charset) + "&Op=" + AMAdminConstants.OPERATION_ADD;
            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 {
        ServicesAddViewBean vb = (ServicesAddViewBean) getViewBean(ServicesAddViewBean.class);
        setPageSessionAttribute(ServicesAddViewBean.SERVICE_NAME, serviceName);
        passPgSessionMap(vb);
        vb.forwardTo(getRequestContext());
    }
}
Also used : HttpServletResponse(javax.servlet.http.HttpServletResponse) UnsupportedEncodingException(java.io.UnsupportedEncodingException) IOException(java.io.IOException) SCUtils(com.sun.identity.console.service.model.SCUtils)

Example 4 with SCUtils

use of com.sun.identity.console.service.model.SCUtils 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

SCUtils (com.sun.identity.console.service.model.SCUtils)4 IOException (java.io.IOException)4 UnsupportedEncodingException (java.io.UnsupportedEncodingException)4 HttpServletResponse (javax.servlet.http.HttpServletResponse)4 ServicesModel (com.sun.identity.console.realm.model.ServicesModel)2 EntitiesModel (com.sun.identity.console.idm.model.EntitiesModel)1