Package com.dotmarketing.portlets.report.struts

Examples of com.dotmarketing.portlets.report.struts.ReportForm


    newReport = false;
    ActionRequestImpl reqImpl = (ActionRequestImpl) req;
    HttpServletRequest httpReq = reqImpl.getHttpServletRequest();
    String cmd = req.getParameter(Constants.CMD);
    Logger.debug(this, "Inside EditReportAction cmd=" + cmd);
    ReportForm rfm = (ReportForm) form;
    String owner = rfm.getOwner();
    ArrayList<String> ds = (DbConnectionFactory.getAllDataSources());
    ArrayList<DataSource> dsResults = new ArrayList<DataSource>();
    for (String dataSource : ds) {
      DataSource d = rfm.getNewDataSource();
      if (dataSource
          .equals(com.dotmarketing.util.Constants.DATABASE_DEFAULT_DATASOURCE)) {
        d.setDsName("DotCMS Datasource");
      } else {
        d.setDsName(dataSource);
      }
      dsResults.add(d);
    }
    rfm.setDataSources(dsResults);
    httpReq.setAttribute("dataSources", rfm.getDataSources());

    String reportId = req.getParameter("reportId");
    String referrer = SecurityUtils.stripReferer(httpReq, req.getParameter("referrer"));

    // Report Exists
    if (UtilMethods.isSet(reportId)) {
      report = ReportFactory.getReport(reportId);
      ArrayList<String> adminRoles = new ArrayList<String>();
      adminRoles
          .add("CMS Administrator");
      if (user.getUserId().equals(report.getOwner())) {
        _checkWritePermissions(report, user, httpReq, adminRoles);
      }
      if (cmd == null || !cmd.equals(Constants.EDIT)) {
        rfm.setSelectedDataSource(report.getDs());
        rfm.setReportName(report.getReportName());
        rfm.setReportDescription(report.getReportDescription());
        rfm.setReportId(report.getInode());
        rfm.setWebFormReport(report.isWebFormReport());
        httpReq.setAttribute("selectedDS", report.getDs());
      }
    } else {
      if (!editor) {
        throw new DotRuntimeException(
            "user not allowed to create a new report");
      }
      report = new Report();
      report.setOwner(_getUser(req).getUserId());
      newReport = true;
    }
    req.setAttribute(WebKeys.REPORT_EDIT, report);

    if ((cmd != null) && cmd.equals(Constants.EDIT)) {
      if (Validator.validate(req, form, mapping)) {
        report.setReportName(rfm.getReportName());
        report.setReportDescription(rfm.getReportDescription());
        report.setWebFormReport(rfm.isWebFormReport());
        if (rfm.isWebFormReport())
          report.setDs("None");
        else
          report.setDs(rfm.getSelectedDataSource());
        String jrxmlPath = "";
        String jasperPath = "";
        String reportPath = "";

        try {
          HibernateUtil.startTransaction();
          ReportFactory.saveReport(report);

          if (!rfm.isWebFormReport()) {

            if (UtilMethods.isSet(Config
                .getStringProperty("ASSET_REAL_PATH"))) {
              jrxmlPath = Config
                  .getStringProperty("ASSET_REAL_PATH")
View Full Code Here

TOP

Related Classes of com.dotmarketing.portlets.report.struts.ReportForm

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.