Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package domain;
- import data.TableGateway;
- import data.GrupoGateway;
- import java.util.Map;
- import java.util.List;
- import java.io.IOException;
- import javax.servlet.ServletException;
- public class GrupoModule {
- private GrupoGateway gateway;
- public void setGateway(TableGateway gateway) {
- this.gateway = (GrupoGateway)gateway;
- }
- public void actualizar(int id, int numero, String sigla, String nombre,
- String horario, String aula, int id_grupo) throws Exception {
- if (id <= 0)
- throw new Exception("Identificador de grupo incorrecto");
- gateway.update(id,numero,sigla,nombre,horario,aula,id_grupo);
- }
- public void ingresar(int id, int numero, String sigla, String nombre,
- String horario, String aula, int id_grupo) throws Exception {
- if (id <= 0)
- throw new Exception("Identificador de grupo incorrecto");
- if (id_grupo <= 0)
- gateway.insert(id,cedula,nombre,titulo,area,telefono);
- else
- throw new Exception("Error en el id del profesor");
- }
- public void eliminar(int id) throws Exception {
- if (id <= 0)
- throw new Exception("Identificador de grupo incorrecto");
- gateway.delete(id+"");
- }
- public Map<String,Object> buscar(int id) throws Exception {
- if (id <= 0)
- throw new Exception("Identificador de grupo incorrecto");
- Map<String,Object> grup = gateway.find(id+"");
- return grup;
- }
- public List<Map<String,Object>> buscarXprof(int id) throws Exception {
- if (id <= 0)
- throw new Exception("Identificador de grupo incorrecto");
- List<Map<String,Object>> grups = gateway.findWithProfesor(id+"");
- return grups;
- }
- public List<Map<String,Object>> listado() throws Exception {
- List<Map<String,Object>> grups = gateway.findAll();
- return grups;
- }
- }
Add Comment
Please, Sign In to add comment