|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.ucsb.nceas.metacat.DBUtil
public class DBUtil
A suite of utility classes for querying DB
| Field Summary | |
|---|---|
static int |
NONEEXIST
|
| Constructor Summary | |
|---|---|
DBUtil()
Construct an instance of the utility class |
|
| Method Summary | |
|---|---|
static java.lang.String |
findDataSetDocIdForGivenDocument(java.lang.String givenDocId)
To a given docid, found a dataset docid which contains the the given docid This will be done by searching xml_relation table If couldn't find, null will be return |
java.util.Vector<java.lang.String> |
getAllDocids(java.lang.String scope)
get the latest Accession Number from a particular scope |
java.util.Vector<java.lang.String> |
getAllDocidsByType(java.lang.String doctype,
boolean includeRevs)
return all docids with a given doctype |
java.lang.String |
getCurrentRevisionAndDocTypeForGivenDocument(java.lang.String givenDocId)
Method to get current revision and doctype for a given docid The output will look like "rev;doctype" |
static int |
getLatestRevisionInDocumentTable(java.lang.String docIdWithoutRev)
Get last revision number from database for a docid If couldn't find an entry, -1 will return The return value is integer because we want compare it to there new one |
java.lang.String |
getMaxDocid(java.lang.String scope)
get the latest Accession Number from a particular scope |
static int |
getMaxRevFromRevisionTable(java.lang.String docIdWithoutRev)
Method to return max rev number in xml_revision for given docid. |
static java.util.Vector<java.lang.Integer> |
getRevListFromRevisionTable(java.lang.String docIdWithoutRev)
Method to return a rev list in xml_revision for given docid. |
boolean |
idExists(java.lang.String docid)
return true if the given docid is registered in either the xml_documents or xml_revisions table |
static void |
main(java.lang.String[] args)
main routine used for testing. |
java.lang.String |
readDoctypes()
read all doctypes from db connection in XML format select all Public Id from xml_catalog table |
java.lang.String |
readDTDSchema(java.lang.String doctype)
read DTD or Schema file from Metacat's XML catalog system |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int NONEEXIST
| Constructor Detail |
|---|
public DBUtil()
| Method Detail |
|---|
public static void main(java.lang.String[] args)
Usage: java DBUtil <-dt|-dg>
-dt - for selecting all doctypes
-dg for selecting DataGuide
public java.lang.String readDoctypes()
throws java.sql.SQLException
java.sql.SQLException
public java.lang.String readDTDSchema(java.lang.String doctype)
throws java.sql.SQLException,
java.net.MalformedURLException,
java.io.IOException,
edu.ucsb.nceas.utilities.PropertyNotFoundException
java.sql.SQLException
java.net.MalformedURLException
java.io.IOException
edu.ucsb.nceas.utilities.PropertyNotFoundException
public java.lang.String getMaxDocid(java.lang.String scope)
throws java.sql.SQLException
java.sql.SQLException
public boolean idExists(java.lang.String docid)
throws java.sql.SQLException
java.sql.SQLException
public java.util.Vector<java.lang.String> getAllDocidsByType(java.lang.String doctype,
boolean includeRevs)
throws java.sql.SQLException
java.sql.SQLException
public java.util.Vector<java.lang.String> getAllDocids(java.lang.String scope)
throws java.sql.SQLException
java.sql.SQLExceptionpublic static java.lang.String findDataSetDocIdForGivenDocument(java.lang.String givenDocId)
givenDocId, - the docid which we want to find
public java.lang.String getCurrentRevisionAndDocTypeForGivenDocument(java.lang.String givenDocId)
throws java.sql.SQLException
givenDocId, - the docid which we want
java.sql.SQLException
public static int getMaxRevFromRevisionTable(java.lang.String docIdWithoutRev)
throws java.sql.SQLException
docId -
java.sql.SQLException
public static java.util.Vector<java.lang.Integer> getRevListFromRevisionTable(java.lang.String docIdWithoutRev)
throws java.sql.SQLException
docId -
java.sql.SQLException
public static int getLatestRevisionInDocumentTable(java.lang.String docIdWithoutRev)
throws java.sql.SQLException
docid - java.sql.SQLException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||