Package org.dbwiki.data.database

Examples of org.dbwiki.data.database.Database


      DatabaseWiki wiki = server.get(wikiName);
     
      // [wiki] should never be null
      assert(wiki != null);
     
      Database database = wiki.database();
           
      Connection con = connector.getConnection();
      con.setAutoCommit(false);

      ImportPresentationFiles p = new ImportPresentationFiles(server, wiki, database, username);
View Full Code Here


    @Override
    public void print(Printer printer) {
      HtmlLinePrinter body = new HtmlLinePrinter();
     
        PageContentPrinter contentPrinter = (PageContentPrinter)((ExtendedPrinter) printer).getExtension();
        Database database = contentPrinter.getDatabase();
     
      try {     
        String query = _queryString;
        if(query.toLowerCase().startsWith("ignore:")) {
          return;
        }
        else if(query.toLowerCase().startsWith("chart:") || query.toLowerCase().startsWith("chart(")) {
          // FIXME: should parse the arguments to charts in a more
          // sensible scalable way.
          query = query.substring("chart".length());
          String xSize = "800";
          String ySize = "600";
          if(query.startsWith("(")) {
            int comma = query.indexOf(",");
            int closeParen = query.indexOf(")", comma);
            int colon = query.indexOf(":", closeParen);
           
            if(comma == -1 || closeParen == -1 || colon != closeParen+1)
              throw new WikiQueryException(WikiQueryException.UnknownQueryFormat, _queryString);
           
            xSize = query.substring(1, comma);
            ySize = query.substring(comma+1, closeParen);
            query = query.substring(colon+1);
          } else {
            query = query.substring(1);
          }
          QueryResultSet rs = database.query(query);
          body.openPARAGRAPH(CSS.CSSPageText);
          drawChart(ChartType.Column, xSize, ySize, rs, body);
        } else if(query.toLowerCase().startsWith("pie:") || query.toLowerCase().startsWith("pie(")) {
          // FIXME: should parse the arguments to charts in a more
          // sensible scalable way.
          query = query.substring("pie".length());
          String xSize = "800";
          String ySize = "600";
          if(query.startsWith("(")) {
            int comma = query.indexOf(",");
            int closeParen = query.indexOf(")", comma);
            int colon = query.indexOf(":", closeParen);

            if(comma == -1 || closeParen == -1 || colon != closeParen+1)
              throw new WikiQueryException(WikiQueryException.UnknownQueryFormat, _queryString);

            xSize = query.substring(1, comma);
            ySize = query.substring(comma+1, closeParen);
            query = query.substring(colon+1);
          } else {
            query = query.substring(1);
          }
          QueryResultSet rs = database.query(query);
          body.openPARAGRAPH(CSS.CSSPageText);
          drawChart(ChartType.Pie, xSize, ySize, rs, body);
        } else if(query.toLowerCase().startsWith("map:")) {
          query = query.substring("map:".length());
          QueryResultSet rs = database.query(query);
          body.openPARAGRAPH(CSS.CSSPageText);
          drawMap(rs, body);
        } else {
          QueryResultSet rs = database.query(query);
          if (!rs.isEmpty()) {
            body.openPARAGRAPH(CSS.CSSPageText);
            if (rs.isElement()) {
              RequestParameterVersion versionParameter = null;
              if (rs.hasTimestamp()) {
View Full Code Here

      Collections.sort(_wikiListing);
      //
      // Import data into created database wiki if the user specified an import resource.
      //
      if (resource != null) {
        Database database = wiki.database();
        // Note that database.schema() is a copy of databaseSchema that has been read back from the database
        // after being loaded in when we created new database above.
        // We should really deal with the target path separately, e.g. via extra text field
        XMLDocumentImportReader reader = new XMLDocumentImportReader(resource,
                            database.schema(),
                            path, user, false, false);
        ImportHandler importHandler = database.createImportHandler(con);
        reader.setImportHandler(importHandler);
        reader.start();
      }
    } catch (java.sql.SQLException sqlException) {
      con.rollback();
View Full Code Here

      Collections.sort(_wikiListing);
      //
      // Import data into created database wiki if the user specified an import resource.
      //
      if (resource != null) {
        Database database = wiki.database();
        // Note that database.schema() is a copy of databaseSchema that has been read back from the database
        // after being loaded in when we created new database above.
        // We should really deal with the target path separately, e.g. via extra text field
        XMLDocumentImportReader reader = new XMLDocumentImportReader(resource,
                            database.schema(),
                            path, user, false, false);
        ImportHandler importHandler = database.createImportHandler(con);
        reader.setImportHandler(importHandler);
        reader.start();
      }
    } catch (java.sql.SQLException sqlException) {
      con.rollback();
View Full Code Here

      Collections.sort(_wikiListing);
      //
      // Import data into created database wiki if the user specified an import resource.
      //
      if (resource != null) {
        Database database = wiki.database();
        // Note that database.schema() is a copy of databaseSchema that has been read back from the database
        // after being loaded in when we created new database above.
        // We should really deal with the target path separately, e.g. via extra text field
        XMLDocumentImportReader reader = new XMLDocumentImportReader(resource,
                            database.schema(),
                            path, user, false, false);
        ImportHandler importHandler = database.createImportHandler(con);
        reader.setImportHandler(importHandler);
        reader.start();
      }
    } catch (java.sql.SQLException sqlException) {
      con.rollback();
View Full Code Here

TOP

Related Classes of org.dbwiki.data.database.Database

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.