Package com.centraview.report.valueobject

Examples of com.centraview.report.valueobject.ReportVO


        adhocReportForm.set("removeRow", "false");
      }
      // now that the criteria is ready stick it on the formbean.
      adhocReportForm.set("searchCriteria", searchCriteria);

      ReportVO reportVO = new ReportVO();
      reportVO.setSelect(selects);
      // This parses the fields from the form bean and builds up an arraylist of
      // ReportContentVOs which represent what is selected.  This is then stuck on the
      // reportVO which is stuck on the request
      reportVO.setSelectedFields(getSelectedFieldsWithNames((String)adhocReportForm.get("contentFields"), (String)adhocReportForm.get("contentOrders"), (String)adhocReportForm.get("contentFieldNames")));
      request.setAttribute("pagedata", reportVO);
      // I think this should probably live on the adhocreportform, rather than worrying
      // about something on the request.  But here it is for now.
      request.setAttribute("reportType", String.valueOf(ReportConstants.ADHOC_REPORT_CODE));
    } catch (Exception e) {
View Full Code Here


      if (createNew.equals("true"))
      {
        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)
View Full Code Here

        String nextURL = "addadhocreport";
        try
        {
            HttpSession session = request.getSession();
            DynaActionForm reportForm = null;
            ReportVO reportVO = null;

            UserObject userObject = (UserObject)session.getAttribute("userobject");
            int individualId = userObject.getIndividualID();

            String rowId[] = null;
            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);

            request.setAttribute("reportType", String.valueOf(ReportConstants.ADHOC_REPORT_CODE));
            request.setAttribute("moduleId", String.valueOf(reportVO.getModuleId()));
        }
        catch(Exception e)
        {
            System.out.println("[Exception][DuplicateAdHocReportHandler.execute] Exception Thrown: " + e);
            throw new ServletException(e);
View Full Code Here

   * @param form ActionForm
   * @return ReportVO
   */
  protected ReportVO getAdHocReportVOFromForm(String timeZone, DynaActionForm form)
  {
    ReportVO reportVO = new ReportVO();
    reportVO.setModuleId(((Integer)form.get("moduleId")).intValue());
    reportVO.setName((String)form.get("name"));
    reportVO.setDescription((String)form.get("description"));
    reportVO.setReportId(((Integer)form.get("reportId")).intValue());
    reportVO.setSelectedFields(getSelectedFieldsWithNames((String)form.get("contentFields"), (String)form.get("contentOrders"), (String)form.get("contentFieldNames")));
    reportVO.setSearchFields(getSearchFields((String)form.get("searchFields")));
    return reportVO;
  }
View Full Code Here

   */
  protected ReportVO getStandardReportVOFromForm(String timeZone, ActionForm form)
  {

    DynaActionForm reportForm = (DynaActionForm)form;
    ReportVO reportVO = new ReportVO();
    reportVO.setModuleId(((Integer)reportForm.get("moduleId")).intValue());
    reportVO.setName((String)reportForm.get("name"));
    reportVO.setDescription((String)reportForm.get("description"));
    reportVO.setReportId(((Integer)reportForm.get("reportId")).intValue());
    if (((String)reportForm.get("startday")) != null && !((String)reportForm.get("startday")).equals(""))
      reportVO.setFrom(getDate((String)reportForm.get("startday"), (String)reportForm.get("startmonth"), (String)reportForm.get("startyear"), timeZone));
    if (((String)reportForm.get("endday")) != null && !((String)reportForm.get("endday")).equals(""))
      reportVO.setTo(getDate((String)reportForm.get("endday"), (String)reportForm.get("endmonth"), (String)reportForm.get("endyear"), timeZone));
    reportVO.setSearchFields(getSearchFields((String)reportForm.get("searchFields")));
    return reportVO;
  }
View Full Code Here

      UserObject userobject = (UserObject)session.getAttribute("userobject");
      String timeZone = userobject.getUserPref().getTimeZone();
      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);
View Full Code Here

          saveErrors(request, errors);
          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);
View Full Code Here

   */
  private void setPageData(HttpServletRequest request, int moduleId)
  {
    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

   * @return ReportVO
   */
  public ReportVO getStandardReport(int userId, int reportId)
  {
    try {
      ReportVO reportVO = new ReportVO();
      ReportLocalHome reportHome = EntityHomeFactory.getReportLocalHome();
      ReportContentLocalHome reportContentHome = EntityHomeFactory.getReportContentLocalHome();
      ReportLocal reportLocal = reportHome.findByPrimaryKey(new ReportPK(reportId, this.dataSource));

      reportVO.setDescription(reportLocal.getDescription());
      reportVO.setModuleId(reportLocal.getModuleId());
      reportVO.setName(reportLocal.getName());
      reportVO.setReportId(reportId);
      reportVO.setFrom(reportLocal.getDateFrom());
      reportVO.setTo(reportLocal.getDateTo());
      reportVO.setSelect(getAdHocPageData(reportLocal.getModuleId()));
      return reportVO;
    } catch (Exception e) {
      throw new EJBException(e);
    }
  }
View Full Code Here

      int fieldId = 0;
      int tableId = 0;
      String fieldName = null;
      ArrayList selectedTopFields = new ArrayList();

      ReportVO reportVO = getStandardReport(userId, reportId);

      ReportContentLocalHome reportContentHome = EntityHomeFactory.getReportContentLocalHome();
      ReportContentLocal reportContent = null;
      Collection reportContents = reportContentHome.findByReport(reportId, this.dataSource);
      for (Iterator iterator = reportContents.iterator(); iterator.hasNext();) {
        reportContent = (ReportContentLocal) iterator.next();
        tableId = reportContent.getTableId();
        fieldId = reportContent.getFieldId();
        fieldName = getFieldName(fieldId, tableId);
        selectedTopFields.add(new ReportContentVO(fieldId, tableId, fieldName, reportContent.getSortOrderSequence(), reportContent.getSortOrder()));
      }
      reportVO.setSelectedFields(selectedTopFields);
      return reportVO;
    } catch (Exception e) {
      throw new EJBException(e);
    }
  }
View Full Code Here

TOP

Related Classes of com.centraview.report.valueobject.ReportVO

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.