]> git.somenet.org - pub/jan/sbc.git/blob - src/main/java/at/ac/tuwien/sbc/valesriegler/types/PizzaOrder.java
[XVSM] Create initial Pizzeria Recovery support.
[pub/jan/sbc.git] / src / main / java / at / ac / tuwien / sbc / valesriegler / types / PizzaOrder.java
1 package at.ac.tuwien.sbc.valesriegler.types;
2
3 import java.io.Serializable;
4
5 import at.ac.tuwien.sbc.valesriegler.common.HasId;
6 import at.ac.tuwien.sbc.valesriegler.common.Util;
7
8 /**
9  * Class denoting one Pizza in the future and its state.
10  * 
11  * @author jan
12  * 
13  */
14 public class PizzaOrder implements Serializable, HasId {
15         private static int nextID = 0;
16         protected Integer id;
17
18         protected Integer orderId;
19         protected PizzaType pizzaType;
20         protected PizzaOrderStatus status;
21         protected Integer cookId;
22
23     public PizzaOrder(PizzaType pizzaType) {
24                 id = ++nextID;
25                 this.pizzaType = pizzaType;
26                 status = PizzaOrderStatus.NEW;
27         }
28
29         public PizzaOrder(int id) {
30                 this.id = id;
31         }
32
33         public PizzaOrder() {
34         }
35
36     public PizzaType getPizzaType() {
37                 return pizzaType;
38         }
39
40         public PizzaOrderStatus getStatus() {
41                 return status;
42         }
43
44         public int getId() {
45                 return id;
46         }
47
48         public int getCookId() {
49                 return Util.getIntSafe(cookId);
50         }
51
52         public void setCookId(int cookId) {
53                 this.cookId = cookId;
54         }
55
56         public void setStatus(PizzaOrderStatus status) {
57                 this.status = status;
58         }
59
60         public void setId(Integer id) {
61                 this.id = id;
62         }
63
64         public void setPizzaType(PizzaType pizzaType) {
65                 this.pizzaType = pizzaType;
66         }
67
68
69
70         public int getOrderId() {
71                 return Util.getIntSafe(orderId);
72         }
73
74         public void setOrderId(Integer orderId) {
75                 this.orderId = orderId;
76         }
77
78         @Override
79         public String toString() {
80                 return "PizzaOrder [id=" + id + ", orderId=" + orderId + ", pizzaType="
81                                 + pizzaType + ", status=" + status + "]";
82         }
83
84 }