Iteración 3(Versión sin idiomas)
[ISBets21MAUBRY] / eclipse-workspace / ISBets21MAUBRY / src / main / java / businessLogic / BLFacade.java
1 package businessLogic;
2
3 import java.util.Date;
4 import java.util.Vector;
5
6 import javax.jws.WebMethod;
7 import javax.jws.WebService;
8
9 import domain.AdminUser;
10 import domain.Bet;
11 import domain.Event;
12 import domain.Forecast;
13 //import domain.Booking;
14 import domain.Question;
15 import domain.RegularUser;
16 import domain.User;
17 import exceptions.EventFinished;
18 import exceptions.QuestionAlreadyExist;
19 import exceptions.UserAlreadyExistException;
20
21 /**
22  * Interface that specifies the business logic.
23  */
24 @WebService
25 public interface BLFacade {
26
27         /**
28          * This method creates a question for an event, with a question text and the
29          * minimum bet
30          * 
31          * @param event      to which question is added
32          * @param question   text of the question
33          * @param betMinimum minimum quantity of the bet
34          * @return the created question, or null, or an exception
35          * @throws EventFinished        if current data is after data of the event
36          * @throws QuestionAlreadyExist if the same question already exists for the
37          *                              event
38          */
39         @WebMethod
40         Question createQuestion(Event event, String question, float betMinimum) throws EventFinished, QuestionAlreadyExist;
41
42         /**
43          * This method retrieves the events of a given date
44          * 
45          * @param date in which events are retrieved
46          * @return collection of events
47          */
48         @WebMethod
49         public Vector<Event> getEvents(Date date);
50
51         public Vector<Event> getAllEvents();
52
53         public Vector<Question> getAllQuestions();
54
55         public boolean deleteEvent(Event evento);
56
57         /**
58          * This method retrieves from the database the dates a month for which there are
59          * events
60          * 
61          * @param date of the month for which days with events want to be retrieved
62          * @return collection of dates
63          */
64         @WebMethod
65         public Vector<Date> getEventsMonth(Date date);
66
67         /**
68          * This method calls the data access to initialize the database with some events
69          * and questions. It is invoked only when the option "initialize" is declared in
70          * the tag dataBaseOpenMode of resources/config.xml file
71          */
72         @WebMethod
73         public void initializeBD();
74
75 //      public RegularUser login(String username, String pass)
76 //                      throws exceptions.IncorrectPassException, exceptions.UserDoesNotExistException;
77
78 //      public boolean validoUsuario(String puser);
79
80         public RegularUser registrar(String user, String pass, String name, String lastName, String birthDate, String email,
81                         String account, Integer numb, String address, float balance) throws UserAlreadyExistException;
82
83         public boolean insertEvent(Event pEvento);
84
85         public int getNumberEvents();
86
87         public boolean existEvent(Event event);
88
89         public int getNumberForecasts();
90
91         public boolean existForecast(Forecast f);
92
93         public boolean insertForecast(Question question, String forecast, float fee);
94
95         public Vector<Forecast> getForecasts();
96
97         public Vector<Forecast> getForecasts(Question pregunta);
98
99         public boolean editarPerfilUsuario(String pContraseña, String pUsername, String pNombre, String pApellido,
100                         String pEmail, String pCuentaBancaria);
101
102         public boolean editarPerfilUsuarioSinPass(String pUsername, String pNombre, String pApellido, String pEmail,
103                         String pCuentaBancaria);
104
105         public Vector<User> getAllUsers();
106
107         public Integer getMaxIdInDB();
108
109         public boolean doLogin(String username, String pass);
110
111         public boolean isAdmin(String pusername, String ppassword);
112
113         public RegularUser getRegularUserByUsername(String pusername);
114
115         public AdminUser getAdminUserByUsername(String pusername);
116
117         public int createApuesta(Forecast pselectedAnswer, RegularUser pselectedClient, Float pselectedAmount);
118
119         public boolean closeEvent(Event e, Question q, Forecast f);
120
121         public boolean anularApuesta(Bet pApuesta);
122
123         public Vector<Bet> getApuestasAbiertas(RegularUser pUser);
124
125         public Vector<Bet> getApuestasCerradas(RegularUser pUser);
126
127         public Vector<Bet> getApuestasGanadas(RegularUser pUser);
128
129         public Vector<Bet> getApuestasPerdidas(RegularUser pUser);
130
131         public Vector<Bet> getApuestasAnuladas(RegularUser pUser);
132
133         public Vector<Bet> getApuestasByUser(RegularUser user);
134
135         public boolean aplicarBonoBienvenida(String user);
136
137         public boolean recargarSaldo(String user, Float importe);
138
139         public boolean definirResultados(Event pselectedEvent, Question pselectedQuestion, Forecast pselectedForecast);
140
141         public Vector<Question> getOpenedQuestions(Event ev);
142
143         public boolean getEstadoEvento(Event ev);
144
145         public Vector<Event> getEventosMedioCerrados();
146 }