Example #1
0
  /* (non-Javadoc)
   * @see it.eng.spago.dispatching.service.list.basic.IFaceBasicListService#getList(it.eng.spago.base.SourceBean, it.eng.spago.base.SourceBean)
   */
  public ListIFace getList(SourceBean request, SourceBean response) throws Exception {

    logger.debug("IN");
    ListIFace list = null;
    // get role / par id / par field name name
    String roleName = (String) request.getAttribute("roleName");
    String parIdStr = (String) request.getAttribute("parameterId");
    logger.debug("roleName=" + roleName);
    logger.debug("parameterId=" + parIdStr);

    Integer parId = new Integer(parIdStr);
    // check if the parameter use is manual input
    IParameterUseDAO parusedao = DAOFactory.getParameterUseDAO();
    ParameterUse paruse = parusedao.loadByParameterIdandRole(parId, roleName);
    Integer manInp = paruse.getManualInput();
    if (manInp.intValue() == 1) {
      String message = "";
      try {
        message =
            PortletUtilities.getMessage(
                "scheduler.fillparmanually", "component_scheduler_messages");
      } catch (Exception e) {
        IMessageBuilder msgBuilder = MessageBuilderFactory.getMessageBuilder();
        message =
            msgBuilder.getMessage("scheduler.fillparmanually", "component_scheduler_messages");
      }
      response.setAttribute(SpagoBIConstants.MESSAGE_INFO, message);
    } else {
      list = loadSpagoList(request, response, parId, roleName);
    }
    // fill response
    response.setAttribute(SpagoBIConstants.PUBLISHER_NAME, "LovLookupAjax");
    logger.debug("OUT");
    return list;
  }
  /**
   * Do start tag.
   *
   * @return the int
   * @throws JspException the jsp exception
   * @see it.eng.spagobi.commons.presentation.tags.CheckListTag#doStartTag()
   */
  public int doStartTag() throws JspException {
    SpagoBITracer.info("Admintools", "ListTag", "doStartTag", " method invoked");
    httpRequest = (HttpServletRequest) pageContext.getRequest();
    renderResponse = (RenderResponse) httpRequest.getAttribute("javax.portlet.response");
    renderRequest = (RenderRequest) httpRequest.getAttribute("javax.portlet.request");

    _requestContainer = RequestContainerPortletAccess.getRequestContainer(httpRequest);
    portReq = PortletUtilities.getPortletRequest();
    _serviceRequest = _requestContainer.getServiceRequest();
    _responseContainer = ResponseContainerPortletAccess.getResponseContainer(httpRequest);

    msgBuilder = MessageBuilderFactory.getMessageBuilder();
    if (_bundle == null) _bundle = "messages";

    _session = _requestContainer.getSessionContainer();

    _serviceResponse = _responseContainer.getServiceResponse();
    ConfigSingleton configure = ConfigSingleton.getInstance();
    if (_actionName != null) {
      _serviceName = _actionName;
      _content = _serviceResponse;
      SourceBean actionBean =
          (SourceBean)
              configure.getFilteredSourceBeanAttribute("ACTIONS.ACTION", "NAME", _actionName);
      _layout = (SourceBean) actionBean.getAttribute("CONFIG");
      if (_layout == null) {
        // if the layout is dinamically created it is an attribute of the response
        _layout = (SourceBean) _serviceResponse.getAttribute("CONFIG");
      }
      _providerURL = "ACTION_NAME=" + _actionName + "&";
      _providerUrlMap.put("ACTION_NAME", _actionName);
      HashMap params = (HashMap) _serviceResponse.getAttribute("PARAMETERS_MAP");
      if (params != null) {
        _paramsMap = params;
        _providerUrlMap.putAll(_paramsMap);
      }
    } // if (_actionName != null)
    else if (_moduleName != null) {
      _serviceName = _moduleName;
      SpagoBITracer.debug("Admintools", "ListTag", "doStartTag", " Module Name: " + _moduleName);
      _content = (SourceBean) _serviceResponse.getAttribute(_moduleName);
      SourceBean moduleBean =
          (SourceBean)
              configure.getFilteredSourceBeanAttribute("MODULES.MODULE", "NAME", _moduleName);

      if (moduleBean != null)
        SpagoBITracer.debug(
            "Admintools", "ListTag", "doStartTag", _moduleName + " configuration loaded");
      _layout = (SourceBean) moduleBean.getAttribute("CONFIG");
      if (_layout == null) {
        // if the layout is dinamically created it is an attribute of the response
        _layout = (SourceBean) _serviceResponse.getAttribute(_moduleName + ".CONFIG");
      }
      String pageName = (String) _serviceRequest.getAttribute("PAGE");
      SpagoBITracer.debug("Admintools", "ListTag", "doStartTag", " PAGE: " + pageName);
      _providerURL = "PAGE=" + pageName + "&MODULE=" + _moduleName + "&";
      _providerUrlMap.put("PAGE", pageName);
      _providerUrlMap.put("MODULE", _moduleName);
      HashMap params = (HashMap) _serviceResponse.getAttribute(_moduleName + ".PARAMETERS_MAP");
      if (params != null) {
        _paramsMap = params;
        _providerUrlMap.putAll(_paramsMap);
      }
    } // if (_moduleName != null)
    else {
      SpagoBITracer.critical("Admintools", "ListTag", "doStartTag", "service name not specified");
      throw new JspException("Business name not specified !");
    } // if (_content == null)
    if (_content == null) {
      SpagoBITracer.warning("Admintools", "ListTag", "doStartTag", "list content null");
      return SKIP_BODY;
    } // if (_content == null)
    if (_layout == null) {
      SpagoBITracer.warning(
          "Admintools", "ListTag", "doStartTag", "list module configuration null");
      return SKIP_BODY;
    } // if (_layout == null)
    // if the LightNavigator is disabled entering the list, it is kept disabled untill exiting the
    // list
    Object lightNavigatorDisabledObj =
        _serviceRequest.getAttribute(LightNavigationManager.LIGHT_NAVIGATOR_DISABLED);
    if (lightNavigatorDisabledObj != null) {
      String lightNavigatorDisabled = (String) lightNavigatorDisabledObj;
      _providerUrlMap.put(LightNavigationManager.LIGHT_NAVIGATOR_DISABLED, lightNavigatorDisabled);
    }
    _htmlStream = new StringBuffer();

    PortletURL url = renderResponse.createActionURL();
    url.setParameter("PAGE", "DetailBIObjectPage");
    url.setParameter("MESSAGEDET", "RETURN_FROM_SUBREPORTS_LOOKUP");
    url.setParameter("LIGHT_NAVIGATOR_DISABLED", "true");

    _htmlStream.append(" <form method='POST' action='" + url.toString() + "'>\n");
    makeForm();
    _htmlStream.append(" </form>\n");
    try {
      pageContext.getOut().print(_htmlStream);
    } // try
    catch (Exception ex) {
      SpagoBITracer.critical(
          "Admintools", "ListTag", "doStartTag", "Impossible to send the stream");
      throw new JspException("Impossible to send the stream");
    } // catch (Exception ex)
    return SKIP_BODY;
  } // public int doStartTag() throws JspException