2727import edu .suffolk .litlab .efsp .model .PartyId ;
2828import edu .suffolk .litlab .efsp .model .Person ;
2929import edu .suffolk .litlab .efsp .stdlib .NonEmptyString ;
30- import edu .suffolk .litlab .efsp .utils .FailFastCollector ;
3130import edu .suffolk .litlab .efsp .utils .FilingError ;
3231import edu .suffolk .litlab .efsp .utils .InfoCollector ;
3332import edu .suffolk .litlab .efsp .utils .InterviewVariable ;
5049import gov .niem .niem .niem_core ._2 .TelephoneNumberType ;
5150import gov .niem .niem .niem_core ._2 .TextType ;
5251import gov .niem .niem .proxy .xsd ._2 .Base64Binary ;
53- import gov .niem .niem .proxy .xsd ._2 .Decimal ;
5452import gov .niem .niem .usps_states ._2 .USStateCodeSimpleType ;
5553import gov .niem .niem .usps_states ._2 .USStateCodeType ;
5654import jakarta .xml .bind .JAXBElement ;
@@ -562,10 +560,9 @@ public static tyler.efm.latest.services.schema.common.AddressType serializeTyler
562560 addr .setAddressLine1 (myAddr .getStreet ());
563561 addr .setAddressLine2 (myAddr .getApartment ());
564562 addr .setCity (myAddr .getCity ());
565- FailFastCollector collector = new FailFastCollector ();
566- Optional <CountryCodeType > cct = strToCountryCode (myAddr .getCountry (), collector );
567- if (cct .isEmpty ()) {
568- throw FilingError .serverError ("Country Code is wrong" );
563+ var cct = Ecf4Helper .strToCountryCode (myAddr .getCountry ());
564+ if (cct .isErr ()) {
565+ throw FilingError .serverError ("Country Code is wrong: " + myAddr .getCountry ());
569566 }
570567 addr .setState (myAddr .getState ());
571568 addr .setZipCode (myAddr .getZip ());
@@ -587,8 +584,8 @@ public JAXBElement<AddressType> serializeNiemContactMeans(
587584 ProperNameTextType pntt = niemObjFac .createProperNameTextType ();
588585 pntt .setValue (address .getCity ());
589586 sat .setLocationCityName (pntt );
590- Optional < CountryCodeType > cct = strToCountryCode (address .getCountry (), collector );
591- if (cct . isEmpty ()) {
587+ var cctResult = Ecf4Helper . strToCountryCode (address .getCountry ());
588+ if (cctResult . isErr ()) {
592589 List <String > countries =
593590 Arrays .stream (CountryCodeSimpleType .values ())
594591 .map ((t ) -> t .toString ())
@@ -602,9 +599,10 @@ public JAXBElement<AddressType> serializeNiemContactMeans(
602599 Optional .of (address .getCountry ()));
603600 collector .addWrong (var );
604601 }
605- sat .setLocationCountry (niemObjFac .createLocationCountryFIPS104Code (cct .get ()));
606- if (!fillStateCode (address .getState (), cct .get (), sat )) {
607- String countryString = cct .get ().getValue ();
602+ CountryCodeType cct = cctResult .unwrapOrElseThrow ();
603+ sat .setLocationCountry (niemObjFac .createLocationCountryFIPS104Code (cct ));
604+ if (!fillStateCode (address .getState (), cct , sat )) {
605+ String countryString = cct .getValue ();
608606 List <String > stateCodes = cd .getStateCodes (this .court .code , countryString );
609607 InterviewVariable var =
610608 collector .requestVar (
@@ -914,9 +912,7 @@ public JAXBElement<DocumentType> filingDocToXml(
914912 if (serv .feeAmount .isEmpty ()) {
915913 collector .addWrong (servVar .appendDesc (": needs fee prompt" ));
916914 } else {
917- Decimal dec = new Decimal ();
918- dec .setValue (serv .feeAmount .get ());
919- xmlServ .setFeeAmount (dec );
915+ xmlServ .setFeeAmount (Ecf4Helper .convertDecimal (serv .feeAmount .get ()));
920916 }
921917 }
922918 if (!codeSettings .hasfeeprompt && serv .feeAmount .isPresent ()) {
@@ -926,9 +922,7 @@ public JAXBElement<DocumentType> filingDocToXml(
926922 if (serv .multiplier .isEmpty ()) {
927923 collector .addWrong (servVar .appendDesc (": needs multiplier" ));
928924 } else {
929- Decimal dec = new Decimal ();
930- dec .setValue (new BigDecimal (serv .multiplier .get ()));
931- xmlServ .setMultiplier (dec );
925+ xmlServ .setMultiplier (Ecf4Helper .convertDecimal (serv .multiplier .get ()));
932926 }
933927 }
934928 docType .getDocumentOptionalService ().add (xmlServ );
@@ -1170,14 +1164,6 @@ private String findDocumentDescription(
11701164 }
11711165 }
11721166
1173- // TODO(brycew): don't need the Optional anyy more
1174- private static Optional <CountryCodeType > strToCountryCode (
1175- String country , InfoCollector collector ) {
1176- CountryCodeType cct = new CountryCodeType ();
1177- cct .setValue (country );
1178- return Optional .of (cct );
1179- }
1180-
11811167 /** True if it worked. */
11821168 private boolean fillStateCode (String state , CountryCodeType country , StructuredAddressType sat ) {
11831169 String countryString = country .getValue ().toString ();
0 commit comments