[jboss-cvs] jboss-seam/examples/booking/src/org/jboss/seam/example/booking ...

Gavin King gavin.king at jboss.com
Fri Dec 15 08:26:32 EST 2006


  User: gavin   
  Date: 06/12/15 08:26:32

  Modified:    examples/booking/src/org/jboss/seam/example/booking  
                        Booking.java Hotel.java
  Log:
  prices
  
  Revision  Changes    Path
  1.12      +14 -1     jboss-seam/examples/booking/src/org/jboss/seam/example/booking/Booking.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Booking.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/examples/booking/src/org/jboss/seam/example/booking/Booking.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -b -r1.11 -r1.12
  --- Booking.java	25 Oct 2006 15:31:57 -0000	1.11
  +++ Booking.java	15 Dec 2006 13:26:32 -0000	1.12
  @@ -1,7 +1,8 @@
  -//$Id: Booking.java,v 1.11 2006/10/25 15:31:57 gavin Exp $
  +//$Id: Booking.java,v 1.12 2006/12/15 13:26:32 gavin Exp $
   package org.jboss.seam.example.booking;
   
   import java.io.Serializable;
  +import java.math.BigDecimal;
   import java.text.DateFormat;
   import java.util.Date;
   
  @@ -43,6 +44,18 @@
         this.user = user;
      }
   
  +   @Transient
  +   public BigDecimal getTotal()
  +   {
  +      return hotel.getPrice().multiply( new BigDecimal( getNights() ) );
  +   }
  +
  +   @Transient
  +   public int getNights()
  +   {
  +      return (int) ( checkoutDate.getTime() - checkinDate.getTime() ) / 1000 / 60 / 60 / 24;
  +   }
  +
      @Id @GeneratedValue
      public Long getId()
      {
  
  
  
  1.11      +14 -2     jboss-seam/examples/booking/src/org/jboss/seam/example/booking/Hotel.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Hotel.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/examples/booking/src/org/jboss/seam/example/booking/Hotel.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -b -r1.10 -r1.11
  --- Hotel.java	25 Oct 2006 15:31:57 -0000	1.10
  +++ Hotel.java	15 Dec 2006 13:26:32 -0000	1.11
  @@ -1,8 +1,10 @@
  -//$Id: Hotel.java,v 1.10 2006/10/25 15:31:57 gavin Exp $
  +//$Id: Hotel.java,v 1.11 2006/12/15 13:26:32 gavin Exp $
   package org.jboss.seam.example.booking;
   
   import java.io.Serializable;
  +import java.math.BigDecimal;
   
  +import javax.persistence.Column;
   import javax.persistence.Entity;
   import javax.persistence.GeneratedValue;
   import javax.persistence.Id;
  @@ -22,6 +24,7 @@
      private String state;
      private String zip;
      private String country;
  +   private BigDecimal price;
      
      @Id @GeneratedValue
      public Long getId()
  @@ -88,12 +91,21 @@
      {
         return country;
      }
  -   
      public void setCountry(String country)
      {
         this.country = country;
      }
   
  +   @Column(precision=6, scale=2)
  +   public BigDecimal getPrice()
  +   {
  +      return price;
  +   }
  +   public void setPrice(BigDecimal price)
  +   {
  +      this.price = price;
  +   }
  +   
      @Override
      public String toString()
      {
  
  
  



More information about the jboss-cvs-commits mailing list