Project

General

Profile

« Previous | Next » 

Revision 2043

Added by sgarg over 20 years ago

Replaced Hash table with Vector of Vector datastructure in getting <param> from Query. This was done so that the results are represented in same order as they appeared in the document.

View differences:

src/edu/ucsb/nceas/metacat/DBQuery.java
1 1
/**
2 2
 *  '$RCSfile$'
3
 *    Purpose: A Class that searches a relational DB for elements and 
3
 *    Purpose: A Class that searches a relational DB for elements and
4 4
 *             attributes that have free text matches a query string,
5
 *             or structured query matches to a path specified node in the 
6
 *             XML hierarchy.  It returns a result set consisting of the 
5
 *             or structured query matches to a path specified node in the
6
 *             XML hierarchy.  It returns a result set consisting of the
7 7
 *             document ID for each document that satisfies the query
8 8
 *  Copyright: 2000 Regents of the University of California and the
9 9
 *             National Center for Ecological Analysis and Synthesis
......
47 47
import java.io.BufferedWriter;
48 48
import javax.servlet.ServletOutputStream;
49 49

  
50
/** 
51
 * A Class that searches a relational DB for elements and 
50
/**
51
 * A Class that searches a relational DB for elements and
52 52
 * attributes that have free text matches a query string,
53
 * or structured query matches to a path specified node in the 
54
 * XML hierarchy.  It returns a result set consisting of the 
53
 * or structured query matches to a path specified node in the
54
 * XML hierarchy.  It returns a result set consisting of the
55 55
 * document ID for each document that satisfies the query
56 56
 */
57 57
public class DBQuery {
......
59 59
  static final int ALL = 1;
60 60
  static final int WRITE = 2;
61 61
  static final int READ = 4;
62
 
62

  
63 63
  //private Connection  conn = null;
64 64
  private String  parserName = null;
65 65
  private MetaCatUtil util = new MetaCatUtil();
......
71 71
   * @param xmlfile the filename of the xml file containing the query
72 72
   */
73 73
  static public void main(String[] args) {
74
     
74

  
75 75
     if (args.length < 1)
76 76
     {
77 77
        System.err.println("Wrong number of arguments!!!");
......
90 90
          if ( args[i].equals( "-index" ) ) {
91 91
            useXMLIndex = true;
92 92
            i++;
93
          } 
93
          }
94 94
          String xmlfile  = args[i];
95 95

  
96 96
          // Time the request if asked for
......
113 113
          String document = null;
114 114
          String docid = null;
115 115
          result.append("<?xml version=\"1.0\"?>\n");
116
          result.append("<resultset>\n"); 
117
  
116
          result.append("<resultset>\n");
117

  
118 118
          if (!showRuntime)
119 119
          {
120 120
            Enumeration doclist = nodelist.keys();
121 121
            while (doclist.hasMoreElements()) {
122 122
              docid = (String)doclist.nextElement();
123 123
              document = (String)nodelist.get(docid);
124
              result.append("  <document>\n    " + document + 
124
              result.append("  <document>\n    " + document +
125 125
                            "\n  </document>\n");
126 126
            }
127
            
127

  
128 128
            result.append("</resultset>\n");
129 129
          }
130 130
          // Time the request if asked for
......
146 146
            File f = new File("./result.txt");
147 147
            FileWriter fw = new FileWriter(f);
148 148
            BufferedWriter out = new BufferedWriter(fw);
149
            out.write(result.toString());          
149
            out.write(result.toString());
150 150
            out.flush();
151 151
            out.close();
152 152
            fw.close();
153 153
          }
154
          
155
        } 
154

  
155
        }
156 156
        catch (Exception e) {
157 157
          System.err.println("Error in DBQuery.main");
158 158
          System.err.println(e.getMessage());
......
160 160
        }
161 161
     }
162 162
  }
163
  
163

  
164 164
  /**
165
   * construct an instance of the DBQuery class 
165
   * construct an instance of the DBQuery class
166 166
   *
167
   * <p>Generally, one would call the findDocuments() routine after creating 
167
   * <p>Generally, one would call the findDocuments() routine after creating
168 168
   * an instance to specify the search query</p>
169 169
   *
170 170
   * @param conn the JDBC connection that we use for the query
171 171
   * @param parserName the fully qualified name of a Java class implementing
172 172
   *                   the org.xml.sax.XMLReader interface
173 173
   */
174
  public DBQuery(String parserName ) 
175
                  throws IOException, 
176
                         SQLException, 
174
  public DBQuery(String parserName )
175
                  throws IOException,
176
                         SQLException,
177 177
                         ClassNotFoundException {
178 178
    //this.conn = conn;
179 179
    this.parserName = parserName;
180 180
  }
181
  
182
  /** 
181

  
182
  /**
183 183
   * routine to search the elements and attributes looking to match query
184 184
   *
185 185
   * @param xmlquery the xml serialization of the query (@see pathquery.dtd)
......
191 191
    return findDocuments(xmlquery, user, groups, true);
192 192
  }
193 193

  
194
  /** 
194
  /**
195 195
   * routine to search the elements and attributes looking to match query
196 196
   *
197 197
   * @param xmlquery the xml serialization of the query (@see pathquery.dtd)
......
206 206
      try
207 207
      {
208 208
        // Get the XML query and covert it into a SQL statment
209
        QuerySpecification qspec = new QuerySpecification(xmlquery, 
210
                                   parserName, 
209
        QuerySpecification qspec = new QuerySpecification(xmlquery,
210
                                   parserName,
211 211
                                   util.getOption("accNumSeparator"));
212 212
        result = findDocuments(qspec, user, groups, useXMLIndex);
213 213
      }
214
      catch (IOException ioe) 
214
      catch (IOException ioe)
215 215
      {
216 216
        MetaCatUtil.debugMessage("IO error in DBQuery.findDocuments:", 30);
217 217
        MetaCatUtil.debugMessage(ioe.getMessage(), 30);
218 218
      }
219 219
      return result;
220 220
  }
221
  
222
  /** 
221

  
222
  /**
223 223
   * routine to search the elements and attributes looking to match query
224 224
   *
225 225
   * @param qspec java object of the query
......
227 227
   * @param group the group of the user
228 228
   * @param useXMLIndex flag whether to search using the path index
229 229
   */
