-> Data Control scope [Shared/Isolated] & Transaction Options:
If bounded taskflow Overview -> behavior -> check box ‘shared data controls with calling Tf’ is Not checked means that this taskflow get its own data control frame. means having Isolated data controls.
If the property is checked means BTF uses the parent page(calling page) datacontrol frame instead creatig a new one.
Refer- Share data controls behavior [same data to be displayed on base page and region present it]:
Refer- (Transaction optios& datacontrol scope options): http://www.oracle.com/technetwork/developer-tools/adf/learnmore/adf-task-flow-trans-fund-v1-0-1723395.pdf?bcsi_scan_510c2960d4f4e50e=5IfxgIvC5gAAdZN467HNcuezvLAFAAAA7KQgLA==&bcsi_scan_filename=adf-task-flow-trans-fund-v1-0-1723395.pdf
Eg: Let’s take a basepage and display departments as readonly table. Keep two buttons to call two different bounded taskflows. for BTF1 keep the datacontrols scope proeprty to ‘shared’. So when you navigatte from basepage to BTF1 on click of button1 then the row selection in basePage will be maintained here also. Now chagne row and navigate back to basePage, again the row selection is mainainted. This is because by keeping the option to ‘shared’ will use the same datacontrol instance/frame.
Now for BTF2 keep the datacontrol proeprty to ‘isolated’ and call this BTF2 on click on button2 from base page. when you naviagate from basePage to BTF2 row selection is not maintained. Now chagne row and naviagate back to the basePagea again you can see row selection in basePage is different from selected row in BTF2. Beacause we set the datacontrol option to Isolated, it creaetd two different datacontrol instances for basepage and BTF2. [BTF2 is not using the basepage instance]
Note: 1)In above example the transaction property is left default which is “<No Controller Transaction>”
2) You can have N number BTF calling chain having datacontrol option as isolated/shared for each.
eg: UnboundedTF -> BTF1(shared) -> BTF2(isolated) -> BTF3(isolated) -> BTF4(shared)
In the above flow BTF1 uses the UTF’s datacontrol instacne (for matching datacontrols metadata)
BTF2 creates its new datacontrol instacne.
BTF3 creates its new datacontrol instacne.
BTF4 uses the BTF3’s datacontrol instacne (for matching datacontrols metadata)
3) if base page has Employee table and it is calling a BTF whose data control property is ‘shared’ and which has a page showing Departments table. Here though you set datacontrol property to ‘shared’ for BTF, as there are no datacontrol in BTF which present in basePage, a new datacontrol instance/frame will be created for the BTF.
We need to undertand from here is that datacontrol can be shared only if the metadata of datacontrol is same in current page and calling BTF. datacontrols meta data is present in page definition files.
4) (Not sure, mostly correct) Now let’s take another example, base page showing employees table and it is calling a BTF whose datacontrols property is set to ‘shared’ and which is having a page showing ‘Employees table’ and ‘departments’ table and ‘Jobs’ table. Now in this case only employees datacontrols are sahred and when you navigate from base page to BTF you can see the row selection will be maintained. but for deaprtments, jobs datacontrols it creates a new datacontrolFrame/ datacontrol instance as the department datacontrol, jobs datacontrol metadata is not present in parent page. the created dataControlFrame has datacontrols of departments, jobs only. Employees datacontrol will be taken from the existing dataControlFrame
5) So far we discussed about this property (Share data control with calling TF) behavior when navigating from one UBT/BTF to other BTF.
But this can also be used when you have differnt BTFs and they are present in a page as regions. If you set ‘shared data control with calling TF’ property to both the TFs present in the page then, selecting in one TFs table/row will be also change the current row in otehr TF if both have common data controls.
bounded taskflow Overview -> behavior -> Transaction drop down
‘No Controller Transaction’
‘Always Begin New Transaction’
‘Always Use the Existing Transaction’
‘Use the Existing Transaction If Possible’
Note: 1) Is transaction is open/Not for a datacontrol frame will be known to the framework by using method ‘ DataControlFrame.getOpenTransactionName()’
2) DataControlFrame also contains commit(), rollback() methods. Note that these are not the data control’s associated commit and rollback operations. DataControlFrame contains many datacontrols and the commit/rollbak methods in it applies to all the datacontrols in it.
Always Begin New Transaction:
Transaction (Always Begin New Transaction) + Datacontrol Scope (Isolated) => Valid
Transaction (Always Begin New Transaction) + Datacontrol Scope (Shared ) => throw error “ADFC-00020 + Task flow ‘<name>’ requires a new transaction, but a transaction is already open on the frame” at runtime.
If this option is set then, TF must call a Taskflow Return activity with ‘End Transaction’ property to ‘Commit/Rollback’ options.
Always Use the Existing Transaction:
Transaction (Always Use Existing Transaction) + Datacontrol Scope (Shared) => Valid
Transaction (Always Use Existing Transaction) + Datacontrol Scope (Isolated) => throw error “ADFC-00006: Existing
transaction is required when calling task flow <task flow name>” at runtime.
If this option is set then, TF SHOULD NOT call a Taskflow Return activity with End Transaction property to ‘Commit/Rollback’ options. If you do so, at design time only the return activity will be flagged as error and agt run time they’ll be ignored. You can set the return activity ‘End Transaction’ property to ‘None’.
Use the Existing Transaction If Possible: [If you are not sure about parent transaction, choose this option]
Transaction (Use Existing Transaction if Possible) + Datacontrol Scope (Isolated) == Transaction (Always Begin New Transaction) + Datacontrol Scope (Isolated)
Transaction (Use Existing Transaction if Possible) + Datacontrol Scope (Shared) (If datacontrol frame of parent has Open the transaction) then == Always Use Existing Transaction + Shared
Transaction (Use Existing Transaction if Possible) + Datacontrol Scope (Shared) (If datacontrol frame of parent has not Not Open the transaction) then == Always Begin New Transaction + Shared
Let’s see an example (here arrow (->) means navigaiton (calling))
UTF -> BTF1 (TXN-exisitng) -> BTF2 (TXN-New) -> BTF3 (TXN-New) -> BTF4 (TXN-exisitng)
BTF1: it uses exisitng transaction. uses same AM instance of UTF. [I assume dataControl proeprty is shared]
BTF2: it begins new transaction. new AM isntance created. so it must call taskflow return with End transaction prperty as Commit/Rollback [I assume dataControl proeprty is Isolated]
BTF3: it begins new transaction. new AM isntance created. so it must call taskflow return with End transaction prperty as Commit/Rollback [I assume dataControl proeprty is Isolated]
BTF4: it uses exisitng transaction of UTF. Here you can not set ‘End Transaction’ property of taskflow return activity to commit/rollback. it should be default (none). Once control is returned to UTF then from there you can commit/rollback.
When you commit int UTF now, then data changed in UTF& BTF4 will get committed. (BTF2, BTF3 data has to be committed there itself).
If you do not set the Transaction property to the BTF then Transaction will not be started. And if perform any transaction events, then you get run time exception.
-> <No Controller Transaction>: The called bounded task flow does not participate in any transaction management.
-> Always Use Existing Transaction: When called, the bounded task flow participates in an existing transaction already in progress.
-> Use Existing Transaction If Possible: When called, the bounded task flow either participates in an existing transaction if one exists, or starts a new transaction upon entry of the bounded task flow if one doesn’t exist.
-> Always Begin New Transaction: A new transaction starts when the bounded task flow is entered, regardless of whether or not a transaction is in progress. The new transaction completes when the bounded task flow exits.
Programatically call a DataControl frame and commit one datacontrol in it.
BindingContext bc = BindingContext.getCurrent();
String dcfName = bindingContext.getCurrentDataControlFrame();
DataControlFrame dcf = bc.findDataControlFrame(dfcName);
dcf.commit(); // or dcf.rollback();