Project

General

Profile

« Previous | Next » 

Revision 3220

Added by Jing Tao about 17 years ago

Add a new overload method - createResultDocument and add a new check for null.

View differences:

DBQuery.java
366 366
    
367 367
    return new StringBuffer(mrs.serializeToXML(pagestart, pagestart + pagesize));
368 368
  }
369
  
370
  
371
  /**
372
   * Transforms a hashtable of documents to an xml or html result and sent
373
   * the content to outputstream. Keep going untill hastable is empty. stop it.
374
   * add the QuerySpecification as parameter is for ecogrid. But it is duplicate
375
   * to xmlquery String
376
   * @param xmlquery
377
   * @param qspec
378
   * @param out
379
   * @param user
380
   * @param groups
381
   * @param useXMLIndex
382
   * @param sessionid
383
   * @return
384
   */
385
    public StringBuffer createResultDocument(String xmlquery,
386
                                              QuerySpecification qspec,
387
                                              PrintWriter out,
388
                                              String user, String[] groups,
389
                                              boolean useXMLIndex)
390
    {
391
    	return createResultDocument(xmlquery,qspec,out, user,groups, useXMLIndex, 0, 0,"");
392
    }
369 393

  
370 394
  /*
371 395
   * Transforms a hashtable of documents to an xml or html result and sent
......
388 412
    Hashtable sessionHash = MetaCatServlet.getSessionHash();
389 413
    HttpSession sess = (HttpSession)sessionHash.get(sessionid);
390 414

  
391
    QuerySpecification cachedQuerySpec = (QuerySpecification)sess.getAttribute("query");
415
    QuerySpecification cachedQuerySpec = null;
416
    if (sess != null)
417
    {
418
    	cachedQuerySpec = (QuerySpecification)sess.getAttribute("query");
419
    }
420
    
392 421
    if(cachedQuerySpec != null && 
393 422
       cachedQuerySpec.printSQL(false).equals(qspec.printSQL(false)))
394 423
    { //use the cached resultset if the query was the same as the last

Also available in: Unified diff