230
  public Hashtable findDocuments(QuerySpecification qspec, String user, 
230
  public Hashtable findDocuments(QuerySpecification qspec, String user,
231 231
                                  String[] groups, boolean useXMLIndex)
232 232
  {
233 233
      Hashtable   docListResult = new Hashtable();
......
246 246
      StringBuffer document = null;
247 247
      DBConnection dbconn = null;
248 248
      int serialNumber = -1;
249
      
249

  
250 250
      try {
251
       
252
        
251

  
252

  
253 253
        dbconn=DBConnectionPool.getDBConnection("DBQuery.findDocuments");
254 254
        serialNumber=dbconn.getCheckOutSerialNumber();
255
      
255

  
256 256
        String query = qspec.printSQL(useXMLIndex);
257 257
        String ownerQuery = getOwnerQuery(user);
258 258
        MetaCatUtil.debugMessage("query: "+query, 30);
......
269 269
          query = query + accessQuery;
270 270
          MetaCatUtil.debugMessage(" final query: "+query, 30);
271 271
        }
272
        
272

  
273 273
        double startTime = System.currentTimeMillis()/1000;
274 274
        pstmt = dbconn.prepareStatement(query);
275
  
275

  
276 276
        // Execute the SQL query using the JDBC connection
277 277
        pstmt.execute();
278 278
        ResultSet rs = pstmt.getResultSet();
279
        double queryExecuteTime =System.currentTimeMillis()/1000; 
280
        MetaCatUtil.debugMessage("Time for execute query: "+ 
279
        double queryExecuteTime =System.currentTimeMillis()/1000;
280
        MetaCatUtil.debugMessage("Time for execute query: "+
281 281
                                            (queryExecuteTime -startTime), 30);
282 282
        boolean tableHasRows = rs.next();
283
        while (tableHasRows) 
283
        while (tableHasRows)
284 284
        {
285 285
          docid = rs.getString(1).trim();
286 286
          //long checkTimeStart = System.currentTimeMillis();
......
293 293
            //tableHasRows = rs.next();
294 294
            //continue;
295 295
          //}
296
          
296

  
297 297
          docname = rs.getString(2);
298 298
          doctype = rs.getString(3);
299 299
          createDate = rs.getString(4);
......
303 303
          // if there are returndocs to match, backtracking can be performed
304 304
          // otherwise, just return the document that was hit
305 305
          Vector returndocVec = qspec.getReturnDocList();
306
          if (returndocVec.size() != 0 && !returndocVec.contains(doctype) 
306
          if (returndocVec.size() != 0 && !returndocVec.contains(doctype)
307 307
              && !qspec.isPercentageSearch())
308
          { 
308
          {
309 309
            MetaCatUtil.debugMessage("Back tracing now...", 20);
310 310
            String sep = util.getOption("accNumSeparator");
311 311
            StringBuffer btBuf = new StringBuffer();
......
319 319
              if (i != (returndocVec.size() - 1))
320 320
              {
321 321
                btBuf.append(", ");
322
              } 
322
              }
323 323
            }
324 324
            btBuf.append(") ");
325 325

  
......
327 327
            btBuf.append(docid).append("'");
328 328
            btBuf.append("or object like '");
329 329
            btBuf.append(docid).append("')");
330
            
330

  
331 331
            PreparedStatement npstmt = dbconn.
332 332
                                       prepareStatement(btBuf.toString());
333 333
            //should incease usage count
......
353 353
              }
354 354
              catch(Exception e)
355 355
              {
356
                System.out.println("Error getting document in " + 
356
                System.out.println("Error getting document in " +
357 357
                                   "DBQuery.findDocuments: " + e.getMessage());
358 358
              }
359
              
359

  
360 360
              String docid_org = xmldoc.getDocID();
361 361
              if (docid_org == null) {
362 362
                util.debugMessage("Docid_org was null.", 40);
......
388 388
              }
389 389
              // Store the document id and the root node id
390 390
              docListResult.put(docid,(String)document.toString());
391
         
391

  
392 392
              // Get the next package document linked to our hit
393 393
              hasBtRows = btrs.next();
394 394
            }
395 395
            npstmt.close();
396 396
            btrs.close();
397
          } 
398
          else if (returndocVec.size() != 0 && returndocVec.contains(doctype)) 
397
          }
398
          else if (returndocVec.size() != 0 && returndocVec.contains(doctype))
399 399
          {
400
          
400

  
401 401
            document = new StringBuffer();
402 402

  
403 403
            String completeDocid = docid + util.getOption("accNumSeparator");
......
417 417
            }
418 418
            // Store the document id and the root node id
419 419
            docListResult.put(docid,(String)document.toString());
420
  
420

  
421 421
          }
422 422

  
423 423
          // Advance to the next record in the cursor
......
428 428
        double docListTime =System.currentTimeMillis()/1000;
429 429
        MetaCatUtil.debugMessage("prepare docid list time: "
430 430
                                          +(docListTime-queryExecuteTime), 30);
431
        
431

  
432 432
        if (qspec.containsExtendedSQL())
433 433
        {
434 434
          Vector extendedFields = new Vector(qspec.getReturnFieldList());
435 435
          Vector results = new Vector();
436 436
          Enumeration keylist = docListResult.keys();
437 437
          StringBuffer doclist = new StringBuffer();
438
          Hashtable parentidList = new Hashtable();
438
          Vector parentidList = new Vector();
439 439
          Hashtable returnFieldValue = new Hashtable();
440 440
          while(keylist.hasMoreElements())
441 441
          {
......
443 443
            doclist.append((String)keylist.nextElement());
444 444
            doclist.append("',");
445 445
          }
446
          if (doclist.length() > 0) 
446
          if (doclist.length() > 0)
447 447
          {
448 448
            Hashtable controlPairs = new Hashtable();
449 449
            double extendedQueryStart = System.currentTimeMillis()/1000;
......
464 464
              controlPairs.put(new Long(startNodeId), new Long(endNodeId));
465 465
              tableHasRows = rs.next();
466 466
            }
467
            
467

  
468 468
            double extendedAccessQueryEnd = System.currentTimeMillis()/1000;
469 469
            MetaCatUtil.debugMessage("Time for execute access extended query: "
470 470
                              +(extendedAccessQueryEnd-extendedQueryStart), 30);
471
            
472
            String extendedQuery = qspec.printExtendedSQL(doclist.toString(), 
471

  
472
            String extendedQuery = qspec.printExtendedSQL(doclist.toString(),
473 473
                                                          controlPairs);
474 474
            MetaCatUtil.debugMessage("Extended query: "+ extendedQuery, 30);
475 475
            pstmt = dbconn.prepareStatement(extendedQuery);
......
481 481
            MetaCatUtil.debugMessage("Time for execute extended query: "
482 482
                                    +(extendedQueryEnd-extendedQueryStart), 30);
483 483
            tableHasRows = rs.next();
484
            while(tableHasRows) 
484
            while(tableHasRows)
485 485
            {
486 486
              ReturnFieldValue returnValue = new ReturnFieldValue();
487 487
              docid = rs.getString(1).trim();
488 488
              fieldname = rs.getString(2);
489 489
              fielddata = rs.getString(3);
490 490
              fielddata = MetaCatUtil.normalize(fielddata);
491
              
491

  
492 492
              String parentId = rs.getString(4);
493
                         
493

  
494 494
              StringBuffer value = new StringBuffer();
495
              if (!parentidList.containsKey(parentId))
495
              if (!containsKey(parentidList,parentId))
496 496
              {
497
                // don't need to merger nodedata 
497
                // don't need to merger nodedata
498 498
                value.append("<param name=\"");
499 499
                value.append(fieldname);
500 500
                value.append("\">");
......
505 505
                returnValue.setFieldValue(fielddata);
506 506
                returnValue.setXMLFieldValue(value.toString());
507 507
                // Store it in hastable
508
                parentidList.put(parentId, returnValue);
508
                putInArray(parentidList, parentId, returnValue);
509 509
              }
510 510
              else
511 511
              {
512 512
                // need to merge nodedata if they have same parent id ant
513 513
                // node type is text
514 514
                fielddata = (String)((ReturnFieldValue)
515
                       parentidList.get(parentId)).getFieldValue() +  fielddata;
515
                       getArrayValue(parentidList,parentId)).getFieldValue() +  fielddata;
516 516
                value.append("<param name=\"");
517 517
                value.append(fieldname);
518 518
                value.append("\">");
......
524 524
                // remove the old return value from paretnidList
525 525
                parentidList.remove(parentId);
526 526
                // store the new return value in parentidlit
527
                parentidList.put(parentId, returnValue);
527
                putInArray(parentidList,parentId, returnValue);
528 528
              }
529 529
               tableHasRows = rs.next();
530 530
            }//while
531 531
            rs.close();
532 532
            pstmt.close();
533
            
533

  
534 534
            // put the merger node data info into doclistReult
535
            Enumeration xmlFieldValue = parentidList.elements();
535
            Enumeration xmlFieldValue = (getElements(parentidList)).elements();
536 536
            while( xmlFieldValue.hasMoreElements() )
537 537
            {
538 538
              ReturnFieldValue object = (ReturnFieldValue)
......
546 546
              }
547 547
              else
548 548
              {
549
                  docListResult.put(docid, object.getXMLFieldValue()); 
549
                  docListResult.put(docid, object.getXMLFieldValue());
550 550
              }
551 551
            }//while
552 552
            double docListResultEnd = System.currentTimeMillis()/1000;
553 553
            MetaCatUtil.debugMessage("Time for prepare doclistresult after"+
554 554
                                      " execute extended query: "
555 555
                                    +(docListResultEnd-extendedQueryEnd), 30);
556
            
557
            
556

  
557

  
558 558
            // get attribures return
559 559
            docListResult = getAttributeValueForReturn
560 560
                                      (qspec,docListResult, doclist.toString());
561 561
          }//if doclist lenght is great than zero
