Class Query

java.lang.Object
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

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The queryType parameter for the findDups method: return all results.
    static final int
    The queryType parameter for the findDups method: only return results not from the collection collKey.
    static final int
    The queryType parameter for the findDups method: only return results from the collection collKey.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Query(int bugs, String dbUrl)
    Constructor: Makes the connection to the database.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Closes the database connection.
    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).
    Returns the collection name associated with a collection key, or null if none found.
    Returns the directory containing the XML records of the given collection key, or null if none found.
    getMmdRec(String collKey, String id)
    Returns the MmdRec specified, or null if none found.
    static void
     
    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 Details

    • QUERY_SAME

      public static final int QUERY_SAME
      The queryType parameter for the findDups method: only return results from the collection collKey.
      See Also:
    • 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:
    • QUERY_BOTH

      public static final int QUERY_BOTH
      The queryType parameter for the findDups method: return all results.
      See Also:
  • Constructor Details

    • 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 Details

    • 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:
      collKey - DESCRIPTION
      id - The id of the record
      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
      invalid reference
      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