Package com.skava.web
Class CollectionPropertyController
java.lang.Object
com.skava.web.CollectionPropertyController
@RestController
@RequestMapping("/collections/{collectionId}")
public class CollectionPropertyController
extends Object
The Class CollectionPropertyController -
The controller class has service end points to process CollectionProperty entity. This controller handles the notification's collection property resource.
The controller class has service end points to process CollectionProperty entity. This controller handles the notification's collection property resource.
- Author:
- Infosys Equinox
-
Constructor Summary
ConstructorsConstructorDescriptionCollectionPropertyController
(GetCollectionPropertyService getCollectionPropertyService, UpdateCollectionPropertyService updateCollectionPropertyService, PutUpdateCollectionPropertiesService putUpdateCollectionPropertiesService, CommonServices commonServices) The class constructor. -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<Object>
getCollectionPropertyByName
(Long businessId, String version, long storeId, String authToken, String name, long collectionId, String locale) getCollectionPropertyByNameorg.springframework.http.ResponseEntity<CollectionPropertiesResponse>
updateCollectionProperty
(Long businessId, String version, long storeId, String authToken, @Valid List<CollectionProperty> request, long collectionId, String locale) updateCollectionPropertyorg.springframework.http.ResponseEntity<Object>
updateProperties
(Long businessId, String version, long storeId, String authToken, long collectionId, @Valid List<CollectionProperty> request, String locale) updateProperties
-
Constructor Details
-
CollectionPropertyController
@Autowired public CollectionPropertyController(GetCollectionPropertyService getCollectionPropertyService, UpdateCollectionPropertyService updateCollectionPropertyService, PutUpdateCollectionPropertiesService putUpdateCollectionPropertiesService, CommonServices commonServices) The class constructor.
-
-
Method Details
-
getCollectionPropertyByName
@GetMapping("/properties/{name}") @PreAuthorize("hasPrivilegeForServiceAndCollection(\'notification/view/collectionproperties\', #businessId, \'notification\', #collectionId)") @Audit(action="getCollectionPropertyByName") public org.springframework.http.ResponseEntity<Object> getCollectionPropertyByName(@RequestParam("businessId") Long businessId, @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="AUTH_TOKEN") String authToken, @PathVariable(value="name",required=true) @AuditField(field="PROPERTY_NAME") String name, @PathVariable(required=true) @AuditField(field="COLLECTIONID") long collectionId, @RequestHeader(value="locale",required=false,defaultValue="en_US") @AuditField(field="LOCALE") String locale) 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.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.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
- aString
object. Indicates property name of the collection.collectionId
- aLong
object. It refers to the identifier of the collection.locale
- aString
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 formatstoreId
- Refers to the unique id of the store.version
- Refers to the version.- Returns:
- the responseEntity of CollectionPropertyResponse Instance of
CollectionPropertyResponse
-
updateCollectionProperty
@PatchMapping("/properties") @PreAuthorize("hasPrivilegeForServiceAndCollection(\'notification/update/collectionproperties\', #businessId, \'notification\', #collectionId)") @Audit(action="updateCollectionProperty") public org.springframework.http.ResponseEntity<CollectionPropertiesResponse> updateCollectionProperty(@RequestParam("businessId") Long businessId, @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="AUTH_TOKEN") String authToken, @Valid @RequestBody(required=true) @AuditField(field="COLLECTION_PROPERTY") @Valid List<CollectionProperty> request, @PathVariable(required=true) @AuditField(field="COLLECTIONID") long collectionId, @RequestHeader(value="locale",required=false,defaultValue="en_US") @AuditField(field="LOCALE") String locale) 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.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.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
- aCollectionProperty
object. Indicates List of Collection property request contains the entire property data to be updated.collectionId
- aLong
object. It refers to the identifier of the collection.locale
- aString
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 formatstoreId
- Refers to the unique id of the store.version
- Refers to the version.- Returns:
- a
CollectionPropertiesResponse
object. Returns the collection properties which were updated.
-
updateProperties
@PutMapping("/properties") @PreAuthorize("hasPrivilegeForServiceAndCollection(\'notification/update/collectionproperties\', #businessId, \'notification\', #collectionId)") @Audit(action="putUpdateCollectionProperty") public org.springframework.http.ResponseEntity<Object> updateProperties(@RequestParam("businessId") Long businessId, @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="AUTH_TOKEN") String authToken, @PathVariable(value="collectionId",required=true) @AuditField(field="COLLECTIONID") long collectionId, @Valid @RequestBody(required=true) @AuditField(field="COLLECTION_PROPERTY") @Valid List<CollectionProperty> request, @RequestHeader(value="locale",required=false,defaultValue="en_US") @AuditField(field="LOCALE") String locale) updateProperties
This method is used to update/replace a list of Properties and it's fields 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.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.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
- aLong
object. It refers to the identifier of the collection.request
- aCollectionProperty
object. It contains the attributes required for the update all field in Properties.locale
- aString
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 formatstoreId
- Refers to the unique id of the store.version
- Refers to the version.- Returns:
- a
CollectionPropertiesResponse
object. It returns the all the properties which now available for the collection.
-