562
          
562

  
563 563
        }//if has extended query
564
        
565
        
564

  
565

  
566 566
        //this loop adds the relation data to the resultdoc
567 567
        //this code might be able to be added to the backtracking code above
568 568
        double startRelation = System.currentTimeMillis()/1000;
......
583 583
            String obj = rs.getString(3);
584 584
            String subDT = rs.getString(4);
585 585
            String objDT = rs.getString(5);
586
            
586

  
587 587
            document = new StringBuffer();
588 588
            document.append("<triple>");
589 589
            document.append("<subject>").append(MetaCatUtil.normalize(sub));
......
602 602
              document.append("</objectdoctype>");
603 603
            }
604 604
            document.append("</triple>");
605
            
605

  
606 606
            String removedelement = (String)docListResult.remove(docidkey);
607
            docListResult.put(docidkey, removedelement + 
607
            docListResult.put(docidkey, removedelement +
608 608
                              document.toString());
609 609
            tableHasRows = rs.next();
610 610
          }
......
614 614
        double endRelation = System.currentTimeMillis()/1000;
615 615
        MetaCatUtil.debugMessage("Time for adding relation to docListResult: "+
616 616
                                (endRelation-startRelation), 30);
617
        
617

  
618 618
      } catch (SQLException e) {
619
        System.err.println("SQL Error in DBQuery.findDocuments: " + 
619
        System.err.println("SQL Error in DBQuery.findDocuments: " +
620 620
                           e.getMessage());
621 621
      } catch (Exception ee) {
622
        System.err.println("Exception in DBQuery.findDocuments: " + 
622
        System.err.println("Exception in DBQuery.findDocuments: " +
623 623
                           ee.getMessage());
624 624
        ee.printStackTrace(System.err);
625 625
      }
626
      finally 
626
      finally
627 627
      {
628 628
        try
629 629
        {
......
643 643
    //System.out.println(docListResult.toString());
644 644
    return docListResult;
645 645
  }
646

  
646 647
  /*
648
   * A method to search if Vector contains a particular key string
649
   */
650
  private boolean containsKey(Vector parentidList,String parentId){
651

  
652
    Vector tempVector = null;
653

  
654
    for(int count = 0; count < parentidList.size(); count++){
655
      tempVector = (Vector)parentidList.get(count);
656
      if(parentId.compareTo((String)tempVector.get(0)) == 0){
657
        return false;
658
      }
659
    }
660
    return false;
661
  }
662

  
663
  /*
664
   * A method to put key and value in Vector
665
   */
666
  private void putInArray(Vector parentidList, String key,
667
                          ReturnFieldValue value){
668

  
669
    Vector tempVector = null;
670

  
671
    for(int count = 0; count < parentidList.size(); count++){
672
      tempVector = (Vector)parentidList.get(count);
673

  
674
      if(key.compareTo((String)tempVector.get(0)) == 0){
675
        tempVector.remove(1);
676
        tempVector.add(1, value);
677
        return;
678
      }
679
    }
680

  
681
    tempVector = new Vector();
682
    tempVector.add(0, key);
683
    tempVector.add(1, value);
684
    parentidList.add(tempVector);
685
    return;
686
  }
687

  
688
  /*
689
   * A method to get value in Vector given a key
690
   */
691
  private ReturnFieldValue getArrayValue(Vector parentidList,
692
                                         String key){
693

  
694
    Vector tempVector = null;
695

  
696
    for(int count = 0; count < parentidList.size(); count++){
697
      tempVector = (Vector)parentidList.get(count);
698

  
699
      if(key.compareTo((String)tempVector.get(0)) == 0){
700
        return (ReturnFieldValue)tempVector.get(1);
701
      }
702
    }
703
    return null;
704
  }
705

  
706
  /*
707
   * A method to get enumeration of all values in Vector
708
   */
709
  private Vector getElements(Vector parentidList){
710
    Vector enum = new Vector();
711
    Vector tempVector = null;
712

  
713
    for(int count = 0; count < parentidList.size(); count++){
714
      tempVector = (Vector)parentidList.get(count);
715

  
716
      enum.add(tempVector.get(1));
717
    }
718
    return enum;
719
  }
720

  
721
  /*
647 722
   * A method to return search result after running a query which return
648 723
   * field have attribue
649 724
   */
......
658 733
    ResultSet rs = null;
659 734
    int serialNumber = -1;
660 735
    boolean tableHasRows =false;
661
    
736

  
662 737
    //check the parameter
663 738
    if (squery == null || docList==null || docList.length() <0)
664 739
    {
665 740
      return docInformationList;
666 741
    }
667
    
742

  
668 743
    // if has attribute as return field
669 744
    if (squery.containAttributeReturnField())
670 745
    {
671 746
      sql = squery.printAttributeQuery(docList);
672
      try 
747
      try
673 748
      {
674 749
        dbconn=DBConnectionPool.getDBConnection("DBQuery.getAttributeValue");
675 750
        serialNumber=dbconn.getCheckOutSerialNumber();
......
677 752
        pstmt.execute();
678 753
        rs = pstmt.getResultSet();
679 754
        tableHasRows = rs.next();
680
        while(tableHasRows) 
755
        while(tableHasRows)
681 756
        {
682 757
          String docid = rs.getString(1).trim();
683 758
          String fieldname = rs.getString(2);
684 759
          String fielddata = rs.getString(3);
685 760
          String attirbuteName = rs.getString(4);
686 761
          XML = new StringBuffer();
687
  
762

  
688 763
          XML.append("<param name=\"");
689 764
          XML.append(fieldname);
690 765
          XML.append(QuerySpecification.ATTRIBUTESYMBOL);
......
693 768
          XML.append(fielddata);
694 769
          XML.append("</param>");
695 770
          tableHasRows = rs.next();
696
          
771

  
697 772
          if (docInformationList.containsKey(docid))
698 773
          {
699 774
            String removedelement = (String)docInformationList.remove(docid);
......
701 776
          }
702 777
          else
703 778
          {
704
            docInformationList.put(docid, XML.toString()); 
779
            docInformationList.put(docid, XML.toString());
705 780
          }
706 781
        }//while
707 782
        rs.close();
......
730 805
      }//finally
731 806
    }//if
732 807
    return docInformationList;
733
      
808

  
734 809
  }
735
   
736
  
810

  
811

  
737 812
  /*
738 813
   * A method to create a query to get owner's docid list
739 814
   */
......
755 830
    return self.toString();
756 831
  }
757 832
  /**
758
   * returns a string array of the contents of a particular node. 
759
   * If the node appears more than once, the contents are returned 
833
   * returns a string array of the contents of a particular node.
834
   * If the node appears more than once, the contents are returned
760 835
   * in the order in which they appearred in the document.
761 836
   * @param nodename the name or path of the particular node.
762 837
   * @param docid the docid of the document you want the node from.
......
782 857
      pstmt.execute();
783 858
      ResultSet rs = pstmt.getResultSet();
784 859
      boolean tableHasRows = rs.next();
785
      while (tableHasRows) 
860
      while (tableHasRows)
786 861
      {
787 862
        result.add(rs.getString(1));
788 863
        //System.out.println(rs.getString(1));
789 864
        tableHasRows = rs.next();
790 865
      }
791
    } 
792
    catch (SQLException e) 
866
    }
867
    catch (SQLException e)
793 868
    {
794 869
      System.err.println("Error in DBQuery.getNodeContent: " + e.getMessage());
795 870
    } finally {
......
797 872
      {
798 873
        pstmt.close();
799 874
      }
800
      catch(SQLException sqle) 
875
      catch(SQLException sqle)
801 876
      {}
802 877
      finally
803 878
      {
804 879
        DBConnectionPool.returnDBConnection(dbconn, serialNumber);
805 880
      }
806
      
881

  
807 882
    }
808 883
    return result.toArray();
809 884
  }
810
  
885

  
811 886
  /**
812 887
   * format a structured query as an XML document that conforms
813 888
   * to the pathquery.dtd and is appropriate for submission to the DBQuery
......
816 891
   * @param params The list of parameters that should be included in the query
817 892
   */
818 893
  public static String createSQuery(Hashtable params)
819
  { 
894
  {
820 895
    StringBuffer query = new StringBuffer();
821 896
    Enumeration elements;
822 897
    Enumeration keys;
......
835 910
      query.append( ((String[])params.get("meta_file_id"))[0]);
836 911
      query.append("</meta_file_id>");
837 912
    }
838
    
913

  
839 914
    if (params.containsKey("returndoctype"))
840 915
    {
841 916
      String[] returnDoctypes = ((String[])params.get("returndoctype"));
......
843 918
      {
844 919
        String doctype = (String)returnDoctypes[i];
845 920

  
846
        if (!doctype.equals("any") && 
921
        if (!doctype.equals("any") &&
847 922
            !doctype.equals("ANY") &&
848
            !doctype.equals("") ) 
923
            !doctype.equals("") )
849 924
        {
850 925
          query.append("<returndoctype>").append(doctype);
851 926
          query.append("</returndoctype>");
852 927
        }
853 928
      }
854 929
    }
855
    
930

  
856 931
    if (params.containsKey("filterdoctype"))
857 932
    {
858 933
      String[] filterDoctypes = ((String[])params.get("filterdoctype"));
......
862 937
        query.append("</filterdoctype>");
863 938
      }
864 939
    }
865
    
940

  
866 941
    if (params.containsKey("returnfield"))
867 942
    {
868 943
      String[] returnfield = ((String[])params.get("returnfield"));
......
872 947
        query.append("</returnfield>");
873 948
      }
874 949
    }
