public void setAttributeEditable ( Attribute attribute , boolean editable ) { attribute . setEditable ( editable ) ; if ( ! ( attribute instanceof LazyAttribute ) ) { // should not instantiate lazy attributes! if ( attribute instanceof ManyToOneAttribute ) { setAttributeEditable ( ( ( ManyToOneAttribute ) attribute ) . getValue ( ) , editable ) ; } else if ( attribute instanceof OneToManyAttribute ) { List < AssociationValue > values = ( ( OneToManyAttribute ) attribute ) . getValue ( ) ; for ( AssociationValue value : values ) { setAttributeEditable ( value , editable ) ; } } } }
Set editable state on an attribute . This needs to also set the state on the associated attributes .