Class CollectionController

java.lang.Object
com.skava.ratingandreviews.web.CollectionController

@RestController @RequestMapping("/collections") public class CollectionController extends Object

The Class CollectionController.

This class is the Rest Controller class. All the Collection API calls are mapped to this class. It is the starting point of all the Collection API calls.

  • Field Details

  • Constructor Details

  • Method Details

    • createCollection

      @PreAuthorize("hasRoleForBusinessById(\'ROLE_RATINGSANDREVIEWS_ADMIN\', #businessId) or hasPrivilegeForBusinessById( \'ratingsreviews/manage/collection\', #businessId) or hasPrivilegeForBusinessById( \'ratingsreviews/create/collection\', #businessId)") @ResponseStatus(CREATED) @PostMapping("") @Audit public org.springframework.http.ResponseEntity<CollectionResponse> createCollection(@RequestHeader(value="x-version-id",required=false) String versionId, @RequestHeader(value="x-auth-token",required=true) String authToken, @RequestHeader(value="x-store-id",required=false) String storeId, @RequestParam(required=true) long businessId, @RequestParam(required=false,defaultValue="en_US") @IgnoreAudit String locale, @RequestBody(required=true) CollectionRequest request)
      method CreateCollection This method is used to create Collection based on given CollectionRequest.
      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 list. Indicates the store id associated with the item.
      businessId - This field holds a valid business identifier. A Business is typically a customer who has signed up with Infosys Equinox to launch a commerce store or a digital experience. An Infosys Equinox Commerce Instance can have multiple Businesses under which there can be multiple stores - Logical entity which binds all the services together to bring in an storefront experience.
      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 - It contains the attributes required for the creation of Collection.
      versionId - It hold the value of version number of API. Using this parameter we can access the different version of the API. Holds the value of an API version number. Using this parameter, you can access different versions of the API. The version format is major.minor.patch. For example, 8.0.0.
      Returns:
      An instance of CollectionResponse.
      Throws:
      com.skava.core.ECommerceException - It will throw Ecommerce exception if it process get failed
    • findAllCollection

      @PreAuthorize("hasRoleForBusinessById(\'ROLE_RATINGSANDREVIEWS_ADMIN\', #businessId) or hasPrivilegeForBusinessById( \'ratingsreviews/manage/collection\', #businessId) or hasPrivilegeForBusinessById( \'ratingsreviews/view/collection\', #businessId)") @ResponseStatus(OK) @GetMapping("") @Audit public org.springframework.http.ResponseEntity<CollectionsResponse> findAllCollection(@RequestHeader(value="x-version-id",required=false) String versionId, @RequestHeader(value="x-auth-token",required=true) String authToken, @RequestHeader(value="x-store-id",required=false,defaultValue="0") long storeId, @RequestParam(required=true) long businessId, @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)
      method findAllCollection This method is used to find all Collection.
      Parameters:
      businessId - This field holds a valid business identifier. A Business is typically a customer who has signed up with Infosys Equinox to launch a commerce store or a digital experience. An Infosys Equinox Commerce Instance can have multiple Businesses under which there can be multiple stores - Logical entity which binds all the services together to bring in an storefront experience.
      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.
      page - This parameter will be available for all the services that supports pagination. It starts from value "1".
      sort - It contains the parameters for sorting. Example Format : {"sort":[{"field":"id","direction":"ASC"}]}.
      filters - This field is used to delete the particular data from collection which satisfies the filter condition . The fields presented in the filters should be same as it is in the collection for correct filtering . Sample Filtering Eg : {"filters":[{"field":"id","operation":"EQUALS","value":"1"}]}
      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 - It hold the value of version number of API. Using this parameter we can access the different version of the API. Holds the value of an API version number. Using this parameter, you can access different versions of the API. The version format is major.minor.patch. For example, 8.0.0.
      size - This parameter will be available for all the services that supports pagination . This holds the max page size.
      Returns:
      An instance of CollectionsResponse.
    • getCollectionById

      @PreAuthorize("hasRoleForBusinessById(\'ROLE_RATINGSANDREVIEWS_ADMIN\', #businessId) or hasPrivilegeForServiceAndCollection( \'ratingsreviews/manage/collection\',\'ratingsreviews\', #collectionId) or hasPrivilegeForServiceAndCollection( \'ratingsreviews/view/collection\',\'ratingsreviews\', #collectionId)") @ResponseStatus(OK) @GetMapping("/{collectionId}") @Audit public org.springframework.http.ResponseEntity<CollectionResponse> getCollectionById(@RequestHeader(value="x-version-id",required=false) String versionId, @RequestHeader(value="x-auth-token",required=false) String authToken, @RequestHeader(value="x-store-id",required=false,defaultValue="0") long storeId, @RequestParam(required=true) long businessId, @RequestParam(required=false,defaultValue="en_US") @IgnoreAudit String locale, @PathVariable(required=true) long collectionId)
      method getCollectionById This method is used to load single Collection based on given CollectionRequest.
      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.
      businessId - This field holds a valid business identifier. A Business is typically a customer who has signed up with Infosys Equinox to launch a commerce store or a digital experience. An Infosys Equinox Commerce Instance can have multiple Businesses under which there can be multiple stores - Logical entity which binds all the services together to bring in an storefront experience.
      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 - It hold the value of version number of API. Using this parameter we can access the different version of the API. Holds the value of an API version number. Using this parameter, you can access different versions of the API. The version format is major.minor.patch. For example, 8.0.0.
      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.
      Returns:
      An instance of CollectionResponse.
    • updateCollection

      @PreAuthorize("hasRoleForBusinessById(\'ROLE_RATINGSANDREVIEWS_ADMIN\', #businessId) or hasPrivilegeForServiceAndCollection( \'ratingsreviews/manage/collection\',\'ratingsreviews\', #collectionId) or hasPrivilegeForServiceAndCollection( \'ratingsreviews/update/collection\',\'ratingsreviews\', #collectionId)") @ResponseStatus(OK) @PutMapping("/{collectionId}") @Audit public org.springframework.http.ResponseEntity<CollectionResponse> updateCollection(@RequestHeader(value="x-version-id",required=false) String versionId, @RequestHeader(value="x-auth-token",required=true) String authToken, @RequestHeader(value="x-store-id",required=false,defaultValue="0") long storeId, @RequestParam(required=true) long businessId, @RequestParam(required=false,defaultValue="en_US") @IgnoreAudit String locale, @PathVariable(required=true) long collectionId, @RequestBody(required=true) CollectionRequest request)
      method UpdateCollection This method is used to update all field in Collection based on given CollectionRequest.
      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.
      businessId - This field holds a valid business identifier. A Business is typically a customer who has signed up with Infosys Equinox to launch a commerce store or a digital experience. An Infosys Equinox Commerce Instance can have multiple Businesses under which there can be multiple stores - Logical entity which binds all the services together to bring in an storefront experience.
      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 - It hold the value of version number of API. Using this parameter we can access the different version of the API. Holds the value of an API version number. Using this parameter, you can access different versions of the API. The version format is major.minor.patch. For example, 8.0.0.
      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.
      request - It contains the attributes required for the update all field in Collection.
      Returns:
      An instance of CollectionResponse.
      Throws:
      com.skava.core.ECommerceException - It will throw Ecommerce exception if it process get failed.
    • initBinder

      @InitBinder public void initBinder(org.springframework.web.bind.WebDataBinder binder)
      method initBinder
      Parameters:
      binder - The Web data binder