Class ExpressionUtil

java.lang.Object
com.ssgllc.fish.service.util.registered.ExpressionUtil
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware

@Component public class ExpressionUtil extends Object implements org.springframework.context.ApplicationContextAware
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static com.ssgllc.fish.config.CasetivityProperties
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    ExpressionUtil(com.ssgllc.fish.repository.gen.UserRepository userRepository)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    areExactAddresses(com.ssgllc.fish.domain.CasetivityAddress address, com.ssgllc.fish.domain.CasetivityAddress addressToCompare)
    Checks if two CasetivityAddress objects are an exact match.
    static boolean
    areExactAddressesIgnoreUnit(com.ssgllc.fish.domain.CasetivityAddress address, com.ssgllc.fish.domain.CasetivityAddress addressToCompare)
    Checks if two CasetivityAddress objects are an exact match, ignoring the unit field.
    static boolean
    bothNotNull(Object valueOne, Object valueTwo)
    Checks if both values are non-null.
    static boolean
    bothNull(Object valueOne, Object valueTwo)
    Checks if both values are null.
    static Object
    Returns the first non-null object of two objects.
    static Boolean
    Checks if the current user has any of the given roles.
    static Boolean
     
    static String
    formatDate(LocalDate date, String format)
    Formats a LocalDate object using the specified date format.
    static String
    Formats a LocalDate object using the default date format specified in casetivityProperties.
    static String
    Gets the email of the currently logged in user.
    static String
    Gets the ID of the currently logged in user.
    static String
    Gets the login name of the currently logged in user.
    static com.ssgllc.fish.domain.gen.User
    Gets the User object for the currently logged in user.
    static Object
    Returns the property for the current user's session as specified in the userTokenFields of the casetivity.properties file for the application.
    static List<String>
    Gets a list of the roles that the currently logged in user belongs to.
    static UUID
    Gets the UUID of the currently logged in user.
    static String
    Gets the UUID string of the currently logged in user.
    static String
    Returns a string representation of a date object.
    static String
    Returns a string containing the items that appear more than once in a list.
    static String
    Deprecated.
    static Object
    getUserProperty(com.ssgllc.fish.bpm.domain.BpmUser user, String key)
     
    static boolean
     
    static boolean
    isContainedInOther(String text, String textToCompare, String splitRegEx, Integer minContainsLen)
    Checks if one string is contained in another string.
    static boolean
    isFirstLastBirthDateExact(com.ssgllc.fish.domain.CasetivityPerson person, com.ssgllc.fish.domain.CasetivityPerson personToCompare)
    Checks if the first name, last name, and birth date fields in two CasetivityPerson objects are an exact match.
    static boolean
    isFirstLastGenderBirthDateExact(com.ssgllc.fish.domain.CasetivityPerson person, com.ssgllc.fish.domain.CasetivityPerson personToCompare)
    Checks if the first name, last name, gender, and birth date fields in two CasetivityPerson objects are an exact match.
    static boolean
    isFirstLastMiddleExact(com.ssgllc.fish.domain.CasetivityPerson person, com.ssgllc.fish.domain.CasetivityPerson personToCompare)
    Checks if the first name, last name, and middle name fields in two CasetivityPerson objects are an exact match.
    static boolean
     
    static boolean
    Checks if a list contains only unique items.
    static Boolean
    matchPattern(String string, String pattern)
    Deprecated.
    This method is deprecated.
    static double
    mlAddressMatch(com.ssgllc.fish.domain.CasetivityAddress address, com.ssgllc.fish.domain.CasetivityAddress addressToCompare)
    Returns the match score between two CasetivityAddress objects using MLAddressMatch.
    static double
    mlPersonMatch(com.ssgllc.fish.domain.CasetivityPerson person, com.ssgllc.fish.domain.CasetivityPerson personToCompare)
    Returns the match score between two CasetivityPerson objects using MLPersonMatch.
    static com.ssgllc.fish.dedupe.match.ml.dataset.ScoreHolder
    mlPersonMatchScores(com.ssgllc.fish.domain.CasetivityPerson person, com.ssgllc.fish.domain.CasetivityPerson personToCompare)
    Returns a ScoreHolder object containing the match scores between two CasetivityPerson objects using MLPersonMatch.
    static boolean
    oneNullOneGiven(Object valueOne, Object valueTwo)
    Checks if one of the values is null and the other is non-null.
    void
    setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
     
    static Boolean
    userHasARoleIn(com.ssgllc.fish.bpm.domain.BpmUser user, List<String> roleNames)
    Checks if a given user has any of the given roles.
    static Boolean
    userHasRole(com.ssgllc.fish.bpm.domain.BpmUser user, String roleName)
    Checks if a given user has a specified role.
    static Integer
    Z(Object value)
    ZeroOrOne: Returns 0 if the value is null or blank, else returns 1.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • casetivityProperties

      protected static com.ssgllc.fish.config.CasetivityProperties casetivityProperties
  • Constructor Details

    • ExpressionUtil

      public ExpressionUtil(com.ssgllc.fish.repository.gen.UserRepository userRepository)
  • Method Details

    • setApplicationContext

      public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
      Specified by:
      setApplicationContext in interface org.springframework.context.ApplicationContextAware
      Throws:
      org.springframework.beans.BeansException
    • Z

      public static Integer Z(Object value)
      ZeroOrOne: Returns 0 if the value is null or blank, else returns 1.
      Parameters:
      value - the object whose nullness is to be checked
      Returns:
      0 if the value is null or blank, else returns 1
    • oneNullOneGiven

      public static boolean oneNullOneGiven(Object valueOne, Object valueTwo)
      Checks if one of the values is null and the other is non-null.
      Parameters:
      valueOne - the first object whose nullness is to be checked
      valueTwo - the second object whose nullness is to be checked
      Returns:
      true if one of the values is null and the other is non-null, false otherwise
    • bothNull

      public static boolean bothNull(Object valueOne, Object valueTwo)
      Checks if both values are null.
      Parameters:
      valueOne - the first object whose nullness is to be checked
      valueTwo - the second object whose nullness is to be checked
      Returns:
      true if both values are null, false otherwise
    • bothNotNull

      public static boolean bothNotNull(Object valueOne, Object valueTwo)
      Checks if both values are non-null.
      Parameters:
      valueOne - the first object whose nullness is to be checked
      valueTwo - the second object whose nullness is to be checked
      Returns:
      true if both values are non-null, false otherwise
    • mlPersonMatch

      public static double mlPersonMatch(com.ssgllc.fish.domain.CasetivityPerson person, com.ssgllc.fish.domain.CasetivityPerson personToCompare)
      Returns the match score between two CasetivityPerson objects using MLPersonMatch.
      Parameters:
      person - the first CasetivityPerson object to be compared
      personToCompare - the second CasetivityPerson object to be compared
      Returns:
      the match score between the two CasetivityPerson objects using MLPersonMatch
    • mlPersonMatchScores

      public static com.ssgllc.fish.dedupe.match.ml.dataset.ScoreHolder mlPersonMatchScores(com.ssgllc.fish.domain.CasetivityPerson person, com.ssgllc.fish.domain.CasetivityPerson personToCompare)
      Returns a ScoreHolder object containing the match scores between two CasetivityPerson objects using MLPersonMatch.
      Parameters:
      person - the first CasetivityPerson object to be compared
      personToCompare - the second CasetivityPerson object to be compared
      Returns:
      a ScoreHolder object containing the match scores between the two CasetivityPerson objects using MLPersonMatch
    • mlAddressMatch

      public static double mlAddressMatch(com.ssgllc.fish.domain.CasetivityAddress address, com.ssgllc.fish.domain.CasetivityAddress addressToCompare)
      Returns the match score between two CasetivityAddress objects using MLAddressMatch.
      Parameters:
      address - the first CasetivityAddress object to be compared
      addressToCompare - the second CasetivityAddress object to be compared
      Returns:
      the match score between the two CasetivityAddress objects using MLAddressMatch
    • areExactAddresses

      public static boolean areExactAddresses(com.ssgllc.fish.domain.CasetivityAddress address, com.ssgllc.fish.domain.CasetivityAddress addressToCompare)
      Checks if two CasetivityAddress objects are an exact match.
      Parameters:
      address - the first CasetivityAddress object to be compared
      addressToCompare - the second CasetivityAddress object to be compared
      Returns:
      true if the two CasetivityAddress objects are an exact match, false otherwise
    • areExactAddressesIgnoreUnit

      public static boolean areExactAddressesIgnoreUnit(com.ssgllc.fish.domain.CasetivityAddress address, com.ssgllc.fish.domain.CasetivityAddress addressToCompare)
      Checks if two CasetivityAddress objects are an exact match, ignoring the unit field.
      Parameters:
      address - the first CasetivityAddress object to be compared
      addressToCompare - the second CasetivityAddress object to be compared
      Returns:
      true if the two CasetivityAddress objects are an exact match, ignoring the unit field, false otherwise
    • isFirstLastMiddleExact

      public static boolean isFirstLastMiddleExact(com.ssgllc.fish.domain.CasetivityPerson person, com.ssgllc.fish.domain.CasetivityPerson personToCompare)
      Checks if the first name, last name, and middle name fields in two CasetivityPerson objects are an exact match.
      Parameters:
      person - the first CasetivityPerson object to be compared
      personToCompare - the second CasetivityPerson object to be compared
      Returns:
      true if the first name, last name, and middle name fields in the two CasetivityPerson objects are an exact match, false otherwise
    • isFirstLastBirthDateExact

      public static boolean isFirstLastBirthDateExact(com.ssgllc.fish.domain.CasetivityPerson person, com.ssgllc.fish.domain.CasetivityPerson personToCompare)
      Checks if the first name, last name, and birth date fields in two CasetivityPerson objects are an exact match.
      Parameters:
      person - the first CasetivityPerson object to be compared
      personToCompare - the second CasetivityPerson object to be compared
      Returns:
      true if the first name, last name, and birth date fields in the two CasetivityPerson objects are an exact match, false otherwise
    • isFirstLastGenderBirthDateExact

      public static boolean isFirstLastGenderBirthDateExact(com.ssgllc.fish.domain.CasetivityPerson person, com.ssgllc.fish.domain.CasetivityPerson personToCompare)
      Checks if the first name, last name, gender, and birth date fields in two CasetivityPerson objects are an exact match.
      Parameters:
      person - the first CasetivityPerson object to be compared
      personToCompare - the second CasetivityPerson object to be compared
      Returns:
      true if the first name, last name, gender, and birth date fields in the two CasetivityPerson objects are an exact match, false otherwise
    • isContainedInOther

      public static boolean isContainedInOther(String text, String textToCompare, String splitRegEx, Integer minContainsLen)
      Checks if one string is contained in another string.
      Parameters:
      text - the string to be searched
      textToCompare - the string to search for
      splitRegEx - a regular expression used to split the strings into words
      minContainsLen - the minimum length of a word to be considered for a match
      Returns:
      true if the second string contains a word that is at least as long as minContainsLen and is a word in the first string, false otherwise
    • isUnique

      public static boolean isUnique(List<Object> list)
      Checks if a list contains only unique items.
      Parameters:
      list - the list to be checked
      Returns:
      true if the list contains only unique items, false otherwise
    • getDuplicateItems

      public static String getDuplicateItems(List<String> list)
      Returns a string containing the items that appear more than once in a list.
      Parameters:
      list - the list to be checked
      Returns:
      a string containing the items that appear more than once in the list
    • formatDateDefault

      public static String formatDateDefault(LocalDate date)
      Formats a LocalDate object using the default date format specified in casetivityProperties.
      Parameters:
      date - the LocalDate object to be formatted
      Returns:
      a string containing the formatted date
    • formatDate

      public static String formatDate(LocalDate date, String format)
      Formats a LocalDate object using the specified date format.
      Parameters:
      date - the LocalDate object to be formatted
      format - the format to be used for the date
      Returns:
      a string containing the formatted date
    • getDateString

      public static String getDateString(Object date)
      Returns a string representation of a date object.
      Parameters:
      date - the date object to be represented as a string
      Returns:
      a string representation of the date object
    • matchPattern

      @Deprecated public static Boolean matchPattern(String string, String pattern)
      Deprecated.
      This method is deprecated. Use SpEL matches to achieve the same functionality.
      This method is deprecated. Use SpEL matches to achieve the same functionality. Usage examples with SpEL matches: #inputString matches #regexPattern
      #inputString matches 'Hello,.*'
      Checks if a string matches a specified regular expression pattern.
      Parameters:
      string - the string to be checked
      pattern - the regular expression pattern to check the string against
      Returns:
      true if the string matches the pattern, false otherwise
    • coalesce

      public static Object coalesce(Object a, Object b)
      Returns the first non-null object of two objects.
      Parameters:
      a - the first object to be checked
      b - the second object to be checked
      Returns:
      the first non-null object of the two objects
    • getCurrentUserProperty

      public static Object getCurrentUserProperty(String key)
      Returns the property for the current user's session as specified in the userTokenFields of the casetivity.properties file for the application. These properties are evaluated and set when a user logs into the application and carried in the user's access token.
      Parameters:
      the - user property key to get
    • getUserProperty

      public static Object getUserProperty(com.ssgllc.fish.bpm.domain.BpmUser user, String key)
    • currentUserHasRole

      public static Boolean currentUserHasRole(String roleName)
    • currentUserHasARoleIn

      public static Boolean currentUserHasARoleIn(List<String> roleNames)
      Checks if the current user has any of the given roles.
      Parameters:
      roleNames - A list of role names to check.
      Returns:
      True if the current user has any of the specified roles, false otherwise.
    • userHasRole

      public static Boolean userHasRole(com.ssgllc.fish.bpm.domain.BpmUser user, String roleName)
      Checks if a given user has a specified role.
      Parameters:
      user - The user to check.
      roleName - The name of the role to check for.
      Returns:
      True if the user has the specified role, false otherwise.
    • userHasARoleIn

      public static Boolean userHasARoleIn(com.ssgllc.fish.bpm.domain.BpmUser user, List<String> roleNames)
      Checks if a given user has any of the given roles.
      Parameters:
      user - The user to check.
      roleNames - A list of role names to check.
      Returns:
      True if the user has any of the specified roles, false otherwise.
    • getCurrentUserId

      public static String getCurrentUserId()
      Gets the ID of the currently logged in user.
      Returns:
      The ID of the current user.
    • getCurrentUserUuid

      public static UUID getCurrentUserUuid()
      Gets the UUID of the currently logged in user.
      Returns:
      The UUID of the current user.
    • getCurrentUserUuidStr

      public static String getCurrentUserUuidStr()
      Gets the UUID string of the currently logged in user.
      Returns:
      The UUID string of the current user.
    • getCurrentUserLogin

      public static String getCurrentUserLogin()
      Gets the login name of the currently logged in user.
      Returns:
      The login name of the current user.
    • getCurrentUserEmail

      public static String getCurrentUserEmail()
      Gets the email of the currently logged in user.
      Returns:
      The email of the current user.
    • getUserIdByLogin

      @Deprecated public static String getUserIdByLogin(String login)
      Deprecated.
      Gets the ID of a user with a given login name. Use
      invalid @link
      {@link UserUtil.getUserIdByLogin(String)
      } instead.
      Parameters:
      login - The login name of the user to look up.
      Returns:
      The ID of the user with the specified login name.
    • getCurrentUserObject

      @Transactional(readOnly=true) public static com.ssgllc.fish.domain.gen.User getCurrentUserObject()
      Gets the User object for the currently logged in user.
      Returns:
      The User object for the current user.
    • getCurrentUserRoles

      public static List<String> getCurrentUserRoles()
      Gets a list of the roles that the currently logged in user belongs to.
      Returns:
      A list of the roles that the current user belongs to.
    • isFrontend

      public static boolean isFrontend()
    • isBackend

      public static boolean isBackend()