View Javadoc

1   package ecar.dao;
2   
3   import java.util.HashSet;
4   import java.util.Set;
5   
6   import javax.servlet.http.HttpServletRequest;
7   
8   import comum.database.Dao;
9   import comum.util.Pagina;
10  import ecar.pojo.Email;
11  import ecar.pojo.UsuarioUsu;
12  
13  public class EmailDao extends Dao {
14  
15    public EmailDao() {
16      super();
17    }
18  
19    public Email setEmail(HttpServletRequest request, UsuarioUsu usu) {
20      try {
21        Email email = new Email(usu);
22        email.setCodEmail(Long.valueOf(Pagina.getParam(request, "codEmail")));
23        return email;
24      } catch (Exception e) {
25        logger.error(e);
26        return null;
27      }
28    }
29  
30    @SuppressWarnings("unchecked")
31    public Set getLista(String[] list) {
32      try {
33        Set lista = new HashSet();
34        for (int i = 0; i < list.length; i++) {
35          lista.add(this.buscar(Email.class, Long.valueOf(list[i])));
36        }
37        return lista;
38      } catch (Exception e) {
39        logger.error(e);
40        return null;
41      }
42    }
43  }