Package com.skava.ratingandreviews.web
Class RatingsReviewsController
java.lang.Object
com.skava.ratingandreviews.web.RatingsReviewsController
The Class RatingReviewController.
This class is the Rest Controller class. All the RatingReview API calls are mapped to this class. It is the starting point of all the RatingReview API calls.
-
Constructor Summary
ConstructorsConstructorDescriptionRatingsReviewsController
(CreateRatingReviewService createRatingReviewPreferenceService, FindbyIdRatingReviewService findbyIdRatingReviewPreferenceService, DeleteRatingReviewService deleteRatingReviewPreferenceService, UpdateRatingReviewService updateRatingReviewPreferenceService, FindALLRatingReviewService findALLRatingReviewService, PatchUpdateImageService patchUpdateImageService, com.skava.core.auth.AuthTokenHandler authTokenHandler) -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<RatingReviewResponse>
createRatingsReviews
(long collectionId, String authToken, String userId, String storeId, String locale, RatingsReviewsRequest request) method CreateRatingReviews Creates the RatingRevieworg.springframework.http.ResponseEntity<RatingReviewResponse>
deleteRatingsReviewsById
(String authToken, String versionId, String storeId, long collectionId, String locale, long id) method DeleteRatingReviewsById This method is used to delete the RatingReviews by Id.org.springframework.http.ResponseEntity<RatingReviewsResponse>
getRatingsReviewsAll
(String versionId, String authToken, long collectionId, String storeId, com.skava.core.qdsl.sort.EcomSorts sort, String filters, String locale, int page, int size, boolean skipTotalCount, boolean enableReviewSummary, boolean enableHashtags) method GetRatingReviewAll This method is used to get RatingReview.org.springframework.http.ResponseEntity<RatingReviewResponse>
getRatingsReviewsById
(String authToken, String versionId, String userId, long collectionId, String storeId, String locale, long id) method getRatingReviewById This method is used to get the RatingReview by Id.static void
initBinder
(org.springframework.web.bind.WebDataBinder binder) org.springframework.http.ResponseEntity<RatingReviewResponse>
updateRatingsReviews
(String authToken, String versionId, String storeId, long collectionId, String locale, long ratingsReviewsId, RatingsReviewsRequest request) method UpdateRatingReviews This method is used to Update the RatingReview.org.springframework.http.ResponseEntity<RatingReviewResponse>
uploadImages
(long collectionId, String authToken, String userId, String storeId, String locale, org.springframework.web.multipart.MultipartFile[] files, long id) method UploadImages This methos is used to uploadimages.
-
Constructor Details
-
RatingsReviewsController
@Autowired public RatingsReviewsController(CreateRatingReviewService createRatingReviewPreferenceService, FindbyIdRatingReviewService findbyIdRatingReviewPreferenceService, DeleteRatingReviewService deleteRatingReviewPreferenceService, UpdateRatingReviewService updateRatingReviewPreferenceService, FindALLRatingReviewService findALLRatingReviewService, PatchUpdateImageService patchUpdateImageService, com.skava.core.auth.AuthTokenHandler authTokenHandler)
-
-
Method Details
-
createRatingsReviews
@ResponseStatus(CREATED) @PostMapping("") @PreAuthorize("hasRoleForServiceAndCollection(\'ROLE_GUEST\',\'ratingsreviews\', #collectionId) or hasRoleForServiceAndCollection(\'ROLE_REG_USER\',\'ratingsreviews\', #collectionId) or hasPrivilegeForServiceAndCollection( \'ratingsreviews/manage/ratingsreviews\',\'ratingsreviews\', #collectionId) or hasPrivilegeForServiceAndCollection( \'ratingsreviews/create/ratingsreviews\',\'ratingsreviews\', #collectionId) or hasPrivilegeForServiceAndCollection( \'ratingsreviews/manage/moderator\',\'ratingsreviews\', #collectionId)") public org.springframework.http.ResponseEntity<RatingReviewResponse> createRatingsReviews(@RequestHeader(required=true) long collectionId, @RequestHeader(value="x-auth-token",required=true) String authToken, @RequestHeader(required=false) String userId, @RequestHeader(value="x-store-id",required=false) String storeId, @RequestParam(required=false,defaultValue="en_US") @IgnoreAudit String locale, @RequestBody(required=true) RatingsReviewsRequest request) method CreateRatingReviews Creates the RatingReview- Parameters:
authToken
- This field holds a valid authorization token generated using the Authorization microservice for an user. Auth token (JWT format) represents claims containing roles and privileges of the user accessing this API. JSON Web Token (JWT) is an open standard (RFC 7519) that defines a compact and self-contained way for securely transmitting information between parties as a JSON object. Since the token is a required field for this API it has to be generated before hand by invoking the /auth/sessions API provided by Authorization microservice. The output is three Base64 strings separated by dots that can be easily passed in HTML and HTTP environments, while being more compact when compared to XML-based standards such as SAML. Thus generated token has to be passed to this service and the request will be processed only if the following conditions are met: Token validation against the secret key Expiry time should be in the future Necessary privileges are available for the user to perform the action on the subjected resource.storeId
- It contains the storeId associated with ratingandreviews.collectionId
- This field holds a valid collection identifier of this microservice and requested operation will be performed on this collection identifier. Collection is the top most entity of a microservice under which all the other entities/resources reside. Each collection represents an instance of the microservice with configured properties and these properties c an be modified to bring in a different behavior per collection of the same microservice. Store association is the process of associating a microservice collection to a store along with its respective sub-entity. This way storefront can fetch/store the required information from that respective association.userId
- Holds the identifier of the user.locale
- API Response and error messages will be responded in the mentioned locale. Indicates the locale in which the API response and the error messages will be responded. The locale should be mentioned in the Java standard locale format.request
- Holds the information about the request.- Returns:
- ResponseEntity HOlds the reponse of the output in the form of ResponseEntity.
-
uploadImages
@ResponseStatus(ACCEPTED) @PostMapping(value="/{id}/images", consumes="multipart/form-data") @PreAuthorize("hasRoleForServiceAndCollection(\'ROLE_GUEST\',\'ratingsreviews\', #collectionId) or hasRoleForServiceAndCollection(\'ROLE_REG_USER\',\'ratingsreviews\', #collectionId) or hasPrivilegeForServiceAndCollection( \'ratingsreviews/manage/ratingsreviews\',\'ratingsreviews\', #collectionId) or hasPrivilegeForServiceAndCollection( \'ratingsreviews/create/ratingsreviews\',\'ratingsreviews\', #collectionId) or hasPrivilegeForServiceAndCollection( \'ratingsreviews/manage/moderator\',\'ratingsreviews\', #collectionId)") public org.springframework.http.ResponseEntity<RatingReviewResponse> uploadImages(@RequestHeader(required=true) long collectionId, @RequestHeader(value="x-auth-token",required=true) String authToken, @RequestHeader(required=false) String userId, @RequestHeader(value="x-store-id",required=false) String storeId, @RequestParam(required=false,defaultValue="en_US") @IgnoreAudit String locale, @RequestPart(name="files",required=false) org.springframework.web.multipart.MultipartFile[] files, @PathVariable long id) method UploadImages This methos is used to uploadimages.- Parameters:
authToken
- This field holds a valid authorization token generated using the Authorization microservice for an user. Auth token (JWT format) represents claims containing roles and privileges of the user accessing this API. JSON Web Token (JWT) is an open standard (RFC 7519) that defines a compact and self-contained way for securely transmitting information between parties as a JSON object. Since the token is a required field for this API it has to be generated before hand by invoking the /auth/sessions API provided by Authorization microservice. The output is three Base64 strings separated by dots that can be easily passed in HTML and HTTP environments, while being more compact when compared to XML-based standards such as SAML. Thus generated token has to be passed to this service and the request will be processed only if the following conditions are met: Token validation against the secret key Expiry time should be in the future Necessary privileges are available for the user to perform the action on the subjected resource.storeId
- It contains the storeId associated with ratingandreviews.collectionId
- This field holds a valid collection identifier of this microservice and requested operation will be performed on this collection identifier. Collection is the top most entity of a microservice under which all the other entities/resources reside. Each collection represents an instance of the microservice with configured properties and these properties c an be modified to bring in a different behavior per collection of the same microservice. Store association is the process of associating a microservice collection to a store along with its respective sub-entity. This way storefront can fetch/store the required information from that respective association.userId
- Holds the identifier of the user.locale
- API Response and error messages will be responded in the mentioned locale. Indicates the locale in which the API response and the error messages will be responded. The locale should be mentioned in the Java standard locale format.files
- Holds the value for files. Changed required to false because in newer versions of spring-boot passing empty file in place of files is not allowed. If {} is passed as files data, controller will not be executed and 400 will be returned by spring-boot itself. Instead the required logic can be manually handled in case of null value for files.id
- HOlds the value for identifier .- Returns:
- ResponseEntity HOlds the reponse of the output in the form of ResponseEntity.
-
getRatingsReviewsById
@ResponseStatus(OK) @GetMapping("/{id}") @PreAuthorize("hasRoleForServiceAndCollection(\'ROLE_GUEST\',\'ratingsreviews\', #collectionId) or hasRoleForServiceAndCollection(\'ROLE_REG_USER\',\'ratingsreviews\', #collectionId) or hasPrivilegeForServiceAndCollection( \'ratingsreviews/manage/ratingsreviews\',\'ratingsreviews\', #collectionId) or hasPrivilegeForServiceAndCollection( \'ratingsreviews/view/ratingsreviews\',\'ratingsreviews\', #collectionId) or hasPrivilegeForServiceAndCollection( \'ratingsreviews/manage/moderator\',\'ratingsreviews\', #collectionId)") public org.springframework.http.ResponseEntity<RatingReviewResponse> getRatingsReviewsById(@RequestHeader(value="x-auth-token",required=true) String authToken, @RequestHeader(value="x-version-id",required=false) String versionId, @RequestHeader(required=false) String userId, @RequestHeader(required=true) long collectionId, @RequestHeader(value="x-store-id",required=false) String storeId, @RequestParam(required=false,defaultValue="en_US") @IgnoreAudit String locale, @PathVariable long id) method getRatingReviewById This method is used to get the RatingReview by Id.- Parameters:
authToken
- This field holds a valid authorization token generated using the Authorization microservice for an user. Auth token (JWT format) represents claims containing roles and privileges of the user accessing this API. JSON Web Token (JWT) is an open standard (RFC 7519) that defines a compact and self-contained way for securely transmitting information between parties as a JSON object. Since the token is a required field for this API it has to be generated before hand by invoking the /auth/sessions API provided by Authorization microservice. The output is three Base64 strings separated by dots that can be easily passed in HTML and HTTP environments, while being more compact when compared to XML-based standards such as SAML. Thus generated token has to be passed to this service and the request will be processed only if the following conditions are met: Token validation against the secret key Expiry time should be in the future Necessary privileges are available for the user to perform the action on the subjected resource.storeId
- It contains the storeId associated with ratingandreviews.collectionId
- This field holds a valid collection identifier of this microservice and requested operation will be performed on this collection identifier. Collection is the top most entity of a microservice under which all the other entities/resources reside. Each collection represents an instance of the microservice with configured properties and these properties c an be modified to bring in a different behavior per collection of the same microservice. Store association is the process of associating a microservice collection to a store along with its respective sub-entity. This way storefront can fetch/store the required information from that respective association.userId
- Holds the identifier of the user.locale
- API Response and error messages will be responded in the mentioned locale. Indicates the locale in which the API response and the error messages will be responded. The locale should be mentioned in the Java standard locale format.versionId
- holds the identfier of the version.id
- holds the value for identifier.- Returns:
- ResponseEntity gives output in the form of ResponseEntity.
-
getRatingsReviewsAll
@ResponseStatus(OK) @GetMapping("") @PreAuthorize("hasRoleForServiceAndCollection(\'ROLE_GUEST\',\'ratingsreviews\', #collectionId) or hasRoleForServiceAndCollection(\'ROLE_REG_USER\',\'ratingsreviews\', #collectionId) or hasPrivilegeForServiceAndCollection( \'ratingsreviews/manage/ratingsreviews\',\'ratingsreviews\', #collectionId) or hasPrivilegeForServiceAndCollection( \'ratingsreviews/view/ratingsreviews\',\'ratingsreviews\', #collectionId) or hasPrivilegeForServiceAndCollection( \'ratingsreviews/manage/moderator\',\'ratingsreviews\', #collectionId)") public org.springframework.http.ResponseEntity<RatingReviewsResponse> getRatingsReviewsAll(@RequestHeader(value="x-version-id",required=false) String versionId, @RequestHeader(value="x-auth-token",required=false) String authToken, @RequestHeader(required=true) long collectionId, @RequestHeader(value="x-store-id",required=false) String storeId, @RequestParam(required=false) com.skava.core.qdsl.sort.EcomSorts sort, @RequestParam(required=false) String filters, @RequestParam(required=false,defaultValue="en_US") @IgnoreAudit String locale, @RequestParam(required=false,defaultValue="1") int page, @RequestParam(required=false,defaultValue="10") int size, @RequestParam(required=false,defaultValue="false") @IgnoreAudit boolean skipTotalCount, @RequestParam(required=false,defaultValue="false") @IgnoreAudit boolean enableReviewSummary, @RequestParam(required=false,defaultValue="false") @IgnoreAudit boolean enableHashtags) method GetRatingReviewAll This method is used to get RatingReview.- Parameters:
authToken
- This field holds a valid authorization token generated using the Authorization microservice for an user. Auth token (JWT format) represents claims containing roles and privileges of the user accessing this API. JSON Web Token (JWT) is an open standard (RFC 7519) that defines a compact and self-contained way for securely transmitting information between parties as a JSON object. Since the token is a required field for this API it has to be generated before hand by invoking the /auth/sessions API provided by Authorization microservice. The output is three Base64 strings separated by dots that can be easily passed in HTML and HTTP environments, while being more compact when compared to XML-based standards such as SAML. Thus generated token has to be passed to this service and the request will be processed only if the following conditions are met: Token validation against the secret key Expiry time should be in the future Necessary privileges are available for the user to perform the action on the subjected resource.storeId
- It contains the storeId associated with ratingandreviews.collectionId
- This field holds a valid collection identifier of this microservice and requested operation will be performed on this collection identifier. Collection is the top most entity of a microservice under which all the other entities/resources reside. Each collection represents an instance of the microservice with configured properties and these properties c an be modified to bring in a different behavior per collection of the same microservice. Store association is the process of associating a microservice collection to a store along with its respective sub-entity. This way storefront can fetch/store the required information from that respective association.locale
- API Response and error messages will be responded in the mentioned locale. Indicates the locale in which the API response and the error messages will be responded. The locale should be mentioned in the Java standard locale format.page
- Page denotes the requested page number.size
- Size denotes the number of records a page can have.versionId
- holds the identfier of the version.sort
- holds the value for sort .filters
- holds the value for filters.enableReviewSummary
- if set true it will generate review summary.enableHashtags
- if set true it will generate hashtags for review.- Returns:
- ResponseEntity gives output in the form of ResponseEntity.
-
updateRatingsReviews
@ResponseStatus(ACCEPTED) @PreAuthorize("hasRoleForServiceAndCollection(\'ROLE_GUEST\',\'ratingsreviews\', #collectionId) or hasRoleForServiceAndCollection(\'ROLE_REG_USER\',\'ratingsreviews\', #collectionId) or hasPrivilegeForServiceAndCollection( \'ratingsreviews/manage/ratingsreviews\',\'ratingsreviews\', #collectionId) or hasPrivilegeForServiceAndCollection( \'ratingsreviews/update/ratingsreviews\',\'ratingsreviews\', #collectionId) or hasPrivilegeForServiceAndCollection( \'ratingsreviews/manage/moderator\',\'ratingsreviews\', #collectionId)") @PatchMapping("/{id}") public org.springframework.http.ResponseEntity<RatingReviewResponse> updateRatingsReviews(@RequestHeader(value="x-auth-token",required=true) String authToken, @RequestHeader(value="x-version-id",required=false) String versionId, @RequestHeader(value="x-store-id",required=false) String storeId, @RequestHeader(required=true) long collectionId, @RequestParam(required=false,defaultValue="en_US") @IgnoreAudit String locale, @PathVariable("id") long ratingsReviewsId, @RequestBody(required=true) RatingsReviewsRequest request) method UpdateRatingReviews This method is used to Update the RatingReview.- Parameters:
authToken
- This field holds a valid authorization token generated using the Authorization microservice for an user. Auth token (JWT format) represents claims containing roles and privileges of the user accessing this API. JSON Web Token (JWT) is an open standard (RFC 7519) that defines a compact and self-contained way for securely transmitting information between parties as a JSON object. Since the token is a required field for this API it has to be generated before hand by invoking the /auth/sessions API provided by Authorization microservice. The output is three Base64 strings separated by dots that can be easily passed in HTML and HTTP environments, while being more compact when compared to XML-based standards such as SAML. Thus generated token has to be passed to this service and the request will be processed only if the following conditions are met: Token validation against the secret key Expiry time should be in the future Necessary privileges are available for the user to perform the action on the subjected resource.versionId
- holds the identfier of the version.ratingsReviewsId
- Holdes the identifier for ratingsReviews.request
- Holds the information about the request.storeId
- It contains the storeId associated with ratingandreviews.collectionId
- This field holds a valid collection identifier of this microservice and requested operation will be performed on this collection identifier. Collection is the top most entity of a microservice under which all the other entities/resources reside. Each collection represents an instance of the microservice with configured properties and these properties c an be modified to bring in a different behavior per collection of the same microservice. Store association is the process of associating a microservice collection to a store along with its respective sub-entity. This way storefront can fetch/store the required information from that respective association.locale
- API Response and error messages will be responded in the mentioned locale. Indicates the locale in which the API response and the error messages will be responded. The locale should be mentioned in the Java standard locale format.- Returns:
- ResponseEntity holds the value of the response entity
-
deleteRatingsReviewsById
@ResponseStatus(OK) @PreAuthorize("hasRoleForServiceAndCollection(\'ROLE_GUEST\',\'ratingsreviews\', #collectionId) or hasRoleForServiceAndCollection(\'ROLE_REG_USER\',\'ratingsreviews\', #collectionId) or hasPrivilegeForServiceAndCollection( \'ratingsreviews/manage/ratingsreviews\',\'ratingsreviews\', #collectionId) or hasPrivilegeForServiceAndCollection( \'ratingsreviews/delete/ratingsreviews\',\'ratingsreviews\', #collectionId)") @DeleteMapping("/{id}") public org.springframework.http.ResponseEntity<RatingReviewResponse> deleteRatingsReviewsById(@RequestHeader(value="x-auth-token",required=true) String authToken, @RequestHeader(value="x-version-id",required=false) String versionId, @RequestHeader(value="x-store-id",required=false) String storeId, @RequestHeader(required=true) long collectionId, @RequestParam(required=false,defaultValue="en_US") @IgnoreAudit String locale, @PathVariable(required=true) long id) method DeleteRatingReviewsById This method is used to delete the RatingReviews by Id.- Parameters:
authToken
- This field holds a valid authorization token generated using the Authorization microservice for an user. Auth token (JWT format) represents claims containing roles and privileges of the user accessing this API. JSON Web Token (JWT) is an open standard (RFC 7519) that defines a compact and self-contained way for securely transmitting information between parties as a JSON object. Since the token is a required field for this API it has to be generated before hand by invoking the /auth/sessions API provided by Authorization microservice. The output is three Base64 strings separated by dots that can be easily passed in HTML and HTTP environments, while being more compact when compared to XML-based standards such as SAML. Thus generated token has to be passed to this service and the request will be processed only if the following conditions are met: Token validation against the secret key Expiry time should be in the future Necessary privileges are available for the user to perform the action on the subjected resource.storeId
- It contains the storeId associated with ratingandreviews.collectionId
- This field holds a valid collection identifier of this microservice and requested operation will be performed on this collection identifier. Collection is the top most entity of a microservice under which all the other entities/resources reside. Each collection represents an instance of the microservice with configured properties and these properties c an be modified to bring in a different behavior per collection of the same microservice. Store association is the process of associating a microservice collection to a store along with its respective sub-entity. This way storefront can fetch/store the required information from that respective association.locale
- API Response and error messages will be responded in the mentioned locale. Indicates the locale in which the API response and the error messages will be responded. The locale should be mentioned in the Java standard locale format.versionId
- holds the identfier of the version.id
- Holds the value of identifier.- Returns:
- ResponseEntity Holds the output response of the method in the form of ResponseEntity.
-
initBinder
@InitBinder public static void initBinder(org.springframework.web.bind.WebDataBinder binder) - Parameters:
binder
- The Web data binder
-