]> git.somenet.org - pub/jan/sbc.git/blob - src/main/java/at/ac/tuwien/sbc/valesriegler/types/Pizza.java
Some UI Fixes in PizzeriaGUI inter-table communication.
[pub/jan/sbc.git] / src / main / java / at / ac / tuwien / sbc / valesriegler / types / Pizza.java
1 package at.ac.tuwien.sbc.valesriegler.types;
2
3 import java.io.Serializable;
4
5 import at.ac.tuwien.sbc.valesriegler.common.Util;
6 import at.ac.tuwien.sbc.valesriegler.waiter.jms.JMSWaiter;
7
8 /**
9  * this is a PIZZA! omnomnomnom
10  * 
11  * @author jan
12  * 
13  */
14 public class Pizza extends PizzaOrder implements Serializable {
15         public JMSWaiter deliveryAgent;
16
17         /**
18          * Yes that's funny! the pizza has a field idOfOrder although PizzaOrder
19          * already has a field orderId! The reason: The space linda selection is a
20          * little bit limited. when I look for a template pizza with orderId set the
21          * space gives me ALL pizzas. The reason obviously is that it can't really
22          * include the field of the superclass in the search. So we must have an
23          * idOfOrder field in the pizza and not only in the PizzaOrder for the time
24          * being.. ^^
25          */
26         private Integer idOfOrder;
27
28         private Pizza(int id, PizzaType type, int cookId, int orderId, boolean isDeliveryPizza) {
29                 this.id = id;
30                 this.pizzaType = type;
31                 this.cookId = cookId;
32                 this.idOfOrder = orderId;
33         this.isDeliveryPizza = isDeliveryPizza;
34                 this.status = PizzaOrderStatus.DONE;
35         }
36
37         public Pizza() {
38                 super();
39         }
40
41         public static Pizza createPizzaFromPizzaOrder(PizzaOrder pizzaorder, int cookId, boolean isDeliveryPizza) {
42                 return new Pizza(pizzaorder.getId(), pizzaorder.getPizzaType(), cookId, pizzaorder.getOrderId(), isDeliveryPizza);
43         }
44
45         @Override
46         public String toString() {
47                 return "Pizza [deliveryAgent=" + deliveryAgent + ", id=" + id + ", orderId=" + orderId + ", pizzaType=" + pizzaType
48                                 + ", status=" + status + ", cookId=" + cookId + "]";
49         }
50
51         @Override
52         public int getOrderId() {
53                 return getIdOfOrder();
54         };
55
56         @Override
57         public void setOrderId(Integer orderId) {
58                 idOfOrder = orderId;
59         };
60
61         public int getIdOfOrder() {
62                 return Util.getIntSafe(idOfOrder);
63         }
64
65         public void setIdOfOrder(Integer idOfOrder) {
66                 this.idOfOrder = idOfOrder;
67         }
68
69 }