Class FHIRDbDAOImpl

  • All Implemented Interfaces:
    FHIRDbDAO
    Direct Known Subclasses:
    ParameterDAOImpl, ResourceDAOImpl

    public class FHIRDbDAOImpl
    extends java.lang.Object
    implements FHIRDbDAO
    This class is a root Data Access Object for managing JDBC access to the FHIR database. As of 4.3.0, connection handling is factored out of the DAO and is instead the responsibility of the FHIRPersistenceJDBCImpl. Each DAO therefore requires a connection to be passed to it. This is good for separation of concerns, because the DAO code shouldn't care where the connection comes from. As each DAO is stateless, and lightweight, they can be created on-the-fly and handed a connection in the constructor. This pattern avoids polluting every method call with a connection parameter.
    • Constructor Summary

      Constructors 
      Constructor Description
      FHIRDbDAOImpl​(java.sql.Connection connection, java.lang.String schemaName, FHIRDbFlavor flavor)
      Constructs a DAO instance suitable for acquiring DB connections via JNDI from the app server.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected FHIRPersistenceDataAccessException buildExceptionWithIssue​(java.lang.String msg, IssueType issueType)  
      protected FHIRPersistenceDBConnectException buildFHIRPersistenceDBConnectException​(java.lang.String msg, IssueType issueType)  
      protected void cleanup​(java.sql.PreparedStatement stmt)
      Closes the passed PreparedStatement.
      protected void cleanup​(java.sql.ResultSet resultSet, java.sql.PreparedStatement stmt)
      Closes the passed ResultSet, PreparedStatement.
      protected Resource createDTO​(java.sql.ResultSet resultSet, boolean hasResourceTypeId)
      A method for creating a Data Transfer Object of type T from the contents of the passed ResultSet.
      protected java.util.List<Resource> createDTOs​(java.sql.ResultSet resultSet)
      An method for creating a collection of Data Transfer Objects of type T from the contents of the passed ResultSet.
      java.sql.Connection getConnection()
      Getter for the connection being used by this DAO.
      FHIRDbFlavor getFlavor()
      Get the database flavor, which describes the database type and its capabilities (e.g.
      java.lang.String getSchemaName()
      Getter for the schema name we've been configured for
      protected IDatabaseTranslator getTranslator()
      Get the translator appropriate for the flavor of database we are using
      protected int runCountQuery​(java.lang.String sql, java.lang.Object... searchArgs)
      Creates and executes a PreparedStatement for the passed sql containing a 'SELECT COUNT...'.
      protected int runCountQuery​(Select countQuery)
      Creates and executes a PreparedStatement for the passed sql containing a 'SELECT COUNT...'.
      protected java.util.List<Resource> runQuery​(java.lang.String sql, java.lang.Object... searchArgs)
      Creates and executes a PreparedStatement using the passed parameters that returns a collection of FHIR Data Transfer Objects of type T.
      protected java.util.List<Resource> runQuery​(Select select)
      Retrieve the FHIR objects by executing the given Select statement
      protected java.util.List<java.lang.String> runQuery_STR_VALUES​(java.lang.String sql, java.lang.Object... searchArgs)
      Creates and executes a PreparedStatement using the passed parameters that returns a collection of String values.
      protected <XT extends FHIRPersistenceException>
      XT
      severe​(java.util.logging.Logger logger, XT fx, java.lang.String errorMessage, java.lang.Throwable cause)
      Log the exception message here along with the cause stack.
      protected <XT extends FHIRPersistenceException>
      XT
      severe​(java.util.logging.Logger logger, XT fx, java.lang.Throwable cause)
      Convenience function to log the cause of an exception about to be thrown.
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FHIRDbDAOImpl

        public FHIRDbDAOImpl​(java.sql.Connection connection,
                             java.lang.String schemaName,
                             FHIRDbFlavor flavor)
        Constructs a DAO instance suitable for acquiring DB connections via JNDI from the app server.