[prev in list] [next in list] [prev in thread] [next in thread]
List: jboss-cvs-commits
Subject: [jboss-cvs] xpetstore-ejb3.0/xpetstore-ejb/java/xpetstore/domain Account.java Category.java Customer
From: Gavin King <oneovthafew () users ! sourceforge ! net>
Date: 2004-06-29 4:37:55
Message-ID: E1BfANX-00056G-7X () sc8-pr-cvs1 ! sourceforge ! net
[Download RAW message or body]
User: oneovthafew
Date: 04/06/28 21:37:55
Modified: xpetstore-ejb/java/xpetstore/domain Account.java
Category.java Customer.java Order.java
OrderItem.java
Log:
my cleanups
Revision Changes Path
1.2 +5 -21 \
xpetstore-ejb3.0/xpetstore-ejb/java/xpetstore/domain/Account.java
Index: Account.java
===================================================================
RCS file: /cvsroot/jboss/xpetstore-ejb3.0/xpetstore-ejb/java/xpetstore/domain/Account.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Account.java 25 Jun 2004 17:17:41 -0000 1.1
+++ Account.java 29 Jun 2004 04:37:54 -0000 1.2
@@ -4,7 +4,6 @@
import javax.ejb.Id;
import java.io.Serializable;
-
/**
* @author <a href="mailto:bill@jboss.org">Bill Burke</a>
*
@@ -12,34 +11,19 @@
@Entity
public class Account implements Serializable
{
- private Long userUid;
+ private Long accountId;
private String userId;
private String password;
- public boolean matchPassword( String password )
- {
- return ( password == null )
- ? ( getPassword( ) == null )
- : password.equals( getPassword( ) );
- }
-
- public Account() {}
-
@Id
- public Long getUserUid() {
- return userUid;
+ public Long getAccountId() {
+ return accountId;
}
- public void setUserUid(Long userUid) {
- this.userUid = userUid;
+ public void setAccountId(Long accountId) {
+ this.accountId = accountId;
}
- public Account(String userId, String password)
- {
- this.userId = userId;
- this.password = password;
- }
-
public String getUserId() {
return userId;
}
1.2 +0 -4 \
xpetstore-ejb3.0/xpetstore-ejb/java/xpetstore/domain/Category.java
Index: Category.java
===================================================================
RCS file: /cvsroot/jboss/xpetstore-ejb3.0/xpetstore-ejb/java/xpetstore/domain/Category.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Category.java 25 Jun 2004 17:17:41 -0000 1.1
+++ Category.java 29 Jun 2004 04:37:54 -0000 1.2
@@ -19,10 +19,6 @@
private String description;
private Collection<Product> products = new ArrayList<Product>();
- //==========================================
- // CMR fields
- //==========================================
-
@Id
public Long getCategoryId() {
return categoryId;
1.2 +0 -34 \
xpetstore-ejb3.0/xpetstore-ejb/java/xpetstore/domain/Customer.java
Index: Customer.java
===================================================================
RCS file: /cvsroot/jboss/xpetstore-ejb3.0/xpetstore-ejb/java/xpetstore/domain/Customer.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Customer.java 25 Jun 2004 17:17:41 -0000 1.1
+++ Customer.java 29 Jun 2004 04:37:54 -0000 1.2
@@ -12,7 +12,6 @@
public class Customer implements Serializable
{
private Long customerId;
- //private Long userId;
private String firstname;
private String lastname;
private String email;
@@ -29,29 +28,6 @@
private String creditCardExpiryDate;
private Account account;
- public Customer()
- {
- }
-
- public Customer(Long userId, String firstname, String lastname, String email, \
String telephone, String language, String street1, String street2, String city, \
String state, String zipcode, String country, String creditCardNumber, String \
creditCardType, String creditCardExpiryDate)
- {
- //this.userId = userId;
- this.firstname = firstname;
- this.lastname = lastname;
- this.email = email;
- this.telephone = telephone;
- this.language = language;
- this.street1 = street1;
- this.street2 = street2;
- this.city = city;
- this.state = state;
- this.zipcode = zipcode;
- this.country = country;
- this.creditCardNumber = creditCardNumber;
- this.creditCardType = creditCardType;
- this.creditCardExpiryDate = creditCardExpiryDate;
- }
-
@Id
public Long getCustomerId() {
return customerId;
@@ -61,16 +37,6 @@
this.customerId = customerId;
}
- /*public Long getUserId()
- {
- return userId;
- }
-
- public void setUserId(Long userId)
- {
- this.userId = userId;
- }*/
-
public String getFirstname()
{
return firstname;
1.2 +5 -9 \
xpetstore-ejb3.0/xpetstore-ejb/java/xpetstore/domain/Order.java
Index: Order.java
===================================================================
RCS file: /cvsroot/jboss/xpetstore-ejb3.0/xpetstore-ejb/java/xpetstore/domain/Order.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Order.java 25 Jun 2004 17:17:42 -0000 1.1
+++ Order.java 29 Jun 2004 04:37:54 -0000 1.2
@@ -22,8 +22,6 @@
@Entity
public class Order implements Serializable
{
- public static final String COUNTER_NAME = "Order";
-
private int orderUId;
private Date orderDate;
private OrderStatus status;
@@ -39,7 +37,7 @@
private Customer customer;
private Collection<OrderItem> orderItems = new ArrayList<OrderItem>();
- public void add(Item item, int quantity )
+ public void add(Item item, int quantity )
{
orderItems.add( new OrderItem(item, quantity ) );
}
@@ -47,14 +45,12 @@
@Transient
public double getTotal()
{
- double total = 0;
- Iterator it = orderItems.iterator( );
-
- while ( it.hasNext( ) )
+ double total = 0;
+ Iterator it = orderItems.iterator();
+ while ( it.hasNext() )
{
- total += ( ( OrderItem ) it.next( ) ).getSubTotal( );
+ total += ( ( OrderItem ) it.next( ) ).getSubTotal();
}
-
return total;
}
1.2 +22 -15 \
xpetstore-ejb3.0/xpetstore-ejb/java/xpetstore/domain/OrderItem.java
Index: OrderItem.java
===================================================================
RCS file: /cvsroot/jboss/xpetstore-ejb3.0/xpetstore-ejb/java/xpetstore/domain/OrderItem.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- OrderItem.java 25 Jun 2004 17:17:42 -0000 1.1
+++ OrderItem.java 29 Jun 2004 04:37:54 -0000 1.2
@@ -14,35 +14,40 @@
*
*/
@Entity
-public class OrderItem implements Serializable
+public class OrderItem implements Serializable, Comparable
{
- private int orderItemUId;
+ private int orderItemId;
private int quantity;
- private double unitPrice;
private Item item;
- public OrderItem() {}
+ public int compareTo(Object o)
+ {
+ OrderItem that = (OrderItem) o;
+ return this.getItem().getItemId().compareTo( that.getItem().getItemId() );
+ }
+
+
+ protected OrderItem() {}
public OrderItem(Item item, int quantity)
{
this.item = item;
this.quantity = quantity;
}
- //public static final String COUNTER_NAME = "OrderItem";
@Transient
- public double getSubTotal( )
+ public double getSubTotal()
{
- return Math.max( getQuantity( ) * getUnitPrice( ), 0 );
+ return Math.max( getQuantity() * getListPrice(), 0 );
}
@Id
- public int getOrderItemUId() {
- return orderItemUId;
+ public int getOrderItemId() {
+ return orderItemId;
}
- public void setOrderItemUId(int orderItemUId) {
- this.orderItemUId = orderItemUId;
+ public void setOrderItemId(int orderItemId) {
+ this.orderItemId = orderItemId;
}
public int getQuantity() {
@@ -53,12 +58,14 @@
this.quantity = quantity;
}
- public double getUnitPrice() {
- return unitPrice;
+ @Transient
+ public double getListPrice() {
+ return item.getListPrice();
}
- public void setUnitPrice(double unitPrice) {
- this.unitPrice = unitPrice;
+ @Transient
+ public Long getItemId() {
+ return item.getItemId();
}
public Item getItem() {
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
jboss-cvs-commits mailing list
jboss-cvs-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-cvs-commits
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic