public class DBQuery
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
XPATHQUERYOFFINFO |
Constructor and Description |
---|
DBQuery()
construct an instance of the DBQuery class
|
DBQuery(java.util.Vector docids)
Construct an instance of DBQuery Class
BUT accept a docid Vector that will supersede
the query.printSQL() method
If a docid Vector is passed in,
the docids will be used to create a simple IN query
without the multiple subselects of the printSQL() method
Using this constructor, we just check for
a docidOverride Vector in the findResultDoclist() method
|
Modifier and Type | Method and Description |
---|---|
static void |
clearQueryResultCache()
Method to clear the query result cache.
|
static java.lang.String |
createQuery(java.lang.String value)
format a simple free-text value query as an XML document that conforms
to the pathquery.dtd and is appropriate for submission to the DBQuery
structured query engine
|
static java.lang.String |
createQuery(java.lang.String value,
java.lang.String doctype)
format a simple free-text value query as an XML document that conforms
to the pathquery.dtd and is appropriate for submission to the DBQuery
structured query engine
|
java.lang.StringBuffer |
createResultDocument(java.lang.String xmlquery,
QuerySpecification qspec,
java.io.Writer out,
java.lang.String user,
java.lang.String[] groups,
boolean useXMLIndex)
Transforms a hashtable of documents to an xml or html result and sent
the content to outputstream.
|
java.lang.StringBuffer |
createResultDocument(java.lang.String xmlquery,
QuerySpecification qspec,
java.io.Writer out,
java.lang.String user,
java.lang.String[] groups,
boolean useXMLIndex,
int pagesize,
int pagestart,
java.lang.String sessionid,
java.lang.String qformat,
boolean includeGuid) |
static java.lang.String |
createSQuery(java.util.Hashtable params)
format a structured query as an XML document that conforms to the
pathquery.dtd and is appropriate for submission to the DBQuery
structured query engine
|
void |
findDocuments(javax.servlet.http.HttpServletResponse response,
java.io.Writer out,
java.util.Hashtable params,
java.lang.String user,
java.lang.String[] groups,
java.lang.String sessionid)
Method put the search result set into out printerwriter
|
java.lang.String |
getOperator() |
java.lang.String |
getQformat() |
java.util.zip.ZipOutputStream |
getZippedPackage(java.lang.String docIdString,
javax.servlet.ServletOutputStream out,
java.lang.String user,
java.lang.String[] groups,
java.lang.String passWord)
put a data packadge into a zip output stream
|
static void |
main(java.lang.String[] args)
the main routine used to test the DBQuery utility.
|
java.lang.String |
performPathquery(java.lang.String xmlquery,
java.lang.String user,
java.lang.String[] groups) |
void |
setOperator(java.lang.String operator)
Specifies if and how docid overrides should be included in the general query
|
static java.sql.PreparedStatement |
setPreparedStatementValues(java.util.List<java.lang.Object> parameterValues,
java.sql.PreparedStatement pstmt)
Set the parameter values in the prepared statement using instrospection
of the given value objects
|
void |
setQformat(java.lang.String qformat) |
public static final java.lang.String XPATHQUERYOFFINFO
public DBQuery() throws edu.ucsb.nceas.utilities.PropertyNotFoundException
Generally, one would call the findDocuments() routine after creating an instance to specify the search query
parserName
- the fully qualified name of a Java class implementing
the org.xml.sax.XMLReader interfaceedu.ucsb.nceas.utilities.PropertyNotFoundException
public DBQuery(java.util.Vector docids) throws edu.ucsb.nceas.utilities.PropertyNotFoundException
docids
- List of docids to display in the resultsetedu.ucsb.nceas.utilities.PropertyNotFoundException
public static void main(java.lang.String[] args)
Usage: java DBQuery
xmlfile
- the filename of the xml file containing the querypublic void findDocuments(javax.servlet.http.HttpServletResponse response, java.io.Writer out, java.util.Hashtable params, java.lang.String user, java.lang.String[] groups, java.lang.String sessionid) throws edu.ucsb.nceas.utilities.PropertyNotFoundException
resoponse
- the return responseout
- the output printerparams
- the paratermer hashtableuser
- the user name (it maybe different to the one in param)groups
- the group arraysessionid
- the sessionidorg.dataone.service.exceptions.NotImplemented
edu.ucsb.nceas.utilities.PropertyNotFoundException
public java.lang.StringBuffer createResultDocument(java.lang.String xmlquery, QuerySpecification qspec, java.io.Writer out, java.lang.String user, java.lang.String[] groups, boolean useXMLIndex)
xmlquery
- qspec
- out
- user
- groups
- useXMLIndex
- sessionid
- public java.lang.String performPathquery(java.lang.String xmlquery, java.lang.String user, java.lang.String[] groups) throws edu.ucsb.nceas.utilities.PropertyNotFoundException, java.io.IOException
xmlquery
- user
- groups
- useXMLIndex
- java.io.IOException
edu.ucsb.nceas.utilities.PropertyNotFoundException
public java.lang.StringBuffer createResultDocument(java.lang.String xmlquery, QuerySpecification qspec, java.io.Writer out, java.lang.String user, java.lang.String[] groups, boolean useXMLIndex, int pagesize, int pagestart, java.lang.String sessionid, java.lang.String qformat, boolean includeGuid)
public static void clearQueryResultCache()
public static java.sql.PreparedStatement setPreparedStatementValues(java.util.List<java.lang.Object> parameterValues, java.sql.PreparedStatement pstmt) throws java.sql.SQLException
parameterValues
- pstmt
- java.sql.SQLException
public static java.lang.String createSQuery(java.util.Hashtable params) throws edu.ucsb.nceas.utilities.PropertyNotFoundException
params
- The list of parameters that should be included in the
queryedu.ucsb.nceas.utilities.PropertyNotFoundException
public static java.lang.String createQuery(java.lang.String value, java.lang.String doctype)
value
- the text string to search for in the xml catalogdoctype
- the type of documents to include in the result set -- use
"any" or "ANY" for unfiltered result setspublic static java.lang.String createQuery(java.lang.String value)
value
- the text string to search for in the xml catalogpublic java.lang.String getOperator()
public void setOperator(java.lang.String operator)
operator
- null, UNION, or INTERSECT (see QueryGroup)public java.lang.String getQformat()
public void setQformat(java.lang.String qformat)
public java.util.zip.ZipOutputStream getZippedPackage(java.lang.String docIdString, javax.servlet.ServletOutputStream out, java.lang.String user, java.lang.String[] groups, java.lang.String passWord) throws java.lang.ClassNotFoundException, java.io.IOException, java.sql.SQLException, McdbException, java.lang.NumberFormatException, java.lang.Exception
docId,
- which the user want to put into zip output stream,it has versionout,
- a servletoutput stream which the zip output stream will be
putuser,
- the username of the usergroups,
- the group of the userjava.lang.ClassNotFoundException
java.io.IOException
java.sql.SQLException
McdbException
java.lang.NumberFormatException
java.lang.Exception
Copyright © 2020 Regents of the University of California. All Rights Reserved.