This post explains the use of all the available operations of Viewobject in ADF.
These can be seen when you create a Viewobject in the Model project and expand the
Viewobject -> Operations folder in Datacontrols palette.
1) Create
This operation opens a slot for a new record in the collection.
The new record is added to the collection after the page is submitted.
Works with ADF Form (af:panelFormLayout).
In ADF Table it does not show the new row inserted in the Table.
Does not require cleanup task when the user abandons the form.
2) Create Insert
The new empty record is inserted into the collection as part of the operation. This means that even if the user never submits the page, the row will still be in the collection.
Works with both ADF Table and the ADF From.
In ADF Table it shows the new row inserted in the Table.
Require cleanup task when the user abandons the form.
3) CreateWithParams
This operation is same as CreateInsert and only difference is that we can assign default values on CreateInsert.
CreateWithParams operation allows us to define parameter to assign it to the new row for some specific attribute.
How To Do: Insert “NamedData” inside ExecuteWithParams action binding in pagedef , give the "key" and "value" attribute.
Pagedef Entry:
<action IterBinding="EmployeesView1Iterator" id="CreateWithParams" RequiresUpdateModel="true" Action="createWithParams">
<NamedData NDName="FirstName" NDType="java.lang.String" NDValue="Hari"/>
</action>
4) Delete
Deletes the first row in the rowset unless is it directed to a particular row.
In order to delete a selected row, we have to make it as a current Row and then execute the Delete Operation.
How To Do: For ex. In a table check “Row Selection as Single” while dropping the table on the page or use any other operations such as setCurrentRowWithKey, setCurrentRowWithKeyValue etc.
5) Execute
Executes the VO.
6) Execute With Params
Execute the VO by passing values to the Bind Variables.
How To Do: Drag the operation on to the page. Edit the operation in the pagedef and pass the parameters to the bindVariables
7) Find
Used to search some record in the VO.
How To Do: Drop a VO as a form in the jsff , Drop “Find” and “Execute” operations in the jsff.
Click find to initialize the inputTexts, Enter the Record to be searched in the inputtext and click Execute.
8) First
Navigates to the first record/row in the rowset. ( For Ex. In a panelFormLayout)
9) Last
Navigates to the last record/row in the rowset. ( For Ex. In a panelFormLayout)
10) Next
Navigates to the next record/row in the rowset. ( For Ex. In a panelFormLayout)
11) NextSet
Navigates to the next set of record/rows based on the rangesize value in the iterator binding in pagedef.
For ex: in the rangeSize=5, in initial rowset (1-5), clicking on nextSet will display the 6th record.
12) Previous
Navigates to the previous record/row in the rowset. ( For Ex. In a panelFormLayout)
13) PreviousSet
Navigates to the previous set of record/rows based on the rangesize value in the iterator binding in pagedef.
For ex: in the rangeSize=5, in final rowset (10-15), clicking on previous will display the 9th record .
14) RemoveRowWithKey
Takes the serialized String of a row ("#{row.rowKeyStr}") as a parameter and deletes the currentrow
How To Do: Drag the operation as a button “Delete” to a column in a table and pass the parameter in pagedef as below,
Pagedef Entry:
<action IterBinding="EmployeesView1Iterator" id="removeRowWithKey" RequiresUpdateModel="false" Action="removeRowWithKey">
<NamedData NDName="rowKey" NDType="java.lang.String" NDValue="#{row.rowKeyStr}"/>
</action>
Click of “Delete” Button will delete the current row. This can be done easily by checking “Row Selection as Single” while dropping the table on the page . However this will be usefull if you stamp out the collection in a af:iterator or af:foreach
15) setCurrentRowWithKey
Takes the serialized String of a row ("#{row.rowKeyStr}") as a parameter and sets the row as the currentrow
How to Do: Drag the operation as a button “Make Current” to a column in a table and pass the parameter in pagedef as below
Pagedef Entry:
<action IterBinding="EmployeesView1Iterator" id="setCurrentRowWithKey" RequiresUpdateModel="false" Action="setCurrentRowWithKey">
<NamedData NDName="rowKey" NDType="java.lang.String" NDValue="#{row.rowKeyStr}"/>
</action>
Click of “Make Current” button will make the row as the current row. Then you can do other operations required on the current row (For ex. Delete, Edit)
16) setCurrentRowWithKeyValue
Takes the static Value (“1001”) / from an EL as a parameter and sets the row as the currentrow.
1001 should be the primary key identifying a particular row in the collection.
How to Do: Drag the operation as a button outside the table and pass the parameter in pagedef as below
Pagedef Entry:
<action IterBinding="EmployeesView1Iterator" id="setCurrentRowWithKeyValue" RequiresUpdateModel="false" Action=" setCurrentRowWithKeyValue">
<NamedData NDName="rowKey" NDType="java.lang.String" NDValue="1001"/>
</action>
The row with the primary key “1001” will be set as the current row and further operations can be performed on it.