Class IcatBase

java.lang.Object
gda.data.metadata.icat.IcatBase
All Implemented Interfaces:
Icat
Direct Known Subclasses:
DlsIcatBase, NullIcat, XMLIcat

public abstract class IcatBase extends Object implements Icat
Provides base functionality for classes implementing the Icat interface.
  • Field Details

    • visitID

      protected String visitID
    • operatingDate

      protected Date operatingDate
    • metadata

      protected Metadata metadata
    • instrumentName

      protected String instrumentName
    • username

      protected String username
  • Constructor Details

    • IcatBase

      public IcatBase()
  • Method Details

    • icatInUse

      public boolean icatInUse()
      Has an ICAT been defined for use? Based solely on the java property @see Icat.ICAT_TYPE_PROP
      Specified by:
      icatInUse in interface Icat
      Returns:
      true if the Icat database can be connected to.
    • setMyVisit

      public void setMyVisit(String choiceOfVisit)
      Description copied from interface: Icat
      Sets the visit under which this user shall collect data.
      Specified by:
      setMyVisit in interface Icat
      Parameters:
      choiceOfVisit -
    • getMyValidVisits

      public VisitEntry[] getMyValidVisits(String username) throws Exception
      Description copied from interface: Icat
      Returns all the visit IDs for this user on this beamline at this point in time (tolerance in the IcatConnectionDetails).
      Specified by:
      getMyValidVisits in interface Icat
      Parameters:
      username -
      Returns:
      array of valid visit IDs
      Throws:
      Exception
    • getCurrentInformation

      public String getCurrentInformation(String accessName) throws Exception
      Description copied from interface: Icat
      Queries the database filtering using the current username and visit held in metadata.
      Specified by:
      getCurrentInformation in interface Icat
      Parameters:
      accessName -
      Returns:
      String or null if no information found
      Throws:
      Exception
    • getMyInformation

      public String getMyInformation(String accessName) throws Exception
      Description copied from interface: Icat
      Queries the database filtering using the stored username, beamline and visit.
      Specified by:
      getMyInformation in interface Icat
      Parameters:
      accessName -
      Returns:
      String or null if no information found
      Throws:
      Exception
    • getMyInformation

      public String getMyInformation(String accessName, String username, String visitID) throws Exception
      Description copied from interface: Icat
      Queries the database filtering using the given username, beamline and visit.
      Specified by:
      getMyInformation in interface Icat
      Parameters:
      accessName -
      username -
      visitID -
      Returns:
      String or null if no information found
      Throws:
      Exception
    • setOperatingDate

      public void setOperatingDate(Date date)
      Description copied from interface: Icat
      Inject the current time for testing. This will be used when filtering for valid visits on the given beamline.

      Set to null for the current date to be used.

      Specified by:
      setOperatingDate in interface Icat
      Parameters:
      date -
    • getVisitDataByPrefix

      public List<VisitData> getVisitDataByPrefix(String visitPrefix) throws Exception
      Description copied from interface: Icat
      Get VisitData for visits beginning with the specified prefix
      Specified by:
      getVisitDataByPrefix in interface Icat
      Parameters:
      visitPrefix - the prefix to search for. This can be a complete visit name
      Throws:
      Exception
    • setMetadata

      public void setMetadata(Metadata metadata)
      Inject the metadata object for testing. If not defined this gets the Metadata object from GDAMetadataProvider.
      Parameters:
      metadata -
    • getVisitIDAccessName

      protected abstract String getVisitIDAccessName()
      Returns the access name which is used to find the visit ID
    • getExperimentTitleAccessName

      protected abstract String getExperimentTitleAccessName()
      Returns the access name which is used to find the experiment title
    • getValue

      protected abstract String getValue(String visitIDFilter, String userNameFilter, String accessName) throws Exception
      Returns the SQL result for the given accessName string filtered by beamline, username and (optionally) visitID.
      Parameters:
      visitIDFilter -
      userNameFilter -
      accessName -
      Returns:
      String
      Throws:
      Exception
    • getMetadata

      protected Metadata getMetadata()
    • setInstrumentName

      public void setInstrumentName(String instrumentName)
      Inject the beamline (instrument) name for testing. If not defined this looks for the name in first metadata and then in java properties.
      Parameters:
      instrumentName -
    • getInstrumentName

      protected String getInstrumentName()