Package com.skava.ratingandreviews.web
Class CollectionPropertyController
java.lang.Object
com.skava.ratingandreviews.web.CollectionPropertyController
@RestController
@RequestMapping("/collections")
public class CollectionPropertyController
extends Object
The Class CollectionPropertyController.
This class is the Rest Controller class. All the Collection Property API calls are mapped to this class. It is the starting point of all the Collection Property API calls.
-
Constructor Summary
ConstructorsConstructorDescriptionCollectionPropertyController
(FindCollectionAttributeService findCollectionAttributeService, UpdateCollectionPropertyService updateCollectionPropertiesService, PatchUpdateCollectionPropertyService patchUpdateCollectionPropertiesService) -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<CollectionPropertyResponse>
getCollectionPropertiesByName
(String versionId, String authToken, long businessId, long storeId, String locale, long collectionId, String name) method getCollectionPropertiesByName Fetch the collection property based on the the given collection property namevoid
initBinder
(org.springframework.web.bind.WebDataBinder binder) method InitBinderorg.springframework.http.ResponseEntity<CollectionPropertiesResponse>
patchUpdateCollectionProperties
(String versionId, String authToken, long businessId, long storeId, String locale, long collectionId, @Valid List<CollectionProperty> request) method PatchUpdateCollectionProperties Updates the collection properties which are existing under a collectionorg.springframework.http.ResponseEntity<CollectionPropertiesResponse>
updateCollectionProperties
(String versionId, String authToken, long collectionId, long businessId, long storeId, String locale, @Valid List<CollectionProperty> request) method UpdateCollectionProperties Updates the all collection properties which are existing under a collection
-
Constructor Details
-
CollectionPropertyController
@Autowired public CollectionPropertyController(FindCollectionAttributeService findCollectionAttributeService, UpdateCollectionPropertyService updateCollectionPropertiesService, PatchUpdateCollectionPropertyService patchUpdateCollectionPropertiesService)
-
-
Method Details
-
getCollectionPropertiesByName
@PreAuthorize("hasRoleForBusinessById(\'ROLE_RATINGSANDREVIEWS_ADMIN\', #businessId) or hasPrivilegeForServiceAndCollection( \'ratingsreviews/manage/collection\',\'ratingsreviews\', #collectionId) or hasPrivilegeForServiceAndCollection( \'ratingsreviews/view/collection\',\'ratingsreviews\', #collectionId)") @ResponseStatus(OK) @GetMapping("/{collectionId}/properties/{name}") @Audit public org.springframework.http.ResponseEntity<CollectionPropertyResponse> getCollectionPropertiesByName(@RequestHeader(value="x-version-id",required=false) String versionId, @RequestHeader(value="x-auth-token",required=false) String authToken, @RequestParam(required=true) long businessId, @RequestHeader(value="x-store-id",required=false,defaultValue="0") @AuditField(field="STORE_ID") long storeId, @RequestParam(required=false,defaultValue="en_US") @IgnoreAudit String locale, @PathVariable(required=true) @AuditField(field="Collection Id") long collectionId, @PathVariable(required=true) @AuditField(field="Collection property name") String name) method getCollectionPropertiesByName Fetch the collection property based on the the given collection property name- Parameters:
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.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.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.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.name
- This field holds the Unique name of collection property under a collection which will be fetched.- Returns:
- An instance of
CollectionPropertyResponse
-
updateCollectionProperties
@PreAuthorize("hasRoleForBusinessById(\'ROLE_RATINGSANDREVIEWS_ADMIN\', #businessId) or hasPrivilegeForServiceAndCollection( \'ratingsreviews/manage/collection\',\'ratingsreviews\', #collectionId) or hasPrivilegeForServiceAndCollection( \'ratingsreviews/update/collection\',\'ratingsreviews\', #collectionId)") @ResponseStatus(OK) @PutMapping("/{collectionId}/properties") @Audit(action="updateCollectionProperties") public org.springframework.http.ResponseEntity<CollectionPropertiesResponse> updateCollectionProperties(@RequestHeader(value="x-version-id",required=false) String versionId, @RequestHeader(value="x-auth-token",required=false) String authToken, @PathVariable(required=true) @AuditField(field="Collection Id") long collectionId, @RequestParam(required=true) long businessId, @RequestHeader(value="x-store-id",required=false,defaultValue="0") @AuditField(field="STORE_ID") long storeId, @RequestParam(required=false,defaultValue="en_US") @IgnoreAudit String locale, @RequestBody(required=true) @AuditField(field="a collection of properties to update") @Valid @Valid List<CollectionProperty> request) method UpdateCollectionProperties Updates the all collection properties which are existing under a collection- 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.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.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.request
- Contains the collection property information in list- Returns:
- An instance of
CollectionPropertiesResponse
-
patchUpdateCollectionProperties
@PreAuthorize("hasRoleForBusinessById(\'ROLE_RATINGSANDREVIEWS_ADMIN\', #businessId) or hasPrivilegeForServiceAndCollection( \'ratingsreviews/manage/collection\',\'ratingsreviews\', #collectionId) or hasPrivilegeForServiceAndCollection( \'ratingsreviews/update/collection\',\'ratingsreviews\', #collectionId)") @ResponseStatus(OK) @Audit(action="patchUpdateCollectionProperties") @PatchMapping("/{collectionId}/properties") public org.springframework.http.ResponseEntity<CollectionPropertiesResponse> patchUpdateCollectionProperties(@RequestHeader(value="x-version-id",required=false) String versionId, @RequestHeader(value="x-auth-token",required=false) String authToken, @RequestParam(required=true) long businessId, @RequestHeader(value="x-store-id",required=false,defaultValue="0") @AuditField(field="STORE_ID") long storeId, @RequestParam(required=false,defaultValue="en_US") @IgnoreAudit String locale, @PathVariable(required=true) @AuditField(field="Collection Id") long collectionId, @RequestBody(required=true) @AuditField(field="a collection of properties/property to patch update") @Valid @Valid List<CollectionProperty> request) method PatchUpdateCollectionProperties Updates the collection properties which are existing under a collection- 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.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.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
- Contains the collection properties information in listversionId
- 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
CollectionPropertiesResponse
-
initBinder
@InitBinder public void initBinder(org.springframework.web.bind.WebDataBinder binder) method InitBinder- Parameters:
binder
- The web data Binder.
-