Project

General

Profile

« Previous | Next » 

Revision 2087

Added by Jing Tao over 20 years ago

Add a new transferm method for string reader.

View differences:

src/edu/ucsb/nceas/metacat/DBQuery.java
8 8
 *  Copyright: 2000 Regents of the University of California and the
9 9
 *             National Center for Ecological Analysis and Synthesis
10 10
 *    Authors: Matt Jones
11
 *    Release: @release@
11
 *    Release: 1.4.0
12 12
 *
13 13
 *   '$Author$'
14 14
 *     '$Date$'
......
38 38
import java.io.FileWriter;
39 39
import java.io.IOException;
40 40
import java.io.InputStream;
41
import java.io.PrintWriter;
41 42
import java.io.Reader;
42 43
import java.io.StringReader;
43 44
import java.io.StringWriter;
......
52 53
import java.util.zip.ZipOutputStream;
53 54

  
54 55
import javax.servlet.ServletOutputStream;
56
import javax.servlet.http.HttpServletResponse;
55 57

  
58

  
56 59
import edu.ucsb.nceas.morpho.datapackage.Triple;
57 60
import edu.ucsb.nceas.morpho.datapackage.TripleCollection;
58 61

  
......
80 83
     * the main routine used to test the DBQuery utility.
81 84
     * <p>
82 85
     * Usage: java DBQuery <xmlfile>
83
     * 
86
     *
84 87
     * @param xmlfile the filename of the xml file containing the query
85 88
     */
86 89
    static public void main(String[] args)
......
120 123
                        .getOption("saxparser"));
121 124
                FileReader xml = new FileReader(new File(xmlfile));
122 125
                Hashtable nodelist = null;
123
                nodelist = queryobj.findDocuments(xml, null, null, useXMLIndex);
126
                //nodelist = queryobj.findDocuments(xml, null, null, useXMLIndex);
124 127

  
125 128
                // Print the reulting document listing
126 129
                StringBuffer result = new StringBuffer();
......
174 177

  
175 178
    /**
176 179
     * construct an instance of the DBQuery class
177
     * 
180
     *
178 181
     * <p>
179 182
     * Generally, one would call the findDocuments() routine after creating an
180 183
     * instance to specify the search query
181 184
     * </p>
182
     * 
183
     * @param conn the JDBC connection that we use for the query
185
     *
186

  
184 187
     * @param parserName the fully qualified name of a Java class implementing
185 188
     *            the org.xml.sax.XMLReader interface
186 189
     */
187
    public DBQuery(String parserName) throws IOException, SQLException,
188
            ClassNotFoundException
190
    public DBQuery(String parserName)
189 191
    {
190
        //this.conn = conn;
191
        this.parserName = parserName;
192
       this.parserName = parserName;
192 193
    }
193 194

  
195

  
196
  /**
197
   * Method put the search result set into out printerwriter
198
   * @param resoponse the return response
199
   * @param out the output printer
200
   * @param params the paratermer hashtable
201
   * @param user the user name (it maybe different to the one in param)
202
   * @param groups the group array
203
   * @param sessionid  the sessionid
204
   */
205
  public void findDocuments(HttpServletResponse response,
206
                                       PrintWriter out, Hashtable params,
207
                                       String user, String[] groups,
208
                                       String sessionid)
209
  {
210
    boolean useXMLIndex = (new Boolean(MetaCatUtil.getOption("usexmlindex")))
211
               .booleanValue();
212
    findDocuments(response, out, params, user, groups, sessionid, useXMLIndex);
213

  
214
  }
215

  
216

  
194 217
    /**
195
     * routine to search the elements and attributes looking to match query
196
     * 
197
     * @param xmlquery the xml serialization of the query (@see pathquery.dtd)
198
     * @param user the username of the user
199
     * @param group the group of the user
218
     * Method put the search result set into out printerwriter
219
     * @param resoponse the return response
220
     * @param out the output printer
221
     * @param params the paratermer hashtable
222
     * @param user the user name (it maybe different to the one in param)
223
     * @param groups the group array
224
     * @param sessionid  the sessionid
200 225
     */
201
    public Hashtable findDocuments(Reader xmlquery, String user, String[] groups)
226
    public void findDocuments(HttpServletResponse response,
227
                                         PrintWriter out, Hashtable params,
228
                                         String user, String[] groups,
229
                                         String sessionid, boolean useXMLIndex)
202 230
    {
203
        boolean useXMLIndex = (new Boolean(MetaCatUtil.getOption("usexmlindex")))
204
                .booleanValue();
205
        return findDocuments(xmlquery, user, groups, useXMLIndex);
231
      // get query and qformat
232
      String xmlquery = ((String[])params.get("query"))[0];
233
      xmlquery = transformQuery(xmlquery);
234
      MetaCatUtil.debugMessage("xmlquery: " + xmlquery, 30);
235
      String qformat = ((String[])params.get("qformat"))[0];
236
      MetaCatUtil.debugMessage("qformat: " + qformat, 30);
237

  
238
      if (qformat != null && qformat.equals(MetaCatServlet.XMLFORMAT))
239
      {
240
        //xml format
241
        response.setContentType("text/xml");
242
        createResultDocument(xmlquery, out, user, groups, useXMLIndex);
243
      }//if
244
      else
245
      {
246
        //knb format, in this case we will get whole result and sent it out
247
        response.setContentType("text/html");
248
        PrintWriter nonout = null;
249
        StringBuffer xml =
250
              createResultDocument(xmlquery, nonout, user, groups, useXMLIndex);
251
        //transfer the xml to html
252
        try
253
        {
254

  
255
         DBTransform trans = new DBTransform();
256
         response.setContentType("text/html");
257
         trans.transformXMLDocument(xml.toString(), "-//NCEAS//resultset//EN",
258
                                 "-//W3C//HTML//EN", qformat, out, params,
259
                                 sessionid);
260

  
261
        }
262
        catch(Exception e)
263
        {
264
         MetaCatUtil.debugMessage("Error in MetaCatServlet.transformResultset:"
265
                                +e.getMessage(), 30);
266
         }
267

  
268
      }//else
269

  
206 270
    }
207 271

  
208
    /**
209
     * routine to search the elements and attributes looking to match query
210
     * 
211
     * @param xmlquery the xml serialization of the query (@see pathquery.dtd)
212
     * @param user the username of the user
213
     * @param group the group of the user
214
     * @param useXMLIndex flag whether to search using the path index
215
     */
216
    public Hashtable findDocuments(Reader xmlquery, String user,
217
            String[] groups, boolean useXMLIndex)