875
    
950

  
876 951
    if (params.containsKey("owner"))
877 952
    {
878 953
      String[] owner = ((String[])params.get("owner"));
......
882 957
        query.append("</owner>");
883 958
      }
884 959
    }
885
    
960

  
886 961
    if (params.containsKey("site"))
887 962
    {
888 963
      String[] site = ((String[])params.get("site"));
......
892 967
        query.append("</site>");
893 968
      }
894 969
    }
895
    
970

  
896 971
    //allows the dynamic switching of boolean operators
897 972
    if (params.containsKey("operator"))
898 973
    {
899
      query.append("<querygroup operator=\"" + 
974
      query.append("<querygroup operator=\"" +
900 975
                ((String[])params.get("operator"))[0] + "\">");
901 976
    }
902 977
    else
903 978
    { //the default operator is UNION
904
      query.append("<querygroup operator=\"UNION\">"); 
979
      query.append("<querygroup operator=\"UNION\">");
905 980
    }
906
        
981

  
907 982
    if (params.containsKey("casesensitive"))
908 983
    {
909
      casesensitive = ((String[])params.get("casesensitive"))[0]; 
984
      casesensitive = ((String[])params.get("casesensitive"))[0];
910 985
    }
911 986
    else
912 987
    {
913
      casesensitive = "false"; 
988
      casesensitive = "false";
914 989
    }
915
    
990

  
916 991
    if (params.containsKey("searchmode"))
917 992
    {
918
      searchmode = ((String[])params.get("searchmode"))[0]; 
993
      searchmode = ((String[])params.get("searchmode"))[0];
919 994
    }
920 995
    else
921 996
    {
922
      searchmode = "contains"; 
997
      searchmode = "contains";
923 998
    }
924
        
925
    //anyfield is a special case because it does a 
999

  
1000
    //anyfield is a special case because it does a
926 1001
    //free text search.  It does not have a <pathexpr>
927 1002
    //tag.  This allows for a free text search within the structured
928 1003
    //query.  This is useful if the INTERSECT operator is used.
......
934 1009
       {
935 1010
         if (!anyfield[i].equals(""))
936 1011
         {
937
           query.append("<queryterm casesensitive=\"" + casesensitive + 
1012
           query.append("<queryterm casesensitive=\"" + casesensitive +
938 1013
                        "\" " + "searchmode=\"" + searchmode + "\"><value>" +
939 1014
                        anyfield[i] +
940
                        "</value></queryterm>"); 
1015
                        "</value></queryterm>");
941 1016
         }
942 1017
       }
943 1018
    }
