-
Notifications
You must be signed in to change notification settings - Fork 4
Remove TylerEnv from CodeDatabase #408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,9 @@ | ||
| package edu.suffolk.litlab.efsp.ecfcodes; | ||
|
|
||
| import edu.suffolk.litlab.efsp.Jurisdiction; | ||
| import edu.suffolk.litlab.efsp.db.Database; | ||
| import edu.suffolk.litlab.efsp.stdlib.SQLFunction; | ||
| import edu.suffolk.litlab.efsp.stdlib.SQLGetter; | ||
| import edu.suffolk.litlab.efsp.tyler.TylerDomain; | ||
| import java.io.InputStream; | ||
| import java.sql.Connection; | ||
| import java.sql.PreparedStatement; | ||
|
|
@@ -33,11 +33,8 @@ public CodeDatabaseAPI(Connection conn) { | |
| super(conn); | ||
| } | ||
|
|
||
| /** | ||
| * The domain (the juristiction + environment, e.g. illinois-stage) that this database is working | ||
| * over. | ||
| */ | ||
| public abstract TylerDomain getDomain(); | ||
| /** The jurisdiction (e.g illinois) that this database is working over */ | ||
| public abstract Jurisdiction getDomain(); | ||
|
Comment on lines
+36
to
+37
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should rename this |
||
|
|
||
| /** | ||
| * Gets all court location identifiers (CLI) stored in the database. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -180,7 +180,7 @@ public void preSetup() { | |
| SoapX509CallbackHandler.setX509Password(x509Password); | ||
|
|
||
| log.info("Checking table if absent"); | ||
| try (CodeDatabase cd = new CodeDatabase(tylerDomain, codeDs.getConnection())) { | ||
| try (CodeDatabase cd = new CodeDatabase(tylerDomain.jurisdiction(), codeDs.getConnection())) { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might be slightly more than the original issue, but it looks like TylerEnv isn't really used anymore in this class (is included in the logs and the |
||
| cd.createTablesIfAbsent(); | ||
| List<String> locations = cd.getAllLocations(); | ||
| log.info("All locations for {}: {}", tylerDomain, locations); | ||
|
|
@@ -263,7 +263,7 @@ public Jurisdiction getJurisdiction() { | |
| } | ||
|
|
||
| public Set<String> getCourts() { | ||
| try (CodeDatabase cd = new CodeDatabase(tylerDomain, codeDs.getConnection())) { | ||
| try (CodeDatabase cd = new CodeDatabase(tylerDomain.jurisdiction(), codeDs.getConnection())) { | ||
| Set<String> allCourts = new HashSet<String>(cd.getAllLocations()); | ||
| // 0 and 1 are special "system" courts that have defaults for all courts. | ||
| // They aren't available for filing | ||
|
|
@@ -286,7 +286,7 @@ public JurisdictionServiceHandle getServiceHandle() { | |
|
|
||
| Supplier<CodeDatabase> cdSupplier = | ||
| () -> { | ||
| return CodeDatabase.fromDS(tylerDomain, this.codeDs); | ||
| return CodeDatabase.fromDS(tylerDomain.jurisdiction(), this.codeDs); | ||
| }; | ||
|
|
||
| PolicyCacher policyCacher = new PolicyCacher(); | ||
|
|
@@ -358,7 +358,7 @@ public Optional<EfmRestCallbackInterface> getCallback() { | |
|
|
||
| @Override | ||
| public void setupGlobals() { | ||
| Supplier<CodeDatabase> makeCD = () -> CodeDatabase.fromDS(tylerDomain, codeDs); | ||
| Supplier<CodeDatabase> makeCD = () -> CodeDatabase.fromDS(tylerDomain.jurisdiction(), codeDs); | ||
| Supplier<UserDatabase> makeUD = () -> UserDatabase.fromDS(userDs); | ||
| OasisEcfWsCallback implementor = new OasisEcfWsCallback(makeCD, makeUD, sender); | ||
| String baseLocalUrl = ServiceHelpers.BASE_LOCAL_URL; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,13 @@ | ||
| package edu.suffolk.litlab.efsp.tyler.ecfcodes; | ||
|
|
||
| import edu.suffolk.litlab.efsp.Jurisdiction; | ||
| import edu.suffolk.litlab.efsp.ecfcodes.CodeAndLocation; | ||
| import edu.suffolk.litlab.efsp.ecfcodes.CodeDatabaseAPI; | ||
| import edu.suffolk.litlab.efsp.ecfcodes.CodeDatabaseUtils; | ||
| import edu.suffolk.litlab.efsp.ecfcodes.CodeDatabaseUtils.UnsupportedTableException; | ||
| import edu.suffolk.litlab.efsp.ecfcodes.CodeDocException; | ||
| import edu.suffolk.litlab.efsp.ecfcodes.CodeDocIterator; | ||
| import edu.suffolk.litlab.efsp.ecfcodes.NameAndCode; | ||
| import edu.suffolk.litlab.efsp.tyler.TylerDomain; | ||
| import java.io.InputStream; | ||
| import java.sql.Connection; | ||
| import java.sql.PreparedStatement; | ||
|
|
@@ -39,19 +39,16 @@ | |
| public class CodeDatabase extends CodeDatabaseAPI { | ||
| private static final Logger log = LoggerFactory.getLogger(CodeDatabase.class); | ||
|
|
||
| /** The tyler jurisdiction + tyler environment, i.e. illinois-stage. */ | ||
| private final TylerDomain tylerDomain; | ||
| private final Jurisdiction jurisdiction; | ||
|
|
||
| // TODO(brycew): the database doesn't need the env. Should be implicit, but it's gonna be a lot to | ||
| // take out. | ||
| public CodeDatabase(TylerDomain domain, Connection conn) { | ||
| public CodeDatabase(Jurisdiction jurisdiction, Connection conn) { | ||
| super(conn); | ||
| this.tylerDomain = domain; | ||
| this.jurisdiction = jurisdiction; | ||
| } | ||
|
|
||
| public static CodeDatabase fromDS(TylerDomain domain, DataSource ds) { | ||
| public static CodeDatabase fromDS(Jurisdiction jurisdiction, DataSource ds) { | ||
| try { | ||
| CodeDatabase cd = new CodeDatabase(domain, ds.getConnection()); | ||
| CodeDatabase cd = new CodeDatabase(jurisdiction, ds.getConnection()); | ||
| return cd; | ||
| } catch (SQLException e) { | ||
| log.error("In CodeDatabase constructor, can't get connection: ", e); | ||
|
|
@@ -83,12 +80,12 @@ public void createTablesIfAbsent() throws SQLException { | |
| } | ||
|
|
||
| @Override | ||
| public TylerDomain getDomain() { | ||
| return tylerDomain; | ||
| public Jurisdiction getDomain() { | ||
| return jurisdiction; | ||
| } | ||
|
|
||
| private String domainStr() { | ||
| return tylerDomain.getName(); | ||
| return jurisdiction.getName(); | ||
| } | ||
|
Comment on lines
87
to
89
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should rename this to |
||
|
|
||
| public void createTableIfAbsent(String tableName) throws SQLException { | ||
|
|
@@ -714,7 +711,7 @@ public void vacuumAll() { | |
| vacuumSt.executeUpdate(); | ||
| } | ||
| } catch (SQLException ex) { | ||
| log.error("Error when vacuuming in {}", this.tylerDomain, ex); | ||
| log.error("Error when vacuuming in {}", this.jurisdiction, ex); | ||
| } | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, I think it also makes sense to rename the
domaincolumn tojurisdictionafter the regex as well.