Revision 744
Added by Matt Jones over 23 years ago
src/edu/ucsb/nceas/metacat/DBQuery.java | ||
---|---|---|
555 | 555 |
StringBuffer query = new StringBuffer(); |
556 | 556 |
Enumeration elements; |
557 | 557 |
Enumeration keys; |
558 |
String doctype = null; |
|
559 | 558 |
String filterDoctype = null; |
560 | 559 |
String casesensitive = null; |
561 | 560 |
String searchmode = null; |
... | ... | |
574 | 573 |
|
575 | 574 |
if (params.containsKey("returndoctype")) |
576 | 575 |
{ |
577 |
doctype = ((String[])params.get("returndoctype"))[0]; |
|
576 |
String[] returnDoctypes = ((String[])params.get("returndoctype")); |
|
577 |
for(int i=0; i<returnDoctypes.length; i++) |
|
578 |
{ |
|
579 |
String doctype = (String)returnDoctypes[i]; |
|
580 |
|
|
581 |
if (!doctype.equals("any") && |
|
582 |
!doctype.equals("ANY") && |
|
583 |
!doctype.equals("") ) |
|
584 |
{ |
|
585 |
query.append("<returndoctype>").append(doctype); |
|
586 |
query.append("</returndoctype>"); |
|
587 |
} |
|
588 |
} |
|
578 | 589 |
} |
579 |
else |
|
580 |
{ |
|
581 |
doctype = "ANY"; |
|
582 |
} |
|
583 |
|
|
590 |
|
|
584 | 591 |
if (params.containsKey("filterdoctype")) |
585 | 592 |
{ |
586 | 593 |
String[] filterDoctypes = ((String[])params.get("filterdoctype")); |
... | ... | |
621 | 628 |
} |
622 | 629 |
} |
623 | 630 |
|
624 |
// back trace to doctype |
|
625 |
if (!doctype.equals("any") && |
|
626 |
!doctype.equals("ANY") && |
|
627 |
!doctype.equals("") ) |
|
628 |
{ |
|
629 |
query.append("<returndoctype>"); |
|
630 |
query.append(doctype).append("</returndoctype>"); |
|
631 |
} |
|
632 |
|
|
633 | 631 |
//allows the dynamic switching of boolean operators |
634 | 632 |
if (params.containsKey("operator")) |
635 | 633 |
{ |
src/edu/ucsb/nceas/metacat/MetaCatServlet.java | ||
---|---|---|
487 | 487 |
} |
488 | 488 |
|
489 | 489 |
Hashtable doclist = runQuery(xmlquery, user, group, returndoc); |
490 |
//String resultdoc = createResultDocument(doclist, transformQuery(xmlquery)); |
|
491 | 490 |
|
492 | 491 |
resultdoc = createResultDocument(doclist, transformQuery(xmlquery)); |
493 | 492 |
|
... | ... | |
632 | 631 |
|
633 | 632 |
/** |
634 | 633 |
* Transforms a hashtable of documents to an xml or html result. |
635 |
* If there is a returndoc, then it only displays documents of |
|
636 |
* whatever type returndoc represents. If a result is found in a document |
|
637 |
* that is not of type returndoc then this attempts to find a relation |
|
638 |
* between this document and one that satifies the returndoc doctype. |
|
639 | 634 |
* |
640 | 635 |
* @param doclist- the hashtable to transform |
641 |
* @param xmlquery- the query that returned the dolist result |
|
642 |
* @param resultdoc- the document type to backtrack to. |
|
636 |
* @param xmlquery- the query that returned the doclist result |
|
643 | 637 |
*/ |
644 | 638 |
protected String createResultDocument(Hashtable doclist, String xmlquery) |
645 | 639 |
{ |
... | ... | |
666 | 660 |
} |
667 | 661 |
|
668 | 662 |
resultset.append("</resultset>"); |
669 |
//System.out.println(resultset.toString()); |
|
670 | 663 |
return resultset.toString(); |
671 | 664 |
} |
672 | 665 |
// END OF SQUERY & QUERY SECTION |
Also available in: Unified diff
Added ability to process multiple "returndoc" elements in
a pathquery document. Now, any query hit will be back traced to an
associated package if that package is listed in one of the
"returndoctype" elements.