Class Ecf4Helper
java.lang.Object
edu.suffolk.litlab.efspserver.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
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
amountToString
(AmountType amt) static boolean
checkErrors
(ErrorType error) Returns true on errors from the ECF side of the API.static Base64Binary
convertBase64
(byte[] rawContent) static Boolean
convertBool
(boolean bool) Niem's Boolean type: either true or false.static CourtType
convertCourtType
(String courtId) static DateType
convertDate
(LocalDate date) Creates a date from a java date.static IdentificationType
static IdentificationType
static String
convertString
(String str) Converts a Java string to NIEM's XML String.static TextType
convertText
(String str) Converts a Java string to NIEM "Text", a wrapper around the NIEM String.static AnyURI
convertUri
(String uri) Converts a Java string to a URI.static jakarta.ws.rs.core.Response
makeResponse
(QueryResponseMessageType resp, Supplier<jakarta.ws.rs.core.Response> defaultRespFunc) static jakarta.ws.rs.core.Response
mapTylerCodesToHttp
(List<ErrorType> errors, Supplier<jakarta.ws.rs.core.Response> defaultRespFunc) static <T> void
objectToXmlFile
(T toXml, Class<T> toXmlClazz, File outfile) Converts any XML annotated object (from CXF) to a file.static <T> String
objectToXmlStr
(T toXml, Class<T> toXmlClazz) Converts any XML annotated object (from CXF) to a string.static <T> String
objectToXmlStrOrError
(T toXml, Class<T> toXmlClazz) Converts any XML annotated object (from CXF) to a string.static <T extends QueryMessageType>
Tstatic void
setupReplys
(CaseFilingType reply) static long
-
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. -
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
-
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
-
prep
-
makeResponse
public static jakarta.ws.rs.core.Response makeResponse(QueryResponseMessageType resp, Supplier<jakarta.ws.rs.core.Response> defaultRespFunc) -
checkErrors
Returns true on errors from the ECF side of the API. They work the same as the Tyler ones. -
mapTylerCodesToHttp
-
setupReplys
-