Package com.hybris.yprofile.common
Class Utils
java.lang.Object
com.hybris.yprofile.common.Utils
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringformatDate(Date d) static Stringstatic Optional<ConsentModel>getActiveConsentModelForCustomerAndBaseSite(BaseSiteModel baseSiteModel, CustomerModel customerModel, CommerceConsentService commerceConsentService) Gets the active consent model for the given baseSite and user from theCommerceConsentService.static Optional<ConsentModel>getActiveConsentModelFromEvent(AbstractCommerceUserEvent event, CommerceConsentService commerceConsentService) Gets the active consent model for the base-site and customer pertaining to the event from theCommerceConsentService.static StringgetActiveConsentReferenceForCustomerAndBaseSite(BaseSiteModel baseSiteModel, CustomerModel customerModel, CommerceConsentService commerceConsentService) Gets the ConsentReference from the consent model for the base-site and customer fromCommerceConsentService.static StringgetActiveConsentReferenceFromEvent(AbstractCommerceUserEvent event, CommerceConsentService commerceConsentService) Gets the ConsentReference from the consent model for the base-site and customer of the event fromCommerceConsentService.static Optional<javax.servlet.http.Cookie>static StringparseObjectToJson(Object obj) static StringremapSiteId(String siteId) static voidremoveCookie(EnhancedCookieGenerator enhancedCookieGenerator, javax.servlet.http.HttpServletResponse response, String cookieName) static voidsetCookie(EnhancedCookieGenerator enhancedCookieGenerator, javax.servlet.http.HttpServletResponse response, String cookieName, String cookieValue, boolean isSessionCookie)
-
Method Details
-
formatDouble
-
formatDate
-
remapSiteId
-
getHeader
-
getCookie
-
setCookie
public static void setCookie(EnhancedCookieGenerator enhancedCookieGenerator, javax.servlet.http.HttpServletResponse response, String cookieName, String cookieValue, boolean isSessionCookie) -
removeCookie
public static void removeCookie(EnhancedCookieGenerator enhancedCookieGenerator, javax.servlet.http.HttpServletResponse response, String cookieName) -
parseObjectToJson
-
getActiveConsentModelFromEvent
public static Optional<ConsentModel> getActiveConsentModelFromEvent(AbstractCommerceUserEvent event, CommerceConsentService commerceConsentService) Gets the active consent model for the base-site and customer pertaining to the event from theCommerceConsentService.- Parameters:
event- the event containing the user/customer model and the base sitecommerceConsentService- the service used to obtain the active consentModel- Returns:
- an optional of the active consent model for this user and base site if present
-
getActiveConsentReferenceFromEvent
public static String getActiveConsentReferenceFromEvent(AbstractCommerceUserEvent event, CommerceConsentService commerceConsentService) Gets the ConsentReference from the consent model for the base-site and customer of the event fromCommerceConsentService.- Parameters:
event- the event containing the user/customer model and the base sitecommerceConsentService- the service used to obtain the active consentModel- Returns:
- consent-reference as string if present, null otherwise
-
getActiveConsentReferenceForCustomerAndBaseSite
public static String getActiveConsentReferenceForCustomerAndBaseSite(BaseSiteModel baseSiteModel, CustomerModel customerModel, CommerceConsentService commerceConsentService) Gets the ConsentReference from the consent model for the base-site and customer fromCommerceConsentService.- Parameters:
baseSiteModel- the model containing the current baseSitecustomerModel- the model containing user infocommerceConsentService- the service used to obtain the active consentModel- Returns:
- consent-reference as string if present, null otherwise
-
getActiveConsentModelForCustomerAndBaseSite
public static Optional<ConsentModel> getActiveConsentModelForCustomerAndBaseSite(BaseSiteModel baseSiteModel, CustomerModel customerModel, CommerceConsentService commerceConsentService) Gets the active consent model for the given baseSite and user from theCommerceConsentService.- Parameters:
baseSiteModel- the model containing the current baseSitecustomerModel- the model containing user infocommerceConsentService- the service used to obtain the active consentModel- Returns:
- an optional of the active consent model for this user and base site
-