Class DefaultServiceUtils

java.lang.Object
com.sap.retail.oaa.commerce.services.common.util.impl.DefaultServiceUtils
All Implemented Interfaces:
ServiceUtils

public class DefaultServiceUtils extends Object implements ServiceUtils
REST Service Utility Class
  • Constructor Details

    • DefaultServiceUtils

      public DefaultServiceUtils()
  • Method Details

    • convertGuidToBase64

      public String convertGuidToBase64(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 String addLeadingZeros(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 Integer formatStringtoInt(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 Date parseStringToDate(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 String removeLeadingZeros(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 String formatDateToString(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(String dateFormat)
      Parameters:
      dateFormat -
    • setTimeZone

      public void setTimeZone(String timeZone)
      Parameters:
      timeZone -
    • setLeadingZeroFormatter

      public void setLeadingZeroFormatter(String leadingZeroFormatter)
      Parameters:
      leadingZeroFormatter - the leadingZeroFormatter to set
    • createExternalIdForItem

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

      public String extractItemIdFromExternalId(String externalId)
      Specified by:
      extractItemIdFromExternalId in interface ServiceUtils
      Returns:
      itemId