Class Ecf4Helper

java.lang.Object
edu.suffolk.litlab.efspserver.ecf4.Ecf4Helper

public class Ecf4Helper extends Object
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 Details

    • Ecf4Helper

      public Ecf4Helper()
  • Method Details

    • convertDate

      public static DateType convertDate(LocalDate date)
      Creates a date from a java date. Doesn't have time associated with it.
    • convertBool

      public static Boolean convertBool(boolean bool)
      Niem's Boolean type: either true or false.
    • convertText

      public static TextType convertText(String str)
      Converts a Java string to NIEM "Text", a wrapper around the NIEM String.

      "A data type for a character string"

    • convertString

      public static String convertString(String str)
      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

      public static long sizeMeasureAsBytes(MeasureType type)
      Parameters:
      type - will always be in bytes, but this is for backup.
    • convertId

      public static IdentificationType convertId(String idStr)
    • convertId

      public static IdentificationType convertId(String idStr, String category)
    • convertUri

      public static AnyURI convertUri(String uri)
      Converts a Java string to a URI.
    • convertBase64

      public static Base64Binary convertBase64(byte[] rawContent)
    • convertCourtType

      public static CourtType convertCourtType(String courtId)
    • amountToString

      public static String amountToString(AmountType amt)
    • objectToXmlStrOrError

      public static <T> String objectToXmlStrOrError(T toXml, Class<T> toXmlClazz)
      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

      public static <T extends QueryMessageType> T prep(T newMsg, String courtId)
    • makeResponse

      public static jakarta.ws.rs.core.Response makeResponse(QueryResponseMessageType resp, Supplier<jakarta.ws.rs.core.Response> defaultRespFunc)
    • checkErrors

      public static boolean checkErrors(ErrorType error)
      Returns true on errors from the ECF side of the API. They work the same as the Tyler ones.
    • mapTylerCodesToHttp

      public static jakarta.ws.rs.core.Response mapTylerCodesToHttp(List<ErrorType> errors, Supplier<jakarta.ws.rs.core.Response> defaultRespFunc)
    • setupReplys

      public static void setupReplys(CaseFilingType reply)