944
        
1019

  
945 1020
    //this while loop finds the rest of the parameters
946 1021
    //and attempts to query for the field specified
947 1022
    //by the parameter.
......
977 1052
        //allow for more than value per field name
978 1053
        for(int i=0; i<((String[])nextelement).length; i++) {
979 1054
          if (!((String[])nextelement)[i].equals("")) {
980
            query.append("<queryterm casesensitive=\"" + casesensitive +"\" " + 
1055
            query.append("<queryterm casesensitive=\"" + casesensitive +"\" " +
981 1056
                         "searchmode=\"" + searchmode + "\">" +
982 1057
                         "<value>" +
983 1058
                         //add the query value
984 1059
                         ((String[])nextelement)[i] +
985 1060
                         "</value><pathexpr>" +
986
                         //add the path to query by 
987
                         nextkey.toString() + 
1061
                         //add the path to query by
1062
                         nextkey.toString() +
988 1063
                         "</pathexpr></queryterm>");
989 1064
          }
990 1065
        }
......
994 1069
    //append on the end of the xml and return the result as a string
995 1070
    return query.toString();
996 1071
  }
997
  
1072

  
998 1073
  /**
999 1074
   * format a simple free-text value query as an XML document that conforms
1000 1075
   * to the pathquery.dtd and is appropriate for submission to the DBQuery
......
1016 1091

  
1017 1092
     xmlquery.append("<querygroup operator=\"UNION\">");
1018 1093
     //chad added - 8/14
1019
     //the if statement allows a query to gracefully handle a null 
1094
     //the if statement allows a query to gracefully handle a null
1020 1095
     //query.  Without this if a nullpointerException is thrown.
1021 1096
     if (!value.equals(""))
1022 1097
     {
......
1028 1103
     xmlquery.append("</querygroup>");
1029 1104
     xmlquery.append("</pathquery>");
1030 1105

  
1031
     
1106

  
1032 1107
     return (xmlquery.toString());
1033 1108
   }
1034 1109

  
......
1042 1117
   public static String createQuery(String value) {
1043 1118
     return createQuery(value, "any");
1044 1119
   }
1045
   
1046
  /** 
1047
    * Check for "READ" permission on @docid for @user and/or @group 
1048
    * from DB connection 
1120

  
1121
  /**
1122
    * Check for "READ" permission on @docid for @user and/or @group
1123
    * from DB connection
1049 1124
    */
1050 1125
  private boolean hasPermission (String user,
1051
                                  String[] groups, String docid ) 
1126
                                  String[] groups, String docid )
1052 1127
                  throws SQLException, Exception
1053 1128
  {
1054 1129
    // Check for READ permission on @docid for @user and/or @groups
......
1070 1145
    ResultSet rs=null;
1071 1146
    String docIdInSubjectField=null;
1072 1147
    String docIdInObjectField=null;
1073
    
1148

  
1074 1149
    // Check the parameter
1075 1150
    if (dataPackageDocid == null || dataPackageDocid.equals(""))
1076 1151
    {
1077 1152
      return docIdList;
1078 1153
    }//if
1079
    
1154

  
1080 1155
    //the query stirng
1081 1156
    String query="SELECT subject, object from xml_relation where docId = ?";
1082 1157
    try
......
1131 1206
      {
1132 1207
        MetaCatUtil.debugMessage("Error in getDocidListForDataPackage: "
1133 1208
                            +ee.getMessage(), 30);
1134
      }//catch     
1209
      }//catch
1135 1210
      finally
1136 1211
      {
1137 1212
        DBConnectionPool.returnDBConnection(dbConn, serialNumber);
......
1139 1214
    }//finally
1140 1215
    return docIdList;
1141 1216
  }//getCurrentDocidListForDataPackadge()
1142
  
1217

  
1143 1218
  /**
1144 1219
   * Get all docIds list for a data packadge
1145 1220
   * @param dataPackageDocid, the string in docId field of xml_relation table
1146 1221
   */
1147 1222
  private Vector getOldVersionDocidListForDataPackage(String dataPackageDocid)
