|
74 | 74 | public class CodeUpdater { |
75 | 75 | private static final Logger log = LoggerFactory.getLogger(CodeUpdater.class); |
76 | 76 |
|
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 | | - |
133 | 77 | /** |
134 | 78 | * The path to the keystore file, containing the x509 cert used to sign headers to download zips. |
135 | 79 | */ |
@@ -352,7 +296,7 @@ private boolean downloadCourtTables( |
352 | 296 | policyResp.getRuntimePolicyParameters().getCourtCodelist().stream() |
353 | 297 | .collect( |
354 | 298 | Collectors.toMap( |
355 | | - (cc1) -> ecf4ElemToTableName.get(cc1.getECFElementName().getValue()), |
| 299 | + (cc1) -> cd.xmlElemToTableName().get(cc1.getECFElementName().getValue()), |
356 | 300 | // Tyler gives us URLs w/ spaces, which aren't valid. This makes them valid |
357 | 301 | (cc1) -> |
358 | 302 | cc1.getCourtCodelistURI() |
@@ -531,7 +475,7 @@ public boolean replaceSome( |
531 | 475 | log.info("Downloading system tables for {}", cd.getJurisdiction()); |
532 | 476 | boolean success = downloadSystemTables(baseUrl, cd, signer); |
533 | 477 |
|
534 | | - var tablesToDeleteDomain = ecf4ElemToTableName.values(); |
| 478 | + var tablesToDeleteDomain = cd.xmlElemToTableName().values(); |
535 | 479 | for (String table : tablesToDeleteDomain) { |
536 | 480 | cd.createTableIfAbsent(table); |
537 | 481 | cd.deleteFromTable(table); |
@@ -676,7 +620,9 @@ private static CodeDatabaseAPI makeCodeDatabase(Jurisdiction jurisdiction) { |
676 | 620 | 10, |
677 | 621 | 100); |
678 | 622 |
|
679 | | - return CodeDatabase.fromDS(jurisdiction, ds); |
| 623 | + return switch (jurisdiction.getVendor()) { |
| 624 | + case Jurisdiction.Vendor.TYLER -> CodeDatabase.fromDS(jurisdiction, ds); |
| 625 | + }; |
680 | 626 | } catch (Exception ex) { |
681 | 627 | throw new RuntimeException(ex); |
682 | 628 | } |
|
0 commit comments