DLESE Tools
v1.6.0

org.dlese.dpc.services.mmd
Class Query

java.lang.Object
  extended by org.dlese.dpc.services.mmd.Query

public class Query
extends Object

Provides access to the meta-metadata database.

Sample test program:

 ###
 

Author:
Sonal Bhushan

Field Summary
static int QUERY_BOTH
          The queryType parameter for the findDups method: return all results.
static int QUERY_OTHER
          The queryType parameter for the findDups method: only return results not from the collection collKey.
static int QUERY_SAME
          The queryType parameter for the findDups method: only return results from the collection collKey.
 
Constructor Summary
Query(int bugs, String dbUrl)
          Constructor: Makes the connection to the database.
 
Method Summary
 void closeDb()
          Closes the database connection.
 MmdRec[] findDups(int queryType, String collKey, String id, String exc)
          Returns an array of MmdRec representing ids in other collections that appear identical to the specified (collKey, id).
 String getCollectionName(String collKey)
          Returns the collection name associated with a collection key, or null if none found.
 String getDirectory(String collKey)
          Returns the directory containing the XML records of the given collection key, or null if none found.
 MmdRec getMmdRec(String collKey, String id)
          Returns the MmdRec specified, or null if none found.
static void reloadIdExclusionDocument()
           
 void setStatus(String collKey, String id, String newStatus)
          Updates the status of a single record.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

QUERY_SAME

public static final int QUERY_SAME
The queryType parameter for the findDups method: only return results from the collection collKey.

See Also:
Constant Field Values

QUERY_OTHER

public static final int QUERY_OTHER
The queryType parameter for the findDups method: only return results not from the collection collKey.

See Also:
Constant Field Values

QUERY_BOTH

public static final int QUERY_BOTH
The queryType parameter for the findDups method: return all results.

See Also:
Constant Field Values
Constructor Detail

Query

public Query(int bugs,
             String dbUrl)
      throws MmdException
Constructor: Makes the connection to the database.

Parameters:
bugs - DESCRIPTION
dbUrl - DESCRIPTION
Throws:
MmdException - DESCRIPTION
Method Detail

closeDb

public void closeDb()
             throws MmdException
Closes the database connection. After close, this Query object is useless.

Throws:
MmdException - DESCRIPTION

getCollectionName

public String getCollectionName(String collKey)
                         throws MmdException
Returns the collection name associated with a collection key, or null if none found.

Parameters:
collKey - DESCRIPTION
Returns:
The collectionName value
Throws:
MmdException - DESCRIPTION

getDirectory

public String getDirectory(String collKey)
                    throws MmdException
Returns the directory containing the XML records of the given collection key, or null if none found.

Parameters:
collKey - DESCRIPTION
Returns:
The directory value
Throws:
MmdException - DESCRIPTION

getMmdRec

public MmdRec getMmdRec(String collKey,
                        String id)
                 throws MmdException
Returns the MmdRec specified, or null if none found.

Parameters:
id - The id of the record
collKey - DESCRIPTION
Returns:
The mmdRec value
Throws:
MmdException - DESCRIPTION

setStatus

public void setStatus(String collKey,
                      String id,
                      String newStatus)
               throws MmdException
Updates the status of a single record. The new status must be one of the legal values defined in MmdRecord.

Parameters:
collKey - The collection key.
id - The id of the record
newStatus - The new status value
Throws:
MmdException - DESCRIPTION

reloadIdExclusionDocument

public static void reloadIdExclusionDocument()

findDups

public MmdRec[] findDups(int queryType,
                         String collKey,
                         String id,
                         String exc)
                  throws MmdException
Returns an array of MmdRec representing ids in other collections that appear identical to the specified (collKey, id).

Parameters:
queryType - One of:
  • QUERY_SAME: only return results from collection collKey
  • QUERY_OTHER: only return results not from collection collKey
  • QUERY_BOTH: return all results.
collKey - The collection key.
id - The id to search for
Returns:
An array of MmdRecod, each of which represents a resource from a different collection having possibly identical content.
Throws:
MmdException - DESCRIPTION

DLESE Tools
v1.6.0