Class Util

java.lang.Object
org.projecthusky.common.utils.Util

@Deprecated(forRemoval=true) public class Util extends Object
Deprecated, for removal: This API element is subject to removal in a future version.
Helper methods for the Husky and CDA.
  • Field Details

    • TELECOMS_EMAIL_PREFIX

      public static final String TELECOMS_EMAIL_PREFIX
      Deprecated, for removal: This API element is subject to removal in a future version.
      The Constant TELECOMS_EMAIL_PREFIX.
      See Also:
    • TELECOMS_FAX_PREFIX

      public static final String TELECOMS_FAX_PREFIX
      Deprecated, for removal: This API element is subject to removal in a future version.
      The Constant TELECOMS_FAX_PREFIX.
      See Also:
    • TELECOMS_PHONE_PREFIX

      public static final String TELECOMS_PHONE_PREFIX
      Deprecated, for removal: This API element is subject to removal in a future version.
      The Constant TELECOMS_PHONE_PREFIX.
      See Also:
    • TELECOMS_WEBSITE_PREFIX

      public static final String TELECOMS_WEBSITE_PREFIX
      Deprecated, for removal: This API element is subject to removal in a future version.
      The Constant TELECOMS_WEBSITE_PREFIX. Note: omitting the : here in order to support http and https
      See Also:
    • NAMESPACE_HL7_V3

      public static final String NAMESPACE_HL7_V3
      Deprecated, for removal: This API element is subject to removal in a future version.
      HL7v3 namespace.
      See Also:
  • Method Details

    • atLeastOne

      public static boolean atLeastOne(List<?> l)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Checks to see if the list has at least one element.
      Parameters:
      l - the list
      Returns:
      false if l is null, if l.size() < 1 or if l.get(0) is null. Otherwise, return true.
    • convertIds

      public static List<Identificator> convertIds(List<II> mII)
      Converts a list of II int a list of Identificators.
      Parameters:
      mII - the list to convert
      Returns:
      returns a list of Identificators
    • createAddress

      public static AD createAddress(String zip, String city, PostalAddressUse usage)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates an address.
      Parameters:
      zip - ZIP code
      city - the city
      usage - usage of this address
      Returns:
      HL7 AD Object
    • createAssignedAuthorFromAssignedEntity

      public static POCDMT000040AssignedAuthor createAssignedAuthorFromAssignedEntity(POCDMT000040AssignedEntity a)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates an MDHT assignedEntity object from an MDHT AssignedAuthor object.
      Parameters:
      a - the assignedAuthor
      Returns:
      the assignedEntity
    • createAssignedAuthorFromOrganization

      public static POCDMT000040AssignedAuthor createAssignedAuthorFromOrganization(Organization organization)
      Deprecated.
      Creates the assigned author from organization.
      Parameters:
      organization - the organization
      Returns:
      the assigned author
    • createAssignedEntityFromAssignedAuthor

      public static POCDMT000040AssignedEntity createAssignedEntityFromAssignedAuthor(POCDMT000040AssignedAuthor a)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates an assignedEntity object from an AssignedAuthor object.
      Parameters:
      a - the assignedAuthor
      Returns:
      the assignedEntity
    • createAssignedEntityFromOrganization

      public static POCDMT000040AssignedEntity createAssignedEntityFromOrganization(Organization organization)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates the assigned entity from organization.
      Parameters:
      organization - the organization
      Returns:
      the assigned entity
    • createAuthenticatorFromAuthor

      public static POCDMT000040Authenticator createAuthenticatorFromAuthor(Author author)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates the authenticator from author.
      Parameters:
      author - the author
      Returns:
      the authenticator
    • createAuthorFromAuthenticator

      public static POCDMT000040Author createAuthorFromAuthenticator(POCDMT000040Authenticator authenticator)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates a new MDHT Author object from an MDHT LegalAuthenticator object.
      Parameters:
      authenticator -
      the authenticator
      Returns:
      the Author
    • createAuthorFromLegalAuthenticator

      public static POCDMT000040Author createAuthorFromLegalAuthenticator(POCDMT000040LegalAuthenticator authenticator)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates a new MDHT Author object from an MDHT LegalAuthenticator object.
      Parameters:
      authenticator -
      the authenticator
      Returns:
      the Author
    • createCustodianOrganizationFromOrganization

      public static POCDMT000040CustodianOrganization createCustodianOrganizationFromOrganization(Organization organization)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates a new MDHT CustodianOrganization object from an eHC Organization object.
      Parameters:
      organization - the Organization
      Returns:
      CustodianOrganization the CustodianOrganization
    • createEffectiveTimeNullFlavorUnk

      public static IVLTS createEffectiveTimeNullFlavorUnk()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates the effective time null flavor unk.
      Returns:
      the ivl ts
    • createEMail

      public static TEL createEMail(String eMail, TelecomAddressUse usage)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates the MDHT email TEL object.
      Parameters:
      eMail -
      e mail
      usage -
      usage
      Returns:
      the tel
    • createEurDateStrFromTS

      public static String createEurDateStrFromTS(String hl7Stimestamp)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates the eur date str from ts.
      Parameters:
      hl7Stimestamp -
      hl7 stimestamp
      Returns:
      the string
    • createFax

      public static TEL createFax(String faxNr, TelecomAddressUse usage)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates the MDHT fax TEL object.
      Parameters:
      faxNr -
      fax nr
      usage -
      usage
      Returns:
      the tel
    • createLegalAuthenticatorFromAuthor

      public static POCDMT000040LegalAuthenticator createLegalAuthenticatorFromAuthor(Author author)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates a new MDHT LegalAuthor object from an MDHT Author object. Signature Code will be set to fixed 's'
      Parameters:
      author -
      the author
      Returns:
      the legal authenticator
    • createOrganizationFromCustodianOrganization

      public static POCDMT000040CustodianOrganization createOrganizationFromCustodianOrganization(POCDMT000040CustodianOrganization mdhtCO)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates the organization from custodian organization.
      Parameters:
      mdhtCO - the mdht CO
      Returns:
      the org.openhealthtools.mdht.uml.cda. organization
    • createOrganizationFromParticipant

      public static Organization createOrganizationFromParticipant(Participant p)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates the organization from participant.
      Parameters:
      p - the p
      Returns:
      the organization
    • createPnFromOn

      public static PN createPnFromOn(ON on)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates the pn from on.
      Parameters:
      on - the on
      Returns:
      the pn
    • createReference

      @Deprecated public static ED createReference(ED existingText, String reference)
      Creates an MDHT ED reference from a given String. Adds the hashtag '#' automatically, if not present as first character.
      Parameters:
      existingText - the existing text
      reference - the reference
      Returns:
      the MDHT ED
    • createReference

      @Deprecated public static ED createReference(int contentId, String prefix)
      Creates the reference.
      Parameters:
      contentId -
      content id
      prefix -
      prefix
      Returns:
      the ed
    • createReference

      @Deprecated public static ED createReference(String reference)
      Deprecated.
      Creates an MDHT ED reference from a given String. Adds the hashtag '#' automatically, if not present as first character.
      Parameters:
      reference - the reference value
      Returns:
      the MDHT ED
    • createReference

      @Deprecated public static ED createReference(String url, String narrativeText)
      Creates an MDHT ED reference from a given String.
      Parameters:
      url - the reference url
      narrativeText - the reference narrative text
      Returns:
      the MDHT ED
    • createReferenceTel

      @Deprecated public static TEL createReferenceTel(String value)
      Creates the reference tel.
      Parameters:
      value - the value
      Returns:
      the tel
    • createTel

      public static TEL createTel(String telNr, TelecomAddressUse usage)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates the MDHT phone TEL object.
      Parameters:
      telNr -
      tel nr
      usage -
      usage
      Returns:
      the tel
    • getChecksum

      public static int getChecksum(Serializable object)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Gets the checksum of a serializable object.
      Parameters:
      object - the object
      Returns:
      the checksum
    • getCommentRef

      public static String getCommentRef(List<POCDMT000040EntryRelationship> e)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Extracts the reference to a comment from a given list of MDHT EntryRelationship objects.
      Parameters:
      e - the EntryRelationship list
      Returns:
      the reference to the comment
    • getCommentText

      public static String getCommentText(List<POCDMT000040EntryRelationship> e)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns the text of a comment from a given list of MDHT EntryRelationship objects.
      Parameters:
      e - the EntryRelationship list
      Returns:
      the tet of the comment
    • getCommentText

      public static String getCommentText(List<POCDMT000040EntryRelationship> e, String contentId)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns the text of a comment from a given list of MDHT EntryRelationship objects and sets the text reference.
      Parameters:
      e - the EntryRelationship list
      contentId - the content id for the text reference
      Returns:
      the tet of the comment
    • getCurrentDirectory

      public static String getCurrentDirectory()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Gets the current directory.
      Returns:
      the current directory
    • getEMail

      public static Map<String,TelecomAddressUse> getEMail(List<TEL> telecoms)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Gets the e mail from an ArrayList of TEL.
      Liefert e mail aus einer ArrayList of TEL.
      Parameters:
      telecoms -
      the telecoms
      Returns:
      the e mail
    • getFax

      public static Map<String,TelecomAddressUse> getFax(List<TEL> telecoms)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Gets the fax from an ArrayList of TEL.
      Liefert cax aus einer ArrayList von TEL.
      Parameters:
      telecoms -
      the telecoms
      Returns:
      the fax
    • getPhones

      public static Map<String,TelecomAddressUse> getPhones(List<TEL> telecoms)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Gets the e mail from an ArrayList of TEL.
      Liefert e mail aus einer ArrayList von TEL.
      Parameters:
      telecoms -
      the telecoms
      Returns:
      the phone
    • getRscDir

      public static String getRscDir()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Gets the rsc directory (./rsc or ../rsc or specified by the command line argument rscdir).
      Returns:
      the rsc dir
    • getSystemFontsPaths

      public static List<String> getSystemFontsPaths()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Gets the system fonts paths in relation to the current OS. This is where all the fonts must be found in order to embed them into the PDF/A document.
      Returns:
      the system fonts paths
    • getTempDirectory

      public static String getTempDirectory()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Gets a temp folder for output files. If you set an environment variable with the name 'eHCTempPath' the Husky will use the path specified in this environment variable. If no such environment variable is set, it will try to use /temp. If the path is not writable the Husky will use the system temp folder.
      Returns:
      path to temp folder
    • getUsedMemoryString

      public static String getUsedMemoryString(String hint)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Gets the used memory as string for display e.g. to console.
      Parameters:
      hint - to be added to the string
      Returns:
      the used memory string
    • getUtf8InputStream

      public static InputStream getUtf8InputStream(File file)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Gets the utf 8 input stream from file.
      Parameters:
      file - the file
      Returns:
      the utf 8 input stream from file
    • getUtf8InputStream

      public static InputStream getUtf8InputStream(FileInputStream fis)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Gets the utf 8 input stream from file.
      Parameters:
      fis - the fis
      Returns:
      the utf 8 input stream from file
    • getUtf8InputStream

      public static InputStream getUtf8InputStream(InputStream is)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Gets the utf 8 input stream from file.
      Parameters:
      is - the is
      Returns:
      the utf 8 input stream from file
    • getUtf8InputStream

      public static InputStream getUtf8InputStream(String fileName)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Gets the utf 8 input stream from file.
      Parameters:
      fileName - the file name
      Returns:
      the utf 8 input stream from file
    • getVmMemoryFreeInMegaBytes

      public static int getVmMemoryFreeInMegaBytes()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Gets the free Java VM heap space in mega bytes.
      Returns:
      the free Java VM heap space in mega bytes.
    • getVmMemoryTotalInMegaBytes

      public static int getVmMemoryTotalInMegaBytes()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Gets the total Java VM heap space in mega bytes.
      Returns:
      the total Java VM heap space in mega bytes.
    • getVmMemoryUsedInMegaBytes

      public static int getVmMemoryUsedInMegaBytes()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Gets the used Java VM heap space in mega bytes.
      Returns:
      the used Java VM heap space in mega bytes.
    • getWebsites

      public static Map<String,TelecomAddressUse> getWebsites(List<TEL> telecoms)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Gets the website from an ArrayList of TEL.
      Liefert die Webseite aus einer ArrayList von TEL.
      Parameters:
      telecoms -
      the telecoms
      Returns:
      the webside
    • isComment

      public static boolean isComment(POCDMT000040EntryRelationship er)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Checks if an EntryRelationship is a comment.
      Parameters:
      er - the EntryRelationship
      Returns:
      true if the EntryRelationship is a comment, false otherwise
    • join

      public static String join(List<String> nameList, String delimiter)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Join an ArrayList of String with person names to a whole name
      .
      Parameters:
      nameList -
      name list
      delimiter -
      delimiter
      Returns:
      the string
    • joinEListStr

      public static String joinEListStr(List<ENXP> list)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Join a list of MDHT ENXP (name parts) to a whole person name
      .
      Parameters:
      list -
      the list
      Returns:
      the string
    • logAvailableMemory

      public static void logAvailableMemory(Class theClass, String hint)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Logs the available memory.
      Parameters:
      theClass - the the class Class to be used in the Log4J log
      hint - the hint hint to be added to the log message
    • runExternalCommand

      public static void runExternalCommand(String cmd) throws IOException, InterruptedException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Runs the given external command.
      Parameters:
      cmd - the command to run
      Throws:
      IOException - Signals that an I/O exception has occurred.
      InterruptedException - the interrupted exception
    • st

      public static ST st(String text)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates an MDHT ST
      .
      Parameters:
      text -
      the text
      Returns:
      the st
    • string2InputStream

      public static InputStream string2InputStream(String inputStr)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Converts the given string to an InputStream.
      Parameters:
      inputStr - the input string
      Returns:
      the input stream
    • getRand

      public static Random getRand()
      Deprecated, for removal: This API element is subject to removal in a future version.
    • setRand

      public static void setRand(Random rand)
      Deprecated, for removal: This API element is subject to removal in a future version.