Project

General

Profile

Revision 5510

Added by berkley almost 11 years ago

fixed bug where the query cache was not getting reset by a REST insert/query combo.

View differences:

src/edu/ucsb/nceas/metacat/restservice/ResourceHandler.java
750 750
                    }
751 751
                }
752 752
                //make the crud call
753
                /*System.out.println("token: " + token + " startTime: " + startTime +
753
                System.out.println("token: " + token + " startTime: " + startTime +
754 754
                        " endtime: " + endTime + " objectFormat: " + 
755 755
                        objectFormat + " replicaStatus: " + replicaStatus + 
756 756
                        " start: " + start + " count: " + count);
757
                */
757
               
758 758
                ObjectList ol = cs.listObjects(token, startTime, endTime, 
759 759
                        objectFormat, replicaStatus, start, count);
760
                //TODO: why is this calling this twice?
761
                //ol = cs.listObjects(token, startTime, endTime, objectFormat, replicaStatus, start, count);
762 760
                
763 761
                StringReader sr = new StringReader(ol.toString());                
764 762
                out = response.getOutputStream();      
src/edu/ucsb/nceas/metacat/dataone/CrudService.java
66 66
import edu.ucsb.nceas.metacat.AccessionNumberException;
67 67
import edu.ucsb.nceas.metacat.MetacatResultSet;
68 68
import edu.ucsb.nceas.metacat.MetacatResultSet.Document;
69
import edu.ucsb.nceas.metacat.DBQuery;
69 70
import edu.ucsb.nceas.metacat.DocumentImpl;
70 71
import edu.ucsb.nceas.metacat.EventLog;
71 72
import edu.ucsb.nceas.metacat.IdentifierManager;
......
571 572
      ObjectList ol = new ObjectList();
572 573
      final SessionData sessionData = getSessionData(token);
573 574
      int totalAfterQuery = 0;
575
      
574 576
      try
575 577
      {
578
          if (PropertyService.getProperty("database.queryCacheOn").equals("true"))
579
          {
580
              //System.out.println("the string stored into cache is "+ resultsetBuffer.toString());
581
              DBQuery.clearQueryResultCache();
582
          }
583
      }
584
      catch (PropertyNotFoundException e1)
585
      {
586
          //just don't do anything
587
      }
588
      
589
      try
590
      {
576 591
          //TODO: Milliseconds need to be added to the dateFormat
577 592
          System.out.println("=========== Listing Objects =============");
578 593
          System.out.println("Current server time is: " + new Date());
......
610 625
          MetacatResultSet rs = handler.query(metacatUrl, params, username, 
611 626
                  groups, sessionid);
612 627
          List docs = rs.getDocuments();
613
          //TODO: make the max count into a const.  See ResourceHandler
614
          //TODO: does the spec use 1000 as a "return all" flag?
615
          if(count == 1000)
616
          {
617
              count = docs.size();
618
          }
619 628
          
620
          //System.out.println("query returned " + docs.size() + " documents.");
629
          System.out.println("query returned " + docs.size() + " documents.");
621 630
          Vector<Document> docCopy = new Vector<Document>();
622 631
          
623 632
          //preparse the list to remove any that don't match the query params
......
669 678
                  }                  
670 679
              }
671 680
              
672
              /*System.out.println("docid: " + d.docid);
681
              /*System.out.println("====================================");
682
              System.out.println("doc number " + i);
683
              System.out.println("docid: " + d.docid);
673 684
              System.out.println("dateSysMetadataModified: " + dateSysMetadataModified);
674 685
              System.out.println("startTime: " + startTime);
675 686
              System.out.println("endtime: " + endTime);*/

Also available in: Unified diff