DLESE Tools
v1.2

org.dlese.dpc.services.mmd
Class Query

java.lang.Object
  extended byorg.dlese.dpc.services.mmd.Query

public class Query
extends Object

Provides access to the meta-metadata database.

Sample test program:

 ###
 


Constructor Summary
Query(int bugs, String dbUrl)
          Constructor: Makes the connection to the database.
 
Method Summary
 void closeDb()
          Closes the database connection.
 MmdRecord[] findAssociationChanges(Date specdateparm, boolean assocFlag)
          Returns an array of ids that have changed either meta-metadata or associations (duplicates) since the specified date.
 MmdRecord[] findDuplicates(String collKey, String id)
          Returns an array of MmdRecord 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.
 MmdRecord getMmdRecord(int changeType, String collKey, String id)
          Returns the MmdRecord specified, or null if none found.
 MmdRecord getMmdRecord(String collKey, String id)
          Returns the MmdRecord specified, or null if none found.
 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
 

Constructor Detail

Query

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

Method Detail

closeDb

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

Throws:
MmdException

getCollectionName

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

Throws:
MmdException

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.

Throws:
MmdException

getMmdRecord

public MmdRecord getMmdRecord(int changeType,
                              String collKey,
                              String id)
                       throws MmdException
Returns the MmdRecord specified, or null if none found.

Parameters:
changeType - The changeType to be set; one of the CHANGE_ values specified in MmdRecord.
collKey - The collection key.
id - The id of the record
Throws:
MmdException

getMmdRecord

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

Parameters:
id - The id of the record
Throws:
MmdException

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
Throws:
MmdException

findAssociationChanges

public MmdRecord[] findAssociationChanges(Date specdateparm,
                                          boolean assocFlag)
                                   throws MmdException
Returns an array of ids that have changed either meta-metadata or associations (duplicates) since the specified date.

Such ids may or may not have changed their meta-metadata content. For example, if id A used to appear identical to id B, but recently changed content so it now appears identical to id C, all three A, B, and C will be returned. This method is conservative: it also may return a few ids that have not changed associations.

Parameters:
specdateparm - The specified date
assocFlag - If false we return only the mmd records that have changed in the DB; if true we return those plus any whose associations may have changed.
Throws:
MmdException

findDuplicates

public MmdRecord[] findDuplicates(String collKey,
                                  String id)
                           throws MmdException
Returns an array of MmdRecord representing ids in other collections that appear identical to the specified (collKey, id).

Parameters:
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

DLESE Tools
v1.2