Memoria Pentaho BI 2012
Una implementación de pentaho BI con datos universitarios, donde he realizado mis primeros pasos en el ecosistema BI, implementando Saiku Analytics y Saiku AdHoc.
Saludos
abril 15, 2018 Reynaldo Claros
abril 15, 2018 Reynaldo Claros
Para ejecutar un reporte en formato .prpt, se tiene que tener cuidado con las versiones, en este post muestro un ejemplo de ejecutar un reporte implementado con Pentaho Reporting y ejejcutado desde una aplicacion web sin requerir el servidor de pentaho.
Para ello se requiere los siguientes pasos:
Las librerias pueden sacarlas desde Pentaho Reporting Designer o bajando desde aqui Libs PDR
Descargar el proyecto con dependencias Maven aqui PentahoMaven
Localizar el archivo reporte1.prpt y abrir con Pentaho Reporting Designer y hacer los cambios que desean.
Importar las librerias al proyecto we y ejecutar.
Teniendo este esquema de implementación facilmente pueden utilizar en las siguientes versiones de Pentaho e integrarlo en sus aplicaciones web
Esta implementación se ha realizado con la version 6.1.0.1-196
Saludos.
abril 14, 2017 Reynaldo Claros
<script type="text/javascript" src="https://fastcdn.org/FileSaver.js/1.1.20151003/FileSaver.min.js"></script> |
download_chart: function (data, x, y, type) {
/** custom **/
var width = x;
var height = y;
var svg = new Blob([data], {type: "image/svg+xml;charset=utf-8"});
var url = URL.createObjectURL(svg);
var img = $('<img />')
.width(width)
.height(height)
.on('load', function () {
var canvas = document.createElement('canvas');
canvas.width = width;
canvas.height = height;
var ctx = canvas.getContext('2d');
ctx.drawImage(img.get(0), 0, 0);
canvas.toBlob(function (blob) {
saveAs(blob, "Grafico de datos." + type);
});
});
img.attr('src', url);
},
exportChart: function (type) {
var svgContent = new XMLSerializer().serializeToString($('svg')[0]);
var rep = '<svg xmlns="http://www.w3.org/2000/svg" ';
if (svgContent.substr(0, rep.length) != rep) {
svgContent = svgContent.replace('<svg ', rep);
}
this.download_chart(svgContent, $('svg').width(), $('svg').width(), type);
/*
svgContent = '<!DOCTYPE svg [<!ENTITY nbsp " ">]>' + svgContent;
var form = $('#svgChartPseudoForm');
form.find('.type').val(type);
form.find('.svg').val(svgContent);
if (this.workspace.query.name != undefined) {
var f = this.workspace.query.name.substring(this.workspace.query.name.lastIndexOf('/') + 1)
.slice(0, -6);
form.find('.name').val(f);
}
form.attr('action', Settings.REST_URL + this.workspace.query.url() +
escape("/../../export/saiku/chart"));
form.submit();*/
return false;
},
noviembre 14, 2016 Reynaldo Claros
public class STException extends Exception {
private String code;
private int status;
public STException() {
super();
}
/**
*
* @param message
*/
public STException(String message) {
super(message);
}
public STException(int status,String message) {
super(message);
this.status=status;
}
/**
* Este metodo se inicia cuando se invoca desde las excepciones que lo
* extienden
*
* @param status
* @param code
* @param message
*/
public STException(int status, String code, String message) {
super(message);
this.status = status;
this.code = code;
}
/**
*
* @param status
* @param message
* @param rootCause
*/
public STException(int status, String message, Throwable rootCause) {
super(message, rootCause);
this.status = status;
}
/**
*
* @param rootCause
*/
public STException(Throwable rootCause) {
super(rootCause);
}
public STException(String message, Throwable rootCause) {
super(message, rootCause);
}
public String getCode() {
return code;
}
public int getStatus() {
return status;
}
}
public class AccessDeniedException extends STException {
public static final int status = 401;
public AccessDeniedException() {
super();
}
/**
*
* @param message
*/
public AccessDeniedException(String message) {
super(status, message);
}
public AccessDeniedException(String code, String message) {
super(status, code, message);
}
/**
*
* @param message
* @param rootCause
*/
public AccessDeniedException(String message, Throwable rootCause) {
super(status, message, rootCause);
}
/**
*
* @param rootCause
*/
public AccessDeniedException(Throwable rootCause) {
super(rootCause);
}
}
public class DatabaseException extends STException {
public static final int status = 500;
public DatabaseException() {
super();
}
/**
*
* @param message
*/
public DatabaseException(String message) {
super(status,message);
}
public DatabaseException(String code,String message) {
super(status, code, message);
}
/**
*
* @param message
* @param rootCause
*/
public DatabaseException(String message, Throwable rootCause) {
super(status, message, rootCause);
}
/**
*
* @param rootCause
*/
public DatabaseException(Throwable rootCause) {
super(rootCause);
}
}
@Override
public void remove(String token, int id) throws STException {
log.debug("add ({},{})", token, id);
UserInfo info = null;
try {
info = SessionManager.getInstance().get(token);
TrainingDAO.getInstance().remove(info, id);
} catch (AccessDeniedException e) {
log.error("remove ({},{})", e.getLocalizedMessage(), e);
throw new AccessDeniedException ("Mensaje de objeto autenticacion");
} catch (HibernateException e) {
log.error("remove ({},{})", e.getLocalizedMessage(), e);
throw new DatabaseException("Mensaje de error en la base de dados");
}
log.debug("add void");
}
@POST
@Path("/add/{id}")
public ResponseData add(TrainingPartaker item) throws STException {
try {
TrainingPartaker nwitem = STTrainingPartaker.getInstance().add(null, item);
return STMessage.success(nwitem);
} catch (STException e) {
throw new GenericException(e);
} catch (Exception e) {
throw new GenericException(e);
}
}
@POST
@Path("/add/{id}")
public ResponseData add(TrainingPartaker item) throws STException {
try {
TrainingPartaker nwitem = STTrainingPartaker.getInstance().add(null, item);
return STMessage.success(nwitem);
} catch (AccessDeniedException e) {
throw new GenericException(e);
} catch (DatabaseException e) {
throw new GenericException(e);
} catch (ParseException e) {
throw new GenericException(e);
} catch (ConverterException e) {
throw new GenericException(e);
} catch (Exception e) {
throw new GenericException(e);
}
}
febrero 22, 2016 Reynaldo Claros
1 | import java.lang.annotation.Documented; |
1 | /** |
1 | public static void main(String[] args) { |
1 | Mensaje de la anotacion : Campo name |
febrero 22, 2016 Reynaldo Claros
1 | <!-- JODA TIME --> |
1 | private static void calcularNroPeriodos(Date fecha1, Date fecha2) { |
febrero 22, 2016 Reynaldo Claros
1 | <#assign licenseFirst = "/*"> */ |
1 | <#assign licenseFirst = "/*"> |
febrero 22, 2016 Reynaldo Claros
<html>
<head>
<title>Notificacion de Java for developers</title>
</head>
<body>
<h1>Estimado :${username} </h1>
<p>
<h2>Asunto : ${subjet}</h2>
<hr>
<i>
<a href="http://claros-java.blogspot.com">Java for Developers</a>
<br>
</i>
</body>
</html>
<!-- TEMPLATE-->
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>2.3.20</version>
</dependency>
public static String loadTemplate() throws Exception {
String templateString = "";
Writer out = new StringWriter();
try {
Template template = getConfig().getTemplate("TemplateEmail.ftl");
Map<String, Object> data = new HashMap<>();
data.put("username", "Reynaldo Claros");
data.put("subjet", "Ejemplo de Plantilla con Freemarker");
template.process(data, out);
templateString = out.toString();
out.close();
} catch (java.io.IOException | freemarker.template.TemplateException e) {
log.error("error ({})", e.getMessage());
throw new IOException(e.getMessage());
}
return templateString;
}
<html>
<head>
<title>Notificacion Java for Developers</title>
</head>
<body>
<h1>Estimado :Reynaldo Claros </h1>
<p>
<h2>Asunto : Ejemplo de Plantilla con Freemarker</h2>
<hr>
<i>
<a href="http://claros-java.blogspot.com">Java for Developers</a>
<br>
</i>
</body>
</html>