1 package org.springframework.samples.jpetstore.domain; 2 3 import java.io.Serializable ; 4 5 public class LineItem implements Serializable { 6 7 8 9 private int orderId; 10 private int lineNumber; 11 private int quantity; 12 private String itemId; 13 private double unitPrice; 14 private Item item; 15 16 17 18 public LineItem() { 19 } 20 21 public LineItem(int lineNumber, CartItem cartItem) { 22 this.lineNumber = lineNumber; 23 this.quantity = cartItem.getQuantity(); 24 this.itemId = cartItem.getItem().getItemId(); 25 this.unitPrice = cartItem.getItem().getListPrice(); 26 this.item = cartItem.getItem(); 27 } 28 29 30 31 public int getOrderId() { return orderId; } 32 public void setOrderId(int orderId) { this.orderId = orderId; } 33 34 public int getLineNumber() { return lineNumber; } 35 public void setLineNumber(int lineNumber) { this.lineNumber = lineNumber; } 36 37 public String getItemId() { return itemId; } 38 public void setItemId(String itemId) { this.itemId = itemId; } 39 40 public double getUnitPrice() { return unitPrice; } 41 public void setUnitPrice(double unitprice) { this.unitPrice = unitprice; } 42 43 public Item getItem() { return item; } 44 public void setItem(Item item) { 45 this.item = item; 46 } 47 48 public int getQuantity() { return quantity; } 49 public void setQuantity(int quantity) { 50 this.quantity = quantity; 51 } 52 53 public double getTotalPrice() { 54 return this.unitPrice * this.quantity; 55 } 56 57 } 58 | Popular Tags |