protected void elaborarReporte(HttpServletRequest req, HttpServletResponse response)
throws ServletException, IOException, InstantiationException, IllegalAccessException {
Map params = (Map) req.getSession().getAttribute(ParamsConst.PARAMS);
Service service = (Service) getType(params).newInstance();
Collection columnsModels = (Collection) params.get(ParamsConst.COLUMN_MODEL);
Report report = new Report((String)params.get(ParamsConst.TITLE), response, Report.CONTENT_TYPE);
TablaPDF tabla = new TablaPDF(report.getDocument());
List<Float> tamanios = new ArrayList();
Integer columnas = 0;
if (columnsModels!=null){
Iterator itDefiniciones = columnsModels.iterator();
while (itDefiniciones.hasNext()) {
Object define = (Object) itDefiniciones.next();
Boolean hidden = (Boolean) getValue(define, "hidden");
if (!hidden){
CeldaPDF celda = new CeldaPDF();
celda.addTexto((String) getValue(define, "name"));
celda.applyHeaderColor();
celda.setAlineacionHorizontal(Element.ALIGN_CENTER);
celda.setAlineacionVertical(Element.ALIGN_MIDDLE);
tabla.addCelda(celda);
tamanios.add(new Float((Integer)getValue(define, "size") * 30) );
columnas++;
}
}
}
tabla.setTamanioColumnas(tamanios);
tabla.setColumnas(columnas);
try {
params.put(ParamsConst.REQUEST, req);
params.put(ListService.LIMIT, null);
params.put(ListService.OFFSET, null);
Map result = service.execute(params);
Collection datas = (Collection) result.get(ParamsConst.DATA);
if (datas!=null){
Iterator itDatas = datas.iterator();
int i=0;