Package com.skava.web

Class CollectionPropertyController

java.lang.Object
com.skava.web.CollectionPropertyController

@RestController @RequestMapping("/collections/{collectionId}") public class CollectionPropertyController extends Object
This controller class used to handle the collection property's manipulation. List of operations handled by this controller are collection property retrieval by collection identifier and property name, collection property update all properties and collection property update a property.
Author:
Infosys Equinox
  • Constructor Details

    • CollectionPropertyController

      public CollectionPropertyController()
      The default constructor.
  • Method Details

    • getCollectionPropertyByName

      @GetMapping("/properties/{name}") @PreAuthorize("hasPrivilegeForServiceAndCollection(\'user/view/collectionproperties\', #businessId, \'user\', #collectionId)") @Audit(action="getCollectionProperty") public org.springframework.http.ResponseEntity<CollectionProperty> getCollectionPropertyByName(@PathVariable @AuditField(field="COLLECTION_ID") long collectionId, @RequestParam("businessId") @AuditField(field="BUSINESS_ID") Long businessId, @PathVariable(value="name",required=true) @AuditField(field="PROPERTY_NAME") String name, @RequestHeader(value="x-auth-token",required=true) @AuditField(field="AUTH_TOKEN") String authToken, @RequestHeader(value="locale",required=false,defaultValue="en_US") @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="STORE_ID") long storeId)

      getCollectionPropertyByName

      This service is used to load a collection property using collection property name and its collection id.
      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
      name - a String object. Indicates property name of the collection.
      collectionId - a Long object. It refers to the identifier of the collection.
      locale - a String object. API Response and error messages will be responded in the locale mentioned in this parameter. Locale needs to be mentioned in Java standard locale format
      version - It hold the value of version number of API. Using this parameter we can access the different version of the API. It is currently unused.
      storeId - It Holds a valid unique identifier of the store.
      Returns:
      The ResponseEntity of CollectionProperty object.
    • updateCollectionProperty

      @PatchMapping("/properties") @PreAuthorize("hasPrivilegeForServiceAndCollection(\'user/update/collectionproperties\', #businessId, \'user\', #collectionId)") @Audit(action="updateCollectionProperty") public org.springframework.http.ResponseEntity<List<CollectionProperty>> updateCollectionProperty(@RequestParam("businessId") @AuditField(field="BUSINESS_ID") Long businessId, @RequestHeader(value="x-auth-token",required=true) @AuditField(field="AUTH_TOKEN") String authToken, @Valid @RequestBody @AuditField(field="COLLECTION_PROPERTIES") @Valid List<CollectionProperty> request, @PathVariable @AuditField(field="COLLECTION_ID") long collectionId, @RequestHeader(value="locale",required=false,defaultValue="en_US") @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="STORE_ID") long storeId)

      updateCollectionProperty

      This service is used to update collection property as per the given collection property request.
      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
      .
      request - a CollectionProperty object. Indicates List of Collection property request contains the entire property data to be updated.
      collectionId - a Long object. It refers to the identifier of the collection.
      locale - a String object. API Response and error messages will be responded in the locale mentioned in this parameter. Locale needs to be mentioned in Java standard locale format
      version - It hold the value of version number of API. Using this parameter we can access the different version of the API. It is currently unused.
      storeId - It Holds a valid unique identifier of the store.
      Returns:
      The ResponseEntity of List of CollectionProperty.
    • updateProperties

      @PutMapping("/properties") @PreAuthorize("hasPrivilegeForServiceAndCollection(\'user/update/collectionproperties\', #businessId, \'user\', #collectionId)") @Audit(action="updateCollectionProperties") public org.springframework.http.ResponseEntity<List<CollectionProperty>> updateProperties(@RequestParam("businessId") @AuditField(field="BUSINESS_ID") Long businessId, @RequestHeader(value="x-auth-token",required=true) @AuditField(field="AUTH_TOKEN") String authToken, @PathVariable("collectionId") @AuditField(field="COLLECTION_ID") Long collectionId, @Valid @RequestBody(required=true) @AuditField(field="COLLECTION_PROPERTIES") @Valid List<CollectionProperty> request, @RequestHeader(value="locale",required=false,defaultValue="en_US") @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="STORE_ID") long storeId)

      updateProperties

      This method is used to update all field in Properties based on given Collection Properties Request.
      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
      .
      collectionId - a Long object. It refers to the identifier of the collection.
      request - a CollectionProperty object. It contains the attributes required for the update all field in Properties.
      locale - a String object. API Response and error messages will be responded in the locale mentioned in this parameter. Locale needs to be mentioned in Java standard locale format
      version - It hold the value of version number of API. Using this parameter we can access the different version of the API. It is currently unused.
      storeId - It Holds a valid unique identifier of the store.
      Returns:
      The ResponseEntity of List of CollectionProperty. It returns the all the properties which now available for the collection.