How to conditionally set data as editable based on another fields value
By Grant Ronald-Oracle on Jul 20, 2011
This question comes up a few times in ADF land and it appeared on the OTN forums this week so I thought I would create a quick demo. The scenario is that depending on some data value, you want to define that some other data is not editable. For example, if an order status is "CANCELLED" then the order cannot be edited.
Now, you might be thinking that you could use some sort of UI functionality here; maybe an EL which checks the value of a field and sets a property or switcher to show non-editable fields. You could, but if you think about it, this is fundementally a business logic problem - regardless of how the UI looks, a cancelled order should not be editable. Its actually quite a simple piece of code you can put in ADF Business Components.
The trick is that for every attribute in a View Object or Entity Object, a framework method isAttributeUpdateable is called to check if this attribute can be updated. So, its pretty easy to override this method to add your own check.