com.ibm.commerce.tools.segmentation

Class SegmentUtil

  • java.lang.Object
    • com.ibm.commerce.tools.segmentation.SegmentUtil
    • Field Detail

    • Constructor Detail

      • SegmentUtil

        public SegmentUtil()
    • Method Detail

      • substitute

        public static java.lang.String substitute(java.lang.String message,
                                                  java.lang.Object[] arguments)
        Substitutes message parameters with arguments. Parameters are of the form {n}.
        Parameters:
        message - A text message with imbedded parameters.
        arguments - An array of arguments.
      • substitute

        public static java.lang.String substitute(java.lang.String message,
                                                  java.lang.Object arg1)
        Substitutes message parameters with arguments. Parameters are of the form {n}.
        Parameters:
        message - A text message with imbedded parameters.
        arg1 - An argument.
      • substitute

        public static java.lang.String substitute(java.lang.String message,
                                                  java.lang.Object arg1,
                                                  java.lang.Object arg2)
        Substitutes message parameters with arguments. Parameters are of the form {n}.
        Parameters:
        message - A text message with imbedded parameters.
        arg1 - An argument.
        arg2 - An argument.
      • substitute

        public static java.lang.String substitute(java.lang.String message,
                                                  java.lang.Object arg1,
                                                  java.lang.Object arg2,
                                                  java.lang.Object arg3)
        Substitutes message parameters with arguments. Parameters are of the form {n}.
        Parameters:
        message - A text message with imbedded parameters.
        arg1 - An argument.
        arg2 - An argument.
        arg3 - An argument.
      • substitute

        public static java.lang.String substitute(java.lang.String message,
                                                  int arg1)
        Substitutes message parameters with arguments. Parameters are of the form {n}.
        Parameters:
        message - A text message with imbedded parameters.
        arg1 - An integer argument.
      • substitute

        public static java.lang.String substitute(java.lang.String message,
                                                  int arg1,
                                                  int arg2)
        Substitutes message parameters with arguments. Parameters are of the form {n}.
        Parameters:
        message - A text message with imbedded parameters.
        arg1 - An integer argument.
        arg2 - An integer argument.
      • toBoolean

        public static boolean toBoolean(java.lang.String value)
        Converts a string value to boolean.
        Returns:
        true if the string is "true".
      • toInteger

        public static java.lang.Integer toInteger(java.lang.String value)
        Converts a string value to Integer.
        Returns:
        An Integer object or null.
      • toLong

        public static java.lang.Long toLong(java.lang.String value)
        Converts a string value to Long.
        Returns:
        A Long object or null.
      • toDouble

        public static java.lang.Double toDouble(java.lang.String value)
        Converts a string value to Double.
        Returns:
        A Double object or null .
      • toBigDecimal

        public static java.math.BigDecimal toBigDecimal(java.lang.String value)
        Converts a string value to BigDecimal.
        Returns:
        A BigDecimal object or null.
      • toVector

        public static java.util.Vector toVector(java.lang.Object value)
        Converts an object to a Vector.
        Returns:
        A Vector object or null.
      • toStringDate

        public static java.lang.String toStringDate(java.lang.String year,
                                                    java.lang.String month,
                                                    java.lang.String day)
        Constructs a string date from year, month, and day strings.
        Parameters:
        year - The year.
        month - The month.
        day - The day.
        Returns:
        A date of the form yyyy-mm-dd.
      • toStringDate

        public static java.lang.String toStringDate(java.sql.Timestamp timestamp)
        Constructs a string date from a Timestamp object.
        Parameters:
        timestamp - A timestamp.
        Returns:
        A date of the form yyyy-mm-dd.
      • getDay

        public static java.lang.String getDay(java.lang.String stringDate)
        Gets the day portion of a string date.
        Parameters:
        stringDate - A date of the form yyyy-mm-dd.
        Returns:
        The day portion of the date.
      • getMonth

        public static java.lang.String getMonth(java.lang.String stringDate)
        Gets the month portion of a string date.
        Parameters:
        stringDate - A date of the form yyyy-mm-dd.
        Returns:
        The month portion of the date.
      • getYear

        public static java.lang.String getYear(java.lang.String stringDate)
        Gets the year portion of a string date.
        Parameters:
        stringDate - A date of the form yyyy-mm-dd.
        Returns:
        The year portion of the date.
      • parseUserRegistrationValues

        public static java.util.Vector parseUserRegistrationValues(java.lang.String options)
        Parses a string of value or national language string pairs and puts the values into a vector. The values are separated from the national language string by a semicolon. The value or national language string pairs are separated from each other by '|'.
        Parameters:
        options - A string of value or national language string pairs.
        Returns:
        A Vector of values.
      • parseUserRegistrationDisplayValues

        public static java.util.Vector parseUserRegistrationDisplayValues(java.lang.String options)
        Parses a string of value or national language string pairs and puts the display values into a vector. The values are separated from the national language string by a semicolon. The value or national language string pairs are separated from each other by '|'.
        Parameters:
        options - A string of value or national language string pairs.
        Returns:
        A Vector of display values.
      • truncate

        public static java.lang.String truncate(java.lang.String string,
                                                int length)
        Truncates a string to the specified length in bytes..
        Parameters:
        string - The string to be truncated.
        length - The maximum number of bytes.
        Returns:
        The truncated string.
      • ensureProfileFits

        public static java.lang.String ensureProfileFits(java.lang.String profile,
                                                         java.lang.Object segmentId)
        Ensures that the profile XML document fits into the CONDITIONS column of the MBRGRPCOND table.
        Parameters:
        profile - The XML document.
        segmentId - The member group ID.
        Returns:
        An XML document that will fit.
      • stripNonAlphanumericCharacters

        public static java.lang.String stripNonAlphanumericCharacters(java.lang.String string)
        Strips the non alphanumeric characters from the specified string.
        Parameters:
        string - A string.
        Returns:
        The string with the alphanumeric characters removed.
      • constructStringListCondition

        public static Condition constructStringListCondition(java.lang.String op,
                                                             java.util.Vector values,
                                                             java.lang.String variable)
        Constructs a Condition object from an operator, a vector of values and a variable.
        Parameters:
        op - An operator.
        values - A vector of values.
        variable - The variable name.
        Returns:
        A Condition object.
      • getResourceBundle

        public static java.util.Hashtable getResourceBundle(java.lang.String baseName,
                                                            java.util.Locale locale)
        Gets a hashtable with all of the keys of the specified resource bundle.
        Parameters:
        baseName - The base name of the resource bundle.
        locale - The desired locale name.
        Returns:
        A Hashtable object that has all of the keys in the resource bundle.