maia/.svn/pristine/c2/c29a96940a2ea0651388f96df6f...

140 lines
3.8 KiB
Plaintext
Executable File

package com.fp.frontend.controller.security.reports;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.ViewScoped;
import com.fp.dto.AbstractDataTransport;
import com.fp.frontend.controller.AbstractController;
import com.fp.frontend.controller.ReportController;
import com.fp.frontend.controller.security.ProfileController;
import com.fp.frontend.helper.MessageHelper;
import com.fp.persistence.pgeneral.safe.TsafeProfile;
/**
* Clase controladora de ipresion de usuarios.
*
* @author Jorge Vaca.
* @version 2.1
*/
@SuppressWarnings("serial")
@ManagedBean
@ViewScoped
public class ReportUserController extends AbstractController<AbstractDataTransport> {
@ManagedProperty(value = "#{reportController}")
private ReportController reportController;
private List<TsafeProfile> lsafeprofile;
public ReportUserController() throws Exception {
super(AbstractDataTransport.class);
}
@PostConstruct
private void postconstruct() {
this.init();
// Inicializa autoconsulta
//super.startQuery();
}
/**
* Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador.
*/
private void init() {
try {
/*this.recperpage = 15; // Cambiar al # reg a mirar.
this.lrecord = new ArrayList<>();
this.beanalias = "CATALOGDETAIL";*/
this.lsafeprofile = ProfileController.find();
} catch (Exception e) {
MessageHelper.setMessageError(e);
}
}
@Override
protected void querydatabase() {
}
/**
* Ejecuta un reporte de usuarios.
*/
public void reportuser() {
String path = "security/reports/user";
HashMap<String, Object> parameters = new HashMap<>();
//parameters.put("cmoneda", "USD");
String format = "pdf";
String filename = "usuarios";
try {
this.reportController.execute(path, parameters, format, filename, this.getLoginController());
} catch (Exception ex) {
MessageHelper.setMessageError(ex);
}
}
/**
* Ejecuta un reporte de usuarios.
*/
public void reportuserperprofile() {
String path = "security/reports/userperprofile";
HashMap<String, Object> parameters = new HashMap<>();
//parameters.put("cmoneda", "USD");
String format = "pdf";
String filename = "usuariosporperfil";
try {
this.reportController.execute(path, parameters, format, filename, this.getLoginController());
} catch (Exception ex) {
MessageHelper.setMessageError(ex);
}
}
/**
* Ejecuta un reporte de usuarios.
*/
public void reporttransactionperprofile() {
String path = "security/reports/transactionsperprofile";
HashMap<String, Object> parameters = new HashMap<>();
//parameters.put("cmoneda", "USD");
String format = "pdf";
String filename = "transaccionesporperfil";
try {
this.reportController.execute(path, parameters, format, filename, this.getLoginController());
} catch (Exception ex) {
MessageHelper.setMessageError(ex);
}
}
/**
* Entrega el valor de: reportController
* @return ReportController
*/
public ReportController getReportController() {
return this.reportController;
}
/**
* Fija el valor de: reportController
* @param reportController Valor a fijar en el atributo.
*/
public void setReportController(ReportController reportController) {
this.reportController = reportController;
}
public List<TsafeProfile> getLsafeprofile() {
return lsafeprofile;
}
public void setLsafeprofile(List<TsafeProfile> lsafeprofile) {
this.lsafeprofile = lsafeprofile;
}
}