User: vharcq  
  Date: 02/06/12 02:22:46

  Modified:    samples/src/java/test/ejb CustomerBean.java
  Log:
  Value Object Validator:
  If a Entity bean define an abstract setAbcValue(AbcValue value) method (that is 
implemened by Xdoclet) and a void validate(AbcValue value), then this last method will 
be called at the beginning of the generated setAbcValue(AbcValue value) method.  This 
is for implementing custom validation rules.
  
  Revision  Changes    Path
  1.3       +15 -1     xdoclet/samples/src/java/test/ejb/CustomerBean.java
  
  Index: CustomerBean.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xdoclet/samples/src/java/test/ejb/CustomerBean.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -w -r1.2 -r1.3
  --- CustomerBean.java 28 May 2002 21:23:05 -0000      1.2
  +++ CustomerBean.java 12 Jun 2002 09:22:46 -0000      1.3
  @@ -185,12 +185,26 @@
      /**
       * @ejb:interface-method view-type="remote"
       */
  -   public abstract void setCustomerNormalValue(CustomerNormalValue value);
  +   public abstract void setCustomerNormalValue(CustomerNormalValue value)
  +           throws ApplicationException;
   
      /**
       * @ejb:interface-method view-type="remote"
       */
      public abstract CustomerNormalValue getCustomerNormalValue();
  +
  +    /**
  +     * This method to show how validation errors can be reported to the user.
  +     * This is Business Logic validation error.
  +     */
  +    protected void validate(CustomerNormalValue value)
  +    throws ApplicationException{
  +        /* This exception should better be done in the client itself because
  +           it requires no ejb connection.  Anyway this is an "example" on how
  +           business validation can be done */
  +        if (value.getTax() < 0)
  +            throw new ApplicationException("A Customer can not have a negative 
Tax");
  +    }
   
      /**
       * Generated bulk accessor.
  
  
  

_______________________________________________________________

Sponsored by:
ThinkGeek at http://www.ThinkGeek.com/
_______________________________________________
Xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel

Reply via email to