Project

General

Profile

« Previous | Next » 

Revision 691

Added by bojilova almost 24 years ago

cleared DOCTITLE attribute in xml_documents and xml_revisions
cleared all mentions of doctitle

View differences:

src/edu/ucsb/nceas/metacat/DBSAXHandler.java
70 70
   private int serverCode = 1;
71 71

  
72 72
   private static final int MAXDATACHARS = 4000;
73
   private static final int MAXTITLELEN = 1000;
73
// DOCTITLE attr cleared from the db
74
//   private static final int MAXTITLELEN = 1000;
74 75

  
75 76
   /** Construct an instance of the handler class 
76 77
    *
......
306 307
       currentNode.writeChildNodeToDB("TEXT", null, data, docid);
307 308
     }
308 309

  
309
     // write the title of document if there are tag <title>
310
     if ( currentNode.getTagName().equals("title") ) {
311
       if ( leftover > MAXTITLELEN ) 
312
         currentDocument.setTitle(new String(cbuf, start, MAXTITLELEN));
313
       else
314
         currentDocument.setTitle(new String(cbuf, start, leftover));
315
     }
310
// DOCTITLE attr cleared from the db
311
//     // write the title of document if there are tag <title>
312
//     if ( currentNode.getTagName().equals("title") ) {
313
//       if ( leftover > MAXTITLELEN ) 
314
//         currentDocument.setTitle(new String(cbuf, start, MAXTITLELEN));
315
//       else
316
//         currentDocument.setTitle(new String(cbuf, start, leftover));
317
//     }
316 318
   }
317 319

  
318 320
   /** 
src/edu/ucsb/nceas/metacat/DocumentImpl.java
70 70
  private String docid = null;
71 71
  private String docname = null;
72 72
  private String doctype = null;
73
  private String doctitle = null;
73
// DOCTITLE attr cleared from the db
74
//  private String doctitle = null;
74 75
  private String createdate = null;
75 76
  private String updatedate = null;
76 77
  private String system_id = null;
......
215 216
    return docid;
216 217
  }
217 218
  
218
  /**
219
   *get the document title
220
   */
221
  public String getDocTitle() {
222
    return doctitle;
223
  }
219
// DOCTITLE attr cleared from the db
220
//  /**
221
//   *get the document title
222
//   */
223
//  public String getDocTitle() {
224
//    return doctitle;
225
//  }
224 226
  
225 227
  public String getUserowner() {
226 228
    return userowner;
......
497 499
    
498 500
    try {
499 501
      StringBuffer sql = new StringBuffer();
500
      sql.append("SELECT docname, doctype, rootnodeid,doctitle, ");
502
// DOCTITLE attr cleared from the db
503
//      sql.append("SELECT docname, doctype, rootnodeid, doctitle, ");
504
      sql.append("SELECT docname, doctype, rootnodeid, ");
501 505
      sql.append("date_created, date_updated, ");
502 506
      sql.append("user_owner, user_updated, server_location, ");
503 507
      sql.append("rev FROM ").append(table);
......
517 521
        this.docname        = rs.getString(1);
518 522
        this.doctype        = rs.getString(2);
519 523
        this.rootnodeid     = rs.getLong(3);
520
        this.doctitle       = rs.getString(4);
524
// DOCTITLE attr cleared from the db
525
//        this.doctitle       = rs.getString(4);
521 526
        this.createdate     = rs.getString(5);
522 527
        this.updatedate     = rs.getString(6);
523 528
        this.userowner      = rs.getString(7);
......
713 718
    }
714 719
  }
715 720

  
716
  /**
717
   * Get the document title
718
   */
719
  public String getTitle() {
720
    return doctitle;
721
  }
721
// DOCTITLE attr cleared from the db
722
//  /**
723
//   * Get the document title
724
//   */
725
//  public String getTitle() {
726
//    return doctitle;
727
//  }
722 728

  
723
  /**
724
   * Set the document title
725
   *
726
   * @param title the new title for the document
727
   */
729
// DOCTITLE attr cleared from the db
730
//  /**
731
//   * Set the document title
732
//   *
733
//   * @param title the new title for the document
734
//   */
735
//  public void setTitle( String title ) {
736
//    this.doctitle = title;
737
//    try {
738
//      PreparedStatement pstmt;
739
//      pstmt = conn.prepareStatement(
740
//            "UPDATE xml_documents " +
741
//            " SET doctitle = ? " +
742
//            "WHERE docid = ?");
743
//
744
//      // Bind the values to the query
745
//      pstmt.setString(1, doctitle);
746
//      pstmt.setString(2, docid);
747
//
748
//      // Do the insertion
749
//      pstmt.execute();
750
//      pstmt.close();
751
//    } catch (SQLException e) {
752
//      System.out.println("Error in DocumentImpl.setTitle: " + e.getMessage());
753
//    }
754
//  }
728 755

  
729
  public void setTitle( String title ) {
730
    this.doctitle = title;
731
    try {
732
      PreparedStatement pstmt;
733
      pstmt = conn.prepareStatement(
734
            "UPDATE xml_documents " +
735
            " SET doctitle = ? " +
736
            "WHERE docid = ?");
737

  
738
      // Bind the values to the query
739
      pstmt.setString(1, doctitle);
740
      pstmt.setString(2, docid);
741

  
742
      // Do the insertion
743
      pstmt.execute();
744
      pstmt.close();
745
    } catch (SQLException e) {
746
      System.out.println("Error in DocumentImpl.setTitle: " + e.getMessage());
747
    }
748
  }
749

  
750 756
  /**
751 757
   * Write an XML file to the database, given a filename
752 758
   *
......
1104 1110
    // for that document as selected from xml_documents
1105 1111
    PreparedStatement pstmt = conn.prepareStatement(
1106 1112
      "INSERT INTO xml_revisions " +
1107
        "(revisionid, docid, rootnodeid, docname, doctype, doctitle, " +
1113
        "(revisionid, docid, rootnodeid, docname, doctype, " +
1108 1114
        "user_owner, user_updated, date_created, date_updated, server_location, " +
1109 1115
        "rev)" +
1110
      "SELECT null, ?, rootnodeid, docname, doctype, doctitle," + 
1116
      "SELECT null, ?, rootnodeid, docname, doctype, " + 
1111 1117
        "user_owner, ?, sysdate, sysdate, server_location, rev "+
1112 1118
      "FROM xml_documents " +
1113 1119
      "WHERE docid = ?");

Also available in: Unified diff