public class DBUtil
extends java.lang.Object
| Modifier and Type | Field and Description | 
|---|---|
static int | 
NONEEXIST  | 
| Constructor and Description | 
|---|
DBUtil()
Construct an instance of the utility class 
 | 
| Modifier and Type | Method and Description | 
|---|---|
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 
 | 
static java.util.Vector<java.lang.String> | 
getAllDocids(java.lang.String scope)
get the latest Accession Number from a particular scope 
 | 
static java.util.Vector<java.lang.String> | 
getAllDocidsByType(java.lang.String doctype,
                  boolean includeRevs)
return all docids with a given doctype on all servers 
 | 
static java.util.Vector<java.lang.String> | 
getAllDocidsByType(java.lang.String doctype,
                  boolean includeRevs,
                  int serverLocation)
return all docids with a given doctype for a given server 
 | 
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 
 | 
public static final int NONEEXIST
public static void main(java.lang.String[] args)
Usage: java DBUtil <-dt|-dg>
-dt - for selecting all doctypes
        -dg for selecting DataGuidepublic java.lang.String readDoctypes()
                              throws java.sql.SQLException
java.sql.SQLExceptionpublic 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.SQLExceptionjava.net.MalformedURLExceptionjava.io.IOExceptionedu.ucsb.nceas.utilities.PropertyNotFoundExceptionpublic java.lang.String getMaxDocid(java.lang.String scope)
                             throws java.sql.SQLException
java.sql.SQLExceptionpublic boolean idExists(java.lang.String docid)
                 throws java.sql.SQLException
java.sql.SQLExceptionpublic static java.util.Vector<java.lang.String> getAllDocidsByType(java.lang.String doctype,
                                                                    boolean includeRevs)
                                                             throws java.sql.SQLException
java.sql.SQLExceptionpublic static java.util.Vector<java.lang.String> getAllDocidsByType(java.lang.String doctype,
                                                                    boolean includeRevs,
                                                                    int serverLocation)
                                                             throws java.sql.SQLException
java.sql.SQLExceptionpublic static 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 findpublic java.lang.String getCurrentRevisionAndDocTypeForGivenDocument(java.lang.String givenDocId)
                                                              throws java.sql.SQLException
givenDocId, - the docid which we wantjava.sql.SQLExceptionpublic static int getMaxRevFromRevisionTable(java.lang.String docIdWithoutRev)
                                      throws java.sql.SQLException
docId - java.sql.SQLExceptionpublic static java.util.Vector<java.lang.Integer> getRevListFromRevisionTable(java.lang.String docIdWithoutRev)
                                                                       throws java.sql.SQLException
docId - java.sql.SQLExceptionpublic static int getLatestRevisionInDocumentTable(java.lang.String docIdWithoutRev)
                                            throws java.sql.SQLException
docid - java.sql.SQLExceptionCopyright © 2020 Regents of the University of California. All Rights Reserved.