272
  /*
273
   * Transforms a hashtable of documents to an xml or html result and sent
274
   * the content to outputstream. Keep going untill hastable is empty. stop it.   *
275
   */
276
  private StringBuffer createResultDocument(String xmlquery, PrintWriter out,
277
                                            String user, String[] groups,
278
                                            boolean useXMLIndex)
279
  {
280
    DBConnection dbconn = null;
281
    int serialNumber = -1;
282
    StringBuffer resultset = new StringBuffer();
283
    resultset.append("<?xml version=\"1.0\"?>\n");
284
    resultset.append("<resultset>\n");
285
    resultset.append("  <query>" + xmlquery + "</query>");
286
    // sent query part out
287
    if (out != null)
218 288
    {
219
        Hashtable result = new Hashtable();
220
        try {
221
            // Get the XML query and covert it into a SQL statment
222
            QuerySpecification qspec = new QuerySpecification(xmlquery,
223
                    parserName, MetaCatUtil.getOption("accNumSeparator"));
224
            result = findDocuments(qspec, user, groups, useXMLIndex);
225
        } catch (IOException ioe) {
226
            MetaCatUtil.debugMessage("IO error in DBQuery.findDocuments:", 30);
227
            MetaCatUtil.debugMessage(ioe.getMessage(), 30);
228
        }
229
        return result;
289
      out.println(resultset.toString());
230 290
    }
291
    try
292
    {
293
      // Get the XML query and covert it into a SQL statment
294
      QuerySpecification qspec = new QuerySpecification(xmlquery,
295
                   parserName, MetaCatUtil.getOption("accNumSeparator"));
296
      //checkout the dbconnection
297
      dbconn = DBConnectionPool.getDBConnection("DBQuery.findDocuments");
298
      serialNumber = dbconn.getCheckOutSerialNumber();
231 299

  
232
    /**
233
     * routine to search the elements and attributes looking to match query
234
     * 
235
     * @param qspec java object of the query
236
     * @param user the username of the user
237
     * @param group the group of the user
238
     * @param useXMLIndex flag whether to search using the path index
239
     */
240
    public Hashtable findDocuments(QuerySpecification qspec, String user,
241
            String[] groups, boolean useXMLIndex)
300
      //print out the search result
301
      // search the doc list
302
      resultset = findResultDoclist(qspec, resultset, out, user, groups,
303
                                    dbconn, useXMLIndex);
304

  
305

  
306
    }//try
307
    catch (IOException ioe)
242 308
    {
243
        Hashtable docListResult = new Hashtable();
244
        PreparedStatement pstmt = null;
245
        String docid = null;
246
        String docname = null;
247
        String doctype = null;
248
        String createDate = null;
249
        String updateDate = null;
250
        String fieldname = null;
251
        String fielddata = null;
252
        String relation = null;
253
        //Connection dbconn = null;
254
        //Connection dbconn2 = null;
255
        int rev = 0;
256
        StringBuffer document = null;
257
        DBConnection dbconn = null;
258
        int serialNumber = -1;
309
       MetaCatUtil.debugMessage("IO error in DBQuery.findDocuments:", 30);
310
       MetaCatUtil.debugMessage(ioe.getMessage(), 30);
259 311

  
260
        try {
312
    }
313
    catch (SQLException e)
314
    {
315
      MetaCatUtil.debugMessage("SQL Error in DBQuery.findDocuments: "
316
                   + e.getMessage(), 30);
317
    }
318
    catch (Exception ee)
319
    {
320
      MetaCatUtil.debugMessage("Exception in DBQuery.findDocuments: "
321
                   + ee.getMessage(), 30);
322
    }
323
    finally
324
    {
325
       DBConnectionPool.returnDBConnection(dbconn, serialNumber);
326
    }//finally
327
    String closeRestultset = "</resultset>";
328
    resultset.append(closeRestultset);
329
    if (out != null)
330
    {
331
      out.println(closeRestultset);
332
    }
333
    return resultset;
334
  }//createResultDocuments
261 335

  
262
            dbconn = DBConnectionPool.getDBConnection("DBQuery.findDocuments");
263
            serialNumber = dbconn.getCheckOutSerialNumber();
264 336

  
265
            String query = qspec.printSQL(useXMLIndex);
266
            String ownerQuery = getOwnerQuery(user);
267
            MetaCatUtil.debugMessage("query: " + query, 30);
268
            //MetaCatUtil.debugMessage("query: "+ownerQuery, 30);
269
            // if query is not the owner query, we need to check the permission
270
            // otherwise we don't need (owner has all permission by default)
271
            if (!query.equals(ownerQuery)) {
272
                // set user name and group
273
                qspec.setUserName(user);
274
                qspec.setGroup(groups);
275
                // Get access query
276
                String accessQuery = qspec.getAccessQuery();
277
                query = query + accessQuery;
278
                MetaCatUtil.debugMessage(" final query: " + query, 30);
279
            }
280 337

  
281
            double startTime = System.currentTimeMillis() / 1000;
282
            pstmt = dbconn.prepareStatement(query);
338
    /*
339
     * Find the doc list which match the query
340
     */
341
    private StringBuffer findResultDoclist(QuerySpecification qspec,
342
                                      StringBuffer resultsetBuffer,
343
                                      PrintWriter out,
344
                                      String user, String[]groups,
345
                                      DBConnection dbconn, boolean useXMLIndex )
346
                                      throws Exception
347
    {
348
      int offset = 800;
349
      int count = 0;
350
      int index = 0;
351
      Hashtable docListResult = new Hashtable();
352
      PreparedStatement pstmt = null;
353
      String docid = null;
354
      String docname = null;
355
      String doctype = null;
356
      String createDate = null;
357
      String updateDate = null;
358
      StringBuffer document = null;
359
      int rev = 0;
360
      String query = qspec.printSQL(useXMLIndex);
361
      String ownerQuery = getOwnerQuery(user);
362
      MetaCatUtil.debugMessage("query: " + query, 30);
363
      //MetaCatUtil.debugMessage("query: "+ownerQuery, 30);
364
      // if query is not the owner query, we need to check the permission
365
      // otherwise we don't need (owner has all permission by default)
366
      if (!query.equals(ownerQuery))
367
      {
368
        // set user name and group
369
        qspec.setUserName(user);
370
        qspec.setGroup(groups);
371
        // Get access query
372
        String accessQuery = qspec.getAccessQuery();
373
        query = query + accessQuery;
374
        MetaCatUtil.debugMessage(" final query: " + query, 30);
375
      }
283 376

  
284
            // Execute the SQL query using the JDBC connection
285
            pstmt.execute();
286
            ResultSet rs = pstmt.getResultSet();
287
            double queryExecuteTime = System.currentTimeMillis() / 1000;
288
            MetaCatUtil.debugMessage("Time for execute query: "
377
      double startTime = System.currentTimeMillis() / 1000;
378
      pstmt = dbconn.prepareStatement(query);
379

  
380
      // Execute the SQL query using the JDBC connection
381
      pstmt.execute();
382
      ResultSet rs = pstmt.getResultSet();
383
      double queryExecuteTime = System.currentTimeMillis() / 1000;
384
      MetaCatUtil.debugMessage("Time for execute query: "
289 385
                    + (queryExecuteTime - startTime), 30);
290
            boolean tableHasRows = rs.next();
291
            while (tableHasRows) {
292
                docid = rs.getString(1).trim();
293
                //long checkTimeStart = System.currentTimeMillis();
294
                //boolean permit =hasPermission(user, groups, docid);
295
                //long checkTimeEnd = System.currentTimeMillis();
296
                //MetaCatUtil.debugMessage("check permission time: "+
297
                //(checkTimeEnd - checkTimeStart), 30);
298
                //if ( !permit ) {
299
                // Advance to the next record in the cursor
300
                //tableHasRows = rs.next();
301
                //continue;
302
                //}
386
      boolean tableHasRows = rs.next();
387
      while (tableHasRows)
388
      {
389
        docid = rs.getString(1).trim();
390
        docname = rs.getString(2);
391
        doctype = rs.getString(3);
392
        createDate = rs.getString(4);
393
        updateDate = rs.getString(5);
394
        rev = rs.getInt(6);
303 395

  
304
                docname = rs.getString(2);
305
                doctype = rs.getString(3);
306
                createDate = rs.getString(4);
307
                updateDate = rs.getString(5);
308
                rev = rs.getInt(6);
396
        // if there are returndocs to match, backtracking can be performed
397
        // otherwise, just return the document that was hit
398
        Vector returndocVec = qspec.getReturnDocList();
399
        if (returndocVec.size() != 0 && !returndocVec.contains(doctype)
400
                        && !qspec.isPercentageSearch())
401
        {
402
           MetaCatUtil.debugMessage("Back tracing now...", 20);
403
           String sep = MetaCatUtil.getOption("accNumSeparator");
404
           StringBuffer btBuf = new StringBuffer();
405
           btBuf.append("select docid from xml_relation where ");
309 406

  
310
                // if there are returndocs to match, backtracking can be
311
                // performed
312
                // otherwise, just return the document that was hit
313
                Vector returndocVec = qspec.getReturnDocList();
314
                if (returndocVec.size() != 0 && !returndocVec.contains(doctype)
315
                        && !qspec.isPercentageSearch()) {
316
                    MetaCatUtil.debugMessage("Back tracing now...", 20);
317
                    String sep = MetaCatUtil.getOption("accNumSeparator");
318
                    StringBuffer btBuf = new StringBuffer();
319
                    btBuf.append("select docid from xml_relation where ");
407
           //build the doctype list for the backtracking sql statement
408
           btBuf.append("packagetype in (");
409
           for (int i = 0; i < returndocVec.size(); i++)
410
           {
411
             btBuf.append("'").append((String) returndocVec.get(i)).append("'");
412
             if (i != (returndocVec.size() - 1))
413
             {
414
                btBuf.append(", ");
415
              }
416
            }
417
            btBuf.append(") ");
418
            btBuf.append("and (subject like '");
419
            btBuf.append(docid).append("'");
420
            btBuf.append("or object like '");
421
            btBuf.append(docid).append("')");
320 422

  
321
                    //build the doctype list for the backtracking sql
322
                    // statement
323
                    btBuf.append("packagetype in (");
324
                    for (int i = 0; i < returndocVec.size(); i++) {
325
                        btBuf.append("'").append((String) returndocVec.get(i))
326
                                .append("'");
327
                        if (i != (returndocVec.size() - 1)) {
328
                            btBuf.append(", ");
329
                        }
423
            PreparedStatement npstmt = dbconn.prepareStatement(btBuf.toString());
424
            //should incease usage count
425
            dbconn.increaseUsageCount(1);
426
            npstmt.execute();
427
            ResultSet btrs = npstmt.getResultSet();
428
            boolean hasBtRows = btrs.next();
429
            while (hasBtRows)
430
            {
431
               //there was a backtrackable document found
432
               DocumentImpl xmldoc = null;
433
               String packageDocid = btrs.getString(1);
434
               MetaCatUtil.debugMessage("Getting document for docid: "
435
                                         + packageDocid, 40);
436
                try
437
                {
438
                    //  THIS CONSTRUCTOR BUILDS THE WHOLE XML doc not
439
                    // needed here
440
                    // xmldoc = new DocumentImpl(dbconn, packageDocid);
441
                    //  thus use the following to get the doc info only
442
                    //  xmldoc = new DocumentImpl(dbconn);
443
                    xmldoc = new DocumentImpl(packageDocid, false);
444
                    if (xmldoc == null)
445
                    {
446
                       MetaCatUtil.debugMessage("Document was null for: "
447
                                                + packageDocid, 50);
330 448
                    }
331
                    btBuf.append(") ");
449
                }
450
                catch (Exception e)
451
                {
452
                    System.out.println("Error getting document in "
453
                                       + "DBQuery.findDocuments: "
454
                                       + e.getMessage());
455
                }
332 456

  
333
                    btBuf.append("and (subject like '");
334
                    btBuf.append(docid).append("'");
335
                    btBuf.append("or object like '");
336
                    btBuf.append(docid).append("')");
457
                String docid_org = xmldoc.getDocID();
458
                if (docid_org == null)
459
                {
460
                   MetaCatUtil.debugMessage("Docid_org was null.", 40);
461
                   continue;
462
                }
463
                docid = docid_org.trim();
464
                docname = xmldoc.getDocname();
465
                doctype = xmldoc.getDoctype();
466
                createDate = xmldoc.getCreateDate();
467
                updateDate = xmldoc.getUpdateDate();
468
                rev = xmldoc.getRev();
469
                document = new StringBuffer();
337 470

  
338
                    PreparedStatement npstmt = dbconn.prepareStatement(btBuf
339
                            .toString());
340
                    //should incease usage count
341
                    dbconn.increaseUsageCount(1);
342
                    npstmt.execute();
343
                    ResultSet btrs = npstmt.getResultSet();
344
                    boolean hasBtRows = btrs.next();
345
                    while (hasBtRows) { //there was a backtrackable document
346
                                        // found
347
                        DocumentImpl xmldoc = null;
348
                        String packageDocid = btrs.getString(1);
349
                        MetaCatUtil.debugMessage("Getting document for docid: "
350
                                + packageDocid, 40);
351
                        try {
352
                            //  THIS CONSTRUCTOR BUILDS THE WHOLE XML doc not
353
                            // needed here
354
                            // xmldoc = new DocumentImpl(dbconn, packageDocid);
355
                            //  thus use the following to get the doc info only
356
                            //  xmldoc = new DocumentImpl(dbconn);
357
                            xmldoc = new DocumentImpl(packageDocid, false);
358
                            if (xmldoc == null) {
359
                                MetaCatUtil.debugMessage(
360
                                        "Document was null for: "
361
                                                + packageDocid, 50);
362
                            }
363
                        } catch (Exception e) {
364
                            System.out.println("Error getting document in "
365
                                    + "DBQuery.findDocuments: "
366
                                    + e.getMessage());
367
                        }
368

  
369
                        String docid_org = xmldoc.getDocID();
370
                        if (docid_org == null) {
371
                            MetaCatUtil.debugMessage("Docid_org was null.", 40);
372
                        }
373
                        docid = docid_org.trim();
374
                        docname = xmldoc.getDocname();
375
                        doctype = xmldoc.getDoctype();
376
                        createDate = xmldoc.getCreateDate();
377
                        updateDate = xmldoc.getUpdateDate();
378
                        rev = xmldoc.getRev();
379

  
380
                        document = new StringBuffer();
381

  
382
                        String completeDocid = docid
471
                String completeDocid = docid
383 472
                                + MetaCatUtil.getOption("accNumSeparator");
384
                        completeDocid += rev;
385
                        document.append("<docid>").append(completeDocid);
386
                        document.append("</docid>");
387
                        if (docname != null) {
388
                            document.append("<docname>" + docname
389
                                    + "</docname>");
390
                        }
391
                        if (doctype != null) {
392
                            document.append("<doctype>" + doctype
393
                                    + "</doctype>");
394
                        }
395
                        if (createDate != null) {
396
                            document.append("<createdate>" + createDate
397
                                    + "</createdate>");
398
                        }
399
                        if (updateDate != null) {
400
                            document.append("<updatedate>" + updateDate
401
                                    + "</updatedate>");
402
                        }
403
                        // Store the document id and the root node id
404
                        docListResult.put(docid, (String) document.toString());
473
                completeDocid += rev;
474
                document.append("<docid>").append(completeDocid);
475
                document.append("</docid>");
476
                if (docname != null)
477
                {
478
                  document.append("<docname>" + docname + "</docname>");
479
                }
480
                if (doctype != null)
481
                {
482
                  document.append("<doctype>" + doctype + "</doctype>");
483
                }
484
                if (createDate != null)
485
                {
486
                 document.append("<createdate>" + createDate + "</createdate>");
487
                }
488
                if (updateDate != null)
489
                {
490
                  document.append("<updatedate>" + updateDate+ "</updatedate>");
491
                }
492
                // Store the document id and the root node id
493
                docListResult.put(docid, (String) document.toString());
494
                count++;
495
                index++;
405 496

  
406
                        // Get the next package document linked to our hit
407
                        hasBtRows = btrs.next();
408
                    }
409
                    npstmt.close();
410
                    btrs.close();
411
                } else if (returndocVec.size() != 0
412
                        && returndocVec.contains(doctype)) {
497
                // Get the next package document linked to our hit
498
                hasBtRows = btrs.next();
499
              }//while
500
              npstmt.close();
501
              btrs.close();
502
        }
503
        else if (returndocVec.size() != 0 && returndocVec.contains(doctype))
504
        {
413 505

  
414
                    document = new StringBuffer();
506
           document = new StringBuffer();
415 507

  
416
                    String completeDocid = docid
508
           String completeDocid = docid
417 509
                            + MetaCatUtil.getOption("accNumSeparator");
418
                    completeDocid += rev;
419
                    document.append("<docid>").append(completeDocid).append(
420
                            "</docid>");
421
                    if (docname != null) {
422
                        document.append("<docname>" + docname + "</docname>");
423
                    }
424
                    if (doctype != null) {
425
                        document.append("<doctype>" + doctype + "</doctype>");
426
                    }
427
                    if (createDate != null) {
428
                        document.append("<createdate>" + createDate
429
                                + "</createdate>");
430
                    }
431
                    if (updateDate != null) {
432
                        document.append("<updatedate>" + updateDate
433
                                + "</updatedate>");
434
                    }
435
                    // Store the document id and the root node id
436
                    docListResult.put(docid, (String) document.toString());
510
           completeDocid += rev;
511
           document.append("<docid>").append(completeDocid).append("</docid>");
512
           if (docname != null)
513
           {
514
               document.append("<docname>" + docname + "</docname>");
515
            }
516
            if (doctype != null)
517
            {
518
               document.append("<doctype>" + doctype + "</doctype>");
519
            }
520
            if (createDate != null)
521
            {
522
                document.append("<createdate>" + createDate + "</createdate>");
523
             }
524
             if (updateDate != null)
525
             {
526
               document.append("<updatedate>" + updateDate + "</updatedate>");
527
             }
528
              // Store the document id and the root node id
529
              docListResult.put(docid, (String) document.toString());
530
              count++;
531
              index++;
437 532

  
438
                }
533
        }//else
534
        // when doclist reached the offset number, send out doc list and empty
535
        // the hash table
536
        if (count == offset)
537
        {
538
          //reset count
539
          count = 0;
540
          handleSubsetResult(qspec,resultsetBuffer, out, docListResult,
541
                              user, groups,dbconn, useXMLIndex);
542
          // reset docListResult
543
          docListResult = new Hashtable();
439 544

  
440
                // Advance to the next record in the cursor
441
                tableHasRows = rs.next();
442
            }
443
            rs.close();
444
            pstmt.close();
445
            double docListTime = System.currentTimeMillis() / 1000;
446
            MetaCatUtil.debugMessage("prepare docid list time: "
545
        }
546
       // Advance to the next record in the cursor
547
       tableHasRows = rs.next();
548
     }//while
549
     rs.close();
550
     pstmt.close();
551
     //if docListResult is not empty, it need to be sent.
552
     if (!docListResult.isEmpty())
553
     {
554
       handleSubsetResult(qspec,resultsetBuffer, out, docListResult,
555
                              user, groups,dbconn, useXMLIndex);
556
     }
557
     double docListTime = System.currentTimeMillis() / 1000;
558
     MetaCatUtil.debugMessage("prepare docid list time: "
447 559
                    + (docListTime - queryExecuteTime), 30);
560
     MetaCatUtil.debugMessage("total docid is ===== "+index, 30);
561
     return resultsetBuffer;
562
    }//findReturnDoclist
448 563

  
449
            if (qspec.containsExtendedSQL()) {
450
                Vector extendedFields = new Vector(qspec.getReturnFieldList());
451
                Vector results = new Vector();
452
                Enumeration keylist = docListResult.keys();
453
                StringBuffer doclist = new StringBuffer();
454
                Vector parentidList = new Vector();
455
                Hashtable returnFieldValue = new Hashtable();
456
                while (keylist.hasMoreElements()) {
457
                    doclist.append("'");
458
                    doclist.append((String) keylist.nextElement());
459
                    doclist.append("',");
460
                }
461
                if (doclist.length() > 0) {
462
                    Hashtable controlPairs = new Hashtable();
463
                    double extendedQueryStart = System.currentTimeMillis() / 1000;
464
                    doclist.deleteCharAt(doclist.length() - 1); //remove the
465
                                                                // last comma
466
                    // check if user has permission to see the return field
467
                    // data
468
                    String accessControlSQL = qspec
469
                            .printAccessControlSQLForReturnField(doclist
470
                                    .toString());
471
                    pstmt = dbconn.prepareStatement(accessControlSQL);
472
                    //increase dbconnection usage count
473
                    dbconn.increaseUsageCount(1);
474
                    pstmt.execute();
475
                    rs = pstmt.getResultSet();
476
                    tableHasRows = rs.next();
477
                    while (tableHasRows) {
478
                        long startNodeId = rs.getLong(1);
479
                        long endNodeId = rs.getLong(2);
480
                        controlPairs.put(new Long(startNodeId), new Long(
481
                                endNodeId));
482
                        tableHasRows = rs.next();
483
                    }
484 564

  
485
                    double extendedAccessQueryEnd = System.currentTimeMillis() / 1000;
486
                    MetaCatUtil
487
                            .debugMessage(
488
                                    "Time for execute access extended query: "
489
                                            + (extendedAccessQueryEnd - extendedQueryStart),
490
                                    30);
565
    /*
566
     * Send completed search hashtable(part of reulst)to output stream
567
     * and buffer into a buffer stream
568
     */
569
    private StringBuffer handleSubsetResult(QuerySpecification qspec,
570
                                           StringBuffer resultset,
571
                                           PrintWriter out, Hashtable partOfDoclist,
572
                                           String user, String[]groups,
573
                                       DBConnection dbconn, boolean useXMLIndex)
574
                                       throws Exception
575
   {
491 576

  
492
                    String extendedQuery = qspec.printExtendedSQL(doclist
493
                            .toString(), controlPairs, useXMLIndex);
494
                    MetaCatUtil.debugMessage(
495
                            "Extended query: " + extendedQuery, 30);
496
                    pstmt = dbconn.prepareStatement(extendedQuery);
497
                    //increase dbconnection usage count
498
                    dbconn.increaseUsageCount(1);
499
                    pstmt.execute();
500
                    rs = pstmt.getResultSet();
501
                    double extendedQueryEnd = System.currentTimeMillis() / 1000;
502
                    MetaCatUtil.debugMessage(
503
                            "Time for execute extended query: "
504
                                    + (extendedQueryEnd - extendedQueryStart),
505
                            30);
506
                    tableHasRows = rs.next();
507
                    while (tableHasRows) {
508
                        ReturnFieldValue returnValue = new ReturnFieldValue();
509
                        docid = rs.getString(1).trim();
510
                        fieldname = rs.getString(2);
511
                        fielddata = rs.getString(3);
512
                        fielddata = MetaCatUtil.normalize(fielddata);
577
     int index =0;
578
     //add return field
579
     partOfDoclist = addRetrunfield(partOfDoclist, qspec, user, groups,
580
                                        dbconn, useXMLIndex );
581
     //add relationship part part docid list
582
     partOfDoclist = addRelationship(partOfDoclist, qspec, dbconn, useXMLIndex);
583
     // send the completed search item to output and store it in a buffer
584
     String key = null;
585
     String element = null;
586
     Enumeration keys = partOfDoclist.keys();
587
     while (keys.hasMoreElements())
588
     {
589
           key = (String) keys.nextElement();
590
           element = (String)partOfDoclist.get(key);
591
           // A string with element
592
           String xmlElement = "  <document>" + element + "</document>";
593
           //send single element to output
594
           if (out != null)
595
           {
596
             out.println(xmlElement);
597
             index++;
598
           }
599
           else
600
           {
601
             index++;
602
           }
603
           resultset.append(xmlElement);
604
      }//while
605
      MetaCatUtil.debugMessage("total package number is ======= = "+ index, 20);
606
      return resultset;
607
   }
513 608

  
514
                        String parentId = rs.getString(4);
515 609

  
516
                        StringBuffer value = new StringBuffer();
517
                        if (!containsKey(parentidList, parentId)) {
518
                            // don't need to merger nodedata
519
                            value.append("<param name=\"");
520
                            value.append(fieldname);
521
                            value.append("\">");
522
                            value.append(fielddata);
523
                            value.append("</param>");
524
                            //set returnvalue
525
                            returnValue.setDocid(docid);
526
                            returnValue.setFieldValue(fielddata);
527
                            returnValue.setXMLFieldValue(value.toString());
528
                            // Store it in hastable
529
                            putInArray(parentidList, parentId, returnValue);
530
                        } else {
531
                            // need to merge nodedata if they have same parent
532
                            // id ant
533
                            // node type is text
534
                            fielddata = (String) ((ReturnFieldValue) getArrayValue(
610
    /*
611
     * A method to add return field to return doclist hash table
612
     */
613
    private Hashtable addRetrunfield(Hashtable docListResult,
614
                                      QuerySpecification qspec,
615
                                      String user, String[]groups,
616
                                      DBConnection dbconn, boolean useXMLIndex )
617
                                      throws Exception
618
    {
619
      PreparedStatement pstmt = null;
620
      ResultSet rs = null;
621
      String docid = null;
622
      String fieldname = null;
623
      String fielddata = null;
624
      String relation = null;
625

  
626
      if (qspec.containsExtendedSQL())
627
      {
628
        qspec.setUserName(user);
629
        qspec.setGroup(groups);
630
        Vector extendedFields = new Vector(qspec.getReturnFieldList());
631
        Vector results = new Vector();
632
        Enumeration keylist = docListResult.keys();
633
        StringBuffer doclist = new StringBuffer();
634
        Vector parentidList = new Vector();
635
        Hashtable returnFieldValue = new Hashtable();
636
        while (keylist.hasMoreElements())
637
        {
638
          doclist.append("'");
639
          doclist.append((String) keylist.nextElement());
640
          doclist.append("',");
641
        }
642
        if (doclist.length() > 0)
643
        {
644
          Hashtable controlPairs = new Hashtable();
645
          double extendedQueryStart = System.currentTimeMillis() / 1000;
646
          doclist.deleteCharAt(doclist.length() - 1); //remove the last comma
647
          // check if user has permission to see the return field data
648
          String accessControlSQL =
649
                 qspec.printAccessControlSQLForReturnField(doclist.toString());
650
          pstmt = dbconn.prepareStatement(accessControlSQL);
651
          //increase dbconnection usage count
652
          dbconn.increaseUsageCount(1);
653
          pstmt.execute();
654
          rs = pstmt.getResultSet();
655
          boolean tableHasRows = rs.next();
656
          while (tableHasRows)
657
          {
658
            long startNodeId = rs.getLong(1);
659
            long endNodeId = rs.getLong(2);
660
            controlPairs.put(new Long(startNodeId), new Long(endNodeId));
661
            tableHasRows = rs.next();
662
          }
663

  
664
           double extendedAccessQueryEnd = System.currentTimeMillis() / 1000;
665
           MetaCatUtil.debugMessage( "Time for execute access extended query: "
666
                          + (extendedAccessQueryEnd - extendedQueryStart),30);
667

  
668
           String extendedQuery =
669
               qspec.printExtendedSQL(doclist.toString(), controlPairs, useXMLIndex);
670
           MetaCatUtil.debugMessage("Extended query: " + extendedQuery, 30);
671
           pstmt = dbconn.prepareStatement(extendedQuery);
672
           //increase dbconnection usage count
673
           dbconn.increaseUsageCount(1);
674
           pstmt.execute();
675
           rs = pstmt.getResultSet();
676
           double extendedQueryEnd = System.currentTimeMillis() / 1000;
677
           MetaCatUtil.debugMessage("Time for execute extended query: "
678
                           + (extendedQueryEnd - extendedQueryStart), 30);
679
           tableHasRows = rs.next();
680
           while (tableHasRows)
681
           {
682
               ReturnFieldValue returnValue = new ReturnFieldValue();
683
               docid = rs.getString(1).trim();
684
               fieldname = rs.getString(2);
685
               fielddata = rs.getString(3);
686
               fielddata = MetaCatUtil.normalize(fielddata);
687
               String parentId = rs.getString(4);
688
               StringBuffer value = new StringBuffer();
689
               if (!containsKey(parentidList, parentId))
690
               {
691
                  // don't need to merger nodedata
692
                  value.append("<param name=\"");
693
                  value.append(fieldname);
694
                  value.append("\">");
695
                  value.append(fielddata);
696
                  value.append("</param>");
697
                  //set returnvalue
698
                  returnValue.setDocid(docid);
699
                  returnValue.setFieldValue(fielddata);
700
                  returnValue.setXMLFieldValue(value.toString());
701
                  // Store it in hastable
702
                  putInArray(parentidList, parentId, returnValue);
703
                }
704
                else
705
                {
706
                  // need to merge nodedata if they have same parent id and
707
                  // node type is text
708
                  fielddata = (String) ((ReturnFieldValue) getArrayValue(
535 709
                                    parentidList, parentId)).getFieldValue()
536 710
                                    + fielddata;
537
                            value.append("<param name=\"");
538
                            value.append(fieldname);
539
                            value.append("\">");
540
                            value.append(fielddata);
541
                            value.append("</param>");
542
                            returnValue.setDocid(docid);
543
                            returnValue.setFieldValue(fielddata);
544
                            returnValue.setXMLFieldValue(value.toString());
545
                            // remove the old return value from paretnidList
546
                            parentidList.remove(parentId);
547
                            // store the new return value in parentidlit
548
                            putInArray(parentidList, parentId, returnValue);
549
                        }
550
                        tableHasRows = rs.next();
551
                    }//while
552
                    rs.close();
553
                    pstmt.close();
711
                  value.append("<param name=\"");
712
                  value.append(fieldname);
713
                  value.append("\">");
714
                  value.append(fielddata);
715
                  value.append("</param>");
716
                  returnValue.setDocid(docid);
717
                  returnValue.setFieldValue(fielddata);
718
                  returnValue.setXMLFieldValue(value.toString());
719
                  // remove the old return value from paretnidList
720
                  parentidList.remove(parentId);
721
                  // store the new return value in parentidlit
722
                  putInArray(parentidList, parentId, returnValue);
723
                }
724
              tableHasRows = rs.next();
725
            }//while
726
            rs.close();
727
            pstmt.close();
554 728

  
555
                    // put the merger node data info into doclistReult
556
                    Enumeration xmlFieldValue = (getElements(parentidList))
557
                            .elements();
558
                    while (xmlFieldValue.hasMoreElements()) {
559
                        ReturnFieldValue object = (ReturnFieldValue) xmlFieldValue
560
                                .nextElement();
561
                        docid = object.getDocid();
562
                        if (docListResult.containsKey(docid)) {
563
                            String removedelement = (String) docListResult
564
                                    .remove(docid);
565
                            docListResult.put(docid, removedelement
566
                                    + object.getXMLFieldValue());
567
                        } else {
568
                            docListResult.put(docid, object.getXMLFieldValue());
569
                        }
570
                    }//while
571
                    double docListResultEnd = System.currentTimeMillis() / 1000;
572
                    MetaCatUtil
573
                            .debugMessage(
574
                                    "Time for prepare doclistresult after"
575
                                            + " execute extended query: "
576
                                            + (docListResultEnd - extendedQueryEnd),
577
                                    30);
729
            // put the merger node data info into doclistReult
730
            Enumeration xmlFieldValue = (getElements(parentidList)).elements();
731
            while (xmlFieldValue.hasMoreElements())
732
            {
733
              ReturnFieldValue object =
734
                  (ReturnFieldValue) xmlFieldValue.nextElement();
735
              docid = object.getDocid();
736
              if (docListResult.containsKey(docid))
737
              {
738
                 String removedelement = (String) docListResult.remove(docid);
739
                 docListResult.
740
                         put(docid, removedelement+ object.getXMLFieldValue());
741
              }
742
              else
743
              {
744
                docListResult.put(docid, object.getXMLFieldValue());
745
               }
746
             }//while
747
             double docListResultEnd = System.currentTimeMillis() / 1000;
748
             MetaCatUtil.debugMessage("Time for prepare doclistresult after"
749
                                       + " execute extended query: "
750
                                       + (docListResultEnd - extendedQueryEnd),
751
                                      30);
578 752

  
579
                    // get attribures return
580
                    docListResult = getAttributeValueForReturn(qspec,
753
              // get attribures return
754
              docListResult = getAttributeValueForReturn(qspec,
581 755
                            docListResult, doclist.toString(), useXMLIndex);
582
                }//if doclist lenght is great than zero
756
       }//if doclist lenght is great than zero
583 757

  
584
            }//if has extended query
758
     }//if has extended query
585 759

  
586
            //this loop adds the relation data to the resultdoc
587
            //this code might be able to be added to the backtracking code
588
            // above
589
            double startRelation = System.currentTimeMillis() / 1000;
590
            Enumeration docidkeys = docListResult.keys();
591
            while (docidkeys.hasMoreElements()) {
592
                //String connstring =
593
                // "metacat://"+util.getOption("server")+"?docid=";
594
                String connstring = "%docid=";
595
                String docidkey = (String) docidkeys.nextElement();
596
                pstmt = dbconn.prepareStatement(QuerySpecification
597
                        .printRelationSQL(docidkey));
598
                pstmt.execute();
599
                rs = pstmt.getResultSet();
600
                tableHasRows = rs.next();
601
                while (tableHasRows) {
602
                    String sub = rs.getString(1);
603
                    String rel = rs.getString(2);
604
                    String obj = rs.getString(3);
605
                    String subDT = rs.getString(4);
606
                    String objDT = rs.getString(5);
760
      return docListResult;
761
    }//addReturnfield
607 762

  
608
                    document = new StringBuffer();
609
                    document.append("<triple>");
610
                    document.append("<subject>").append(
611
                            MetaCatUtil.normalize(sub));
612
                    document.append("</subject>");
613
                    if (subDT != null) {
614
                        document.append("<subjectdoctype>").append(subDT);
615
                        document.append("</subjectdoctype>");
616
                    }
617
                    document.append("<relationship>").append(
618
                            MetaCatUtil.normalize(rel));
619
                    document.append("</relationship>");
620
                    document.append("<object>").append(
621
                            MetaCatUtil.normalize(obj));
622
                    document.append("</object>");
623
                    if (objDT != null) {
624
                        document.append("<objectdoctype>").append(objDT);
625
                        document.append("</objectdoctype>");
626
                    }
627
                    document.append("</triple>");
763
    /*
764
    * A method to add relationship to return doclist hash table
765
    */
766
   private Hashtable addRelationship(Hashtable docListResult,
767
                                     QuerySpecification qspec,
768
                                     DBConnection dbconn, boolean useXMLIndex )
769
                                     throws Exception
770
  {
771
    PreparedStatement pstmt = null;
772
    ResultSet rs = null;
773
    StringBuffer document = null;
774
    double startRelation = System.currentTimeMillis() / 1000;
775
    Enumeration docidkeys = docListResult.keys();
776
    while (docidkeys.hasMoreElements())
777
    {
778
      //String connstring =
779
      // "metacat://"+util.getOption("server")+"?docid=";
780
      String connstring = "%docid=";
781
      String docidkey = (String) docidkeys.nextElement();
782
      pstmt = dbconn.prepareStatement(QuerySpecification
783
                      .printRelationSQL(docidkey));
784
      pstmt.execute();
785
      rs = pstmt.getResultSet();
786
      boolean tableHasRows = rs.next();
787
      while (tableHasRows)
788
      {
789
        String sub = rs.getString(1);
790
        String rel = rs.getString(2);
791
        String obj = rs.getString(3);
792
        String subDT = rs.getString(4);
793
        String objDT = rs.getString(5);
628 794

  
629
                    String removedelement = (String) docListResult
630
                            .remove(docidkey);
631
                    docListResult.put(docidkey, removedelement
632
                            + document.toString());
633
                    tableHasRows = rs.next();
634
                }
635
                rs.close();
636
                pstmt.close();
637
            }
638
            double endRelation = System.currentTimeMillis() / 1000;
639
            MetaCatUtil.debugMessage(
640
                    "Time for adding relation to docListResult: "
641
                            + (endRelation - startRelation), 30);
795
        document = new StringBuffer();
796
        document.append("<triple>");
797
        document.append("<subject>").append(MetaCatUtil.normalize(sub));
798
        document.append("</subject>");
799
        if (subDT != null)
800
        {
801
          document.append("<subjectdoctype>").append(subDT);
802
          document.append("</subjectdoctype>");
803
        }
804
        document.append("<relationship>").append(MetaCatUtil.normalize(rel));
805
        document.append("</relationship>");
806
        document.append("<object>").append(MetaCatUtil.normalize(obj));
807
        document.append("</object>");
808
        if (objDT != null)
809
        {
810
          document.append("<objectdoctype>").append(objDT);
811
          document.append("</objectdoctype>");
812
        }
813
        document.append("</triple>");
642 814

  
643
        } catch (SQLException e) {
644
            System.err.println("SQL Error in DBQuery.findDocuments: "
645
                    + e.getMessage());
646
        } catch (Exception ee) {
647
            System.err.println("Exception in DBQuery.findDocuments: "
648
                    + ee.getMessage());
649
            ee.printStackTrace(System.err);
650
        } finally {
651
            try {
652
                pstmt.close();
653
            }//try
654
            catch (SQLException sqlE) {
655
                MetaCatUtil.debugMessage("Error in DBQuery.findDocuments: "
656
                        + sqlE.getMessage(), 30);
657
            }//catch
658
            finally {
659
                DBConnectionPool.returnDBConnection(dbconn, serialNumber);
660
            }//finally
661
        }//finally
662
        //System.out.println("docListResult: ");
663
        //System.out.println(docListResult.toString());
664
        return docListResult;
665
    }
815
        String removedelement = (String) docListResult.remove(docidkey);
816
        docListResult.put(docidkey, removedelement+ document.toString());
817
        tableHasRows = rs.next();
818
      }//while
819
      rs.close();
820
      pstmt.close();
821
    }//while
822
    double endRelation = System.currentTimeMillis() / 1000;
823
    MetaCatUtil.debugMessage("Time for adding relation to docListResult: "
824
                             + (endRelation - startRelation), 30);
666 825

  
826
    return docListResult;
827
  }//addRelation
828

  
829
  /**
830
   * removes the <?xml version="1.0"?> tag from the beginning.  This takes a
831
   * string as a param instead of a hashtable.
832
   *
833
   * @param xmlquery a string representing a query.
834
   */
835
   private  String transformQuery(String xmlquery)
836
   {
837
     xmlquery = xmlquery.trim();
838
     int index = xmlquery.indexOf("?>");
839
     if (index != -1)
840
     {
841
       return xmlquery.substring(index + 2, xmlquery.length());
842
     }
843
     else
844
     {
845
       return xmlquery;
846
     }
847
   }
848

  
849

  
667 850
    /*
668 851
     * A method to search if Vector contains a particular key string
669 852
     */
......
844 1027
     * format a structured query as an XML document that conforms to the
845 1028
     * pathquery.dtd and is appropriate for submission to the DBQuery
846 1029
     * structured query engine
847
     * 
1030
     *
848 1031
     * @param params The list of parameters that should be included in the
849 1032
     *            query
850 1033
     */
......
987 1170
                    if (!((String[]) nextelement)[i].equals("")) {
988 1171
                        query.append("<queryterm casesensitive=\""
989 1172
                                + casesensitive + "\" " + "searchmode=\""
990
                                + searchmode + "\">" + "<value>" + 
1173
                                + searchmode + "\">" + "<value>" +
991 1174
                                //add the query value
992 1175
                                ((String[]) nextelement)[i]
993
                                + "</value><pathexpr>" + 
1176
                                + "</value><pathexpr>" +
994 1177
                                //add the path to query by
995 1178
                                nextkey.toString() + "</pathexpr></queryterm>");
996 1179
                    }
......
1006 1189
     * format a simple free-text value query as an XML document that conforms
1007 1190
     * to the pathquery.dtd and is appropriate for submission to the DBQuery
1008 1191
     * structured query engine
1009
     * 
1192
     *
1010 1193
     * @param value the text string to search for in the xml catalog
1011 1194
     * @param doctype the type of documents to include in the result set -- use
1012 1195
     *            "any" or "ANY" for unfiltered result sets
......
1042 1225
     * format a simple free-text value query as an XML document that conforms
1043 1226
     * to the pathquery.dtd and is appropriate for submission to the DBQuery
1044 1227
     * structured query engine
1045
     * 
1228
     *
1046 1229
     * @param value the text string to search for in the xml catalog
1047 1230
     */
1048 1231
    public static String createQuery(String value)
......
1065 1248

  
1066 1249
    /**
1067 1250
     * Get all docIds list for a data packadge
1068
     * 
1251
     *
1069 1252
     * @param dataPackageDocid, the string in docId field of xml_relation table
1070 1253
     */
1071 1254
    private Vector getCurrentDocidListForDataPackage(String dataPackageDocid)
......
1141 1324

  
1142 1325
    /**
1143 1326
     * Get all docIds list for a data packadge
1144
     * 
1327
     *
1145 1328
     * @param dataPackageDocid, the string in docId field of xml_relation table
1146 1329
     */
1147 1330
    private Vector getOldVersionDocidListForDataPackage(String dataPackageDocid)
......
1195 1378
     * can use a query to get the entries which the docId equals the given
1196 1379
     * value. If the result is null. The docId is not a packadge id. Otherwise,
1197 1380
     * it is.
1198
     * 
1381
     *
1199 1382
     * @param docId, the id need to be checked
1200 1383
     */
1201 1384
    private boolean isDataPackageId(String docId)
......
1243 1426

  
1244 1427
    /**
1245 1428
     * Check if the user has the permission to export data package
1246
     * 
1429
     *
1247 1430
     * @param conn, the connection
1248 1431
     * @param docId, the id need to be checked
1249 1432
     * @param user, the name of user
......
1258 1441

  
1259 1442
    /**
1260 1443
     * Get the current Rev for a docid in xml_documents table
1261
     * 
1444
     *
1262 1445
     * @param docId, the id need to get version numb If the return value is -5,
1263 1446
     *            means no value in rev field for this docid
1264 1447
     */
......
1315 1498

  
1316 1499
    /**
1317 1500
     * put a doc into a zip output stream
1318
     * 
1501
     *
1319 1502
     * @param docImpl, docmentImpl object which will be sent to zip output
1320 1503
     *            stream
1321 1504
     * @param zipOut, zip output stream which the docImpl will be put
......
1345 1528
     * only inlcudes current version. If a DocumentImple object couldn't find
1346 1529
     * for a docid, then the String of this docid was added to vetor rather
1347 1530
     * than DocumentImple object.
1348
     * 
1531
     *
1349 1532
     * @param docIdList, a vetor hold a docid list for a data package. In
1350 1533
     *            docid, there is not version number in it.
1351 1534
     */
......
1400 1583
     * Transfer a docid vetor to a documentImpl vector. If a DocumentImple
1401 1584
     * object couldn't find for a docid, then the String of this docid was
1402 1585
     * added to vetor rather than DocumentImple object.
1403
     * 
1586
     *
1404 1587
     * @param docIdList, a vetor hold a docid list for a data package. In
1405 1588
     *            docid, t here is version number in it.
1406 1589
     */
......
1452 1635

  
1453 1636
    /**
1454 1637
     * put a data file into a zip output stream
1455
     * 
1638
     *
1456 1639
     * @param docImpl, docmentImpl object which will be sent to zip output
1457 1640
     *            stream
1458 1641
     * @param zipOut, the zip output stream which the docImpl will be put
......
1492 1675

  
1493 1676
    /**
1494 1677
     * create a html summary for data package and put it into zip output stream
1495
     * 
1678
     *
1496 1679
     * @param docImplList, the documentImpl ojbects in data package
1497 1680
     * @param zipOut, the zip output stream which the html should be put
1498 1681
     * @param packageZipEntry, the zip entry name for whole package
......
1567 1750

  
1568 1751
    /**
1569 1752
     * put a data packadge into a zip output stream
1570
     * 
1753
     *
1571 1754
     * @param docId, which the user want to put into zip output stream
1572 1755
     * @param out, a servletoutput stream which the zip output stream will be
1573 1756
     *            put

Also available in: Unified diff