Stefan <rife <at> m42.de> writes: > > Hi Geert, > > yes, that seems clear by your example. Nevertheless I am currently > thinking about pros and cons of a repository. Though this has not been > used in your examples I could think of the need for different > validations for one single pojo. > > Your default way would either be the current way it is implemented in > rife or > an optional (and direct) relationship between > com.mypackage.ThisPojo and > com.mypackage.ThisPojoMetaData > > But think of different users with different rights. One who could enter > a new data object and one who may modify everything (e.g. admin). Though > this could be achieved by if statements it would be an option if > validation A would allow to enter anything but the mId in your example > and validation B would allow to alter that mID also. > > Please note that this is just an idea. Maybe that will not be required > by any real world applications but is an option that would let me prefer > a repository to alter the default settings. So if such an entry does > exist that one will be taken otherwise the default behaviour will be used. > I'm a little late to the thread here, but this is exactly what I am looking at now (domain objects as true POJOs).
Was anything like this ever implemented? I think you would want three levels, two of which you have already alluded to: - A simple configuuration option that causes the framework to attempt to find PojoMetaData, based on a naming convention, in the classpath. - Configuration to explicitly map specific pojo and metadata objects. - Configuration option to specify a "MetaDataFactory" implementation that takes a class and some context information and returns a ValidatedConstrained impl. I agree with Stefan on the need for different validations in different contexts, like user or different views on the same pojo (e.g. multi-page form). In most cases you could rely on one of the simpler approaches, but can get fancy when necessary. Also, while I'm here, I just want to make sure... can the same meta data be used for form validation and for CRUD? So that one can start with CRUD and add custom UIs with minimal recoding of the business logic. Thanks. - JT _______________________________________________ Rife-users mailing list [email protected] http://lists.uwyn.com/mailman/listinfo/rife-users
