Package com.skava.web
Class ConsentController
java.lang.Object
com.skava.web.ConsentController
@Validated
@RestController
@RequestMapping("/consents")
public class ConsentController
extends Object
This controller class contains service end-points that are used to perform actions to add, update, remove,
retrieve a single or multiple consents which is associated to a specific User collection.
- Author:
- Infosys Equinox
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<Consent>
createConsent
(Consent consent, String locale, Long collectionId, String authToken, String version, long storeId) This service is used to create a consent.org.springframework.http.ResponseEntity<Object>
deleteConsent
(long consentId, String locale, Long collectionId, String authToken, String version, long storeId) This service is used to delete the specific consent.getAllConsent
(int page, int size, String search, String locale, Long collectionId, String authToken, String version, long storeId) This service is used to search the consents by specific criteria.org.springframework.http.ResponseEntity<Consent>
getConsent
(long consentId, String locale, Long collectionId, String authToken, String version, long storeId) This service is used to load the specific consent.org.springframework.http.ResponseEntity<Consent>
updateConsent
(long consentId, Consent consent, String locale, Long collectionId, String authToken, String version, long storeId) This service is used to update the specific consent.
-
Constructor Details
-
ConsentController
public ConsentController()Default Constructor.
-
-
Method Details
-
createConsent
@PostMapping @ResponseStatus(CREATED) @Audit(action="createConsent") public org.springframework.http.ResponseEntity<Consent> createConsent(@RequestBody @AuditField(field="CONSENT") Consent consent, @RequestParam(value="locale",required=false,defaultValue="en_US") @AuditField(field="LOCALE") String locale, @RequestHeader(value="x-collection-id",required=true) @AuditField(field="COLLECTION_ID") Long collectionId, @RequestHeader(value="x-auth-token",required=true) @AuditField(field="AUTH_TOKEN") String authToken, @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) This service is used to create a consent.- Parameters:
consent
- HoldsConsent
Holds the consent details that needs to be created. It is given in the form of JSON object. An incorrect JSON would throw Bad request error.locale
- API Response and error messages will be responded in the locale mentioned in this parameter.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 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.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
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
ofConsent
object.
-
getConsent
@GetMapping("/{consentId}") @Audit(action="getConsent") public org.springframework.http.ResponseEntity<Consent> getConsent(@PathVariable @AuditField(field="CONSENT_ID") long consentId, @RequestParam(value="locale",required=false,defaultValue="en_US") @AuditField(field="LOCALE") String locale, @RequestHeader(value="x-collection-id",required=true) @AuditField(field="COLLECTION_ID") Long collectionId, @RequestHeader(value="x-auth-token",required=true) @AuditField(field="AUTH_TOKEN") String authToken, @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) This service is used to load the specific consent.- Parameters:
consentId
- Indicates consent identifier for which consent data to be loaded.locale
- API Response and error messages will be responded in the locale mentioned in this parameter.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 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.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
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
ofConsent
object.
-
getAllConsent
@GetMapping @Audit(action="getConsents") public org.springframework.http.ResponseEntity<List<Consent>> getAllConsent(@RequestParam(value="page",required=true,defaultValue="1") @AuditField(field="PAGE") int page, @RequestParam(value="size",required=true,defaultValue="10") @AuditField(field="SIZE") int size, @RequestParam(value="search",required=false) @AuditField(field="FILTER") String search, @RequestParam(value="locale",required=false,defaultValue="en_US") @AuditField(field="LOCALE") String locale, @RequestHeader(value="x-collection-id",required=true) @AuditField(field="COLLECTION_ID") Long collectionId, @RequestHeader(value="x-auth-token",required=true) @AuditField(field="AUTH_TOKEN") String authToken, @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) This service is used to search the consents by specific criteria.- Parameters:
page
- The page number to be retrieved where the size of the page must be specified by the size/offset/pageSize parameter. First page starts with value \"0\".size
- The number of documents being retrieved on the corresponding page specified by page parameter.search
- Holds String value for consent search criteria.Below are some of the sample search criteria- /consent?search=title:testConsent - Holds the string value. It refers to the title of the consent.
- /consent?search=status:ACTIVE - Holds the string value. It refers user status. Status are active, inactive and not activated.
- /consent?search=id:1, id>1|id<7 - Holds the long value. It refers to the identifier of the created consent.The numerical data search can use greater than ">" and lesser than "<" as well as "|" logical OR operator for searching the consent
The multiple search criteria can be provided separated by comma.locale
- API Response and error messages will be responded in the locale mentioned in this parameter.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 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.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
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
ofList
ofConsent
.
-
updateConsent
@PatchMapping("/{consentId}") @Audit(action="updateConsent") public org.springframework.http.ResponseEntity<Consent> updateConsent(@PathVariable @AuditField(field="CONSENT_ID") long consentId, @RequestBody @AuditField(field="CONSENT") Consent consent, @RequestParam(value="locale",required=false,defaultValue="en_US") @AuditField(field="LOCALE") String locale, @RequestHeader(value="x-collection-id",required=true) @AuditField(field="COLLECTION_ID") Long collectionId, @RequestHeader(value="x-auth-token",required=true) @AuditField(field="AUTH_TOKEN") String authToken, @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) This service is used to update the specific consent.- Parameters:
consentId
- Indicates the identifier of a consent which is needed to be updated. Holds long value.consent
- HoldsConsent
Holds the consent details that needs to be updated.It is given in the form of JSON object. An incorrect JSON would throw Bad request error.locale
- API Response and error messages will be responded in the locale mentioned in this parameter.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 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.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
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
ofConsent
.
-
deleteConsent
@DeleteMapping("/{consentId}") @Audit(action="deleteConsent") public org.springframework.http.ResponseEntity<Object> deleteConsent(@PathVariable @AuditField(field="CONSENT_ID") long consentId, @RequestParam(value="locale",required=false,defaultValue="en_US") @AuditField(field="LOCALE") String locale, @RequestHeader(value="x-collection-id",required=true) @AuditField(field="COLLECTION_ID") Long collectionId, @RequestHeader(value="x-auth-token",required=true) @AuditField(field="AUTH_TOKEN") String authToken, @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) This service is used to delete the specific consent.- Parameters:
consentId
- Indicates the identifier of a consent which is needed to be deleted. Holds long value.locale
- API Response and error messages will be responded in the locale mentioned in this parameter.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 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.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
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
ofObject
.
-