1148 1223
  {
1149
   
1224

  
1150 1225
    Vector docIdList=new Vector();//return value
1151 1226
    Vector tripleList=null;
1152 1227
    String xml=null;
1153
    
1228

  
1154 1229
     // Check the parameter
1155 1230
    if (dataPackageDocid == null || dataPackageDocid.equals(""))
1156 1231
    {
1157 1232
      return docIdList;
1158 1233
    }//if
1159
    
1234

  
1160 1235
    try
1161 1236
    {
1162
      //initial a documentImpl object 
1163
      DocumentImpl packageDocument = 
1237
      //initial a documentImpl object
1238
      DocumentImpl packageDocument =
1164 1239
                  new DocumentImpl(dataPackageDocid);
1165 1240
      //transfer to documentImpl object to string
1166 1241
      xml=packageDocument.toString();
1167
    
1242

  
1168 1243
      //create a tripcollection object
1169
      TripleCollection tripleForPackage = new 
1244
      TripleCollection tripleForPackage = new
1170 1245
                                     TripleCollection(new StringReader(xml));
1171
      //get the vetor of triples 
1246
      //get the vetor of triples
1172 1247
      tripleList=tripleForPackage.getCollection();
1173
    
1248

  
1174 1249
      for (int i= 0; i<tripleList.size(); i++)
1175 1250
      {
1176 1251
        //put subject docid  into docIdlist without duplicate
......
1191 1266
      MetaCatUtil.debugMessage("Error in getOldVersionAllDocumentImpl: "
1192 1267
                            +e.getMessage(), 30);
1193 1268
    }//catch
1194
  
1269

  
1195 1270
    // return result
1196 1271
    return docIdList;
1197
  }//getDocidListForPackageInXMLRevisions()  
1198
  
1272
  }//getDocidListForPackageInXMLRevisions()
1273

  
1199 1274
  /**
1200
   * Check if the docId is a data packadge id. If the id is a data packadage 
1275
   * Check if the docId is a data packadge id. If the id is a data packadage
1201 1276
   *id, it should be store in the docId fields in xml_relation table.
1202
   *So we can use a query to get the entries which the docId equals the given 
1277
   *So we can use a query to get the entries which the docId equals the given
1203 1278
   *value. If the result is null. The docId is not a packadge id. Otherwise,
1204 1279
   * it is.
1205 1280
   * @param docId, the id need to be checked
......
1253 1328
    }//finally
1254 1329
    return result;
1255 1330
  }//isDataPackageId()
1256
  
1331

  
1257 1332
  /**
1258 1333
   * Check if the user has the permission to export data package
1259 1334
   * @param conn, the connection
1260 1335
   * @param docId, the id need to be checked
1261 1336
   * @param user, the name of user
1262 1337
   * @param groups, the user's group
1263
   */ 
