Class DefaultServiceUtils
- java.lang.Object
-
- com.sap.retail.oaa.commerce.services.common.util.impl.DefaultServiceUtils
-
- All Implemented Interfaces:
ServiceUtils
public class DefaultServiceUtils extends java.lang.Object implements ServiceUtils
REST Service Utility Class
-
-
Constructor Summary
Constructors Constructor Description DefaultServiceUtils()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringaddLeadingZeros(java.lang.String productCode)Adds the Leading zeros to Product Codejava.lang.StringconvertGuidToBase64(java.lang.String cartGuid)Converts the GUid from a CartModel to an Base64 encoded GUidjava.lang.StringcreateExternalIdForItem(java.lang.String itemNo, java.lang.String guid)java.lang.StringextractItemIdFromExternalId(java.lang.String externalId)java.lang.StringformatDateToString(java.util.Date date)Converts a date into a date stringjava.lang.IntegerformatStringtoInt(java.lang.String str)It converts a String to an IntegerbooleanlogMessageResponseAndCheckMessageType(org.apache.log4j.Logger logger, MessagesList messages)Checks if the response messages has errors and logs the messagejava.util.DateparseStringToDate(java.lang.String dateAsString)Converts a date string into a date objectjava.lang.StringremoveLeadingZeros(java.lang.String productCode)Removes the leading zeros from the product codevoidsetDateFormat(java.lang.String dateFormat)voidsetLeadingZeroFormatter(java.lang.String leadingZeroFormatter)voidsetTimeZone(java.lang.String timeZone)
-
-
-
Method Detail
-
convertGuidToBase64
public java.lang.String convertGuidToBase64(java.lang.String cartGuid) throws org.apache.commons.codec.DecoderExceptionDescription copied from interface:ServiceUtilsConverts the GUid from a CartModel to an Base64 encoded GUid- Specified by:
convertGuidToBase64in interfaceServiceUtils- Throws:
org.apache.commons.codec.DecoderException
-
addLeadingZeros
public java.lang.String addLeadingZeros(java.lang.String productCode)
Description copied from interface:ServiceUtilsAdds the Leading zeros to Product Code- Specified by:
addLeadingZerosin interfaceServiceUtils- Returns:
- product Code with leading Zeros
-
formatStringtoInt
public java.lang.Integer formatStringtoInt(java.lang.String str)
Description copied from interface:ServiceUtilsIt converts a String to an Integer- Specified by:
formatStringtoIntin interfaceServiceUtils- 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:ServiceUtilsChecks if the response messages has errors and logs the message- Specified by:
logMessageResponseAndCheckMessageTypein interfaceServiceUtils- Returns:
- true if the response contains error messages
-
parseStringToDate
public java.util.Date parseStringToDate(java.lang.String dateAsString)
Description copied from interface:ServiceUtilsConverts a date string into a date object- Specified by:
parseStringToDatein interfaceServiceUtils- Returns:
- converted date
-
removeLeadingZeros
public java.lang.String removeLeadingZeros(java.lang.String productCode)
Description copied from interface:ServiceUtilsRemoves the leading zeros from the product code- Specified by:
removeLeadingZerosin interfaceServiceUtils- Returns:
- product Code without leading Zeros
-
formatDateToString
public java.lang.String formatDateToString(java.util.Date date)
Description copied from interface:ServiceUtilsConverts a date into a date string- Specified by:
formatDateToStringin interfaceServiceUtils- 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:
createExternalIdForItemin interfaceServiceUtils- Parameters:
itemNo-guid-- Returns:
- String
-
extractItemIdFromExternalId
public java.lang.String extractItemIdFromExternalId(java.lang.String externalId)
- Specified by:
extractItemIdFromExternalIdin interfaceServiceUtils- Returns:
- itemId
-
-