You are here

Execute binding operation from managed bean

It often happens that you want to execute an operation added in the bindings. This is often the case with business components. You want to commit a transaction, create a new row and so on. All these operations can be added in the opertion bindings.
The snippet below shows you how to execute these operations from a managed bean.

Snippet: 
  1. private void executeOperation(String method){
  2.      BindingContainer bindings =
  3.          BindingContext.getCurrent().getCurrentBindingsEntry();
  4.      OperationBinding operationBinding =
  5.            bindings.getOperationBinding(method);
  6.      operationBinding.execute();
  7. }
Example: 
This example shows you how you can use the snippet to execute the rollback or commit depending on the outcome of a dialog:
  1. public void dialogListener(DialogEvent e) {
  2.   if(e.getOutcome() != DialogEvent.Outcome.no)
  3.    {
  4.       executeOperation("Commit");
  5.    }
  6.    else
  7.    {
  8.        executeOperation("Rollback");
  9.     }

Comments

Excellent site to learn for webcenter portal.Really love it.

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer