Package org.dbwiki.data.wiki

Examples of org.dbwiki.data.wiki.DatabaseWikiPage


   * @param identifier
   * @return
   * @throws org.dbwiki.exception.WikiException
   */
  public synchronized DatabaseWikiPage get(ResourceIdentifier identifier) throws org.dbwiki.exception.WikiException {
    DatabaseWikiPage page = null;
   
    PageIdentifier p = (PageIdentifier)identifier;
       
    if (p.isRootIdentifier()) {
      return null;
    }
   
    String name = p.toQueryString();
    long timestamp = p.getTimestamp();
   
    try {
      Connection con = _connector.getConnection();
     
      PreparedStatement pStmtSelectPage = null;
      if(timestamp == -1) {
        pStmtSelectPage = con.prepareStatement(
            "SELECT " +
            DatabaseConstants.RelPagesColID + ", " +
            DatabaseConstants.RelPagesColContent + ", " +
            DatabaseConstants.RelPagesColTimestamp + ", " +
            DatabaseConstants.RelPagesColUser + " " +
            "FROM " + _relName + DatabaseConstants.RelationPages + " " +
            "WHERE " + DatabaseConstants.RelPagesColName + " = ? " +
            "ORDER BY " + DatabaseConstants.RelPagesColTimestamp + " DESC");
      } else {
        pStmtSelectPage = con.prepareStatement(
            "SELECT " +
            DatabaseConstants.RelPagesColID + ", " +
            DatabaseConstants.RelPagesColContent + ", " +
            DatabaseConstants.RelPagesColTimestamp + ", " +
            DatabaseConstants.RelPagesColUser + " " +
            "FROM " + _relName + DatabaseConstants.RelationPages + " " +
            "WHERE " + DatabaseConstants.RelPagesColName + " = ?" +
            "AND " + DatabaseConstants.RelPagesColTimestamp + " = ?");
        pStmtSelectPage.setLong(2, timestamp);
      }
   
      pStmtSelectPage.setString(1, name);
     
      ResultSet rs = pStmtSelectPage.executeQuery();
     
      if (rs.next()) {
        page =
          new DatabaseWikiPage(
              rs.getInt(DatabaseConstants.RelPagesColID),
              name,
              rs.getString(DatabaseConstants.RelPagesColContent),
              rs.getLong(DatabaseConstants.RelPagesColTimestamp),
              _users.get(rs.getInt(DatabaseConstants.RelPagesColUser)));
View Full Code Here


      pStmtSelectPage.setString(1, name);
      ResultSet rs = pStmtSelectPage.executeQuery();
     
      while (rs.next()) {
        versions.add(
            new DatabaseWikiPage(rs.getInt(DatabaseConstants.RelPagesColID),
                         name, null,
                         rs.getLong(DatabaseConstants.RelPagesColTimestamp),
                         _users.get(rs.getInt(DatabaseConstants.RelPagesColUser))));
      }
     
View Full Code Here

         
          File wikiFile = new File(args.wikiDir+ File.separator + "page_" + i +".xml" );
          OutputStream wikioutstream = new FileOutputStream(wikiFile);
          OutputStreamWriter wikiout = new OutputStreamWriter(wikioutstream);
         
          DatabaseWikiPage content = _wiki.wiki().get(wikiEntry.identifier());
          content.write(wikiout);
          wikiout.close();
          wikioutstream.close();
        }
      } else {
        throw new Exception("Wiki directory path is not a directory");
View Full Code Here

  protected void printViewMenu(HtmlLinePrinter printer) {
    String name = null;
    try {
      // #wikipages: This throws an exception when we are dealing with the root page request.
      DatabaseWikiPage page = _request.page();
      if (page != null) {
        name = URLEncoder.encode(page.getName(), "UTF-8");
      }
    } catch (WikiException e) {
      e.printStackTrace();
    } catch (UnsupportedEncodingException e) {
View Full Code Here

  /*
   * Public Methods
   */
 
  public void print(HtmlLinePrinter body) throws org.dbwiki.exception.WikiException {
    DatabaseWikiPage page = _request.page();
    body.paragraph(page.getName(), CSS.CSSHeadline);
   
    body.openTABLE(CSS.CSSPageFrame);
    body.openTR();
    body.openTD(CSS.CSSPageContent);

    if(_pegDownProcessor == null)
      _pegDownProcessor = new ExtendedPegDownProcessor();
   
    String content = _pegDownProcessor.markdownToHtml(page.getContent(), this);
    body.add(content);
       
    body.closeTD();
    body.closeTR();
    body.closeTABLE();
   
    String username = User.UnknownUserName;
    if(page.getUser() != null) {
      username = page.getUser().fullName();
    }
   
    String timestamp = new SimpleDateFormat("d MMM yyyy HH:mm:ss").format(new Date(page.getTimestamp()));
   
    body.add("<div><i>Modified by " + username + " " +
        "at " + timestamp +
        "</i></div>")
  }
View Full Code Here

      title = parameters().get(RequestParameter.ActionValuePageTitle).value();
    }
    if (parameters().hasParameter(RequestParameter.ActionValuePageValue)) {
      value = parameters().get(RequestParameter.ActionValuePageValue).value();
    }
    return new DatabaseWikiPage(-1, title, value, -1, user());
  }
View Full Code Here

TOP

Related Classes of org.dbwiki.data.wiki.DatabaseWikiPage

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.