1264
   private boolean hasPermissionToExportPackage(String docId, 
1338
   */
1339
   private boolean hasPermissionToExportPackage(String docId,
1265 1340
                                        String user, String[] groups)
1266 1341
                   throws Exception
1267 1342
   {
1268 1343
     //DocumentImpl doc=new DocumentImpl(conn,docId);
1269 1344
     return DocumentImpl.hasReadPermission(user, groups,docId);
1270 1345
   }
1271
   
1346

  
1272 1347
  /**
1273 1348
   *Get the current Rev for a docid in xml_documents table
1274 1349
   * @param docId, the id need to get version numb
......
1303 1378
      {
1304 1379
        rev=-5;
1305 1380
      }
1306
     
1381

  
1307 1382
    }//try
1308 1383
    catch (SQLException e)
1309 1384
    {
......
1329 1404
    }//finally
1330 1405
    return rev;
1331 1406
  }//getCurrentRevFromXMLDoumentsTable
1332
 
1407

  
1333 1408
 /**
1334 1409
   *put a doc into a zip output stream
1335 1410
   *@param docImpl, docmentImpl object which will be sent to zip output stream
1336 1411
   *@param zipOut, zip output stream which the docImpl will be put
1337 1412
   *@param packageZipEntry, the zip entry name for whole package
1338 1413
   */
1339
  private void addDocToZipOutputStream(DocumentImpl docImpl, 
1414
  private void addDocToZipOutputStream(DocumentImpl docImpl,
1340 1415
                                ZipOutputStream zipOut, String packageZipEntry)
1341
               throws ClassNotFoundException, IOException, SQLException, 
1416
               throws ClassNotFoundException, IOException, SQLException,
1342 1417
                      McdbException, Exception
1343 1418
  {
1344 1419
    byte[] byteString = null;
......
1351 1426
    zipOut.putNextEntry(zEntry);
1352 1427
    zipOut.write(byteString, 0, byteString.length);
1353 1428
    zipOut.closeEntry();
1354
  
1429

  
1355 1430
  }//addDocToZipOutputStream()
1356 1431

  
1357
  
1432

  
1358 1433
  /**
1359
   * Transfer a docid vetor to a documentImpl vector. The documentImpl vetor 
1434
   * Transfer a docid vetor to a documentImpl vector. The documentImpl vetor
1360 1435
   * only inlcudes current version. If a DocumentImple object
1361 1436
   * couldn't find for a docid, then the String of this docid was added to vetor
1362 1437
   * rather than DocumentImple object.
1363 1438
   * @param docIdList, a vetor hold a docid list for a data package. In docid,
1364 1439
   * there is not version number in it.
1365
   */  
1366
  
1440
   */
1441

  
1367 1442
  private Vector getCurrentAllDocumentImpl( Vector docIdList)
1368 1443
                              throws McdbException,Exception
1369 1444
  {
1370 1445
    //Connection dbConn=null;
1371 1446
    Vector documentImplList=new Vector();
1372
    int rev=0; 
1373
    
1447
    int rev=0;
1448

  
1374 1449
    // Check the parameter
1375 1450
    if (docIdList.isEmpty())
1376 1451
    {
1377 1452
      return documentImplList;
1378 1453
    }//if
1379
  
1454

  
1380 1455
    //for every docid in vector
1381 1456
    for (int i=0;i<docIdList.size();i++)
1382 1457
    {
......
1384 1459
      {
1385 1460
        //get newest version for this docId
1386 1461
        rev=getCurrentRevFromXMLDoumentsTable((String)docIdList.elementAt(i));
1387
      
1462

  
1388 1463
        // There is no record for this docId in xml_documents table
1389 1464
        if (rev ==-5)
1390 1465
        {
......
1394 1469
          // Skip other code
1395 1470
          continue;
1396 1471
        }
1397
     
1472

  
1398 1473
        String docidPlusVersion=((String)docIdList.elementAt(i))
1399 1474
                        +util.getOption("accNumSeparator")+rev;
1400
      
1401
      
1475

  
1476

  
1402 1477
        //create new documentImpl object
1403
        DocumentImpl documentImplObject = 
1478
        DocumentImpl documentImplObject =
1404 1479
                                    new DocumentImpl(docidPlusVersion);
1405
       //add them to vector                            
1480
       //add them to vector
1406 1481
        documentImplList.add(documentImplObject);
1407 1482
      }//try
1408 1483
      catch (Exception e)
......
1415 1490
    }//for
1416 1491
    return documentImplList;
1417 1492
  }
1418
  
1493

  
1419 1494
  /**
1420 1495
   * Transfer a docid vetor to a documentImpl vector. If a DocumentImple object
1421 1496
   * couldn't find for a docid, then the String of this docid was added to vetor
1422 1497
   * rather than DocumentImple object.
1423 1498
   * @param docIdList, a vetor hold a docid list for a data package. In docid,
1424 1499
   *t here is version number in it.
1425
   */    
1500
   */
1426 1501
  private Vector getOldVersionAllDocumentImpl( Vector docIdList)
1427 1502
  {
1428 1503
    //Connection dbConn=null;
1429 1504
    Vector documentImplList=new Vector();
1430 1505
    String siteCode=null;
1431 1506
    String uniqueId=null;
1432
    int rev=0; 
1433
    
1507
    int rev=0;
1508

  
1434 1509
    // Check the parameter
1435 1510
    if (docIdList.isEmpty())
1436 1511
    {
1437 1512
      return documentImplList;
1438 1513
    }//if
1439
    
1514

  
1440 1515
    //for every docid in vector
1441 1516
    for (int i=0;i<docIdList.size();i++)
1442 1517
    {
1443
      
1518

  
1444 1519
        String docidPlusVersion=(String)(docIdList.elementAt(i));
1445
        
1520

  
1446 1521
        try
1447 1522
        {
1448 1523
          //create new documentImpl object
1449
          DocumentImpl documentImplObject = 
1524
          DocumentImpl documentImplObject =
1450 1525
                                    new DocumentImpl(docidPlusVersion);
1451
          //add them to vector                            
1526
          //add them to vector
1452 1527
          documentImplList.add(documentImplObject);
1453 1528
        }//try
1454 1529
        catch (McdbDocNotFoundException notFoundE)
......
1468 1543
          // Continue the for loop
1469 1544
          continue;
1470 1545
        }//catch
1471
          
1472
      
1546

  
1547

  
1473 1548
    }//for
1474 1549
    return documentImplList;
1475 1550
  }//getOldVersionAllDocumentImple
1476
  
1551

  
1477 1552
  /**
1478 1553
   *put a data file into a zip output stream
1479 1554
   *@param docImpl, docmentImpl object which will be sent to zip output stream
......
1489 1564
    ZipEntry zEntry = null;
1490 1565
    // this is data file; add file to zip
1491 1566
    String filePath = util.getOption("datafilepath");
1492
    if (!filePath.endsWith("/")) 
1567
    if (!filePath.endsWith("/"))
1493 1568
    {
1494 1569
      filePath += "/";
1495 1570
    }
......
1530 1605
    byte[] byteString=null;
1531 1606
    InputStream source;
1532 1607
    DBTransform xmlToHtml;
1533
  
1608

  
1534 1609
    //create a DBTransform ojbect
1535 1610
    xmlToHtml = new DBTransform();
1536 1611
    //head of html
......
1541 1616
      if ((((docImplList.elementAt(i)).getClass()).toString())
1542 1617
                                             .equals("class java.lang.String"))
1543 1618
      {
1544
        
1619

  
1545 1620
        htmlDoc.append("<a href=\"");
1546 1621
        String dataFileid =(String)docImplList.elementAt(i);
1547 1622
        htmlDoc.append("./data/").append(dataFileid).append("\">");
1548 1623
        htmlDoc.append("Data File: ");
1549 1624
        htmlDoc.append(dataFileid).append("</a><br>");
1550 1625
        htmlDoc.append("<br><hr><br>");
1551
        
1626

  
1552 1627
      }//if
1553 1628
      else if ((((DocumentImpl)docImplList.elementAt(i)).getDoctype()).
1554 1629
                                                         compareTo("BIN")!=0)
......
1588 1663
    zipOut.write(byteString, 0, byteString.length);
1589 1664
    zipOut.closeEntry();
1590 1665
    //dbConn.close();
1591
        
1666

  
1592 1667
  }//addHtmlSummaryToZipOutputStream
1593
  
1594
  
1595
  
1668

  
1669

  
1670

  
1596 1671
  /**
1597 1672
   * put a data packadge into a zip output stream
1598 1673
   * @param docId, which the user want to put into zip output stream
1599
   * @param out, a servletoutput stream which the zip output stream will be put 
1674
   * @param out, a servletoutput stream which the zip output stream will be put
1600 1675
   * @param user, the username of the user
1601 1676
   * @param groups, the group of the user
1602 1677
   */
1603
  public ZipOutputStream getZippedPackage(String docIdString, 
1678
  public ZipOutputStream getZippedPackage(String docIdString,
1604 1679
        ServletOutputStream out, String user, String[] groups, String passWord)
1605
                    throws ClassNotFoundException, IOException, SQLException, 
1680
                    throws ClassNotFoundException, IOException, SQLException,
1606 1681
                      McdbException, NumberFormatException, Exception
1607
  { 
1682
  {
1608 1683
    ZipOutputStream zOut = null;
1609 1684
    String elementDocid=null;
1610 1685
    DocumentImpl docImpls=null;
......
1614 1689
    Vector htmlDocumentImplList=new Vector();
1615 1690
    String packageId=null;
1616 1691
    String rootName="package";//the package zip entry name
1617
    
1692

  
1618 1693
    String docId=null;
1619 1694
    int version=-5;
1620 1695
    // Docid without revision
1621 1696
    docId=MetaCatUtil.getDocIdFromString(docIdString);
1622 1697
    // revision number
1623 1698
    version=MetaCatUtil.getVersionFromString(docIdString);
1624
 
1699

  
1625 1700
    //check if the reqused docId is a data package id
1626 1701
    if (!isDataPackageId(docId))
1627 1702
    {
1628
      
1703

  
1629 1704
      /*Exception e = new Exception("The request the doc id " +docIdString+
1630 1705
                                    " is not a data package id");
1631 1706
      throw e;*/
1632
      
1633
      
1707

  
1708

  
1634 1709
      //CB 1/6/03: if the requested docid is not a datapackage, we just zip
1635 1710
      //up the single document and return the zip file.
1636 1711

  
......
1667 1742
    // Check the permission of user
1668 1743
    else if(!hasPermissionToExportPackage(docId, user, groups))
1669 1744
    {
1670
      
1745

  
1671 1746
      Exception e = new Exception("User " + user + " does not have permission"
1672 1747
                       +" to export the data package " + docIdString);
1673 1748
      throw e;
1674 1749
    }
1675 1750
    else //it is a packadge id
1676
    { 
1751
    {
1677 1752
      //store the package id
1678 1753
      packageId=docId;
1679 1754
      //get current version in database
1680 1755
      int currentVersion = getCurrentRevFromXMLDoumentsTable(packageId);
1681 1756
      //If it is for current version (-1 means user didn't specify revision)
1682 1757
      if ((version ==-1)||version==currentVersion)
1683
      { 
1758
      {
1684 1759
        //get current version number
1685 1760
        version=currentVersion;
1686 1761
        //get package zip entry name
......
1691 1766
        docIdList=getCurrentDocidListForDataPackage(packageId);
1692 1767
        //get the whole documentImple object
1693 1768
        documentImplList=getCurrentAllDocumentImpl(docIdList);
1694
       
1769

  
1695 1770
      }//if
1696 1771
      else if (version > currentVersion || version < -1)
1697 1772
      {
......
1700 1775
      }//else if
1701 1776
      else  //for an old version
1702 1777
      {
1703
       
1778

  
1704 1779
        rootName=docIdString+util.getOption("accNumSeparator")+"package";
1705 1780
        //get the whole id list for data packadge
1706 1781
        docIdList=getOldVersionDocidListForDataPackage(docIdString);
1707 1782

  
1708 1783
        //get the whole documentImple object
1709 1784
        documentImplList=getOldVersionAllDocumentImpl(docIdList);
1710
      }//else  
1711
      
1785
      }//else
1786

  
1712 1787
      // Make sure documentImplist is not empty
1713 1788
      if (documentImplList.isEmpty())
1714 1789
      {
1715 1790
        throw new Exception ("Couldn't find component for data package: "
1716 1791
                                              + packageId);
1717 1792
      }//if
1718
      
1719
     
1793

  
1794

  
1720 1795
       zOut = new ZipOutputStream(out);
1721 1796
      //put every element into zip output stream
1722 1797
      for (int i=0; i < documentImplList.size(); i++ )
......
1730 1805
          String documentId = (String) documentImplList.elementAt(i);
1731 1806
          MetaCatUtil.debugMessage("docid: "+documentId, 30);
1732 1807
          // Get doicd without revision
1733
          String docidWithoutRevision = 
1808
          String docidWithoutRevision =
1734 1809
                                     MetaCatUtil.getDocIdFromString(documentId);
1735 1810
          MetaCatUtil.debugMessage("docidWithoutRevsion: "
1736 1811
                                                     +docidWithoutRevision, 30);
......
1738 1813
          String revision = MetaCatUtil.getRevisionStringFromString(documentId);
1739 1814
          MetaCatUtil.debugMessage("revsion from docIdentifier: "+revision, 30);
1740 1815
          // Zip entry string
1741
          String zipEntryPath = rootName+"/data/"; 
1816
          String zipEntryPath = rootName+"/data/";
1742 1817
          // Create a RemoteDocument object
1743
          RemoteDocument remoteDoc = 
1744
                          new RemoteDocument(docidWithoutRevision,revision,user, 
1818
          RemoteDocument remoteDoc =
1819
                          new RemoteDocument(docidWithoutRevision,revision,user,
1745 1820
                                                     passWord, zipEntryPath);
1746 1821
          // Here we only read data file from remote metacat
1747 1822
          String docType = remoteDoc.getDocType();
......
1757 1832
              htmlDocumentImplList.add(elementInHtmlList);
1758 1833
            }//if
1759 1834
          }//if
1760
         
1835

  
1761 1836
        }//if
1762 1837
        else
1763 1838
        {
......
1765 1840
          docImpls=(DocumentImpl)documentImplList.elementAt(i);
1766 1841
          //checking if the user has the permission to read the documents
1767 1842
          if (docImpls.hasReadPermission(user,groups,docImpls.getDocID()))
1768
          {  
1769
            //if the docImpls is metadata 
1770
            if ((docImpls.getDoctype()).compareTo("BIN")!=0)  
1843
          {
1844
            //if the docImpls is metadata
1845
            if ((docImpls.getDoctype()).compareTo("BIN")!=0)
1771 1846
            {
1772 1847
              //add metadata into zip output stream
1773 1848
              addDocToZipOutputStream(docImpls, zOut, rootName);
1774 1849
              //add the documentImpl into the vetor which will be used in html
1775 1850
              htmlDocumentImplList.add(docImpls);
1776
           
1851

  
1777 1852
            }//if
1778
            else 
1853
            else
1779 1854
            {
1780
              //it is data file 
1855
              //it is data file
1781 1856
              addDataFileToZipOutputStream(docImpls, zOut, rootName);
1782 1857
              htmlDocumentImplList.add(docImpls);
1783 1858
            }//else
......
1792 1867
      return zOut;
1793 1868
    }//else
1794 1869
  }//getZippedPackage()
1795
  
1870

  
1796 1871
   private class ReturnFieldValue
1797 1872
  {
1798 1873
    private String docid          = null; //return field value for this docid
1799 1874
    private String fieldValue     = null;
1800 1875
    private String xmlFieldValue  = null; //return field value in xml format
1801 1876

  
1802
    
1877

  
1803 1878
    public void setDocid(String myDocid)
1804 1879
    {
1805 1880
      docid = myDocid;
1806 1881
    }
1807
    
1882

  
1808 1883
    public String getDocid()
1809 1884
    {
1810 1885
      return docid;
1811 1886
    }
1812
    
1887

  
1813 1888
    public void setFieldValue(String myValue)
1814 1889
    {
1815 1890
      fieldValue = myValue;
1816 1891
    }
1817
    
1892

  
1818 1893
    public String getFieldValue()
1819 1894
    {
1820 1895
      return fieldValue;
1821 1896
    }
1822
    
1897

  
1823 1898
    public void setXMLFieldValue(String xml)
1824 1899
    {
1825 1900
      xmlFieldValue = xml;
1826 1901
    }
1827
    
1902

  
1828 1903
    public String getXMLFieldValue()
1829 1904
    {
1830 1905
      return xmlFieldValue;
1831 1906
    }
1832
    
1833
   
1907

  
1908

  
1834 1909
  }
1835
   
1910

  
1836 1911
}

Also available in: Unified diff