Class CodeDatabaseAPI

java.lang.Object
edu.suffolk.litlab.efsp.db.Database
edu.suffolk.litlab.efsp.ecfcodes.CodeDatabaseAPI
All Implemented Interfaces:
AutoCloseable
Direct Known Subclasses:
CodeDatabase

public abstract class CodeDatabaseAPI extends Database
ECF says that certain parts of the information model of the data that we exchange with the EFM is contained in Genericode code lists. The EfileProxyServer saves those Genericode code lists in a SQL database, for immediate use.

This class is the exposed interface between the SQL databases that store genericode info and the rest of the proxy server, particularly { CodeUpdater }. It should be instanianted once per jurisiction.

  • Constructor Details

    • CodeDatabaseAPI

      public CodeDatabaseAPI(Connection conn)
  • Method Details

    • getDomain

      public abstract TylerDomain getDomain()
      The domain (the juristiction + environment, e.g. illinois-stage) that this database is working over.
    • getAllLocations

      public abstract List<String> getAllLocations()
      Gets all court location identifiers (CLI) stored in the database.
      Returns:
      a list of all valid CLIs for this jurisdiction
    • updateTable

      public abstract void updateTable(String tableName, String courtName, InputStream is) throws SQLException, CodeDocException
      Throws:
      SQLException
      CodeDocException
    • updateTable

      public abstract void updateTable(String tableName, String courtName, String newVersion, Iterator<Map<String,String>> rows) throws SQLException
      The iterator (rows) will be consumed by this function.
      Throws:
      SQLException
    • deleteFromTable

      public abstract boolean deleteFromTable(String tableName) throws SQLException
      Throws:
      SQLException
    • deleteFromTable

      public abstract boolean deleteFromTable(String tableName, String courtLocation) throws SQLException
      Deletes all entries in a domain from a table in the given table from courtLocation .
      Throws:
      SQLException
    • createTableIfAbsent

      public abstract void createTableIfAbsent(String tableName) throws SQLException
      Throws:
      SQLException
    • getVersionsToUpdate

      public abstract Map<String,List<String>> getVersionsToUpdate() throws SQLException
      Returns a map from court names to tables that needed to be updated for it.
      Throws:
      SQLException
    • vacuumAll

      public abstract void vacuumAll()
    • searchCaseCategory

      public abstract List<String> searchCaseCategory(String searchTerm)
      Gets all distinct case category names that have the search term in them.
      Parameters:
      searchTerm -
      Returns:
    • courtCoverageCaseCategory

      public abstract List<String> courtCoverageCaseCategory(String searchTerm)
    • retrieveCaseCategoryByName

      public abstract List<CodeAndLocation> retrieveCaseCategoryByName(String categoryName)
      Get the code and court locations of the case categories that match the given name exactly.
      Parameters:
      categoryName -
      Returns:
    • getCaseCategoryNames

      public abstract List<NameAndCode> getCaseCategoryNames(String courtLocationId)
    • searchCaseType

      public abstract List<String> searchCaseType(String searchTerm)
      Gets all distinct case type names that have the search term in them.
      Parameters:
      searchTerm -
      Returns:
    • courtCoverageCaseType

      public abstract List<String> courtCoverageCaseType(String searchTerm)
    • retrieveCaseTypeByName

      public abstract List<CodeAndLocation> retrieveCaseTypeByName(String caseTypeName)
      Get the code and court locations of the case types that match the given name exactly.
      Parameters:
      caseTypeName -
      Returns:
    • getCaseTypeNamesFor

      public abstract List<NameAndCode> getCaseTypeNamesFor(String courtLocationId, String caseCategoryCode, Optional<Boolean> initial)
    • genericSearch

      protected List<String> genericSearch(String searchTerm, SQLFunction<String,PreparedStatement> queryMaker)
      Runs all of the logic for search queries (both name searches and court coverage searches).
    • safetyWrap

      protected <T> List<T> safetyWrap(SQLGetter<List<T>> sup)
    • safetyWrapOpt

      protected <T> Optional<T> safetyWrapOpt(SQLGetter<Optional<T>> sup)