Class CollectionController

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

@RestController @RequestMapping("/collections") public class CollectionController extends Object
The Class CollectionController-
The controller class has service end points to process collection entity.
Author:
Infosys Equinox
  • Constructor Details

    • CollectionController

      public CollectionController()
  • Method Details

    • createCollection

      @PostMapping @PreAuthorize("hasPrivilegeForBusinessById(\'account/create/collection\', #businessId)") @ResponseStatus(CREATED) @Audit(action="CreateCollection") public org.springframework.http.ResponseEntity<Collections> createCollection(@RequestHeader(value="locale",required=false) @AuditField(field="LOCALE") String locale, @RequestHeader(value="x-version",required=false,defaultValue="8.19.7") @AuditField(field="VERSION") String version, @RequestHeader(value="x-store-id",required=false,defaultValue="0") @AuditField(field="STOREID") long storeId, @RequestParam("businessId") @AuditField(field="BUSINESSID") long businessId, @RequestHeader(value="x-auth-token",required=true) @AuditField(field="AUTHTOKEN") String authToken, @RequestBody(required=true) @AuditField(field="Collection") Collections request)
      This method is used to create Collection based on given Collection Request.
      Parameters:
      locale - API Response and error messages will be responded in the locale mentioned in this parameter.
      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 - Refers to the unique id of the store
      version - Refers to the version
      request - It contains the attributes required for the creation of Collection.
      Returns:
      It returns the CollectionAPIResponse.
    • findAllCollection

      @GetMapping @PreAuthorize("hasPrivilegeForBusinessById(\'account/viewall/collection\', #businessId)") @ResponseStatus(OK) @Audit(action="FindAllCollection") public org.springframework.http.ResponseEntity<CollectionsAPIResponse> findAllCollection(@RequestHeader(value="locale",required=false) @AuditField(field="LOCALE") String locale, @RequestHeader(value="x-version",required=false,defaultValue="8.19.7") @AuditField(field="VERSION") String version, @RequestHeader(value="x-store-id",required=false,defaultValue="0") @AuditField(field="STOREID") long storeId, @RequestHeader(value="x-auth-token",required=true) @AuditField(field="AUTHTOKEN") String authToken, @RequestParam(value="page",required=false,defaultValue="1") @AuditField(field="PAGE") int page, @RequestParam(value="businessId",required=false,defaultValue="-1") @AuditField(field="BUSINESSID") long businessId, @RequestParam(value="size",required=false,defaultValue="10") @AuditField(field="SIZE") int size, @RequestParam(value="filter",required=false,defaultValue="") @AuditField(field="FILTER") String filter, @RequestParam(value="sort",required=false) @AuditField(field="SORT") String sort)
      This method is used to find all Collections based on given Collection Request.
      Parameters:
      locale - API Response and error messages will be responded in the locale mentioned in this parameter.
      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 - Refers to the unique id of the store
      version - Refers to the version
      page - 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.
      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.
      size - This parameter will be available for all the services that supports pagination. This parameter is used to mention the number of maximum items that needs to be responded for the request.
      filter - Holds the search criteria. \n Eg: filter=name:name@infosysequinox.com (or) filter=name:name@infosysequinox.com, description:name1
      sort - the sort.
      Returns:
      It returns the CollectionAPIResponse.
    • getCollectionById

      @GetMapping("/{collectionId}") @PreAuthorize("hasPrivilegeForServiceAndCollection(\'account/view/collection\', #businessId, \'account\', #collectionId)") @ResponseStatus(OK) @Audit(action="GetCollection") public org.springframework.http.ResponseEntity<Collections> getCollectionById(@RequestHeader(value="locale",required=false) @AuditField(field="LOCALE") String locale, @RequestHeader(value="x-version",required=false,defaultValue="8.19.7") @AuditField(field="VERSION") String version, @RequestHeader(value="x-store-id",required=false,defaultValue="0") @AuditField(field="STOREID") long storeId, @RequestHeader(value="x-auth-token",required=true) @AuditField(field="AUTHTOKEN") String authToken, @RequestParam("businessId") @AuditField(field="BUSINESSID") long businessId, @PathVariable(value="collectionId",required=true) @AuditField(field="COLLECTIONID") long collectionId)
      This method is used to load single Collection based on given Collection Request.
      Parameters:
      locale - API Response and error messages will be responded in the locale mentioned in this parameter.
      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 - Refers to the unique id of the store
      version - Refers to the version
      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.
      collectionId - It refers to the unique identifier of the collection which is to be retrieved. It is auto generated when a collection is created. A valid collection should be present for the given id.
      Returns:
      It returns the CollectionAPIResponse.
    • deleteCollection

      @DeleteMapping("/{collectionId}") @PreAuthorize("hasPrivilegeForBusinessById(\'account/delete/collection\', #businessId)") @ResponseStatus(OK) @Audit(action="DeleteCollection") public org.springframework.http.ResponseEntity<CollectionAPIResponse> deleteCollection(@RequestHeader(value="locale",required=false) @AuditField(field="LOCALE") String locale, @RequestHeader(value="x-version",required=false,defaultValue="8.19.7") @AuditField(field="VERSION") String version, @RequestHeader(value="x-store-id",required=false,defaultValue="0") @AuditField(field="STOREID") long storeId, @RequestHeader(value="x-auth-token",required=true) @AuditField(field="AUTHTOKEN") String authToken, @RequestParam("businessId") @AuditField(field="BUSINESSID") long businessId, @PathVariable(value="collectionId",required=true) @AuditField(field="COLLECTIONID") long collectionId)
      This method is used to delete Collection based on given Collection Request.
      Parameters:
      locale - API Response and error messages will be responded in the locale mentioned in this parameter.
      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 - Refers to the unique id of the store
      version - Refers to the version
      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.
      collectionId - It refers to the unique identifier of the collection which is to be deleted. It is auto generated when a collection is created. A valid collection should be present for the given id.
      Returns:
      It returns the CollectionAPIResponse.
    • updateCollection

      @PutMapping("/{collectionId}") @PreAuthorize("hasPrivilegeForServiceAndCollection(\'account/update/collection\', #businessId, \'account\', #collectionId)") @ResponseStatus(OK) @Audit(action="UpdateCollection") public org.springframework.http.ResponseEntity<Collections> updateCollection(@RequestHeader(value="locale",required=false) @AuditField(field="LOCALE") String locale, @RequestHeader(value="x-version",required=false,defaultValue="8.19.7") @AuditField(field="VERSION") String version, @RequestHeader(value="x-store-id",required=false,defaultValue="0") @AuditField(field="STOREID") long storeId, @RequestHeader(value="x-auth-token",required=true) @AuditField(field="AUTHTOKEN") String authToken, @RequestParam("businessId") @AuditField(field="BUSINESSID") long businessId, @PathVariable(value="collectionId",required=true) @AuditField(field="COLLECTIONID") long collectionId, @RequestBody(required=true) @AuditField(field="Collection") Collections request)
      This method is used to update all field in Collection based on given Collection Request.
      Parameters:
      locale - API Response and error messages will be responded in the locale mentioned in this parameter.
      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 - Refers to the unique id of the store
      version - Refers to the version
      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.
      collectionId - It refers to the unique identifier of the collection which is to be updated. It is auto generated when a collection is created. A valid collection should be present for the given id.
      request - It contains the attributes required to the update all field in Collection.
      Returns:
      It returns the CollectionAPIResponse.
    • findAllCollectionAttribute

      @GetMapping("/properties") @PreAuthorize("hasAnyRole() or hasPrivilege(\'account/viewll/collection/properties\')") @ResponseStatus(OK) @Audit(action="FinAllCollectionAttributes") public org.springframework.http.ResponseEntity<List<CollectionAttributes>> findAllCollectionAttribute(@RequestHeader(value="x-auth-token",required=true) @AuditField(field="AUTHTOKEN") String authToken, @RequestHeader(value="locale",required=false) @AuditField(field="LOCALE") String locale, @RequestHeader(value="x-store-id",required=false,defaultValue="0") @AuditField(field="STOREID") long storeId, @RequestHeader(value="x-version",required=false,defaultValue="8.19.7") String version)
      This method is used to load all the collection attributes present in the system.
      Parameters:
      locale - API Response and error messages will be responded in the locale mentioned in this parameter.
      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 - Refers to the unique id of the store
      version - Refers to the version
      Returns:
      It returns the CollectionAPIResponse.