1 package ecar.dao;
2
3 import java.util.Iterator;
4 import java.util.List;
5
6 import javax.servlet.http.HttpServletRequest;
7
8 import comum.database.Dao;
9
10 import ecar.exception.ECARException;
11 import ecar.pojo.TipoEnderecoTend;
12
13
14
15
16
17
18
19 public class TipoEnderecoDao extends Dao {
20
21
22
23 public TipoEnderecoDao(HttpServletRequest request) {
24 super();
25 this.request = request;
26 }
27
28
29
30
31
32 public String getTipoEnderecoJS() throws ECARException {
33 List listaTpEnd = super.listar(TipoEnderecoTend.class, new String[] { "descricaoTpend", "asc" });
34 Iterator itTpEnd = listaTpEnd.iterator();
35 StringBuilder javaScript = new StringBuilder("function getTipoEndereco(n)\n{\n");
36 javaScript.append("\tconteudo = \"\";\n");
37 while (itTpEnd.hasNext()) {
38 TipoEnderecoTend tpEnd = (TipoEnderecoTend) itTpEnd.next();
39 javaScript.append("\tconteudo += \"\\t\\t\\t\\t<option value = \\\"").append(tpEnd.getCodTpend().toString()).append("\\\">").append(tpEnd.getDescricaoTpend()).append("\";\n").append("\tconteudo += \"</option>\\n\"\n");
40 }
41 javaScript.append("\treturn(conteudo);\n}");
42 return javaScript.toString();
43 }
44 }