Class Ecf4Helper
java.lang.Object
edu.suffolk.litlab.efsp.server.ecf4.Ecf4Helper
Helper class that easily converts Java native types to Cumbersome XML Schema types, particularly
those from Oasis's ECF standard, and the National Information Exchange Model (NIEM).
Some information about NIEM: Many of the types here all include the "SimpleObjectAttributeGroup", which, "provides a collection of attributes which are appropriate for definition of object types", including an ID attribute, a Metadata attribute, and a Link Metadata attribute that directly reference objects via IDs instead of including the object as an element. TBH, I'm not sure what the design decisions that dictate the use of them are, but they exist.
- Author:
- Bryce Willey
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringamountToString(AmountType amt) static Optional<Ecf4Helper.Error> checkError(ErrorType error) Returns the error type on errors from the ECF side of the API.static List<Ecf4Helper.Error> checkErrors(List<ErrorType> errors) static Base64BinaryconvertBase64(byte[] rawContent) static BooleanconvertBool(boolean bool) Niem's Boolean type: either true or false.static CourtTypeconvertCourtType(String courtId) static DateTypeconvertDate(LocalDate date) Creates a date from a java date.static DecimalconvertDecimal(int val) Convert an int to a BigDecimal to an XML Decimalstatic DecimalconvertDecimal(BigDecimal deci) static IdentificationTypestatic IdentificationTypestatic StringconvertString(String str) Converts a Java string to NIEM's XML String.static TextTypeconvertText(String str) Converts a Java string to NIEM "Text", a wrapper around the NIEM String.static AnyURIconvertUri(String uri) Converts a Java string to a URI.getNonEmptyText(TextType text) static jakarta.ws.rs.core.ResponsemakeResponse(QueryResponseMessageType resp, Supplier<jakarta.ws.rs.core.Response> defaultRespFunc) static jakarta.ws.rs.core.ResponsemapTylerCodesToHttp(List<Ecf4Helper.Error> err, Supplier<jakarta.ws.rs.core.Response> defaultResp) static <T> voidobjectToXmlFile(T toXml, Class<T> toXmlClazz, File outfile) Converts any XML annotated object (from CXF) to a file.static <T> StringobjectToXmlStr(T toXml, Class<T> toXmlClazz) Converts any XML annotated object (from CXF) to a string.static <T> StringobjectToXmlStrOrError(T toXml, Class<T> toXmlClazz) Converts any XML annotated object (from CXF) to a string.static <T extends QueryMessageType>
Tstatic voidsetupReplys(CaseFilingType reply) static longstatic com.hubspot.algebra.Result<CountryCodeType, IllegalArgumentException> strToCountryCode(String country) Turn a given string into a country type.
-
Constructor Details
-
Ecf4Helper
public Ecf4Helper()
-
-
Method Details
-
convertDate
Creates a date from a java date. Doesn't have time associated with it. -
convertBool
Niem's Boolean type: either true or false. -
getNonEmptyText
-
convertText
Converts a Java string to NIEM "Text", a wrapper around the NIEM String."A data type for a character string"
-
convertString
Converts a Java string to NIEM's XML String. "A datatype for character strings in XML." Practically, just a xsd:string with the extra SimpleObjectAttributeGroup attributes. -
sizeMeasureAsBytes
- Parameters:
type- will always be in bytes, but this is for backup.
-
convertId
-
convertId
-
convertDecimal
-
convertDecimal
Convert an int to a BigDecimal to an XML DecimalWeird conversion, but the multiplier on optional services is a Decimal for some reason? "I need 2.3 copies of this sent to my office", lmao.
- Parameters:
val-- Returns:
-
convertUri
Converts a Java string to a URI. -
convertBase64
-
convertCourtType
-
amountToString
-
objectToXmlStrOrError
Converts any XML annotated object (from CXF) to a string. Useful for debugging. Doesn't throw, but does return the string of the exception instead.- Type Parameters:
T- the type of object being passed in- Parameters:
toXml- The object to do things with- Returns:
- the XML string to do what you want with
-
objectToXmlStr
public static <T> String objectToXmlStr(T toXml, Class<T> toXmlClazz) throws jakarta.xml.bind.JAXBException Converts any XML annotated object (from CXF) to a string. Useful for testing. Will throw an exception if there's a JAXB error.- Type Parameters:
T- the type of object being passed in- Parameters:
toXml- The object to do things with- Returns:
- the XML string to do what you want with
- Throws:
jakarta.xml.bind.JAXBException
-
objectToXmlFile
public static <T> void objectToXmlFile(T toXml, Class<T> toXmlClazz, File outfile) throws jakarta.xml.bind.JAXBException Converts any XML annotated object (from CXF) to a file. Useful for testing larger XML objects that are unwieldly to print. Will throw an exception if there's a JAXB error.- Type Parameters:
T- the type of object being passed in- Parameters:
toXml- The object to do things with- Throws:
jakarta.xml.bind.JAXBException
-
strToCountryCode
public static com.hubspot.algebra.Result<CountryCodeType,IllegalArgumentException> strToCountryCode(String country) Turn a given string into a country type. -
prep
-
makeResponse
public static jakarta.ws.rs.core.Response makeResponse(QueryResponseMessageType resp, Supplier<jakarta.ws.rs.core.Response> defaultRespFunc) -
checkError
Returns the error type on errors from the ECF side of the API. They work the same as the Tyler ones. -
checkErrors
-
mapTylerCodesToHttp
public static jakarta.ws.rs.core.Response mapTylerCodesToHttp(List<Ecf4Helper.Error> err, Supplier<jakarta.ws.rs.core.Response> defaultResp) -
setupReplys
-