Project

General

Profile

« Previous | Next » 

Revision 2653

Added by Jing Tao about 19 years ago

Change the method to get access document docid and revision.

View differences:

src/edu/ucsb/nceas/metacat/RelationHandler.java
172 172
   * @param docid the document identifier of the package
173 173
   * @return the document identifier of the access file for that package
174 174
   */
175
  public static String getAccessFileID(String docid) throws SQLException
175
  public static String getAccessFileIDWithRevision(String docid) throws SQLException
176 176
  {
177 177
    String aclid = null;
178
    int rev;
178 179
    PreparedStatement pstmt = null;
179 180
    DBConnection dbConn = null;
180 181
    int serialNumber = -1;
181 182
    
182 183
    StringBuffer sql = new StringBuffer();
183
    sql.append("SELECT docid FROM xml_documents WHERE docid in (SELECT subject ");
184
    sql.append("SELECT docid, rev FROM xml_documents WHERE docid in (SELECT subject ");
184 185
    sql.append("FROM xml_relation WHERE docid='").append(docid);
185 186
    sql.append("' AND (");
186 187
    Vector accessdoctypes = MetaCatUtil.getOptionList(
......
208 209
      boolean hasRow = rs.next();
209 210
      if (hasRow) {
210 211
        aclid = rs.getString(1);
212
        rev = rs.getInt(2);
213
        aclid = aclid +MetaCatUtil.getOption("accNumSeparator")+rev;
211 214
      }
212 215
      pstmt.close();
213 216
    }//try

Also available in: Unified diff