java.lang.Object
de.hybris.platform.b2ctelcotmfwebservices.v3.controller.TmaBaseController
Direct Known Subclasses:
TmaGeographicAddressApiController, TmaGeographicAddressValidationApiController, TmaProductApiController, TmaProductOfferingApiController, TmaProductOfferingPriceApiController, TmaProductOrderApiController, TmaProductSpecificationApiController, TmaRecommendationApiController

public abstract class TmaBaseController extends Object
Abstract Base Controller defining common methods and fields to be used by other API controllers.
Since:
2007
  • Constructor Details

    • TmaBaseController

      public TmaBaseController()
  • Method Details

    • init

      @PostConstruct public void init()
    • handleModelNotFoundException

      @ResponseStatus(NOT_FOUND) @ResponseBody @ExceptionHandler(de.hybris.platform.servicelayer.exceptions.ModelNotFoundException.class) public Error handleModelNotFoundException(Exception ex)
    • getAuthentication

      protected org.springframework.security.core.Authentication getAuthentication()
      Retrieves the authentication information
      Returns:
      the authentication object for current spring context
    • getUser

      protected String getUser(org.springframework.security.core.Authentication authentication, String relatedPartyId)
      Retrieves the current user which is represented by relatedPartyId, if is not empty, or the user for which the authentication token was obtained
      Parameters:
      authentication - the authentication object
      relatedPartyId - the related party id
      Returns:
      the id of current user null, if no user can be obtained
    • getUnsuccessfulResponse

      protected org.springframework.http.ResponseEntity getUnsuccessfulResponse(String errorMessage, Exception e, org.springframework.http.HttpStatus httpStatus)
    • getUnsuccessfulResponse

      protected org.springframework.http.ResponseEntity getUnsuccessfulResponse(String message, org.springframework.http.HttpStatus httpStatus)
    • getUnsuccessfulResponseWithErrorRepresentation

      protected org.springframework.http.ResponseEntity getUnsuccessfulResponseWithErrorRepresentation(String errorMessage, Exception e, int errorCode, String reason, org.springframework.http.HttpStatus httpStatus)
    • handleInternalError

      protected Error handleInternalError(String message)
    • getRequestUrl

      protected String getRequestUrl(javax.servlet.http.HttpServletRequest request)
    • encodeUrl

      protected static String encodeUrl(String url)
    • getQueryStringWithoutOffsetAndLimit

      protected String getQueryStringWithoutOffsetAndLimit(javax.servlet.http.HttpServletRequest request)
    • handleTmaApiErrorInternal

      protected org.springframework.http.ResponseEntity<Object> handleTmaApiErrorInternal(Exception e)
    • sanitizeQueryString

      protected String sanitizeQueryString(String queryString)
    • filter

      protected String filter(String value)
    • setCatalogVersion

      protected boolean setCatalogVersion(String baseSiteId, String catalogId, String catalogVersion)
    • addDefaultFields

      protected String addDefaultFields(String fields)
      Retrieves the attributes that the user wants to receive in response
      Parameters:
      fields - a string representing attributes we want to receive in response
      Returns:
      a string consisting of default fields id,href and fields given by the user in request null, if user didn't provide any value for fields attribute
    • sanitize

      protected String sanitize(String input)
    • getDataMapper

      protected de.hybris.platform.webservicescommons.mapping.DataMapper getDataMapper()
    • getObjectMapper

      protected com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
    • getTmaCatalogVersionFacade

      protected TmaCatalogVersionFacade getTmaCatalogVersionFacade()