Package com.skava.auth.web
Class CollectionPropertyController
java.lang.Object
org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler
com.skava.core.security.CommonExceptionHandler
com.skava.core.errorhandler.ExceptionResponseProcessor
com.skava.auth.helper.AuthExceptionHandler
com.skava.auth.web.CollectionPropertyController
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.context.MessageSourceAware
@RestController
@RequestMapping("/collections/{collectionId}")
public class CollectionPropertyController
extends AuthExceptionHandler
The class act as a controller to handle collection's properties manipulation.
List of operations handled by this controller are
List of operations handled by this controller are
- Retrieve Collection Property Using Name
- Update Collection Properties Using Collection identifier
- Update All Collection Properties Using Collection identifier
- Author:
- Infosys Equinox
-
Field Summary
Fields inherited from class com.skava.auth.helper.AuthExceptionHandler
CONST_API_VERSION_DEFAULT, DEFAULT_LIMIT, X_TOTAL_COUNT
Fields inherited from class org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler
logger, PAGE_NOT_FOUND_LOG_CATEGORY, pageNotFoundLogger
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<Object>
getCollectionPropertyByName
(String version, Long businessId, String authToken, long storeId, String name, long collectionId, String locale) This API load collection property by property name and the collection associated to the collection Id.org.springframework.http.ResponseEntity<Object>
updateCollectionProperty
(String version, Long businessId, String authToken, long storeId, @Valid List<CollectionPropertyVO> request, long collectionId, String locale) This API updates a collection properties in a collection associated to the collection Id.org.springframework.http.ResponseEntity<Object>
updateProperties
(String version, Long businessId, String authToken, long storeId, long collectionId, @Valid List<CollectionPropertyVO> request, String locale) This API updates a collection properties in a collection associated to the collection Id.Methods inherited from class com.skava.auth.helper.AuthExceptionHandler
getValidationResponse, handleAccessDeniedException, handleResourceNotFoundException, handleRunTimeException
Methods inherited from class com.skava.core.errorhandler.ExceptionResponseProcessor
getExceptionResponse, handleExceptionInternal, handleMethodArgumentNotValid
Methods inherited from class com.skava.core.security.CommonExceptionHandler
handleExceptionInternal, handleInternalException
Methods inherited from class org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler
createProblemDetail, createResponseEntity, getMessageSource, handleAsyncRequestNotUsableException, handleAsyncRequestTimeoutException, handleConversionNotSupported, handleErrorResponseException, handleException, handleHandlerMethodValidationException, handleHttpMediaTypeNotAcceptable, handleHttpMediaTypeNotSupported, handleHttpMessageNotReadable, handleHttpMessageNotWritable, handleHttpRequestMethodNotSupported, handleMaxUploadSizeExceededException, handleMethodValidationException, handleMissingPathVariable, handleMissingServletRequestParameter, handleMissingServletRequestPart, handleNoHandlerFoundException, handleNoResourceFoundException, handleServletRequestBindingException, handleTypeMismatch, setMessageSource
-
Constructor Details
-
CollectionPropertyController
public CollectionPropertyController()The class constructor.
-
-
Method Details
-
getCollectionPropertyByName
@GetMapping("/properties/{name}") @PreAuthorize("hasPrivilegeForServiceAndCollection(\'auth/view/collectionproperties\', \'auth\', #collectionId)") @Audit(action="getCollectionPropertyByCollectionIdAndPropertyName", repository="collectionPropertyRepository") public org.springframework.http.ResponseEntity<Object> getCollectionPropertyByName(@RequestHeader(value="x-version",required=false,defaultValue="8.19.7") @AuditField(field="VERSION") String version, @RequestParam("businessId") Long businessId, @RequestHeader("x-auth-token") @AuditField(field="AUTH_TOKEN") String authToken, @RequestHeader(value="x-store-id",required=false,defaultValue="0") @AuditField(field="STORE_ID") long storeId, @PathVariable(value="name",required=true) @AuditField(field="COLLECTION_PROPERTY_NAME") String name, @PathVariable @AuditField(field="COLLECTION_ID") long collectionId, @RequestParam(value="locale",required=false,defaultValue="en_US") @AuditField(field="LOCALE") String locale) This API load collection property by property name and the collection associated to the collection Id. 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 can 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. The response for this request is given through CollectionProperty model.- Parameters:
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.businessId
- aLong
object. 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
- aString
object. 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 identifier of the store.name
- aString
object. This field holds the valid collection property name registered for this microservice in collection attributes.collectionId
- aLong
object. 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 can 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.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 format.- Returns:
- a
CollectionPropertyVO
object. Returns Collection property data based on the given collection property name and its collection id.
-
updateCollectionProperty
@PatchMapping("/properties") @PreAuthorize("hasPrivilegeForServiceAndCollection(\'auth/update/collectionproperties\', \'auth\', #collectionId)") @Audit(action="updateCollectionProperties", repository="collectionPropertyRepository") public org.springframework.http.ResponseEntity<Object> updateCollectionProperty(@RequestHeader(value="x-version",required=false,defaultValue="8.19.7") @AuditField(field="VERSION") String version, @RequestParam("businessId") Long businessId, @RequestHeader("x-auth-token") @AuditField(field="AUTH_TOKEN") String authToken, @RequestHeader(value="x-store-id",required=false,defaultValue="0") @AuditField(field="STORE_ID") long storeId, @Valid @RequestBody @AuditField(field="COLLECTION_PROPERTIES") @Valid List<CollectionPropertyVO> request, @PathVariable @AuditField(field="COLLECTION_ID") long collectionId, @RequestParam(value="locale",required=false,defaultValue="en_US") @AuditField(field="LOCALE") String locale) This API updates a collection properties in a collection associated to the collection Id. The attrributes name and value are mandatory where name is not allowed to udpate. 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 can 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. The response for this request is given through list of CollectionProperty model.- Parameters:
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.businessId
- aLong
object. 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
- aString
object. 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 identifier of the store.request
- a @List
ofCollectionPropertyVO
objects. This request body holds the updated collection properties of given collection. Collection Properties are the map like entities/resources to hold collection specific attributes. This collection properties are used to customize collection of this microservice.collectionId
- aLong
object. 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 can 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.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 format.- Returns:
- a
CollectionPropertyVO
object. Returns the collection property which has updated.
-
updateProperties
@PreAuthorize("hasPrivilegeForServiceAndCollection(\'auth/update/collectionproperties\', \'auth\', #collectionId)") @PutMapping("/properties") @Audit(action="replaceCollectionProperties", repository="collectionPropertyRepository") public org.springframework.http.ResponseEntity<Object> updateProperties(@RequestHeader(value="x-version",required=false,defaultValue="8.19.7") @AuditField(field="VERSION") String version, @RequestParam("businessId") Long businessId, @RequestHeader("x-auth-token") @AuditField(field="AUTH_TOKEN") String authToken, @RequestHeader(value="x-store-id",required=false,defaultValue="0") @AuditField(field="STORE_ID") long storeId, @PathVariable("collectionId") @AuditField(field="COLLECTION_ID") long collectionId, @Valid @RequestBody(required=true) @AuditField(field="COLLECTION_PROPERTIES") @Valid List<CollectionPropertyVO> request, @RequestParam(value="locale",required=false,defaultValue="en_US") @AuditField(field="LOCALE") String locale) This API updates a collection properties in a collection associated to the collection Id. The attrributes name and value are mandatory where name is not allowed to udpate. 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 can 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. The response for this request is given through list of CollectionProperty model.- Parameters:
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.businessId
- aLong
object. 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
- aString
object. 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 identifier of the store.collectionId
- aLong
object. 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 can 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
- a @List
ofCollectionPropertyVO
objects. This request body holds the new collection properties of given collection to replace existing properties. Collection Properties are the map like entities/resources to hold collection specific attributes. This collection properties are used to customize collection of this microservice.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 format.- Returns:
- a
List
object. It returns the all the properties which now available for the collection.
-