Skip to content

Commit 56cc96e

Browse files
Slight refactor for new TrueFiling tables
The mapping from XML element to the table name should live in the Code Database, not the CodeUpdater.
1 parent 3644896 commit 56cc96e

4 files changed

Lines changed: 71 additions & 61 deletions

File tree

proxyserver/src/main/java/edu/suffolk/litlab/efsp/ecfcodes/CodeDatabaseAPI.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ public CodeDatabaseAPI(Connection conn) {
3636
/** The jurisdiction (e.g illinois) that this database is working over */
3737
public abstract Jurisdiction getJurisdiction();
3838

39+
/**
40+
* Maps the name of an ECF element to be substituted by a court-specific code list or extension.
41+
*/
42+
public abstract Map<String, String> xmlElemToTableName();
43+
3944
/**
4045
* Gets all court location identifiers (CLI) stored in the database.
4146
*

proxyserver/src/main/java/edu/suffolk/litlab/efsp/tyler/ecfcodes/CodeDatabase.java

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,66 @@ public CodeDatabase(Jurisdiction jurisdiction, Connection conn) {
4646
this.jurisdiction = jurisdiction;
4747
}
4848

49+
// TODO(brycew-later): there's little more info on these mappings and how they combine.
50+
// Is this actually an XPath? Should figure it out
51+
private static final Map<String, String> ecf4Map =
52+
Map.ofEntries(
53+
Map.entry("cext:BondTypeText", "bond"),
54+
Map.entry("cext:Charge/cext:ChargeStatute/j:StatuteLevelText", "degree"),
55+
Map.entry("cext:Charge\\cext:ChargePhaseText", "chargephase"),
56+
Map.entry("cext:GeneralOffenseText", "generaloffense"),
57+
Map.entry("cext:StatuteTypeText", "statutetype"),
58+
Map.entry(
59+
"cext:Charge/cext:ChargeStatute/j:StatuteCodeIdentification/nc:IdentificationID",
60+
"statute"),
61+
Map.entry("ecf:CaseParticipantRoleCode", "partytype"),
62+
Map.entry("ecf:FilingStatusCode", "filingstatus"),
63+
Map.entry("ecf:ServiceRecipientID/nc:IdentificationSourceText", "servicetype"),
64+
Map.entry(
65+
"ecf:PersonDriverLicense/nc:DriverLicenseIdentification/nc:IdentificationCategoryText",
66+
"driverlicensetype"),
67+
Map.entry("j:/ArrestCharge/j:ArrestLocation/nc:LocationName", "arrestlocation"),
68+
Map.entry("j:RegisterActionDescriptionText", "filing"),
69+
Map.entry(
70+
"j:ArrestOfficial/j:EnforcementOfficialUnit/nc:OrganizationIdentification/nc:IdentificationID",
71+
"lawenforcementunit"),
72+
Map.entry(
73+
"j:Citation\\nc:ActivityIdentification\\tyler:JurisdictionCode",
74+
"citationjurisdiction"),
75+
Map.entry("nc:CaseCategoryText", "casecategory"),
76+
Map.entry("nc:LocationCountryName", "country"),
77+
Map.entry("nc:BinaryFormatStandardName", "documenttype"),
78+
Map.entry("nc:BinaryCategoryText", "filingcomponent"),
79+
Map.entry("nc:LocationStateName", "state"),
80+
Map.entry("nc:PersonNameSuffixText", "namesuffix"),
81+
Map.entry("nc:BinaryLocationURI", "filetype"),
82+
Map.entry("nc:DocumentIdentification/nc:IdentificationSourceText", "crossreference"),
83+
Map.entry("nc:PrimaryLanguage\\nc:LanguageCode", "language"),
84+
Map.entry("nc:PersonPhysicalFeature\\nc:PhysicalFeatureCategoryCode", "physicalfeature"),
85+
Map.entry("nc:PersonHairColorCode", "haircolor"),
86+
Map.entry("nc:PersonEyeColorCode", "eyecolor"),
87+
Map.entry("nc:PersonEthnicityText", "ethnicity"),
88+
Map.entry("nc:PersonRaceText", "race"),
89+
Map.entry("nc:VehicleMakeCode", "vehiclemake"),
90+
Map.entry("nc:VehicleColorPrimaryCode", "vehiclecolor"),
91+
Map.entry("tyler:CaseTypeText", "casetype"),
92+
Map.entry("tyler:DamageAmountCode", "damageamount"),
93+
Map.entry("tyler:DisclaimerRequirementCode", "disclaimerrequirement"),
94+
Map.entry("tyler:FilerTypeText", "filertype"),
95+
Map.entry("tyler:CaseSubTypeText", "casesubtype"),
96+
Map.entry("tyler:VehicleTypeCode", "vehicletype"),
97+
Map.entry("tyler:MotionTypeCode", "motiontype"),
98+
Map.entry("tyler:AnswerCode", "answer"),
99+
Map.entry("tyler:QuestionCode", "question"),
100+
Map.entry("tyler:RemedyCode", "procedureremedy"),
101+
Map.entry("tyler:DataFieldConfigCode", "datafieldconfig"),
102+
Map.entry("tyler:DocumentOptionalService", "optionalservices"));
103+
104+
@Override
105+
public Map<String, String> xmlElemToTableName() {
106+
return ecf4Map;
107+
}
108+
49109
public static CodeDatabase fromDS(Jurisdiction jurisdiction, DataSource ds) {
50110
try {
51111
CodeDatabase cd = new CodeDatabase(jurisdiction, ds.getConnection());

proxyserver/src/main/java/edu/suffolk/litlab/efsp/tyler/ecfcodes/CodeUpdater.java

Lines changed: 5 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -74,62 +74,6 @@
7474
public class CodeUpdater {
7575
private static final Logger log = LoggerFactory.getLogger(CodeUpdater.class);
7676

77-
// TODO(brycew-later): there's little more info on these mappings and how they combine besides:
78-
// The name of an ECF element to be substituted by a court-specific codelist or extension
79-
// Is this actually an XPath? Should figure it out
80-
public static final Map<String, String> ecf4ElemToTableName =
81-
Map.ofEntries(
82-
Map.entry("cext:BondTypeText", "bond"),
83-
Map.entry("cext:Charge/cext:ChargeStatute/j:StatuteLevelText", "degree"),
84-
Map.entry("cext:Charge\\cext:ChargePhaseText", "chargephase"),
85-
Map.entry("cext:GeneralOffenseText", "generaloffense"),
86-
Map.entry("cext:StatuteTypeText", "statutetype"),
87-
Map.entry(
88-
"cext:Charge/cext:ChargeStatute/j:StatuteCodeIdentification/nc:IdentificationID",
89-
"statute"),
90-
Map.entry("ecf:CaseParticipantRoleCode", "partytype"),
91-
Map.entry("ecf:FilingStatusCode", "filingstatus"),
92-
Map.entry("ecf:ServiceRecipientID/nc:IdentificationSourceText", "servicetype"),
93-
Map.entry(
94-
"ecf:PersonDriverLicense/nc:DriverLicenseIdentification/nc:IdentificationCategoryText",
95-
"driverlicensetype"),
96-
Map.entry("j:/ArrestCharge/j:ArrestLocation/nc:LocationName", "arrestlocation"),
97-
Map.entry("j:RegisterActionDescriptionText", "filing"),
98-
Map.entry(
99-
"j:ArrestOfficial/j:EnforcementOfficialUnit/nc:OrganizationIdentification/nc:IdentificationID",
100-
"lawenforcementunit"),
101-
Map.entry(
102-
"j:Citation\\nc:ActivityIdentification\\tyler:JurisdictionCode",
103-
"citationjurisdiction"),
104-
Map.entry("nc:CaseCategoryText", "casecategory"),
105-
Map.entry("nc:LocationCountryName", "country"),
106-
Map.entry("nc:BinaryFormatStandardName", "documenttype"),
107-
Map.entry("nc:BinaryCategoryText", "filingcomponent"),
108-
Map.entry("nc:LocationStateName", "state"),
109-
Map.entry("nc:PersonNameSuffixText", "namesuffix"),
110-
Map.entry("nc:BinaryLocationURI", "filetype"),
111-
Map.entry("nc:DocumentIdentification/nc:IdentificationSourceText", "crossreference"),
112-
Map.entry("nc:PrimaryLanguage\\nc:LanguageCode", "language"),
113-
Map.entry("nc:PersonPhysicalFeature\\nc:PhysicalFeatureCategoryCode", "physicalfeature"),
114-
Map.entry("nc:PersonHairColorCode", "haircolor"),
115-
Map.entry("nc:PersonEyeColorCode", "eyecolor"),
116-
Map.entry("nc:PersonEthnicityText", "ethnicity"),
117-
Map.entry("nc:PersonRaceText", "race"),
118-
Map.entry("nc:VehicleMakeCode", "vehiclemake"),
119-
Map.entry("nc:VehicleColorPrimaryCode", "vehiclecolor"),
120-
Map.entry("tyler:CaseTypeText", "casetype"),
121-
Map.entry("tyler:DamageAmountCode", "damageamount"),
122-
Map.entry("tyler:DisclaimerRequirementCode", "disclaimerrequirement"),
123-
Map.entry("tyler:FilerTypeText", "filertype"),
124-
Map.entry("tyler:CaseSubTypeText", "casesubtype"),
125-
Map.entry("tyler:VehicleTypeCode", "vehicletype"),
126-
Map.entry("tyler:MotionTypeCode", "motiontype"),
127-
Map.entry("tyler:AnswerCode", "answer"),
128-
Map.entry("tyler:QuestionCode", "question"),
129-
Map.entry("tyler:RemedyCode", "procedureremedy"),
130-
Map.entry("tyler:DataFieldConfigCode", "datafieldconfig"),
131-
Map.entry("tyler:DocumentOptionalService", "optionalservices"));
132-
13377
/**
13478
* The path to the keystore file, containing the x509 cert used to sign headers to download zips.
13579
*/
@@ -352,7 +296,7 @@ private boolean downloadCourtTables(
352296
policyResp.getRuntimePolicyParameters().getCourtCodelist().stream()
353297
.collect(
354298
Collectors.toMap(
355-
(cc1) -> ecf4ElemToTableName.get(cc1.getECFElementName().getValue()),
299+
(cc1) -> cd.xmlElemToTableName().get(cc1.getECFElementName().getValue()),
356300
// Tyler gives us URLs w/ spaces, which aren't valid. This makes them valid
357301
(cc1) ->
358302
cc1.getCourtCodelistURI()
@@ -531,7 +475,7 @@ public boolean replaceSome(
531475
log.info("Downloading system tables for {}", cd.getJurisdiction());
532476
boolean success = downloadSystemTables(baseUrl, cd, signer);
533477

534-
var tablesToDeleteDomain = ecf4ElemToTableName.values();
478+
var tablesToDeleteDomain = cd.xmlElemToTableName().values();
535479
for (String table : tablesToDeleteDomain) {
536480
cd.createTableIfAbsent(table);
537481
cd.deleteFromTable(table);
@@ -676,7 +620,9 @@ private static CodeDatabaseAPI makeCodeDatabase(Jurisdiction jurisdiction) {
676620
10,
677621
100);
678622

679-
return CodeDatabase.fromDS(jurisdiction, ds);
623+
return switch (jurisdiction.getVendor()) {
624+
case Jurisdiction.Vendor.TYLER -> CodeDatabase.fromDS(jurisdiction, ds);
625+
};
680626
} catch (Exception ex) {
681627
throw new RuntimeException(ex);
682628
}

proxyserver/src/test/java/edu/suffolk/litlab/efsp/ecfcodes/tyler/CodeDatabaseTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import edu.suffolk.litlab.efsp.tyler.ecfcodes.CaseType;
1414
import edu.suffolk.litlab.efsp.tyler.ecfcodes.CodeDatabase;
1515
import edu.suffolk.litlab.efsp.tyler.ecfcodes.CodeTableConstants;
16-
import edu.suffolk.litlab.efsp.tyler.ecfcodes.CodeUpdater;
1716
import edu.suffolk.litlab.efsp.tyler.ecfcodes.CourtLocationInfo;
1817
import edu.suffolk.litlab.efsp.tyler.ecfcodes.OptionalServiceCode;
1918
import edu.suffolk.litlab.efsp.tyler.ecfcodes.ServiceCodeType;
@@ -62,7 +61,7 @@ public void tearDown() throws SQLException {
6261

6362
@Test
6463
public void allNamespacesMapToTables() {
65-
for (String table : CodeUpdater.ecf4ElemToTableName.values()) {
64+
for (String table : cd.xmlElemToTableName().values()) {
6665
if (!table.equalsIgnoreCase("optionalservices")) {
6766
assertNotEquals(
6867
CodeTableConstants.getTableColumns(table).size(), 0, "Expected " + table + " to exist");

0 commit comments

Comments
 (0)