Class ApprovalWorkflowController

java.lang.Object
com.skava.accounts.workflow.web.ApprovalWorkflowController

@RestController @RequestMapping("/accounts/{accountId}/approvalWorkflowRule") public class ApprovalWorkflowController extends Object
The Class ApprovalWorkflowController-
The controller class has service end points to process ApprovalWorkflowRule entity.
Author:
Infosys Equinox
  • Constructor Details

    • ApprovalWorkflowController

      public ApprovalWorkflowController()
  • Method Details

    • createApprovalRule

      @PostMapping @PreAuthorize("hasRoleForServiceAndCollectionAndAccount(\'ROLE_ACCOUNT_BUYER_ADMIN\', \'account\', #collectionId, #accountId) or hasPrivilegeForServiceAndCollectionAndAccount(\'account/create/approvalRule\', \'account\', #collectionId, #accountId )") @ResponseStatus(ACCEPTED) @Audit(action="CreateApprovalRule") public org.springframework.http.ResponseEntity<ApprovalRule> createApprovalRule(@RequestHeader(value="locale",required=false,defaultValue="en_US") @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="accountId",required=true) @AuditField(field="ACCOUNTID") long accountId, @RequestBody(required=true) @AuditField(field="ApprovalRule") ApprovalRule request)
      Creates the approvalrule.
      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 store
      version - Refers to the version
      accountId - It refers to the id of the account which is a unique identifier. An account should exists for the given account id, and also the account should be associated with the given collection id.
      request - It refers to the rule approval request object which consists of the details using which a new Approval Workflow Rule will be created
      Returns:
      the response entity of type ApprovalRuleAPIResponse
    • getApprovalRule

      @GetMapping("/{approvalWorkflowRuleId}") @PreAuthorize("hasRoleForServiceAndCollectionAndAccount(\'ROLE_ACCOUNT_BUYER_ADMIN\', \'account\', #collectionId, #accountId) or hasPrivilegeForServiceAndCollectionAndAccount(\'account/get/approvalRule\', \'account\', #collectionId, #accountId )") @ResponseStatus(OK) @Audit(action="GetApprovalRule") public org.springframework.http.ResponseEntity<GetApprovalResponse> getApprovalRule(@RequestHeader(value="locale",required=false,defaultValue="en_US") @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="accountId",required=true) @AuditField(field="ACCOUNTID") long accountId, @PathVariable(value="approvalWorkflowRuleId",required=true) @AuditField(field="APPROVALWORKFLOWRULEID") long approvalRuleId)
      Get the ApprovalWorkflowRule.
      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 store
      version - Refers to the version
      accountId - It refers to the id of the account which is a unique identifier. An account should exists for the given account id, and also the account should be associated with the given collection id.
      approvalRuleId - It refers to the id of an Approval Workflow rule which is a unique identifier.
      Returns:
      response entity
    • deleteApprovalRule

      @DeleteMapping("/{approvalWorkflowRuleId}") @PreAuthorize("hasRoleForServiceAndCollectionAndAccount(\'ROLE_ACCOUNT_BUYER_ADMIN\', \'account\', #collectionId, #accountId) or hasPrivilegeForServiceAndCollectionAndAccount(\'account/delete/approvalRule\', \'account\', #collectionId, #accountId )") @ResponseStatus(OK) @Audit(action="DeleteApprovalRule") public org.springframework.http.ResponseEntity<DeleteApprovalResponse> deleteApprovalRule(@RequestHeader(value="locale",required=false,defaultValue="en_US") @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="accountId",required=true) @AuditField(field="ACCOUNTID") long accountId, @PathVariable(value="approvalWorkflowRuleId",required=true) @AuditField(field="APPROVALWORKFLOWRULEID") long approvalRuleId)
      Delete the ApprovalWorkflowRuleId.
      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 store
      version - Refers to the version
      accountId - It refers to the id of the account which is a unique identifier. An account should exists for the given account id, and also the account should be associated with the given collection id.
      approvalRuleId - It refers to the id of an Approval Workflow rule which is a unique identifier.
      Returns:
      response entity
    • patchApprovalRule

      @PatchMapping("/{approvalWorkflowRuleId}") @PreAuthorize("hasRoleForServiceAndCollectionAndAccount(\'ROLE_ACCOUNT_BUYER_ADMIN\', \'account\', #collectionId, #accountId) or hasPrivilegeForServiceAndCollectionAndAccount(\'account/update/approvalRule\', \'account\', #collectionId, #accountId )") @ResponseStatus(OK) @Audit(action="PatchApprovalRule") public org.springframework.http.ResponseEntity<ApprovalRule> patchApprovalRule(@RequestHeader(value="locale",required=false,defaultValue="en_US") @AuditField(field="LOCALE") String locale, @RequestHeader(value="x-version",required=false,defaultValue="8.19.7") @AuditField(field="VERSION") String version, @RequestHeader(value="x-collection-id",required=true) @AuditField(field="COLLECTIONID") long collectionId, @RequestHeader(value="x-store-id",required=false,defaultValue="0") @AuditField(field="STOREID") long storeId, @RequestHeader(value="x-auth-token",required=true) @AuditField(field="AUTHTOKEN") String authToken, @PathVariable(value="accountId",required=true) @AuditField(field="ACCOUNTID") long accountId, @RequestBody(required=true) @AuditField(field="ApprovalRule") ApprovalRule request, @PathVariable(value="approvalWorkflowRuleId",required=true) @AuditField(field="APPROVALWORKFLOWRULEID") long approvalRuleId)
      Update the ApprovalWorkflowRuleId.
      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
      version - Refers to the version
      accountId - It refers to the id of the account which is a unique identifier. An account should exists for the given account id, and also the account should be associated with the given collection id.
      approvalRuleId - It refers to the id of an Approval Workflow rule which is a unique identifier.
      Returns:
      response entity
    • getAllApprovalRule

      @GetMapping @PreAuthorize("hasRoleForServiceAndCollectionAndAccount(\'ROLE_ACCOUNT_BUYER_ADMIN\', \'account\', #collectionId, #accountId) or hasPrivilegeForServiceAndCollectionAndAccount(\'account/get/approvalRule\', \'account\', #collectionId, #accountId )") @ResponseStatus(OK) @Audit(action="FindAllApprovalRule") public org.springframework.http.ResponseEntity<List<DefaultWorkflowDO>> getAllApprovalRule(@RequestHeader(value="locale",required=false,defaultValue="en_US") @AuditField(field="LOCALE") String locale, @RequestHeader(value="x-version",required=true,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=false) @AuditField(field="AUTHTOKEN") String authToken, @PathVariable(value="accountId",required=true) @AuditField(field="ACCOUNTID") long accountId)
      Find all the ApprovalWorkflowRule.
      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 store
      version - Refers to the version
      accountId - It refers to the id of the account which is a unique identifier. An account should exists for the given account id, and also the account should be associated with the given collection id.
    • validateApprovalRule

      @PostMapping("/validateWorkflowRule") @PreAuthorize("hasRoleForServiceAndCollectionAndAccount(\'ROLE_ACCOUNT_BUYER_ADMIN\', \'account\', #collectionId, #accountId) or hasPrivilegeForServiceAndCollectionAndAccount(\'account/validate/approvalRule\', \'account\', #collectionId, #accountId )") @ResponseStatus(OK) @Audit(action="ValidateApprovalRule") public org.springframework.http.ResponseEntity<ValidateWorkflowAPIResponse> validateApprovalRule(@RequestHeader(value="locale",required=false,defaultValue="en_US") @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="accountId",required=true) @AuditField(field="ACCOUNTID") long accountId, @RequestBody(required=true) @AuditField(field="ValidateApprovalRule") ValidateWorkflowRuleRequest request)
      validate the workflowrule.
      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 store
      version - Refers to the version
      accountId - It refers to the id of the account which is a unique identifier. An account should exists for the given account id, and also the account should be associated with the given collection id.
      request - It refers to the rule validate request object which consists of the details using which Workflow Rule will be validated.
      Returns:
      the response entity of type ValidateWorkflowAPIResponse
    • applyApprovalWorkflowRule

      @PostMapping("/applyApprovalWorkflow") @PreAuthorize("hasRoleForServiceAndCollectionAndAccount(\'ROLE_ACCOUNT_BUYER_ADMIN\', \'account\', #collectionId, #accountId) or hasRoleForServiceAndCollectionAndAccount(\'ROLE_ACCOUNT_BUYER\', \'account\', #collectionId, #accountId) or hasPrivilegeForServiceAndCollectionAndAccount(\'account/apply/approvalRule\', \'account\', #collectionId, #accountId )") @ResponseStatus(OK) @Audit(action="applyApprovalWorkflowRule") public org.springframework.http.ResponseEntity<ApplyWorkflowAPIResponse> applyApprovalWorkflowRule(@RequestHeader(value="locale",required=false,defaultValue="en_US") @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="accountId",required=true) @AuditField(field="ACCOUNTID") long accountId, @RequestBody(required=true) @AuditField(field="SFCartRequest") Cart request)
      apply an approvalWorkflowRule.
      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 store
      version - Refers to the version
      accountId - It refers to the id of the account which is a unique identifier. An account should exists for the given account id, and also the account should be associated with the given collection id.
      request - It refers to the rule approval request object which consists of the details using which a new Approval Workflow Rule will be created
      Returns:
      the response entity of type ApplyWorkflowAPIResponse