Package com.skava.accounts.web
Class AccountTypeController
java.lang.Object
com.skava.accounts.web.AccountTypeController
The Class AccountTypeController-
The controller class has service end points to process account type entity.
The controller class has service end points to process account type entity.
- Author:
- Infosys Equinox
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<AccountTypes>
createAccountType
(String locale, String version, long storeId, long collectionId, String authToken, AccountTypes request) This method is used to create AccountType based on given AccountType Request.org.springframework.http.ResponseEntity<Object>
deleteAccountType
(String locale, String version, long storeId, long collectionId, String authToken, long id) This method is used to delete AccountType based on given AccountType Request.org.springframework.http.ResponseEntity<AccountTypesAPIResponse>
findAllAccountType
(String locale, String version, long storeId, long collectionId, String authToken, int page, int size, String filter, String sort) This method is used to find all AccountTypes based on given AccountType Request.org.springframework.http.ResponseEntity<AccountTypes>
getAccountTypeById
(String locale, String version, long storeId, long collectionId, String authToken, long id) This method is used to load single AccountType based on given AccountType Request.org.springframework.http.ResponseEntity<AccountTypes>
patchUpdateAccountType
(String locale, String version, long storeId, long collectionId, String authToken, long id, AccountTypes request) This method is used to update required field in AccountType based on given AccountType Request.
-
Constructor Details
-
AccountTypeController
public AccountTypeController()
-
-
Method Details
-
createAccountType
@PostMapping @PreAuthorize("hasRoleForServiceAndCollection(\'ROLE_ACCOUNT_ADMIN\', \'account\', #collectionId) or hasPrivilegeForServiceAndCollection(\'account/create/accounttype\', \'account\', #collectionId )") @ResponseStatus(CREATED) @Audit(action="CreateAccountType") public org.springframework.http.ResponseEntity<AccountTypes> createAccountType(@RequestHeader(value="locale",required=false) @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="STOREID") long storeId, @RequestHeader(value="x-collection-id",required=true) @AuditField(field="COLLECTIONID") long collectionId, @RequestHeader(value="x-auth-token",required=true) @AuditField(field="AUTHTOKEN") String authToken, @RequestBody(required=true) @AuditField(field="AccountType") AccountTypes request) This method is used to create AccountType based on given AccountType Request.- Parameters:
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
storeId
- Refers to the unique id of the storeversion
- Refers to the versionrequest
- It contains the attributes required for the creation of AccountType.- Returns:
- It returns the
AccountTypes
.
-
findAllAccountType
@GetMapping @PreAuthorize("hasRoleForServiceAndCollection(\'ROLE_ACCOUNT_ADMIN\', \'account\', #collectionId) or hasRoleForServiceAndCollection(\'ROLE_ACCOUNT_REP\', \'account\', #collectionId) or hasRoleForServiceAndCollection(\'ROLE_ACCOUNT_BUYER_ADMIN\', \'account\', #collectionId) or hasPrivilegeForServiceAndCollection(\'account/viewall/accounttype\', \'account\', #collectionId )") @ResponseStatus(ACCEPTED) @Audit(action="FindAllAccountType") public org.springframework.http.ResponseEntity<AccountTypesAPIResponse> findAllAccountType(@RequestHeader(value="locale",required=false) @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="STOREID") long storeId, @RequestHeader(value="x-collection-id",required=true) @AuditField(field="COLLECTIONID") long collectionId, @RequestHeader(value="x-auth-token",required=true) @AuditField(field="AUTHTOKEN") String authToken, @RequestParam(value="page",required=false,defaultValue="1") @AuditField(field="PAGE") int page, @RequestParam(value="size",required=false,defaultValue="10") @AuditField(field="SIZE") int size, @RequestParam(value="filter",required=false,defaultValue="") @AuditField(field="FILTER") String filter, @RequestParam(value="sort",required=false) @AuditField(field="SORT") String sort) This method is used to find all AccountTypes based on given AccountType Request.- Parameters:
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
storeId
- Refers to the unique id of the storeversion
- Refers to the versionpage
- This parameter will be available for all the services that supports pagination. This parameter is used to mention the starting index of the items which going to responded by the API.size
- This parameter will be available for all the services that supports pagination. This parameter is used to mention the number of maximum items that needs to be responded for the request.filter
- the filtersort
- the sort.- Returns:
- It returns the
AccountTypes
.
-
getAccountTypeById
@GetMapping("/{accountTypeId}") @PreAuthorize("hasRoleForServiceAndCollection(\'ROLE_ACCOUNT_ADMIN\', \'account\', #collectionId) or hasRoleForServiceAndCollection(\'ROLE_ACCOUNT_REP\', \'account\', #collectionId) or hasRoleForServiceAndCollection(\'ROLE_ACCOUNT_BUYER_ADMIN\', \'account\', #collectionId) or hasPrivilegeForServiceAndCollection(\'account/view/accounttype\', \'account\', #collectionId )") @ResponseStatus(ACCEPTED) @Audit(action="GetAccountType") public org.springframework.http.ResponseEntity<AccountTypes> getAccountTypeById(@RequestHeader(value="locale",required=false) @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="STOREID") long storeId, @RequestHeader(value="x-collection-id",required=true) @AuditField(field="COLLECTIONID") long collectionId, @RequestHeader(value="x-auth-token",required=true) @AuditField(field="AUTHTOKEN") String authToken, @PathVariable(value="accountTypeId",required=true) @AuditField(field="ID") long id) This method is used to load single AccountType based on given AccountType Request.- Parameters:
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
storeId
- Refers to the unique id of the storeversion
- Refers to the versionid
- It refers to the unique identifier of the account type which is to be retrieved which is an autogenerated when a account type is created. A valid account type should be present for the given id.- Returns:
- It returns the
AccountTypes
.
-
deleteAccountType
@DeleteMapping("/{accountTypeId}") @PreAuthorize("hasRoleForServiceAndCollection(\'ROLE_ACCOUNT_ADMIN\', \'account\', #collectionId) or hasPrivilegeForServiceAndCollection(\'account/delete/accounttype\', \'account\', #collectionId )") @ResponseStatus(ACCEPTED) @Audit(action="DeleteAccountType") public org.springframework.http.ResponseEntity<Object> deleteAccountType(@RequestHeader(value="locale",required=false) @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="STOREID") long storeId, @RequestHeader(value="x-collection-id",required=true) @AuditField(field="COLLECTIONID") long collectionId, @RequestHeader(value="x-auth-token",required=true) @AuditField(field="AUTHTOKEN") String authToken, @PathVariable(value="accountTypeId",required=true) @AuditField(field="ID") long id) This method is used to delete AccountType based on given AccountType Request.- Parameters:
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
storeId
- Refers to the unique id of the storeversion
- Refers to the versionid
- It refers to the unique identifier of the account type which is to be retrieved which is an autogenerated when a account type is created. A valid account type should be present for the given id.- Returns:
- It returns the
AccountTypes
.
-
patchUpdateAccountType
@PatchMapping("/{accountTypeId}") @PreAuthorize("hasRoleForServiceAndCollection(\'ROLE_ACCOUNT_ADMIN\', \'account\', #collectionId) or hasPrivilegeForServiceAndCollection(\'account/update/accounttype\', \'account\', #collectionId )") @ResponseStatus(ACCEPTED) @Audit(action="UpdateAccountType") public org.springframework.http.ResponseEntity<AccountTypes> patchUpdateAccountType(@RequestHeader(value="locale",required=false) @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="STOREID") long storeId, @RequestHeader(value="x-collection-id",required=true) @AuditField(field="COLLECTIONID") long collectionId, @RequestHeader(value="x-auth-token",required=true) @AuditField(field="AUTHTOKEN") String authToken, @PathVariable(value="accountTypeId",required=true) @AuditField(field="ID") long id, @RequestBody(required=true) @AuditField(field="AccountType") AccountTypes request) This method is used to update required field in AccountType based on given AccountType Request. AccountTypePatchUpdateRequest.- Parameters:
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
storeId
- Refers to the unique id of the storeversion
- Refers to the versionid
- It refers to the unique identifier of the account type which is to be retrieved which is an autogenerated when a account type is created. A valid account type should be present for the given id.request
- It contains the attributes required for the update required field in AccountType.- Returns:
- It returns the
AccountTypes
.
-