Package com.dotmarketing.portlets.report.struts

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


    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


  private HashMap<String, DataSource> packages = new HashMap<String, DataSource>();
  private DataSource defaultSource;
 
  @Override
  public Object getProperty(String name) {
    DataSource pack = getPack(name);
    name = fixName(pack,name);
    return pack.getProperty(name);
  }
View Full Code Here

  protected DataSource getPack(String name) {
    if (name == null) return defaultSource;
    String packName = MString.beforeIndex(name, '.');
    if (packName.length() == 0) return defaultSource;
    DataSource pack = packages.get(packName);
    return pack == null ? defaultSource : pack;
  }
View Full Code Here

    return pack == null ? defaultSource : pack;
  }

  @Override
  public boolean isProperty(String name) {
    DataSource pack = getPack(name);
    name = fixName(pack,name);
    return pack.isProperty(name);
  }
View Full Code Here

    return pack.isProperty(name);
  }

  @Override
  public void removeProperty(String name) throws MException {
    DataSource pack = getPack(name);
    name = fixName(pack,name);
    pack.removeProperty(name);
  }
View Full Code Here

    pack.removeProperty(name);
  }

  @Override
  public void setPropertyData(String name, Object value) throws MException {
    DataSource pack = getPack(name);
    name = fixName(pack,name);
    pack.setProperty(name, value);
  }
View Full Code Here

    packages.remove(name);
  }

  @Override
  public boolean isPropertyPossible(String name) {
    DataSource pack = getPack(name);
    name = fixName(pack,name);
    return pack.isPropertyPossible(name);
  }
View Full Code Here

            ServiceTarget serviceTarget = phaseContext.getServiceTarget();
            ServiceVerificationHandler verificationHandler = new ServiceVerificationHandler();

            if (dataSources.getDataSource() != null && dataSources.getDataSource().size() > 0) {
                for (int i = 0; i < dataSources.getDataSource().size(); i++) {
                    DataSource ds = (DataSource)dataSources.getDataSource().get(i);
                    if (ds.isEnabled() && ds.getDriver() != null) {
                        try {
                            final String jndiName = cleanupJavaContext(ds.getJndiName());
                            LocalDataSourceService lds = new LocalDataSourceService(jndiName);
                            lds.getDataSourceConfigInjector().inject(buildDataSource(ds));
                            final PathAddress addr = getDataSourceAddress(ds.getJndiName(), deploymentUnit, false);
                            installManagementModel(ds, deploymentUnit, addr);
                            startDataSource(lds, jndiName, ds.getDriver(), serviceTarget, verificationHandler, getRegistration(false, deploymentUnit), ds.getJndiName());
                        } catch (Exception e) {
                            throw ConnectorMessages.MESSAGES.exceptionDeployingDatasource(e, ds.getJndiName());
                        }
                    } else {
                        ConnectorLogger.DS_DEPLOYER_LOGGER.debugf("Ignoring: %s", ds.getJndiName());
                    }
                }
            }

            if (dataSources.getXaDataSource() != null && dataSources.getXaDataSource().size() > 0) {
View Full Code Here

        final List<DataSources> dataSourcesList = context.getAttachmentList(DsXmlDeploymentParsingProcessor.DATA_SOURCES_ATTACHMENT_KEY);

        for (final DataSources dataSources : dataSourcesList) {
            if (dataSources.getDataSource() != null) {
                for (int i = 0; i < dataSources.getDataSource().size(); i++) {
                    DataSource ds = (DataSource)dataSources.getDataSource().get(i);
                    undeployDataSource(ds, context);
                }
            }
            if (dataSources.getXaDataSource() != null) {
               for (int i = 0; i < dataSources.getXaDataSource().size(); i++) {
View Full Code Here

            ServiceTarget serviceTarget = phaseContext.getServiceTarget();
            ServiceVerificationHandler verificationHandler = new ServiceVerificationHandler();

            if (dataSources.getDataSource() != null && dataSources.getDataSource().size() > 0) {
                for (int i = 0; i < dataSources.getDataSource().size(); i++) {
                    DataSource ds = (DataSource)dataSources.getDataSource().get(i);
                    if (ds.isEnabled() && ds.getDriver() != null) {
                        try {
                            final String jndiName = cleanupJavaContext(ds.getJndiName());
                            LocalDataSourceService lds = new LocalDataSourceService(jndiName);
                            lds.getDataSourceConfigInjector().inject(buildDataSource(ds));
                            final String dsName = ds.getJndiName();
                            final PathAddress addr = getDataSourceAddress(dsName, deploymentUnit, false);
                            installManagementModel(ds, deploymentUnit, addr);
                            startDataSource(lds, jndiName, ds.getDriver(), serviceTarget, verificationHandler,
                                    getRegistration(false, deploymentUnit), getResource(dsName, false, deploymentUnit), dsName);
                        } catch (Exception e) {
                            throw ConnectorMessages.MESSAGES.exceptionDeployingDatasource(e, ds.getJndiName());
                        }
                    } else {
                        ConnectorLogger.DS_DEPLOYER_LOGGER.debugf("Ignoring: %s", ds.getJndiName());
                    }
                }
            }

            if (dataSources.getXaDataSource() != null && dataSources.getXaDataSource().size() > 0) {
View Full Code Here

TOP

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

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.