01: /*
02: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
03: * Distributed under the terms of either:
04: * - the common development and distribution license (CDDL), v1.0; or
05: * - the GNU Lesser General Public License, v2.1 or later
06: * $Id: PersonCallbacksMetaData.java 3634 2007-01-08 21:42:24Z gbevin $
07: */
08: package com.uwyn.rifetestmodels;
09:
10: import com.uwyn.rife.database.querymanagers.generic.AbstractCallbacks;
11: import com.uwyn.rife.database.querymanagers.generic.Callbacks;
12: import com.uwyn.rife.database.querymanagers.generic.CallbacksProvider;
13: import com.uwyn.rife.site.ConstrainedProperty;
14: import com.uwyn.rife.site.MetaData;
15:
16: public class PersonCallbacksMetaData extends MetaData implements
17: CallbacksProvider {
18: public Callbacks getCallbacks() {
19: return new AbstractCallbacks<PersonCallbacks>() {
20: public boolean beforeSave(PersonCallbacks object) {
21: object.setFirstname("beforeSave");
22: return true;
23: }
24: };
25: }
26:
27: public void activateMetaData() {
28: addConstraint(new ConstrainedProperty("firstname")
29: .maxLength(10).notNull(true));
30: addConstraint(new ConstrainedProperty("lastname").inList(
31: "Smith", "Jones", "Ronda"));
32: }
33: }
|