Package com.centraview.report.ejb.session

Examples of com.centraview.report.ejb.session.ReportFacade


        int[] reportIds = new int[rowId.length];
        int elementID = 0;
        for (int i = 0; i < rowId.length; i++) {
          reportIds[i] = Integer.parseInt(rowId[i]);
        }
        ReportFacade remote = getReportFacade();
        remote.delete(reportIds);
      }
    } catch (Exception e) {
      logger.error("[execute] Exception thrown.", e);
      throw new ServletException(e);
    }
View Full Code Here


  public ReportResultVO getReportResults(int userID, int reportId, SearchVO search) throws ServletException
  {
    String dataSource = Settings.getInstance().getSiteInfo(CVUtility.getHostName(super.getServlet().getServletContext())).getDataSource();
    ReportResultVO reportResult = null;
    try {
      ReportFacade remote = SessionBeanFactory.getReportFacade();
      remote.setDataSource(dataSource);
      reportResult = remote.getAdHocReportResult(userID, reportId, search);
    } catch (Exception e) {
      logger.error("[getReportResults] Exception thrown.", e);
      throw new ServletException(e);
    }
    return reportResult;
View Full Code Here

      int individualId = userObject.getIndividualID();
      String dataSource = Settings.getInstance().getSiteInfo(CVUtility.getHostName(super.getServlet().getServletContext())).getDataSource();
      DynaActionForm adhocReportForm = (DynaActionForm)actionForm;

      SelectVO selects = new SelectVO();
      ReportFacade remote = getReportFacade();
      // Get the table list from the reportFacade
      // The table list is an ArrayList of TheTable objects, which contain
      // an ID an table name and the Display name.
      selects = remote.getAdHocPageData(moduleId);

      // createNew is a string attribute that tells this handler if it should clear
      // the form.
      String createNew = (String)adhocReportForm.get("createNew");
      if (createNew.equals("true")) {
View Full Code Here

      {
        reportForm.initialize(actionMapping);
        reportForm.set("moduleId", new Integer(moduleId));
      }
      ReportVO reportVO = null;
      ReportFacade remote = getReportFacade();
      String action = request.getParameter("action");
      String showFields = (String)((DynaActionForm)actionForm).get("showFields");
      if (action == null) // means we are probably coming here from the list view.
                          // or have resubmitted to manipulate search criteria.
      {
        reportVO = remote.getStandardReport(userId, reportId);
        moduleId = reportVO.getModuleId();
        // See if we should add a row.
        SearchCriteriaVO[] searchCriteria = (SearchCriteriaVO[])reportForm.get("searchCriteria");
        String addRow = (String)reportForm.get("addRow");
        String removeRow = (String)reportForm.get("removeRow");
        if (addRow.equals("true"))
        {
          searchCriteria = AdvancedSearchUtil.addRow(searchCriteria);
          reportForm.set("addRow", "false");
          reportForm.set("searchCriteria", searchCriteria);
        } else if (!removeRow.equals("false")) {
          searchCriteria = AdvancedSearchUtil.removeRow(searchCriteria, removeRow);
          reportForm.set("removeRow", "false");
          reportForm.set("searchCriteria", searchCriteria);
        } else if (!showFields.equals("true")) {
          // showfield probably means we have changed some fields on the form, and we need to parse
          // the form and update the VO that we got from the database to reflect those changes.
          reportForm = (DynaActionForm)getStandardReportFormFromReportVO(reportVO, actionForm, request);
        }
        moduleId = reportVO.getModuleId();
        request.setAttribute("pagedata", reportVO);
      } else if (action.equals("save")) {
        reportVO = getStandardReportVOFromForm(timeZone, actionForm);
        remote.updateStandardReport(userId, reportVO, false);
        // save is save and close (although there is nothing we can update)
        nextURL = "showstandardreportlist";
      } else if (action.equals("run") || action.equals("export") || action.equals("print")) {
        if (action.equals("run"))
        {
          reportVO = getStandardReportVOFromForm(timeZone, actionForm);
          remote.updateStandardReport(userId, reportVO, false);
          reportForm.set("createNew", "true");
          nextURL = "showstandardreportresult";
        } else if (action.equals("export")) {
          reportForm.set("createNew", "true");
          nextURL = "csvstandardreportresult";
        } else if (action.equals("print")) {
          reportForm.set("createNew", "true");
          nextURL = "printstandardreportresult";
        }
        // Extract the SearchVO from the form
        SearchVO search = this.getSearchVOFromForm(actionForm, request);
        if (action.equals("run")){
          session.removeAttribute("searchVO");
          session.setAttribute("searchVO",search);
        }
        // Run the report and get the results.
        if (action.equals("export") || action.equals("print")){
          search = (SearchVO)session.getAttribute("searchVO");
        }
        ReportResultVO reportResultVO = remote.getStandardReportResult(userId, reportId, search);
        moduleId = reportResultVO.getModuleId();
        request.setAttribute("pagedata", reportResultVO);
      }
      request.setAttribute("reportId", String.valueOf(reportId));
      request.setAttribute("moduleId", String.valueOf(moduleId));
View Full Code Here

            if(request.getParameterValues("rowId") != null)
            {
                rowId = request.getParameterValues("rowId");
            }

            ReportFacade remote = getReportFacade();
            reportVO = remote.getAdHocReport(individualId, Integer.parseInt(rowId[0]));
            reportForm = (DynaActionForm)getAdHocReportFormFromReportVO( reportVO, form, request );
            reportForm.set("copy", new Boolean(true));

            request.setAttribute("adhocreportform", reportForm);
            request.setAttribute("pagedata", reportVO);
View Full Code Here

   * @return ReportFacade
   */
  protected ReportFacade getReportFacade()
  {
    String dataSource = Settings.getInstance().getSiteInfo(CVUtility.getHostName(super.getServlet().getServletContext())).getDataSource();
    ReportFacade remote = null;
    try {
      remote = SessionBeanFactory.getReportFacade();
      remote.setDataSource(dataSource);
    } catch (Exception e) {
      logger.error("[getReportFacade] Exception thrown.", e);
    }
    return remote;
  }
View Full Code Here

      int userId = userobject.getIndividualID();
      int reportId = getTheId("reportId", request);
      DynaActionForm adHocReportForm = (DynaActionForm)form;
      ReportVO reportVO = null;

      ReportFacade remote = getReportFacade();

      // searchCriteria should always have at least one row.
      SearchCriteriaVO[] searchCriteria = (SearchCriteriaVO[])adHocReportForm.get("searchCriteria");

      String addRow = (String)adHocReportForm.get("addRow");
      String removeRow = (String)adHocReportForm.get("removeRow");
      // we may just be doing search criteria row manipulation.
      if (addRow.equals("true")) {
        searchCriteria = AdvancedSearchUtil.addRow(searchCriteria);
        adHocReportForm.set("addRow", "false");
        adHocReportForm.set("searchCriteria", searchCriteria);
        reportVO = remote.getAdHocReport(userId, reportId);
        reportVO.setSelectedFields(getSelectedFieldsWithNames((String)adHocReportForm.get("contentFields"), (String)adHocReportForm.get("contentOrders"), (String)adHocReportForm.get("contentFieldNames")));
        request.setAttribute("pagedata", reportVO);
      } else if (!removeRow.equals("false")) {
        searchCriteria = AdvancedSearchUtil.removeRow(searchCriteria, removeRow);
        adHocReportForm.set("removeRow", "false");
        adHocReportForm.set("searchCriteria", searchCriteria);
        reportVO = remote.getAdHocReport(userId, reportId);
        reportVO.setSelectedFields(getSelectedFieldsWithNames((String)adHocReportForm.get("contentFields"), (String)adHocReportForm.get("contentOrders"), (String)adHocReportForm.get("contentFieldNames")));
        request.setAttribute("pagedata", reportVO);
      } else { // So it isn't search criteria row manipulation.
        // if action is null, it means we are displaying the form for editing,
        // otherwise we are going to save and possibly run the report.
        String action = request.getParameter("action");
        if (action == null) {
          String showFields = (String)adHocReportForm.get("showFields");
          String createNew = (String)adHocReportForm.get("createNew");
          if (createNew != null && createNew.equals("true")) {
            adHocReportForm.initialize(mapping);
          }
          reportVO = remote.getAdHocReport(userId, reportId);
          // I guess showFields is used to determine if the user edited any of the fields, that are on the form
          // but not yet in the database.  So we know to pull the report stuff from the DB
          // and then change the selected fields based on the current form.
          // it is initially "false" in the struts config
          if (!showFields.equals("true")) {
            // if it isn't true we update the form with the info from the reportVO from the database.
            adHocReportForm = (DynaActionForm)getAdHocReportFormFromReportVO(reportVO, adHocReportForm, request);
          } else {
            // otherwise we analyze the fields from the form and show that.
            reportVO.setSelectedFields(getSelectedFieldsWithNames((String)adHocReportForm.get("contentFields"), (String)adHocReportForm.get("contentOrders"), (String)adHocReportForm.get("contentFieldNames")));
          }
          moduleId = reportVO.getModuleId();
          request.setAttribute("pagedata", reportVO);
        } else { // action is telling us to do something for real, check for errors.
          ActionErrors errors = adHocReportForm.validate(mapping, request);
          if (0 < errors.size()) {
            saveErrors(request, errors);
            reportVO = remote.getAdHocReport(userId, reportId);
            moduleId = reportVO.getModuleId();
            request.setAttribute("pagedata", reportVO);
          } else { // the form passed validation
            // So we need to build a reportVO based on the form.
            // and either save a new one to the database (if we are duplicate)
            // or update the existing one in the database.
            reportVO = getAdHocReportVOFromForm(timeZone, adHocReportForm);
            // I guess "copy" is used for duplicate?  So if copy is true we will
            // be creating a new one, otherwise we will be updating.
            if (((Boolean)adHocReportForm.get("copy")).booleanValue()) {
              reportId = remote.addAdHocReport(userId, reportVO);
              reportVO.setReportId(reportId);
            } else {
              remote.updateAdHocReport(userId, reportVO);
            }
            if (action.equals("save")) {
              moduleId = reportVO.getModuleId();
              // It may be better to actually store of the Selects and
              // whatever else outside the VO on the formbean, so we can
              // not have to round trip here.  But for now we need to get the
              // reportVO from the EJB layer because it has the field definitions in it.
              reportVO = remote.getAdHocReport(userId, reportId);
              request.setAttribute("pagedata", reportVO);
            } else if (action.equals("close")) {
              adHocReportForm.set("createNew", "true");
              nextURL = "showadhocreportlist";
            } else if (action.equals("run")) {
View Full Code Here

          setPageData(request, moduleId);
          nextURL = "addadhocreport";
        } else {
          // Insert a new report into the database.
          ReportVO reportVO = getAdHocReportVOFromForm(timeZone, reportForm);
          ReportFacade remote = getReportFacade();
          reportId = remote.addAdHocReport(userId, reportVO);
          if (action.equals("new")) {
            // if save&new then show a blank form.
            reportForm.initialize(actionMapping);
            nextURL = "newaddhocreport";
          } else if (action.equals("run")) {
View Full Code Here

  {
    String dataSource = Settings.getInstance().getSiteInfo(CVUtility.getHostName(super.getServlet().getServletContext())).getDataSource();
    try {
      ReportVO reportVO = new ReportVO();
      SelectVO selects = new SelectVO();
      ReportFacade remote = getReportFacade();
      selects = remote.getAdHocPageData(moduleId);
      reportVO.setSelect(selects);
      request.setAttribute("pagedata", reportVO);
    } catch (Exception e) {
      e.printStackTrace();
    }
View Full Code Here

TOP

Related Classes of com.centraview.report.ejb.session.ReportFacade

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.