Tuesday, April 13, 2010

Bit #9 - Controlling the updatability of View Object attributes programmatically

The updatability of a View Object attribute can be controlled programmatically via the isAttributeUpdateable() method. When you look at its documentation, the declarative precedence that determines the attribute updatability should become clear. Programmatically, you override this method in your View Object Implementation Java file that you generate declaratively in JDeveloper. isAttributeUpdateable() is called for each attribute in the View Object. The index that is passed as an argument to the method determines the attribute index as it is returned by the AttributesEnum enumeration defined in the View Object Implementation source - for the specific attribute. To indicate that the specific attribute is updateable, isAttributeUpdateable() returns true; it returns false otherwise.

Example:

    @Override
    public boolean isAttributeUpdateable(int index) {
        boolean isUpdateable = super.isAttributeUpdateable(index);
        
        // do not allow updating first and last name
        if (index == FIRSTNAME || index == LASTNAME) {
            isUpdateable = false;
        }
        
        return isUpdateable;
    }

Context:

View Object Row Implementation

Reference:

Oracle Fusion Middleware Java API Reference for Oracle ADF Model, Row Interface


No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...