IteraciĆ³n 3(VersiĆ³n sin idiomas)
[ISBets21MAUBRY] / eclipse-workspace / ISBets21MAUBRY / src / main / java / domain / Bet.java
1 package domain;
2
3 import javax.persistence.Entity;
4 import javax.persistence.GeneratedValue;
5 import javax.persistence.Id;
6 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
7
8 @Entity
9 public class Bet {
10         @GeneratedValue
11         @Id
12         @XmlJavaTypeAdapter(IntegerAdapter.class)
13         private Integer betNumber;
14         private Forecast forecast;
15         private User user;
16         private float amount;
17         private String estadoApuesta; // Pendiente Ganada Perdida Anulada
18         
19         public  String getEstadoApuesta() {
20                 return estadoApuesta;
21         }
22
23         public void setEstadoApuesta(String estadoApuesta) {
24                 this.estadoApuesta = estadoApuesta;
25         }
26
27         public Bet() {
28                 super();
29         }
30
31         public Bet(Integer n, Forecast forecast, User user, float amount) {
32                 super();
33                 this.betNumber = n;
34                 this.forecast = forecast;
35                 this.user = user;
36                 this.amount = amount;
37                 this.estadoApuesta = "Pendiente";
38         }
39
40         public Bet(Forecast forecast, User user, float amount) {
41                 super();
42                 this.forecast = forecast;
43                 this.user = user;
44                 this.amount = amount;
45                 this.estadoApuesta = "Pendiente";
46
47         }
48
49         public Forecast getForecast() {
50                 return forecast;
51         }
52
53         public void setForecast(Forecast forecast) {
54                 this.forecast = forecast;
55         }
56
57         public User getUser() {
58                 return user;
59         }
60
61         public void setUser(User user) {
62                 this.user = user;
63         }
64
65         public float getAmount() {
66                 return amount;
67         }
68
69         public void setAmount(float amount) {
70                 this.amount = amount;
71         }
72
73         @Override
74         public String toString() {
75                 return "Bet [forecast: " + forecast + ", user: " + user + ", amount: " + amount + "forecast: "
76                                 + forecast.getForecast() + "question: " + forecast.getQuestion().getQuestion() + "event: "
77                                 + forecast.getQuestion().getEvent().getDescription() + "]";
78         }
79
80         public String toString2() {
81
82                 
83
84                 
85
86                 return forecast.getQuestion().getEvent().getEventDate().toString().substring(0, 11) + "             "
87                                 + forecast.getQuestion().getEvent().getDescription() + "                             "
88                                 + forecast.getQuestion().getQuestion() + "                                                  "
89                                 + this.forecast.getForecast() + "                                           "
90                                 + estadoApuesta + "                                "
91                                 + forecast.getQuestion().getResult() + "                    " + this.getAmount()
92                                 + "                         " + forecast.getFee();
93
94 //                              + ""
95 //                              + ""
96 //                              + "forecast: " + forecast + ", amount: " + amount + "forecast: "
97 //                              + "question: " + forecast.getQuestion().getQuestion() + "event: "
98 //                              + forecast.getQuestion().getEvent().getDescription() + "]";
99 //      }
100
101         }
102
103         public String toString3() {
104
105                 return forecast.getQuestion().getEvent().getEventDate().toString().substring(0, 11)
106                                 + "                                   " + forecast.getQuestion().getEvent().getDescription()
107                                 + "                                        " + forecast.getQuestion().getQuestion()
108                                 + "                                    " + this.forecast.getForecast()
109                                 + "                                                         " + this.getAmount()
110                                 + "                                                             " + forecast.getFee();
111         }
112 }