<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.5.1.final using JasperReports Library version 6.5.1  -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="History notes" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="535" leftMargin="30" rightMargin="30" topMargin="20" bottomMargin="20" whenResourceMissingType="Key" uuid="3de66eed-4543-4457-b985-6b3e45c744ce">
	<property name="ireport.scriptlethandling" value="0"/>
	<property name="ireport.encoding" value="UTF-8"/>
	<property name="ireport.zoom" value="1.5"/>
	<property name="ireport.x" value="0"/>
	<property name="ireport.y" value="0"/>
	<property name="com.jaspersoft.studio.data.sql.SQLQueryDesigner.sash.w1" value="337"/>
	<property name="com.jaspersoft.studio.data.sql.SQLQueryDesigner.sash.w2" value="657"/>
	<property name="com.jaspersoft.studio.data.defaultdataadapter" value="Sample DB"/>
	<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
	<import value="net.sf.jasperreports.engine.*"/>
	<import value="java.util.*"/>
	<import value="net.sf.jasperreports.engine.data.*"/>
	<parameter name="host" class="java.lang.String"/>
	<parameter name="uuid" class="java.lang.String"/>
	<queryString>
		<![CDATA[import java.util.*;
import com.openkm.api.OKMNote;
import com.openkm.bean.NoteHistory;
import com.openkm.util.ISO8601;
import java.text.SimpleDateFormat;
import java.util.Calendar;

List al = new ArrayList();
String action = "CREATE";
for (NoteHistory note :  OKMNote.getInstance().getNoteHistories(null, uuid)) {
	Map dob = new HashMap();
	Calendar date =note.getDate();
	date.set(Calendar.HOUR, date.getTime().getHours());
	date.set(Calendar.MINUTE, date.getTime().getMinutes());
	date.set(Calendar.SECOND, date.getTime().getSeconds());
	date.set(Calendar.MILLISECOND, 0);
	SimpleDateFormat sf = new SimpleDateFormat( "dd-MM-yyyy HH:mm:ss");
	dob.put("date",  sf.format(date.getTime()));
	dob.put("text", note.getText());
    dob.put("user", note.getAuthor());
    dob.put("action", note.getAction());
	if(action.equals("CREATE")){
    	dob.put("isNote", true);
    }else{
    	dob.put("isNote", false);
    }
    action = note.getAction();
	al.add(dob);
}

return al;

return al;]]>
	</queryString>
	<field name="date" class="java.lang.String">
		<fieldDescription><![CDATA[date]]></fieldDescription>
	</field>
	<field name="text" class="java.lang.String">
		<fieldDescription><![CDATA[text]]></fieldDescription>
	</field>
	<field name="user" class="java.lang.String">
		<fieldDescription><![CDATA[user]]></fieldDescription>
	</field>
	<field name="action" class="java.lang.String">
		<fieldDescription><![CDATA[action]]></fieldDescription>
	</field>
	<field name="isNote" class="java.lang.Boolean">
		<fieldDescription><![CDATA[Agrupa las notas]]></fieldDescription>
	</field>
	<background>
		<band splitType="Stretch"/>
	</background>
	<title>
		<band height="44" splitType="Stretch">
			<image>
				<reportElement key="image-1" x="374" y="0" width="150" height="35" uuid="548b4359-a8b4-46da-af88-aef12c8f03b9"/>
				<imageExpression><![CDATA[$P{host}+"/logo/report"]]></imageExpression>
			</image>
			<textField pattern="yyyy/MM/dd" isBlankWhenNull="false">
				<reportElement key="textField-13" x="0" y="0" width="65" height="10" forecolor="#010101" uuid="bee06fbc-6d60-445d-953f-c82f2e864f8c"/>
				<box>
					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
				</box>
				<textElement verticalAlignment="Middle">
					<font fontName="Arial" size="8" isBold="true" isUnderline="false"/>
				</textElement>
				<textFieldExpression><![CDATA[new Date()]]></textFieldExpression>
			</textField>
			<textField pattern="h.mm.ss a" isBlankWhenNull="false">
				<reportElement key="textField-14" x="0" y="10" width="65" height="10" forecolor="#010101" uuid="6ed137e9-a932-45b6-a97b-e70433262962"/>
				<box>
					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
				</box>
				<textElement verticalAlignment="Middle">
					<font fontName="Arial" size="8" isBold="true" isUnderline="false"/>
				</textElement>
				<textFieldExpression><![CDATA[new Date()]]></textFieldExpression>
			</textField>
			<line>
				<reportElement key="line-3" x="-15" y="39" width="562" height="1" forecolor="#010101" uuid="a4e1071c-13b3-4b07-a220-68b585576a57"/>
				<graphicElement fill="Solid"/>
			</line>
			<staticText>
				<reportElement x="94" y="0" width="297" height="44" uuid="7d231f16-8cc1-4ab8-bdc5-8cc3b2c2b872"/>
				<textElement textAlignment="Center" verticalAlignment="Middle">
					<font fontName="SansSerif" size="22" isBold="true" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[Historic Notes]]></text>
			</staticText>
		</band>
	</title>
	<pageHeader>
		<band splitType="Stretch"/>
	</pageHeader>
	<columnHeader>
		<band height="32" splitType="Stretch">
			<staticText>
				<reportElement x="0" y="13" width="100" height="14" uuid="c2179b85-b297-4a17-b639-f8e025d887f1"/>
				<box>
					<pen lineColor="#080800"/>
					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
				</box>
				<textElement>
					<font fontName="SansSerif" isBold="true" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[User]]></text>
			</staticText>
			<staticText>
				<reportElement x="100" y="13" width="235" height="14" uuid="dfa3664e-d979-4084-9a1d-76b9a22aa720"/>
				<box>
					<pen lineColor="#080800"/>
					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
				</box>
				<textElement>
					<font fontName="SansSerif" isBold="true" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[Text]]></text>
			</staticText>
			<staticText>
				<reportElement x="335" y="13" width="100" height="14" uuid="d130aea7-a27f-4685-ab5c-b3401840edd5"/>
				<box>
					<pen lineColor="#080800"/>
					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
				</box>
				<textElement>
					<font fontName="SansSerif" isBold="true" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[Action]]></text>
			</staticText>
			<staticText>
				<reportElement x="435" y="13" width="100" height="14" uuid="1f2174b1-72ff-4fd1-a101-485bdf7338a8"/>
				<box>
					<pen lineColor="#080800"/>
					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
				</box>
				<textElement>
					<font fontName="SansSerif" isBold="true" isPdfEmbedded="false"/>
				</textElement>
				<text><![CDATA[Date]]></text>
			</staticText>
			<line>
				<reportElement key="line-5" x="0" y="29" width="534" height="1" forecolor="#010101" uuid="8be071cb-9b5f-478c-a1ec-2bb4202bd1fe"/>
			</line>
		</band>
	</columnHeader>
	<detail>
		<band height="37" splitType="Stretch">
			<printWhenExpression><![CDATA[$F{isNote} == true]]></printWhenExpression>
			<line>
				<reportElement key="line-5" x="0" y="31" width="534" height="1" forecolor="#0095FF" uuid="109f161b-d19f-42f1-8416-e9d696a3face"/>
			</line>
			<textField isStretchWithOverflow="true" isBlankWhenNull="true">
				<reportElement key="textField" x="0" y="12" width="94" height="18" uuid="bc419de5-7904-4517-bb04-dd8548fc3b5b"/>
				<textElement>
					<font fontName="SansSerif"/>
				</textElement>
				<textFieldExpression><![CDATA[$F{user}]]></textFieldExpression>
			</textField>
			<textField isStretchWithOverflow="true" isBlankWhenNull="true">
				<reportElement key="textField" x="435" y="12" width="100" height="18" uuid="9556d82e-c5d4-43c2-b9ef-264f028e54fa"/>
				<textElement>
					<font fontName="SansSerif"/>
				</textElement>
				<textFieldExpression><![CDATA[$F{date}]]></textFieldExpression>
			</textField>
		</band>
		<band height="34">
			<textField isStretchWithOverflow="true" isBlankWhenNull="true">
				<reportElement key="textField" x="435" y="2" width="100" height="18" uuid="25cedadf-5620-480d-881c-aeb49a6d4cdb"/>
				<textElement>
					<font fontName="SansSerif"/>
				</textElement>
				<textFieldExpression><![CDATA[$F{date}]]></textFieldExpression>
			</textField>
			<textField isStretchWithOverflow="true" isBlankWhenNull="true">
				<reportElement key="textField" x="335" y="2" width="94" height="18" uuid="c45b1dd0-1d27-490d-8066-9ef59152f432"/>
				<textElement>
					<font fontName="SansSerif"/>
				</textElement>
				<textFieldExpression><![CDATA[$F{action}]]></textFieldExpression>
			</textField>
			<textField isStretchWithOverflow="true" isBlankWhenNull="true">
				<reportElement key="textField" x="100" y="2" width="227" height="18" uuid="bf6362eb-4cef-482b-9971-72e8ce4bbb44"/>
				<textElement>
					<font fontName="SansSerif"/>
				</textElement>
				<textFieldExpression><![CDATA[$F{text}]]></textFieldExpression>
			</textField>
			<textField isStretchWithOverflow="true" isBlankWhenNull="true">
				<reportElement key="textField" x="0" y="2" width="94" height="18" uuid="c8bf2b3f-49bd-4705-b554-0321b5c4f952"/>
				<textElement>
					<font fontName="SansSerif"/>
				</textElement>
				<textFieldExpression><![CDATA[$F{user}]]></textFieldExpression>
			</textField>
		</band>
	</detail>
	<columnFooter>
		<band splitType="Stretch"/>
	</columnFooter>
	<pageFooter>
		<band height="30" splitType="Stretch">
			<line>
				<reportElement key="line-2" x="-15" y="4" width="567" height="1" forecolor="#010101" backcolor="#FFFFFF" uuid="1c7a558f-73b6-4d7e-b82a-abf410fcd944"/>
				<graphicElement fill="Solid"/>
			</line>
		</band>
	</pageFooter>
	<summary>
		<band splitType="Stretch"/>
	</summary>
</jasperReport>
