Class TmaBaseController
java.lang.Object
de.hybris.platform.b2ctelcotmfwebservices.v2.controller.TmaBaseController
- Direct Known Subclasses:
TmaCatalogApiController,TmaCategoryApiController,TmaChecklistActionApiController,TmaDeliveryModeApiController,TmaGeographicAddressApiController,TmaPartyRoleApiController,TmaPaymentMethodApiController,TmaProcessTypeManagementApiController,TmaProductApiController,TmaProductOfferingApiController,TmaProductOrderApiController,TmaProductSpecificationApiController,TmaRecommendationApiController,TmaReviewApiController,TmaShoppingCartApiController,TmaSubscriptionApiController,TmaSubscriptionBaseApiController,TmaUsageConsumptionReportApiController
Abstract Base Controller defining common methods and fields to be used by other API controllers.
- Since:
- 1810
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringaddDefaultFields(String fields) Retrieves the attributes that the user wants to receive in responseprotected static Stringprotected Stringprotected org.springframework.security.core.AuthenticationRetrieves the authentication informationprotected de.hybris.platform.webservicescommons.mapping.DataMapperprotected com.fasterxml.jackson.databind.ObjectMapperprotected StringgetQueryStringWithoutOffsetAndLimit(javax.servlet.http.HttpServletRequest request) protected StringgetRequestUrl(javax.servlet.http.HttpServletRequest request) protected org.springframework.http.ResponseEntitygetUnsuccessfulResponse(String errorMessage, Exception e, org.springframework.http.HttpStatus httpStatus) protected org.springframework.http.ResponseEntitygetUnsuccessfulResponseWithErrorRepresentation(String errorMessage, Exception e, int errorCode, String reason, org.springframework.http.HttpStatus httpStatus) protected StringRetrieves the current user which is represented by relatedPartyId, if is not empty, or the user for which the authentication token was obtainedprotected ErrorhandleInternalError(String message) protected org.springframework.http.ResponseEntity<Object>protected booleanvoidinit()protected Stringprotected StringsanitizeQueryString(String queryString)
-
Field Details
-
BAD_REQUEST
- See Also:
-
NOT_FOUND
- See Also:
-
-
Constructor Details
-
TmaBaseController
public TmaBaseController()
-
-
Method Details
-
init
@PostConstruct public void init() -
handleModelNotFoundException
-
getUnsuccessfulResponse
-
getUnsuccessfulResponseWithErrorRepresentation
-
handleInternalError
-
getRequestUrl
-
encodeUrl
-
getQueryStringWithoutOffsetAndLimit
-
handleTmaApiErrorInternal
-
sanitizeQueryString
-
filter
-
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 objectrelatedPartyId- the related party id- Returns:
- the id of current user null, if no user can be obtained
-
addDefaultFields
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
-
hasRole
protected boolean hasRole(String role, org.springframework.security.core.Authentication authentication) -
sanitize
-
getDataMapper
protected de.hybris.platform.webservicescommons.mapping.DataMapper getDataMapper() -
getObjectMapper
protected com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
-