hi FriedDust,
one way to control whether an object is editable by adding an authorization
restriction on the command "Edit" (and "Delete") for a type.
you can do this from the ui.
you can also set this up programmatically. if you subclass Application
(and revise applicationContext.xml to specify your Application class
as the bean with the id "application":
<bean id="application" class="com.foo.MyApplication">
)
then you can provide an implementation for the method "initializePermissions"
where you can do stuff like this:
HBMPersistenceMechanism hbm = (HBMPersistenceMechanism) _pmech;
Role defaultRole = (Role) hbm.fetch("from Role r where
r.name = 'Default'");
ComplexType customerType = ComplexType.forClass(Customer.class);
defaultRole.addCmdRestriction(new CreationRestriction(customerType));
defaultRole.addCmdRestriction().on(customerType.instanceCommand("Delete"));
defaultRole.addFldRestriction().on(customerType.field("name"));
defaultRole.addFldRestriction().on(customerType.field("phone"));
defaultRole.addFldRestriction().on(customerType.field("address"));
the default field restriction is a read only restriction (you can also set fields as hidden
for a specific role).
i hope this addresses your question.
in the long term, i'd like to refactor AbstractComplexEObject to provide both
a mutable and immutable versions that you can subclass from.
/ Eitan