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

Shane Bryzak sbryzak at redhat.com
Mon Jul 16 23:37:14 EDT 2007


  User: sbryzak2
  Date: 07/07/16 23:37:14

  Modified:    examples/seambay/src/org/jboss/seam/example/seambay    
                        Account.java Auction.java Bid.java BidAction.java
  Log:
  lots of little bug fixes
  
  Revision  Changes    Path
  1.5       +16 -0     jboss-seam/examples/seambay/src/org/jboss/seam/example/seambay/Account.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Account.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/examples/seambay/src/org/jboss/seam/example/seambay/Account.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -b -r1.4 -r1.5
  --- Account.java	1 May 2007 01:31:48 -0000	1.4
  +++ Account.java	17 Jul 2007 03:37:14 -0000	1.5
  @@ -90,4 +90,20 @@
      {
         this.location = location;
      }
  +   
  +   @Override
  +   public boolean equals(Object value)
  +   {
  +      if (!(value instanceof Account)) return false;
  +      
  +      Account other = (Account) value;
  +      
  +      return other.accountId != null && other.accountId.equals(this.accountId);
  +   }
  +   
  +   @Override
  +   public int hashCode()
  +   {
  +      return accountId != null ? accountId.intValue() : super.hashCode();
  +   }
   }
  
  
  
  1.14      +3 -2      jboss-seam/examples/seambay/src/org/jboss/seam/example/seambay/Auction.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Auction.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/examples/seambay/src/org/jboss/seam/example/seambay/Auction.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -b -r1.13 -r1.14
  --- Auction.java	16 Jul 2007 10:56:42 -0000	1.13
  +++ Auction.java	17 Jul 2007 03:37:14 -0000	1.14
  @@ -230,7 +230,8 @@
      @Transient
      public double getRequiredBid()
      {
  -      return getRequiredBid(getPrice());
  +      return highBid != null ? getRequiredBid(highBid.getActualAmount()) : 
  +         getPrice();
      }
      
      /**
  
  
  
  1.4       +2 -0      jboss-seam/examples/seambay/src/org/jboss/seam/example/seambay/Bid.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Bid.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/examples/seambay/src/org/jboss/seam/example/seambay/Bid.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -b -r1.3 -r1.4
  --- Bid.java	16 Jul 2007 10:56:42 -0000	1.3
  +++ Bid.java	17 Jul 2007 03:37:14 -0000	1.4
  @@ -6,6 +6,7 @@
   import javax.persistence.Entity;
   import javax.persistence.GeneratedValue;
   import javax.persistence.Id;
  +import javax.persistence.ManyToOne;
   
   import org.hibernate.validator.NotNull;
   
  @@ -33,6 +34,7 @@
      }
      
      @NotNull
  +   @ManyToOne
      public Auction getAuction()
      {
         return auction;
  
  
  
  1.4       +22 -1     jboss-seam/examples/seambay/src/org/jboss/seam/example/seambay/BidAction.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: BidAction.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/examples/seambay/src/org/jboss/seam/example/seambay/BidAction.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -b -r1.3 -r1.4
  --- BidAction.java	16 Jul 2007 10:56:42 -0000	1.3
  +++ BidAction.java	17 Jul 2007 03:37:14 -0000	1.4
  @@ -60,6 +60,16 @@
         entityManager.lock(bid.getAuction(), LockModeType.WRITE);
         entityManager.refresh(bid.getAuction());
         
  +      if (bid.getAuction().getStatus() != Auction.STATUS_LIVE)
  +      {
  +         return "ended";
  +      }
  +      else if (bid.getAuction().getEndDate().getTime() < bid.getBidDate().getTime())
  +      {
  +         bid.getAuction().setStatus(Auction.STATUS_COMPLETED);
  +         return "ended";
  +      }
  +      
         List<Bid> bids = entityManager.createQuery(
               "from Bid b where b.auction = :auction")
             .setParameter("auction", bid.getAuction())
  @@ -96,7 +106,18 @@
         }
         else if (bid.getMaxAmount() > highBid.getMaxAmount())
         {
  +         // If this bid is higher than the previous maximum bid, and is from
  +         // a different bidder, set the actual amount to the next required bid 
  +         // amount for the auction
  +         if (!bid.getAccount().equals(highBid.getAccount()))
  +         {
            bid.setActualAmount(Auction.getRequiredBid(highBid.getMaxAmount()));
  +         }        
  +         else
  +         {
  +            // Otherwise don't change the amount from the bidder's last bid
  +            bid.setActualAmount(highBid.getActualAmount());
  +         }
            bid.getAuction().setHighBid(bid);         
         }
         else
  
  
  



More information about the jboss-cvs-commits mailing list