Guest User

Untitled

a guest
Dec 11th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. package domain;
  2.  
  3. import data.TableGateway;
  4. import data.GrupoGateway;
  5.  
  6. import java.util.Map;
  7. import java.util.List;
  8. import java.io.IOException;
  9. import javax.servlet.ServletException;
  10.  
  11. public class GrupoModule {
  12.  
  13. private GrupoGateway gateway;
  14.  
  15. public void setGateway(TableGateway gateway) {
  16. this.gateway = (GrupoGateway)gateway;
  17. }
  18.  
  19. public void actualizar(int id, int numero, String sigla, String nombre,
  20. String horario, String aula, int id_grupo) throws Exception {
  21. if (id <= 0)
  22. throw new Exception("Identificador de grupo incorrecto");
  23. gateway.update(id,numero,sigla,nombre,horario,aula,id_grupo);
  24. }
  25.  
  26. public void ingresar(int id, int numero, String sigla, String nombre,
  27. String horario, String aula, int id_grupo) throws Exception {
  28. if (id <= 0)
  29. throw new Exception("Identificador de grupo incorrecto");
  30. if (id_grupo <= 0)
  31. gateway.insert(id,cedula,nombre,titulo,area,telefono);
  32. else
  33. throw new Exception("Error en el id del profesor");
  34. }
  35.  
  36. public void eliminar(int id) throws Exception {
  37. if (id <= 0)
  38. throw new Exception("Identificador de grupo incorrecto");
  39. gateway.delete(id+"");
  40. }
  41.  
  42. public Map<String,Object> buscar(int id) throws Exception {
  43. if (id <= 0)
  44. throw new Exception("Identificador de grupo incorrecto");
  45. Map<String,Object> grup = gateway.find(id+"");
  46. return grup;
  47. }
  48.  
  49. public List<Map<String,Object>> buscarXprof(int id) throws Exception {
  50. if (id <= 0)
  51. throw new Exception("Identificador de grupo incorrecto");
  52. List<Map<String,Object>> grups = gateway.findWithProfesor(id+"");
  53. return grups;
  54. }
  55.  
  56. public List<Map<String,Object>> listado() throws Exception {
  57. List<Map<String,Object>> grups = gateway.findAll();
  58. return grups;
  59. }
  60. }
Add Comment
Please, Sign In to add comment