Revision 1833
Added by Jing Tao about 21 years ago
src/edu/ucsb/nceas/metacat/QuerySpecification.java | ||
---|---|---|
143 | 143 |
} |
144 | 144 |
|
145 | 145 |
/** |
146 |
* construct an instance of the QuerySpecification class which don't need |
|
147 |
* to parser a xml document |
|
148 |
* @param accNumberSeparator the separator between doc version |
|
149 |
*/ |
|
150 |
public QuerySpecification(String accNumberSeparator ) throws IOException |
|
151 |
{ |
|
152 |
// Initialize the class variables |
|
153 |
returnDocList = new Vector(); |
|
154 |
filterDocList = new Vector(); |
|
155 |
elementStack = new Stack(); |
|
156 |
queryStack = new Stack(); |
|
157 |
returnFieldList = new Vector(); |
|
158 |
ownerList = new Vector(); |
|
159 |
siteList = new Vector(); |
|
160 |
this.accNumberSeparator = accNumberSeparator; |
|
161 |
} |
|
162 |
|
|
163 |
|
|
164 |
/** |
|
146 | 165 |
* Method to set user name |
147 | 166 |
* |
148 | 167 |
* @param myName the user name |
... | ... | |
491 | 510 |
{ |
492 | 511 |
query = group; |
493 | 512 |
} |
494 |
|
|
513 |
|
|
495 | 514 |
/** |
515 |
* set if this query sepcification has extendQuery(has return doc type or not) |
|
516 |
*/ |
|
517 |
public void setContainsExtenedSQL(boolean hasExtenedQuery) |
|
518 |
{ |
|
519 |
containsExtendedSQL = hasExtenedQuery; |
|
520 |
} |
|
521 |
|
|
522 |
/** |
|
496 | 523 |
* Set up the SAX parser for reading the XML serialized query |
497 | 524 |
*/ |
498 | 525 |
private XMLReader initializeParser() { |
... | ... | |
601 | 628 |
} else if (currentTag.equals("filterdoctype")) { |
602 | 629 |
filterDocList.add(inputString); |
603 | 630 |
} else if (currentTag.equals("returnfield")) { |
604 |
// make sure if return fields has an attribute or not |
|
631 |
handleReturnField(inputString); |
|
632 |
} else if (currentTag.equals("filterdoctype")) { |
|
633 |
filterDocList.add(inputString); |
|
634 |
} else if (currentTag.equals("owner")) { |
|
635 |
ownerList.add(inputString); |
|
636 |
} else if (currentTag.equals("site")) { |
|
637 |
siteList.add(inputString); |
|
638 |
} |
|
639 |
} |
|
640 |
|
|
641 |
/** |
|
642 |
* Method to transfer string to return field |
|
643 |
*/ |
|
644 |
public void handleReturnField(String inputString) |
|
645 |
{ |
|
646 |
// make sure if return fields has an attribute or not |
|
605 | 647 |
if (inputString.indexOf(ATTRIBUTESYMBOL) ==-1) |
606 | 648 |
{ |
607 | 649 |
// no attribute value will be returned |
... | ... | |
628 | 670 |
containsExtendedSQL = true; |
629 | 671 |
|
630 | 672 |
} |
631 |
} else if (currentTag.equals("filterdoctype")) { |
|
632 |
filterDocList.add(inputString); |
|
633 |
} else if (currentTag.equals("owner")) { |
|
634 |
ownerList.add(inputString); |
|
635 |
} else if (currentTag.equals("site")) { |
|
636 |
siteList.add(inputString); |
|
637 |
} |
|
638 | 673 |
} |
639 |
|
|
640 | 674 |
/** |
641 | 675 |
* create a SQL serialization of the query that this instance represents |
642 | 676 |
*/ |
Also available in: Unified diff
Revise code so it can be called directly.