OrderDataMetaData.java
01 /**
02  *
03  * All content copyright (c) 2003-2008 Terracotta, Inc.,
04  * except as may otherwise be noted in a separate copyright notice.
05  * All rights reserved.
06  *
07  */
08 package demo.continuations;
09 
10 import com.uwyn.rife.site.ConstrainedBean;
11 import com.uwyn.rife.site.ConstrainedProperty;
12 import com.uwyn.rife.site.MetaData;
13 
14 /**
15  *  Description of the Class
16  *
17  *@author    Terracotta, Inc.
18  */
19 public class OrderDataMetaData extends MetaData<ConstrainedBean, ConstrainedProperty> {
20    /**
21     *  Description of the Field
22     */
23    public static final String GROUP_SHIPPING = "shipping";
24    /**
25     *  Description of the Field
26     */
27    public static final String GROUP_CREDITCARD = "creditcard";
28 
29    public void activateMetaData() {
30       addGroup(GROUP_SHIPPING)
31             .addConstraint(new ConstrainedProperty("shippingMethod")
32             .notNull(true));
33 
34       addGroup(GROUP_CREDITCARD)
35             .addConstraint(new ConstrainedProperty("creditCardType")
36             .notNull(true))
37             .addConstraint(new ConstrainedProperty("creditCardNumber")
38             .notNull(true)
39             .minLength(16)
40             .maxLength(16)
41             .regexp("\\d+"))
42             .addConstraint(new ConstrainedProperty("creditCardExpiration")
43             .notNull(true)
44             .maxLength(5)
45             .regexp("\\d{2}/\\d{2}"));
46    }
47 }