Class DefaultServiceUtils

  • All Implemented Interfaces:
    ServiceUtils

    public class DefaultServiceUtils
    extends java.lang.Object
    implements ServiceUtils
    REST Service Utility Class
    • Constructor Detail

      • DefaultServiceUtils

        public DefaultServiceUtils()
    • Method Detail

      • convertGuidToBase64

        public java.lang.String convertGuidToBase64​(java.lang.String cartGuid)
                                             throws org.apache.commons.codec.DecoderException
        Description copied from interface: ServiceUtils
        Converts the GUid from a CartModel to an Base64 encoded GUid
        Specified by:
        convertGuidToBase64 in interface ServiceUtils
        Throws:
        org.apache.commons.codec.DecoderException
      • addLeadingZeros

        public java.lang.String addLeadingZeros​(java.lang.String productCode)
        Description copied from interface: ServiceUtils
        Adds the Leading zeros to Product Code
        Specified by:
        addLeadingZeros in interface ServiceUtils
        Returns:
        product Code with leading Zeros
      • formatStringtoInt

        public java.lang.Integer formatStringtoInt​(java.lang.String str)
        Description copied from interface: ServiceUtils
        It converts a String to an Integer
        Specified by:
        formatStringtoInt in interface ServiceUtils
        Parameters:
        str - String which represents a number
        Returns:
        Integer representation of the String
      • logMessageResponseAndCheckMessageType

        public boolean logMessageResponseAndCheckMessageType​(org.apache.log4j.Logger logger,
                                                             MessagesList messages)
        Description copied from interface: ServiceUtils
        Checks if the response messages has errors and logs the message
        Specified by:
        logMessageResponseAndCheckMessageType in interface ServiceUtils
        Returns:
        true if the response contains error messages
      • parseStringToDate

        public java.util.Date parseStringToDate​(java.lang.String dateAsString)
        Description copied from interface: ServiceUtils
        Converts a date string into a date object
        Specified by:
        parseStringToDate in interface ServiceUtils
        Returns:
        converted date
      • removeLeadingZeros

        public java.lang.String removeLeadingZeros​(java.lang.String productCode)
        Description copied from interface: ServiceUtils
        Removes the leading zeros from the product code
        Specified by:
        removeLeadingZeros in interface ServiceUtils
        Returns:
        product Code without leading Zeros
      • formatDateToString

        public java.lang.String formatDateToString​(java.util.Date date)
        Description copied from interface: ServiceUtils
        Converts a date into a date string
        Specified by:
        formatDateToString in interface ServiceUtils
        Returns:
        converted date as string
      • setDateFormat

        public void setDateFormat​(java.lang.String dateFormat)
        Parameters:
        dateFormat -
      • setTimeZone

        public void setTimeZone​(java.lang.String timeZone)
        Parameters:
        timeZone -
      • setLeadingZeroFormatter

        public void setLeadingZeroFormatter​(java.lang.String leadingZeroFormatter)
        Parameters:
        leadingZeroFormatter - the leadingZeroFormatter to set
      • createExternalIdForItem

        public java.lang.String createExternalIdForItem​(java.lang.String itemNo,
                                                        java.lang.String guid)
        Specified by:
        createExternalIdForItem in interface ServiceUtils
        Parameters:
        itemNo -
        guid -
        Returns:
        String
      • extractItemIdFromExternalId

        public java.lang.String extractItemIdFromExternalId​(java.lang.String externalId)
        Specified by:
        extractItemIdFromExternalId in interface ServiceUtils
        Returns:
        itemId