165 lines
4.9 KiB
Plaintext
Executable File
165 lines
4.9 KiB
Plaintext
Executable File
package com.fp.frontend.controller.security.reports;
|
|
|
|
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 javax.faces.context.FacesContext;
|
|
|
|
import com.fp.dto.AbstractDataTransport;
|
|
import com.fp.frontend.controller.AbstractController;
|
|
import com.fp.frontend.controller.ReportController;
|
|
import com.fp.frontend.controller.security.LoginController;
|
|
import com.fp.frontend.controller.security.ProfileController;
|
|
import com.fp.frontend.helper.MessageHelper;
|
|
import com.fp.persistence.pgeneral.safe.TsafeProfile;
|
|
import com.fp.persistence.pgeneral.safe.TsafeUserDetail;
|
|
|
|
/**
|
|
* 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;
|
|
|
|
@ManagedProperty(value = "#{logincontroller}")
|
|
private LoginController logincontroller;
|
|
private TsafeUserDetail tsafeUserDetailUsuario = null;
|
|
|
|
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.beanalias = "REPORTE";
|
|
this.lsafeprofile = ProfileController.find();
|
|
this.tsafeUserDetailUsuario = new TsafeUserDetail();
|
|
this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL");
|
|
|
|
} catch (Exception e) {
|
|
MessageHelper.setMessageError(e);
|
|
}
|
|
}
|
|
|
|
@Override
|
|
protected void querydatabase() {
|
|
}
|
|
|
|
/**
|
|
* Ejecuta un reporte de usuarios.
|
|
*/
|
|
public void reportuser() {
|
|
//String path = "security/reports/user";
|
|
String path = "security/reports/usuarios";
|
|
HashMap<String, Object> parameters = new HashMap<>();
|
|
parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto");
|
|
parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas");
|
|
//String format = "pdf";
|
|
String format = "xls";
|
|
String filename = "usuarios";
|
|
try {
|
|
this.reportController.executeXls(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";
|
|
//String path = "security/reports/user";
|
|
HashMap<String, Object> parameters = new HashMap<>();
|
|
parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto");
|
|
parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas");
|
|
//parameters.put("cmoneda", "USD");
|
|
//String format = "pdf";
|
|
String format = "xls";
|
|
String filename = "usuariosporperfil";
|
|
try {
|
|
this.reportController.executeXls(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;
|
|
}
|
|
|
|
public LoginController getLogincontroller() {
|
|
return logincontroller;
|
|
}
|
|
|
|
public void setLogincontroller(LoginController logincontroller) {
|
|
this.logincontroller = logincontroller;
|
|
}
|
|
|
|
|
|
}
|