Project

General

Profile

« Previous | Next » 

Revision 801

Added by Matt Jones over 23 years ago

Changed the constructors so that the nodeRecordList is automatically
retrieved by the DocumentImpl(Connection,String) constructor. this
restores its earlier behavior, but the implementation is totally
done by DocumentImpl(Connection,String,boolean).

View differences:

src/edu/ucsb/nceas/metacat/DocumentImpl.java
102 102
   */
103 103
  public DocumentImpl(Connection conn, String docid, boolean readNodes) throws McdbException 
104 104
  {
105
    this(conn, docid);
105
    try {
106
      this.conn = conn;
107
      this.docid = docid;
108
      
109
      // Look up the document information
110
      getDocumentInfo(docid);
106 111

  
107
    if (readNodes) {
108
      try {
112
      if (readNodes) {
109 113
        // Download all of the document nodes using a single SQL query
110 114
        // The sort order of the records is determined by the NodeComparator
111 115
        // class, and needs to represent a depth-first traversal for the
112 116
        // toXml() method to work properly
113 117
        nodeRecordList = getNodeRecordList(rootnodeid);
118
      }
114 119
    
115
      } catch (McdbException ex) {
116
        throw ex;
117
      } catch (Throwable t) {
118
        throw new McdbException("Error reading document from " +
119
                                "DocumentImpl.DocumentImpl: " + docid);
120
      }
120
    } catch (McdbException ex) {
121
      throw ex;
122
    } catch (Throwable t) {
123
      throw new McdbException("Error reading document from " +
124
                              "DocumentImpl.DocumentImpl: " + docid);
121 125
    }
122 126
  }
123 127

  
......
130 134
   */
131 135
  public DocumentImpl(Connection conn, String docid) throws McdbException 
132 136
  {
133
    try { 
134
      this.conn = conn;
135
      this.docid = docid;
136
      
137
      // Look up the document information
138
      getDocumentInfo(docid);
139
      
140
    } catch (McdbException ex) {
141
      throw ex;
142
    } catch (Throwable t) {
143
      throw new McdbException("Error reading document from " +
144
                              "DocumentImpl.DocumentImpl: " + docid);
145
    }
137
    this(conn, docid, true);
146 138
  }
147 139

  
148 140
  /** 

Also available in: Unified diff