Controlling the updatability of view object attributes programmatically
In ADF, there are a number of ways to control whether a view object attribute can be updated or not. It can be done declaratively in the Attributes tab via the Updatable combo, or on the frontend ViewController layer by setting the disabled
or readOnly
attributes of the JSF page component. Programmatically, it can be done either on a backing bean, or if you are utilizing ADF business components, on a custom view object row implementation class. This recipe demonstrates the latter case. For our example, we will disable updating any of the Department
attributes specifically for departments that have more than a specified number of employees.
Getting ready
This recipe was developed using the HRComponents
workspace, which was created in the Overriding remove() to delete associated children entities recipe in Chapter 2, Dealing with Basics: Entity Objects. The HRComponents
workspace requires a database connection to the...