Project

General

Profile

« Previous | Next » 

Revision 745

Fixed bug in metacat where return doctypes were not being properly
back traced. Changed DBQuery.findDocuments() so that it no longer
takes a returndoc array, but instead retrieves the returndoc array
fromthe QUERYSpecification. The QuerySpecification was augmented
with a whole bunch of get/set accessor methods.

View differences:

DBQuery.java
176 176
    this.parserName = parserName;
177 177
  }
178 178
  
179
  public Hashtable findDocuments(Reader xmlquery, String user, String group,
180
                                 boolean useXMLIndex)
179
  /** 
180
   * routine to search the elements and attributes looking to match query
181
   *
182
   * @param xmlquery the xml serialization of the query (@see pathquery.dtd)
183
   * @param user the username of the user
184
   * @param group the group of the user
185
   */
186
  public Hashtable findDocuments(Reader xmlquery, String user, String group)
181 187
  {
182
    return findDocuments(xmlquery, user, group, null, useXMLIndex);
188
    return findDocuments(xmlquery, user, group, true);
183 189
  }
184
  
185
  public Hashtable findDocuments(Reader xmlquery, String user, String group,
186
                                 String[] returndoc)
187
  {
188
    return findDocuments(xmlquery, user, group, returndoc, true);
189
  }
190 190

  
191 191
  /** 
192 192
   * routine to search the elements and attributes looking to match query
......
194 194
   * @param xmlquery the xml serialization of the query (@see pathquery.dtd)
195 195
   * @param user the username of the user
196 196
   * @param group the group of the user
197
   * @param returndoc an array of document types to backtrack against.
197
   * @param useXMLIndex flag whether to search using the path index
198 198
   */
199 199
  public Hashtable findDocuments(Reader xmlquery, String user, String group,
200
                                 String[] returndoc, boolean useXMLIndex)
200
                                 boolean useXMLIndex)
201 201
  {
202 202
      Hashtable   docListResult = new Hashtable();
203 203
      PreparedStatement pstmt = null;
......
212 212
      Connection dbconn = null;
213 213
      int rev = 0;
214 214
      StringBuffer document = null; 
215
      Vector returndocVec = new Vector();
216 215
      
217
      //add the returndoc elements to a vector for easier manipulation
218
      if (returndoc != null)
219
      {
220
        for(int i=0; i<returndoc.length; i++)
221
        {
222
          returndocVec.add(new String((String)returndoc[i]));
223
        }
224
      }
225
      
226 216
      try {
227 217
        if (conn == null || conn.isClosed()) {
228 218
          dbconn = util.openDBConnection();
......
253 243
          updateDate = rs.getString(5);
254 244
          rev = rs.getInt(6);
255 245

  
256
          //if there are returndocs to match, backtracking can be performed
257
          // If no package exists, do not return the document
246
          // if there are returndocs to match, backtracking can be performed
247
          // otherwise, just return the document that was hit
248
          Vector returndocVec = qspec.getReturnDocList();
258 249
          if (returndocVec.size() != 0 && !returndocVec.contains(doctype))
259 250
          { 
251
            MetaCatUtil.debugMessage("Back tracing now...");
260 252
            String sep = util.getOption("accNumSeparator");
261 253
            StringBuffer btBuf = new StringBuffer();
262 254
            btBuf.append("select docid from xml_relation where ");

Also available in: Unified diff