Package com.skava.catalog.web
Class CollectionController
java.lang.Object
com.skava.catalog.web.CollectionController
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<Collection>
createCollection
(String authToken, String versionId, long businessId, String locale, CollectionRequest request) This method is used to create Collection based on given CollectionRequest.org.springframework.http.ResponseEntity<CollectionsAPIResponse>
findAllCollection
(String authToken, String versionId, int page, int size, com.skava.core.qdsl.sort.EcomSorts sort, String filters, long businessId, String locale) This method is used to find all Collections based on given CollectionRequest.org.springframework.http.ResponseEntity<Collection>
getCollectionById
(String authToken, String versionId, String locale, long id, long businessId) This method is used to load single Collection based on given CollectionRequest.void
initBinder
(org.springframework.web.bind.WebDataBinder binder) org.springframework.http.ResponseEntity<Collection>
updateCollection
(String authToken, String versionId, long businessId, String locale, long id, CollectionRequest request) This method is used to update all field in Collection based on given CollectionRequest.
-
Constructor Details
-
CollectionController
public CollectionController()
-
-
Method Details
-
createCollection
@ResponseStatus(CREATED) @PreAuthorize("hasPrivilegeForBusinessById(\'catalog/create/collection\', #businessId)") @PostMapping @Audit public org.springframework.http.ResponseEntity<Collection> createCollection(@RequestHeader(value="x-auth-token",required=true) String authToken, @RequestHeader(value="x-version",required=false,defaultValue="8.19.7") String versionId, @RequestParam(value="businessId",required=true) long businessId, @RequestParam(value="locale",required=false,defaultValue="en_US") @IgnoreAudit String locale, @RequestBody(required=true) CollectionRequest request) This method is used to create Collection based on given CollectionRequest.- Parameters:
authToken
- It contains the authentication token required for the creation of Collection.versionId
- versionIdbusinessId
- businessIdlocale
- localerequest
- It contains the attributes required for the creation of Collection.- Returns:
- It returns the
CollectionAPIResponse
.
-
findAllCollection
@ResponseStatus(OK) @PreAuthorize("hasPrivilegeForBusinessById(\'catalog/viewall/collection\', #businessId)") @GetMapping @Audit public org.springframework.http.ResponseEntity<CollectionsAPIResponse> findAllCollection(@RequestHeader(value="x-auth-token",required=true) String authToken, @RequestHeader(value="x-version",required=false,defaultValue="8.19.7") String versionId, @RequestParam(value="page",required=false,defaultValue="1") int page, @RequestParam(value="size",required=false,defaultValue="10") int size, @RequestParam(value="sort",required=false) com.skava.core.qdsl.sort.EcomSorts sort, @RequestParam(value="filters",required=false) String filters, @RequestParam(value="businessId",required=false,defaultValue="0") long businessId, @RequestParam(value="locale",required=false,defaultValue="en_US") @IgnoreAudit String locale) This method is used to find all Collections based on given CollectionRequest.- Parameters:
authToken
- It contains the authentication token required for the creation of Collection.versionId
- versionIdpage
- This parameter will be available for all the services that supports pagination. This parameter is used to mention the starting index of the items which going to responded by the API.size
- This parameter will be available for all the services that supports pagination.sort
- It contains the parameters for sorting. Example Format : {"sort":[{"field":"status","direction":"ASC"}, {"field":"status","direction":"DESC"}]}filters
- This parameter contains the filters of the collection.businessId
- This parameter contains the businessId of the collection.locale
- locale- Returns:
- It returns the
CollectionAPIResponse
.
-
getCollectionById
@ResponseStatus(OK) @PreAuthorize("hasPrivilegeForServiceAndCollection(\'catalog/view/collection\',\'catalog\', #id)") @GetMapping("/{id}") @Audit public org.springframework.http.ResponseEntity<Collection> getCollectionById(@RequestHeader(value="x-auth-token",required=true) String authToken, @RequestHeader(value="x-version",required=false,defaultValue="8.19.7") String versionId, @RequestParam(value="locale",required=false,defaultValue="en_US") @IgnoreAudit String locale, @PathVariable(required=true) long id, @RequestParam(value="businessId",required=true) long businessId) This method is used to load single Collection based on given CollectionRequest.- Parameters:
authToken
- It contains the authentication token required for the creation of Collection.versionId
- versionIdlocale
- localeid
- It refers to load of Collection.businessId
- businessId- Returns:
- It returns the
CollectionAPIResponse
.
-
updateCollection
@ResponseStatus(ACCEPTED) @PreAuthorize("hasPrivilegeForServiceAndCollection(\'catalog/update/collection\',\'catalog\', #id)") @PutMapping("/{id}") @Audit public org.springframework.http.ResponseEntity<Collection> updateCollection(@RequestHeader(value="x-auth-token",required=true) String authToken, @RequestHeader(value="x-version",required=false,defaultValue="8.19.7") String versionId, @RequestParam(value="businessId",required=true) long businessId, @RequestParam(value="locale",required=false,defaultValue="en_US") @IgnoreAudit String locale, @PathVariable(required=true) long id, @RequestBody(required=true) CollectionRequest request) This method is used to update all field in Collection based on given CollectionRequest.- Parameters:
authToken
- It contains the authentication token required for the creation of Collection.versionId
- versionIdbusinessId
- business Idlocale
- localeid
- It refers to update Collection.request
- It contains the attributes required for the update all field in Collection.- Returns:
- It returns the
CollectionAPIResponse
.
-
initBinder
@InitBinder public void initBinder(org.springframework.web.bind.WebDataBinder binder)
-