<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Atol Conseils &#38; Développements</title>
	<atom:link href="http://blog.atolcd.com/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://blog.atolcd.com</link>
	<description>Un blog utilisant WordPress</description>
	<lastBuildDate>Thu, 29 Apr 2010 19:55:10 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>fr</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Geo Analysis Tool 0.6</title>
		<link>http://blog.atolcd.com/?p=578</link>
		<comments>http://blog.atolcd.com/?p=578#comments</comments>
		<pubDate>Thu, 29 Apr 2010 10:07:04 +0000</pubDate>
		<dc:creator>Sylvain Decloix</dc:creator>
				<category><![CDATA[Non classé]]></category>
		<category><![CDATA[olap sig]]></category>

		<guid isPermaLink="false">http://blog.atolcd.com/?p=578</guid>
		<description><![CDATA[Après plusieurs semaines de travail, Atol CD et moi-même sont heureux de vous annoncer la naissance de GEO ANALYSIS TOOL (G.A.T.), un serveur web open source pour l&#8217;analyse multidimensionnelle spatiale, également connue sous l&#8217;appellation GEOSBI ou encore SOLAP (&#171;&#160;Spatial OLAP&#160;&#187;).
Geo Analysis Tool (actuellement en version alpha 0.6) va permettre aux sociétés et organisations qui possèdent [...]]]></description>
			<content:encoded><![CDATA[<p>Après plusieurs semaines de travail, <a href="http://www.atolcd.com" target="_blank">Atol CD</a> et moi-même sont heureux de vous annoncer la naissance de <strong>GEO ANALYSIS TOOL</strong> <strong>(G.A.T.)</strong>, un serveur web open source pour l&#8217;analyse multidimensionnelle spatiale, également connue sous l&#8217;appellation <em><strong>GEOSBI </strong></em>ou encore <em><strong>SOLAP </strong>(&laquo;&nbsp;Spatial OLAP&nbsp;&raquo;).</em></p>
<p><strong>Geo Analysis Tool </strong>(actuellement en version <strong>alpha 0.6</strong>) va permettre aux sociétés et organisations qui possèdent des données au format spatial d&#8217;exploiter celles-ci afin d&#8217;effectuer des analyses OLAP puissantes et intuitives au travers de clients web (IE, Firefox, Opera).</p>
<h3>Pourquoi avons nous développé Geo Analysis Tool ?</h3>
<ul>
<li>Parce qu&#8217;actuellement, une seule implémentation SOLAP existe, celle de <a href="http://www.spatialytics.org" target="_blank">Spatialytics</a> avec notamment  <strong>GeoMondrian </strong>et <strong>SOLAPLayers</strong>. Cette solution nous a séduit (tout comme <strong>GeoKettle</strong>), notamment par l&#8217;implémentation côté serveur avec <strong>GeoMondrian</strong>, mais nous a frustré par sa difficulté de mise en oeuvre (pas évident de trouver une documentation complète, ni le code source sur sourceforge, il est bien caché&#8230; ) et surtout des défauts d&#8217;implémentation et des manques fonctionnels en ce qui concerne la partie restitution web</li>
</ul>
<ul>
<li>Parce que<strong> Atol CD</strong> dispose de compétences techniques pointues en <strong>SIG </strong>(système d&#8217;informations géographiques) et <strong>OSBI </strong>(Business Intelligence Open Source) et d&#8217;une bonne compréhension des besoins fonctionnels des utilisateurs. Atol CD a d&#8217;ailleurs déjà réalisé avec <a href="http://www.atolcd.com/btn-ll/mydocgis-alfresco/mydocgis-demonstration.html" target="_blank"><strong>MyDocGIS </strong></a>une mashup entre<strong> Alfresco </strong>(GED open source) et <strong>OpenLayers </strong>(SIG).</li>
</ul>
<h3>Quel est l&#8217;intérêt de Geo Analysis Tool ?</h3>
<p>L&#8217;objectif du développement de <strong>Geo Analysis Tool</strong> est très simple:</p>
<ul>
<li>Proposer un serveur <strong>GEOSBI</strong> complet et <em><strong>&laquo;&nbsp;out of the box&nbsp;&raquo;</strong></em>, donc facilement <strong>configurable </strong>et <strong>déployable </strong>!</li>
</ul>
<p>Les prérequis sont les suivants :</p>
<ul>
<li>Disposer de données spatiales (le minimum tout de même !)</li>
</ul>
<ul>
<li>Avoir un serveur <strong>PostgreSql </strong>pour le stockage de ces données avec la cartouche spatiale <strong>PostGIS</strong></li>
</ul>
<ul>
<li>Etre capable de créer des schémas de cubes OLAP avec <strong>Mondrian</strong></li>
</ul>
<h3>Quelles sont les fonctionnalités de G.A.T. 0.6 alpha ?</h3>
<p>Pour les découvrir, je vous invite à visionner la vidéo ci-dessous !</p>
<div align="center"><object width="640" height="505"><param name="movie" value="http://www.youtube.com/v/lP5Vv1eirNo&#038;hl=fr_FR&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/lP5Vv1eirNo&#038;hl=fr_FR&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="505"></embed></object></div>
<p><BR/><br />
<strong>L&#8217;architecture de Geo Analysis Tool est la suivante :</strong></p>
<p><a href="http://www.osbi.fr/wp-content/GAT-Architecture.png"><img class="alignnone size-full wp-image-1183" title="GAT-Architecture" src="http://www.osbi.fr/wp-content/GAT-Architecture.png" alt="" width="722" height="1145" /></a></p>
<h3>Pour continuer, nous avons besoin de vous !</h3>
<p>Pour poursuivre nos développements et arriver à <strong>la version 1.0 de G.A.T. </strong>, n&#8217;hésitez pas à déposer vos commentaires, besoins fonctionnels et idées sur GoogleCode, projet <a href="http://code.google.com/p/geoanalysistool" target="_blank"><strong>geoanalysistool</strong></a>.</p>
<p>Vous y trouverez d&#8217;ailleurs une <strong><a href="http://geoanalysistool.googlecode.com/files/Geo%20Analysis%20Tool%200.6.pdf" target="_blank">spécification détaillé de Geo Analysis Tool v0.6</a> !<br />
</strong></p>
<p>De notre côté, nous allons préparer et publier sur GoogleCode (dans les 2 mois) le code source et un package d&#8217;installation complet&#8230;</p>
<p>Sylvain</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.atolcd.com/?feed=rss2&amp;p=578</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Présentation (technique) d&#8217;AuditSurf :</title>
		<link>http://blog.atolcd.com/?p=321</link>
		<comments>http://blog.atolcd.com/?p=321#comments</comments>
		<pubDate>Thu, 31 Dec 2009 12:00:14 +0000</pubDate>
		<dc:creator>Bertrand Forest</dc:creator>
				<category><![CDATA[ECM]]></category>
		<category><![CDATA[alfresco]]></category>
		<category><![CDATA[audit]]></category>

		<guid isPermaLink="false">http://blog.atolcd.com/?p=321</guid>
		<description><![CDATA[
Atol met à disposition de la communauté Alfresco (sous licence GPL) une extension qui utilise à la fois le Framework Audit Trail et le Framework SURF, son nom de code : AuditSurf.
Cet outil permet d&#8217;avoir une vue d&#8217;ensemble sur l&#8217;utilisation de l&#8217;entrepôt Alfresco. Il fournit une assistance à l&#8217;administration et un suivi de l&#8217;utilisation d&#8217;Alfresco.
&#160;
Fonctionnement [...]]]></description>
			<content:encoded><![CDATA[<p><!-- 		@page { margin: 2cm } 		P { margin-bottom: 0.21cm } 		A:link { so-language: zxx } --></p>
<p style="text-align: justify;" lang="fr-CA">Atol met à disposition de la communauté Alfresco (sous licence <a href="http://www.gnu.org/licenses/gpl.html">GPL</a>) une extension qui utilise à la fois le Framework Audit Trail et le Framework SURF, son nom de code : <a href="http://www.atolcd.com/btn-ll/audit-alfresco.html">AuditSurf</a>.</p>
<p style="text-align: justify;"><span style="color: #000000;"><span lang="fr-CA">Cet outil permet d&#8217;avoir une vue d&#8217;ensemble sur l&#8217;utilisation </span>de l&#8217;entrepôt Alfresco<span lang="fr-CA">. </span>Il fournit une assistance à l&#8217;administration et un suivi de l&#8217;utilisation d&#8217;Alfresco.</span></p>
<p align="center">&nbsp;</p>
<h2>Fonctionnement général</h2>
<p style="text-align: justify;">
<p style="margin-bottom: 0cm; text-align: justify;">AuditSurf est découpé en deux blocs :</p>
<ul style="text-align: justify;">
<li>un module responsable de la récupération des données d&#8217;audit coté entrepôt (module AMP)</li>
<li>une extension SURF qui assure la présentation / mise en forme des données (Application basée sur le Framework SURF)</li>
</ul>
<p style="text-align: justify;">Les échanges entre ces deux blocs s’effectuent au travers de <em>connecteurs (HTTP)</em>, ce qui permet à notre application SURF d’appeler des WebScripts situés coté entrepôt (le format majoritairement utilisé lors de ces échanges est le JSON).</p>
<p style="text-align: justify;"><em>Voici une schématisation du fonctionnement d&#8217;AuditSurf :</em></p>
<p><img class="aligncenter size-full wp-image-322" title="auditSurf_fonctionnement_general" src="http://blog.atolcd.com/wp-content/auditSurf_fonctionnement_general.PNG" alt="auditSurf_fonctionnement_general" width="721" height="417" /></p>
<p><span id="more-321"></span></p>
<p align="center">&nbsp;</p>
<p><!-- 		@page { margin: 2cm } 		P { margin-bottom: 0.21cm } 		A:link { so-language: zxx } --></p>
<h2>Accès aux données :</h2>
<p style="text-align: justify;">
<p style="text-align: justify;">Les informations d&#8217;AuditSurf sont issues du <a href="http://wiki.alfresco.com/wiki/Category:Auditing">mécanisme d&#8217;audit trail d&#8217;Alfresco</a>, de </span><a href="http://wiki.alfresco.com/wiki/JMX">JMX</a> (pour la version entreprise seulement) et de l&#8217;entrepôt lui-même.</p>
<p style="text-align: justify;">Cette partie va traiter des mécanismes que nous avons utilisés pour extraire les données d&#8217;audit de la base de données Alfresco. Si vous désirez avoir des informations sur le mécanisme d&#8217;audit au sein d&#8217;Alfresco, je vous invite à lire l&#8217;<a title="L’Audit dans Alfresco" href="http://blog.atolcd.com/?p=217" target="_blank">article concernant l&#8217;audit</a> sur ce blog.</p>
<p style="text-align: justify;">
<p style="text-align: justify;"><em>J&#8217;illustrerai les mécanismes coté entrepôt Alfresco à l&#8217;aide d&#8217;un exemple simple (qui sera disponible au téléchargement).</em></p>
<p align="center">&nbsp;</p>
<ul>
<li>Accès aux données d’audit 	(Utilisation d’Hibernate)</span></li>
</ul>
<p style="text-align: justify;">La majorité des fonctionnalités de notre application utilisent des données qui sont stockées dans la base de données.</p>
<p style="text-align: justify;">Pour récupérer les informations dans les tables d&#8217;audit, nous utilisons le mapping Hibernate mis en place dans Alfresco et plus particulièrement l’API que propose Hibernate : <em>Criteria</em> (c<em>&#8216;est une </em><em>API d&#8217;interrogation par critères intuitive et extensible</em>).</p>
<p style="text-align: justify;">
<p style="text-align: justify;">Pour commencer, nous avons créé un service afin de centraliser tous les accès à la base de données via Hibernate. Ce service hérite de la classe abstraite HibernateDaoSupport indispensable pour pouvoir « exécuter » des requêtes Hibernate.</p>
<p style="text-align: justify;">Afin de réaliser des requêtes Criteria, il est utile de consulter le fichier de mapping Hibernate concernant l’audit qui se trouve dans le SDK Alfresco : <em>Audit.hbm.xml</em>.</p>
<p style="text-align: justify;">
<p style="text-align: justify;">
<p style="text-align: justify;"><strong><em>Prenons un exemple simple : on désire récupérer la liste des documents créés lors des sept derniers jours :</em></strong></p>
<p style="text-align: justify;">Pour récupérer la liste des documents créés, il faut auditer le service « FileFolderService » et plus particulièrement sa méthode « create ».</p>
<p style="margin-bottom: 0cm; text-align: justify;">Pour construire la requête Criteria, nous aurons besoins des trois tables d&#8217;audit :</p>
<ul style="text-align: justify;">
<li>La table <span style="font-size: x-small;"><span lang="fr-CA"><strong>ALF_AUDIT_SOURCE</strong></span></span> pour pouvoir sélectionner le service «  FileFolderService » 	et la méthode « create ».</li>
<li>La table <span style="font-size: x-small;"><strong>ALF_AUDIT_FACT</strong></span> pour récupérer les informations sur le document (sa date de 	création et son NodeRef).<span style="color: #000000;"><span lang="fr-CA"> </span></span></li>
<li style="text-align: justify;"><span style="color: #000000;"><span lang="fr-CA">et la table </span><span style="font-size: x-small;"><span lang="fr-CA"><strong>ALF_AUDIT_DATE</strong></span></span><span lang="fr-CA"> si l&#8217;on souhaite restreindre nos résultats sur une période 	précise.</span></span></li>
</ul>
<p style="text-align: justify;"><span style="color: #000000;"><span lang="fr-CA"><br />
</span></span></p>
<p style="text-align: justify;"><strong>Création du service : <em>SimpleAuditService.java</em></strong></p>
<p style="text-align: justify;">

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">com.atolcd.alfresco.auditexample.cmr</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Calendar</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.List</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">interface</span> SimpleAuditService<span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">public</span> List<span style="color: #339933;">&lt;</span>Object<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">&gt;</span> getCreatedDocuments<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">Calendar</span> start, <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">Calendar</span> end<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

</p>
<p align="center">&nbsp;</p>
<p style="text-align: justify;"><strong>Implémentation du service : <em>SimpleAuditServiceImpl.java</em></strong></p>
<ul style="text-align: justify;">
<p lang="fr-CA"><span style="color: #000000;">L&#8217;implémentation 	de notre service hérite de la classe <em>HibernateDaoSupport</em> et 	implémente évidement l&#8217;interface <em><span style="font-weight: normal;">SimpleAuditService</span></em> que nous venons de créer.</span></p>
</ul>
<p style="text-align: justify;">
<ul style="text-align: justify;">
<li><em><span lang="fr-CA">Construction de la requête Criteria</span></em></li>
</ul>
<p style="text-align: justify;" lang="java">

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">com.atolcd.alfresco.auditexample.repo</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.sql.SQLException</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Calendar</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.List</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.alfresco.repo.audit.hibernate.AuditFact</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.hibernate.Criteria</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.hibernate.HibernateException</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.hibernate.Session</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.hibernate.criterion.Expression</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.hibernate.criterion.Projections</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.hibernate.criterion.Restrictions</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.springframework.orm.hibernate3.HibernateCallback</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.springframework.orm.hibernate3.support.HibernateDaoSupport</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.atolcd.alfresco.auditexample.cmr.SimpleAuditService</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> SimpleAuditServiceImpl <span style="color: #000000; font-weight: bold;">extends</span> HibernateDaoSupport <span style="color: #000000; font-weight: bold;">implements</span> SimpleAuditService<span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">public</span> List<span style="color: #339933;">&lt;</span>Object<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">&gt;</span> getCreatedDocuments<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">Calendar</span> start, <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">Calendar</span> end<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	HibernateCallback callback <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> HibernateCallback<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
	    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">Object</span> doInHibernate<span style="color: #009900;">&#40;</span>Session session<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> HibernateException, <span style="color: #003399;">SQLException</span>
	    <span style="color: #009900;">&#123;</span>	
		Criteria crit <span style="color: #339933;">=</span> session.<span style="color: #006633;">createCriteria</span><span style="color: #009900;">&#40;</span>AuditFact.<span style="color: #000000; font-weight: bold;">class</span>, <span style="color: #0000ff;">&quot;af&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		crit.<span style="color: #006633;">createCriteria</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;auditDate&quot;</span>, <span style="color: #0000ff;">&quot;ad&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		crit.<span style="color: #006633;">createCriteria</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;auditSource&quot;</span>, <span style="color: #0000ff;">&quot;aso&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
		crit.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>Restrictions.<span style="color: #006633;">eq</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;aso.service&quot;</span>, <span style="color: #0000ff;">&quot;FileFolderService&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
		    .<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>Restrictions.<span style="color: #006633;">eq</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;aso.method&quot;</span>, <span style="color: #0000ff;">&quot;create&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
		    .<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>Restrictions.<span style="color: #006633;">eq</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;af.arg3&quot;</span>, <span style="color: #0000ff;">&quot;{http://www.alfresco.org/model/content/1.0}content&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
			.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>Restrictions.<span style="color: #006633;">eq</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;af.fail&quot;</span>, <span style="color: #000066; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>start <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span> <span style="color: #339933;">&amp;&amp;</span> end <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span>
		    crit.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>Expression.<span style="color: #006633;">between</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;ad.date&quot;</span>, start.<span style="color: #006633;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, end.<span style="color: #006633;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">//Sélection</span>
		crit.<span style="color: #006633;">setProjection</span><span style="color: #009900;">&#40;</span>Projections.<span style="color: #006633;">projectionList</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
		    .<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>Projections.<span style="color: #006633;">property</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;af.returnValue&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
		    .<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>Projections.<span style="color: #006633;">property</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;af.date&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">return</span> crit.<span style="color: #006633;">list</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	    <span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
	List<span style="color: #339933;">&lt;</span>Object<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">&gt;</span> result <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>List<span style="color: #339933;">&lt;</span>Object<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">&gt;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span>getHibernateTemplate<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">execute</span><span style="color: #009900;">&#40;</span>callback<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">return</span> result<span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

</p>
<p align="center">&nbsp;</p>
<p style="text-align: justify;" lang="fr-CA"><em><u>Explication de la requête</u> : </em></p>
<p style="text-align: justify;" lang="fr-CA">La requête ci-dessus est relativement simple et peut se décomposer comme une requête SQL classique.</p>
<p style="text-align: justify;" lang="fr-CA">Puisque l’on utilise Hibernate, on ne travail pas sur des tables mais sur des classes cependant le raisonnement est sensiblement similaire (bien que la construction n’est pas ordonnée de la même façon).</p>
<p style="text-align: justify;">
<p style="text-align: justify;" lang="fr-CA"><span style="color: #000000;">On commence par sélectionner les classes sur lesquelles on désire travailler (équivalent à clause FROM en SQL) en utilisant « createCriteria ». Ensuite, on définit des restrictions (clause WHERE) à l&#8217;aide de « Restrictions ». Puis on projette ce dont on a besoin (clause SELECT) à l&#8217;aide de  « Projections ».</span></p>
<p align="center">&nbsp;</p>
<p style="text-align: justify;">Cette requête Crtieria équivaut à la requête SQL suivante :</p>
<p style="text-align: justify;">

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">SELECT</span> af<span style="color: #66cc66;">.</span>return_val<span style="color: #66cc66;">,</span> af<span style="color: #66cc66;">.</span>timestamp
<span style="color: #993333; font-weight: bold;">FROM</span> alf_audit_fact af<span style="color: #66cc66;">,</span> alf_audit_date ad<span style="color: #66cc66;">,</span> alf_audit_source aso
<span style="color: #993333; font-weight: bold;">WHERE</span> af<span style="color: #66cc66;">.</span>audit_source_id <span style="color: #66cc66;">=</span> aso<span style="color: #66cc66;">.</span>id
<span style="color: #993333; font-weight: bold;">AND</span> af<span style="color: #66cc66;">.</span>audit_date_id <span style="color: #66cc66;">=</span> ad<span style="color: #66cc66;">.</span>id
<span style="color: #993333; font-weight: bold;">AND</span> aso<span style="color: #66cc66;">.</span>service <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'FileFolderService'</span>
<span style="color: #993333; font-weight: bold;">AND</span> aso<span style="color: #66cc66;">.</span>method <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'create'</span>
<span style="color: #993333; font-weight: bold;">AND</span> af<span style="color: #66cc66;">.</span>arg_3 <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'{http://www.alfresco.org/model/content/1.0}content'</span>
<span style="color: #993333; font-weight: bold;">AND</span> af<span style="color: #66cc66;">.</span>fail <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">0</span>
<span style="color: #66cc66;">&#91;</span><span style="color: #993333; font-weight: bold;">AND</span> ad<span style="color: #66cc66;">.</span>date_only <span style="color: #993333; font-weight: bold;">BETWEEN</span> date_debut <span style="color: #993333; font-weight: bold;">AND</span> date_fin<span style="color: #66cc66;">&#93;</span>;</pre></td></tr></table></div>

</p>
<p style="margin-bottom: 0cm; text-align: justify;">Pour plus d&#8217;informations sur Criteria, je vous renvoie vers le <a href="http://docs.jboss.org/hibernate/core/3.3/reference/en/html/querycriteria.html">site d&#8217;Hibernate</a>.</p>
<p align="center">&nbsp;</p>
<p style="text-align: justify;">
	<span style="color: orange;"><img class="alignleft size-full wp-image-433" style="border: 0pt none; margin-top: -10px; margin-bottom: -10px;" title="important" src="http://blog.atolcd.com/wp-content/important.png" alt="" width="30" height="25" />Cet exemple n&#8217;est plus d&#8217;actualité dans Alfresco 3.2 Entreprise. En effet, dans la dernière monture d&#8217;Alfresco, il faut s&#8217;intéresser au service « ContentService » et à sa méthode « getWriter » pour avoir des informations sur la création de contenu.<br />
		<em>Voici à quoi ressemblerait la requête criteria :</em><br />
	</span>
</p>
<p style="text-align: justify;">

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="java" style="font-family:monospace;">crit.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>Restrictions.<span style="color: #006633;">eq</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;aso.service&quot;</span>, <span style="color: #0000ff;">&quot;ContentService&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
	.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>Restrictions.<span style="color: #006633;">eq</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;aso.method&quot;</span>, <span style="color: #0000ff;">&quot;getWriter&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
	.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>Restrictions.<span style="color: #006633;">eq</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;af.fail&quot;</span>, <span style="color: #000066; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
crit.<span style="color: #006633;">setProjection</span><span style="color: #009900;">&#40;</span>Projections.<span style="color: #006633;">projectionList</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
		.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>Projections.<span style="color: #006633;">property</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;arg1&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
		.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>Projections.<span style="color: #006633;">property</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;af.date&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span></pre></td></tr></table></div>

</p>
<p align="center">&nbsp;</p>
<ul>
<li>Injection du service via le Framework Spring</li>
</ul>
<p>Afin de pouvoir utiliser notre service, il faut créer un bean Spring pour que l’on puisse facilement l’injecter dans nos WebScripts.</p>
<p>La déclaration du bean se fait dans le fichier <em>module-context.xml</em> du module :</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;SimpleAuditService&quot;</span></span>
<span style="color: #009900;">	<span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;com.atolcd.alfresco.auditexample.repo.SimpleAuditServiceImpl&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;sessionFactory&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ref</span> <span style="color: #000066;">bean</span>=<span style="color: #ff0000;">&quot;sessionFactory&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/property<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p align="center">&nbsp;</p>
<ul>
<li>Création d&#8217;un WebScript</li>
</ul>
<p>Maintenant que l&#8217;on a créé un service capable de récupérer des données d&#8217;audit, on peut créer un WebScript qui fera appel à ce dernier.</p>
<p>Les WebScripts d&#8217;AuditSurf (coté entrepôt) sont des <a href="http://wiki.alfresco.com/wiki/Java-backed_Web_Scripts_Samples">WebScripts Java-Backed</a>. Ces WebScripts permettent de faire des traitements plus évolués que des WebScripts « classiques ».</p>
<p>Ce genre de WebScript est composé :</p>
<ul>
<li>d&#8217;une classe Java (qui fera appel 	à notre service pour pouvoir récupérer les informations d&#8217;audit)</li>
<li>d&#8217;un fichier de description qui 	indique les URLs par lesquelles le WebScript est accessible, son 	mode d’authentification, …</li>
<li>d&#8217;un ou plusieurs templates 	(FreeMarker) correspondant aux représentations possibles (un 	template par format (HTML, JSON, Atom, etc.))</li>
<li>et éventuellement d&#8217;un fichier 	JavaScript.</li>
</ul>
<p><em>Poursuite de l&#8217;exemple</em> : on créé un WebScript qui va faire appel à la méthode <em>getCreatedDocuments</em> du service que l&#8217;on a créé précédemment (<em>SimpleAuditService</em>).</p>
<p align="center">&nbsp;</p>
<h5>1. Création de la classe JAVA</h5>
<p style="text-align: justify;">
<p style="text-align: justify;">
Ce WebScript sera de type « DeclarativeWebScript » du fait que les données qu&#8217;il renverra seront mises en forme par un template.</p>
<p>Ce WebScript aura besoin du NodeService et du service que nous avons créé. Ces services seront injectés à l&#8217;aide de Spring.</p>
<p>Afin de pour pouvoir réceptionner ces services dans la classe Java du WebScript, il faut dans un premier temps définir des « setters ».
</p>
<p align="center">&nbsp;</p>
<p><em><u>Fonctionnement</u> :</em></p>
<p style="text-align: justify;">
Le fonctionnement du WebScript est simple, il va faire appel à notre service puis il va traiter les données qui lui seront renvoyées. Les résultats seront ensuite insérés dans le « model » qui sera transmis au template.
</p>
<p align="center">&nbsp;</p>
<p style="text-align: justify;">
<em>CreatedDocumentsGet.java</em><br />
(Dans cette exemple, la période est défini par défaut, le WebScript va récupérer les fichiers créés lors des 7 derniers jours)
</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">com.atolcd.alfresco.auditexample.web.scripts</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Calendar</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Date</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.GregorianCalendar</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.HashMap</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.List</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Map</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.regex.Matcher</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.regex.Pattern</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.alfresco.service.cmr.repository.NodeRef</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.alfresco.service.cmr.repository.NodeService</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.alfresco.web.scripts.Cache</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.alfresco.web.scripts.DeclarativeWebScript</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.alfresco.web.scripts.Status</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.alfresco.web.scripts.WebScriptException</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.alfresco.web.scripts.WebScriptRequest</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.springframework.beans.factory.InitializingBean</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.springframework.util.Assert</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.atolcd.alfresco.auditexample.cmr.SimpleAuditService</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> CreatedDocumentsGet <span style="color: #000000; font-weight: bold;">extends</span> DeclarativeWebScript <span style="color: #000000; font-weight: bold;">implements</span> InitializingBean <span style="color: #009900;">&#123;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">private</span> SimpleAuditService auditService<span style="color: #339933;">;</span>
  <span style="color: #000000; font-weight: bold;">private</span> NodeService nodeService<span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// Setters</span>
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setAuditService<span style="color: #009900;">&#40;</span>SimpleAuditService auditService<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">auditService</span> <span style="color: #339933;">=</span> auditService<span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>	     
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setNodeService<span style="color: #009900;">&#40;</span>NodeService nodeService<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">nodeService</span> <span style="color: #339933;">=</span> nodeService<span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> afterPropertiesSet<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">Exception</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">Assert</span>.<span style="color: #006633;">notNull</span><span style="color: #009900;">&#40;</span>auditService<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">Assert</span>.<span style="color: #006633;">notNull</span><span style="color: #009900;">&#40;</span>nodeService<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>           
&nbsp;
  @Override
  <span style="color: #000000; font-weight: bold;">protected</span> Map<span style="color: #339933;">&lt;</span>String, Object<span style="color: #339933;">&gt;</span> executeImpl<span style="color: #009900;">&#40;</span>WebScriptRequest req, Status status, Cache cache<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
	Map<span style="color: #339933;">&lt;</span>String, Object<span style="color: #339933;">&gt;</span> model <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> HashMap<span style="color: #339933;">&lt;</span>String, Object<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	
&nbsp;
	<span style="color: #003399;">GregorianCalendar</span> start <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">GregorianCalendar</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #003399;">GregorianCalendar</span> end <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">GregorianCalendar</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	start.<span style="color: #006633;">setTime</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Date</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	end.<span style="color: #006633;">setTime</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Date</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	start.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">Calendar</span>.<span style="color: #006633;">WEEK_OF_YEAR</span>, <span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #003399;">List</span> <span style="color: #339933;">&lt;</span>Object<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">&gt;</span> listres <span style="color: #339933;">=</span> auditService.<span style="color: #006633;">getCreatedDocuments</span><span style="color: #009900;">&#40;</span>start, end<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	Map<span style="color: #339933;">&lt;</span>Date, NodeRef<span style="color: #339933;">&gt;</span> docs <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> HashMap<span style="color: #339933;">&lt;</span>Date, NodeRef<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> i<span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>i<span style="color: #339933;">&lt;</span>listres.<span style="color: #006633;">size</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	  <span style="color: #666666; font-style: italic;">//Exemple : FileInfo[name=AuditHbm.xml, isFolder=false, nodeRef=workspace://SpacesStore/06468917-9e0d-40ee-ba7d-d6125bcbd72f]</span>
	  <span style="color: #003399;">String</span> fileInfo <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#41;</span>listres.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>    	
&nbsp;
	  Pattern pNodeRef <span style="color: #339933;">=</span> Pattern.<span style="color: #006633;">compile</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;nodeRef=([^,]*)]&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	  Matcher matcher <span style="color: #339933;">=</span> pNodeRef.<span style="color: #006633;">matcher</span><span style="color: #009900;">&#40;</span>fileInfo<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	  <span style="color: #666666; font-style: italic;">//Test si le nœud existe</span>
	  <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>matcher.<span style="color: #006633;">find</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">nodeService</span>.<span style="color: #006633;">exists</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> NodeRef<span style="color: #009900;">&#40;</span>matcher.<span style="color: #006633;">group</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		NodeRef node <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> NodeRef<span style="color: #009900;">&#40;</span>matcher.<span style="color: #006633;">group</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Récupération du nœud</span>
		docs.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">Date</span><span style="color: #009900;">&#41;</span>listres.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span>, node<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	  <span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>			
&nbsp;
	<span style="color: #666666; font-style: italic;">//Insertion dans le model</span>
	model.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;createdDocs&quot;</span>, docs.<span style="color: #006633;">entrySet</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>    					
&nbsp;
	<span style="color: #000000; font-weight: bold;">return</span> model<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000000; font-weight: bold;">catch</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">Exception</span> e<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">throw</span> <span style="color: #000000; font-weight: bold;">new</span> WebScriptException<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;[CreatedDocumentsGet] Error in executeImpl function&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>		
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

</p</p>
<p align="center">&nbsp;</p>
<h5>2. Création du fichier 	de description du WebScript</h5>
<p style="text-align: justify;">
<p lang="fr-CA">Nom du fichier : <em>createddocuments.get.desc.xml</em></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;webscript<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;shortname<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Created documents<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/shortname<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;description<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Created documents<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/description<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;url<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>/auditexample/CreatedDocuments<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/url<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;authentication<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>admin<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/authentication<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/webscript<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p align="center">&nbsp;</p>
<h5>3. Création de templates</h5>
<p style="text-align: justify;">
<p>Ensuite, à l&#8217;aide de Freemarker, il possible d&#8217;effectuer le rendu que l&#8217;on souhaite (HTML, JSON, …). Voici deux exemples:</p>
<p>Rendu HTML : <em>createddocuments.get.html.ftl</em></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;#if createdDocs?exists&gt;</span>
  <span style="color: #009900;">&lt;#if createdDocs?<span style="color: #000066;">size</span> &amp;gt; <span style="color: #cc66cc;">0</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
      <span style="color: #009900;">&lt;#list createdDocs?sort_by<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;key&quot;</span><span style="color: #66cc66;">&#41;</span>?reverse as data&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
        <span style="color: #009900;">&lt;#assign node <span style="color: #66cc66;">=</span> companyhome.nodeByReference<span style="color: #66cc66;">&#91;</span><span style="color: #000066;">data</span>.<span style="color: #000066;">value</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">/</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;${url.context}${node.icon16}&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span>&gt;</span> 
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;${url.context}${node.downloadUrl}?ticket=${session.ticket}&quot;</span> <span style="color: #000066;">title</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Download&quot;</span>&gt;</span>
	     ${node.properties.name}
	 <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span> 
       (${data.key?datetime?string.medium?capitalize})
      <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>#list&gt;</span>			
    <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>#if&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>#if&gt;</span></pre></td></tr></table></div>

<p><!-- 		@page { margin: 2cm } 		P { margin-bottom: 0.21cm } --><br />
Rendu JSON : <em>createddocuments.get.json.ftl</em></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;#if createdDocs?exists&gt;</span>
  <span style="color: #009900;">&lt;#if createdDocs?<span style="color: #000066;">size</span> !<span style="color: #66cc66;">=</span><span style="color: #cc66cc;">0</span>&gt;</span>
    {
      &quot;node&quot;:
      [			
        <span style="color: #009900;">&lt;#list createdDocs?sort_by<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;key&quot;</span><span style="color: #66cc66;">&#41;</span>?reverse as data&gt;</span>
          <span style="color: #009900;">&lt;#assign node <span style="color: #66cc66;">=</span> companyhome.nodeByReference<span style="color: #66cc66;">&#91;</span><span style="color: #000066;">data</span>.<span style="color: #000066;">value</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">/</span>&gt;</span>
          {
		&quot;icon&quot; : &quot;${url.context}${node.icon16}&quot;,
		&quot;name&quot; : &quot;${node.properties.name}&quot;,
		&quot;downloadUrl&quot; : &quot;${url.context}${node.downloadUrl}?ticket=${session.ticket}&quot;,
		&quot;date&quot; : &quot;${data.key?datetime?string.medium?capitalize}&quot;
          }
          <span style="color: #009900;">&lt;#if data_has_next&gt;</span>,<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>#if&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>#list&gt;</span>
      ]
    }
  <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>#if&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>#if&gt;</span></pre></td></tr></table></div>

<p align="center">&nbsp;</p>
<h5>4. Injection Spring du Web Script</h5>
<p style="text-align: justify;">
<p>Il est important de ne pas oublier de lier la classe java (<em>CreatedDocumentsGet.java</em>) au WebScript, pour cela, il est nécessaire de créer un bean Spring, auquel on injectera les deux services dont on a besoin.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;webscript.com.atolcd.alfresco.auditexample.createddocuments.get&quot;</span></span>
<span style="color: #009900;">	<span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;com.atolcd.alfresco.auditexample.web.scripts.CreatedDocumentsGet&quot;</span></span>
<span style="color: #009900;">	<span style="color: #000066;">parent</span>=<span style="color: #ff0000;">&quot;webscript&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>		
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;auditService&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
     <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ref</span> <span style="color: #000066;">bean</span>=<span style="color: #ff0000;">&quot;SimpleAuditService&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/property<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;nodeService&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
     <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ref</span> <span style="color: #000066;">bean</span>=<span style="color: #ff0000;">&quot;NodeService&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/property<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>				
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>On active l&#8217;audit :</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Audit</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://www.alfresco.org/model/audit/1.0&quot;</span></span>
<span style="color: #009900;"><span style="color: #000066;">xmlns:xsi</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span> <span style="color: #000066;">enabled</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000066;">auditInternal</span>=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #000066;">mode</span>=<span style="color: #ff0000;">&quot;all&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span></pre></td></tr></table></div>

<p>On se limitera d&#8217;auditer la méthode « create » du service « FileFolderService ».</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Service</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;FileFolderService&quot;</span> <span style="color: #000066;">mode</span>=<span style="color: #ff0000;">&quot;none&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Method</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;create&quot;</span> <span style="color: #000066;">mode</span>=<span style="color: #ff0000;">&quot;all&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Service<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p align="center">&nbsp;</p>
<p>Cet exemple est disponible <a href='http://blog.atolcd.com/wp-content/auditExampleModule.zip'>ici</a> sous la forme d’un module Alfresco, les sources complètes étant disponibles <a href='http://blog.atolcd.com/wp-content/auditExample.zip'>ici</a>.</p>
<p><span style="color: orange;"><img class="alignleft size-full wp-image-433" style="border: 0pt none; margin-top: -10px; margin-bottom: -10px;" title="important" src="http://blog.atolcd.com/wp-content/important.png" alt="" width="30" height="25" />Cet exemple ne sera pas fonctionnel en l&#8217;état sur Alfresco 3.2 Entreprise.</span></p>
<p align="center">&nbsp;</p>
<p>Adresse pour accéder au WebScript (rendu HTML) :<br />
<a title="Rendu webscript HTML" href="http://adresse-serveur:port/alfresco/service/auditexample/CreatedDocuments.html">http://adresse-serveur:port/alfresco/service/auditexample/CreatedDocuments.html</a></p>
<p style="text-align: center;">
	<img class="aligncenter size-full wp-image-482" title="Exemple-rendu-HTML" src="http://blog.atolcd.com/wp-content/Exemple-rendu-HTML.png" alt="" width="617" height="224" />
</p>
<p align="center">&nbsp;</p>
<p>Adresse pour accéder au WebScript (rendu JSON) :<br />
<a title="Rendu webcript JSON" href="http://adresse-serveur:port/alfresco/service/auditexample/CreatedDocuments.json">http://adresse-serveur:port/alfresco/service/auditexample/CreatedDocuments.json</a></p>
<p style="text-align: center;">
	<img class="aligncenter size-full wp-image-483" title="Exemple-rendu-JSON" src="http://blog.atolcd.com/wp-content/Exemple-rendu-JSON.png" alt="" width="804" height="550" />
</p>
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<h2><strong>Mise en forme / Application SURF :</strong></h2>
<p style="text-align: center;">
<img class="size-full wp-image-475 aligncenter" style="border: 0pt none;" title="Alfresco SURF" src="http://blog.atolcd.com/wp-content/SurfLogo200.png" alt="" width="200" height="85" />
</p>
<p style="text-align: justify;">
AuditSurf a été construit à l’aide du Framework SURF (Framework web léger) et est basé sur les WebScripts. (Je vous renvoie vers l&#8217;<a href="../../../../../?p=26">article sur les fondamentaux de SURF</a>, rédigé par Thomas Broyer).
</p>
<p align="center">&nbsp;</p>
<p style="margin:0 40px;"><strong>O Comportement SURF</strong></li>
<p style="text-align: justify;">
<p style="text-align: justify;">
Toute notre application SURF est contenue dans une seule page (hormis la connexion et la déconnexion qui sont gérées par deux autres pages).</p>
<p>La page principale est découpée en une multitude de régions.</p>
<p>Chacune de ces régions étant associée à un composant et chaque composant est lié à un WebScript SURF.</p>
<p>Tous les WebScripts SURF font appels à des WebScripts situés coté entrepôt Alfresco. Pour cela, on utilise des « endpoint » et des connecteurs pour communiquer (Je vous renvoie une nouvel fois vers l’article de Thomas Broyer, §4 de la section « Architecture »).</p>
<p>Ces connecteurs sont définis dans le fichier <em>webscript-framework-config.xml</em>, ils permettent de définir le mode d’accès (mais pas seulement) à l&#8217;entrepôt Alfresco (ou une autre source de données).</p>
<p>Nous avons utilisé comme brique de départ, l’excellent tutoriel de Ben Hagan disponible à  adresse suivante : <a href="http://www.benh.co.uk/alfresco/surf-part-1-getting-started/">http://www.benh.co.uk/alfresco/surf-part-1-getting-started/</a>
</p>
<p align="center">&nbsp;</p>
<ul>
<li style="margin:0 80px;">
<p>WebScripts SURF, récupération des données :</p>
</li>
</ul>
<p><em>Fonctionnement général :</em></p>
<p lang="fr-CA">Dans AuditSurf, on distingue deux familles de WebScript : ceux destinés à une mise en forme sous  forme de « dashlets » (rendu HTML) et ceux destinés pour l&#8217;affichage des graphiques (JSON pour <a href="http://teethgrinder.co.uk/open-flash-chart-2/">Open Flash Chart</a>).</p>
<p lang="fr-CA">
<p lang="fr-CA">Chaque WebScript de notre extension SURF fait appel à un WebScript qui se situe coté entrepôt Alfresco. Les données récupérées, à l&#8217;aide des connecteurs, sont majoritairement des données au format JSON (cependant, ces données peuvent être parfois textuelles).</p>
<p lang="fr-CA">Ces données sont par la suite traitées afin de pouvoir générer un rendu graphique.</p>
<p lang="fr-CA">
<p>Ces WebScripts sont composés :</p>
<ul>
<li>d&#8217;un fichier de description</li>
<li>d&#8217;un fichier JavaScript (pour se connecter à un WebScript Alfresco)</li>
<li>d&#8217;un template pour le rendu (HTML ou JSON pour les graphiques)</li>
<li>des fichiers .properties pour l&#8217;internationalisation</li>
</ul>
<p style="text-align: center;">
	<img class="aligncenter size-full wp-image-476" title="webscript SURF" src="http://blog.atolcd.com/wp-content/WS-SURF.png" alt="" width="747" height="263" /><br />
	<em>Schématisation du fonctionnement des WebScripts coté SURF</em>
</p>
<p align="center">&nbsp;</p>
<p><em>Voici un exemple de connexion à un WebScript « Alfresco » via un connecteur (fichier JavaScript) :</em></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">//Création d'un connecteur</span>
<span style="color: #003366; font-weight: bold;">var</span> connector <span style="color: #339933;">=</span> remote.<span style="color: #660066;">connect</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;alfresco&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">//Récupération du JSON renvoyé par le Web Script Alfresco</span>
<span style="color: #003366; font-weight: bold;">var</span> json <span style="color: #339933;">=</span> connector.<span style="color: #660066;">get</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;/auditexample/createdDocuments.json&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Il faut ensuite traiter les données (JSON dans le cas présent) afin de récupérer les informations qui nous intéressent.<br />
Ces informations sont ensuite stockées dans le « model » afin que le template <em>Freemarker</em> du Web Script SURF puisse mettre en forme les données.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">//&quot;Evaluation&quot; du JSON</span>
<span style="color: #003366; font-weight: bold;">var</span> data <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">eval</span><span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">'('</span> <span style="color: #339933;">+</span> json <span style="color: #339933;">+</span> <span style="color: #3366CC;">')'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">//On boucle sur les objets du JSON</span>
<span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span> <span style="color: #339933;">;</span> i<span style="color: #339933;">&lt;</span>data<span style="color: #009900;">&#91;</span><span style="color: #3366CC;">&quot;documents&quot;</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">length</span> <span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> obj <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #3366CC;">&quot;icon&quot;</span> <span style="color: #339933;">:</span> data<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">icon</span><span style="color: #339933;">,</span>
		<span style="color: #3366CC;">&quot;name&quot;</span> <span style="color: #339933;">:</span> data<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #000066;">name</span><span style="color: #339933;">,</span>
		<span style="color: #3366CC;">&quot;url&quot;</span> <span style="color: #339933;">:</span> data<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">downloadUrl</span><span style="color: #339933;">,</span>
		<span style="color: #3366CC;">&quot;date&quot;</span> <span style="color: #339933;">:</span> data<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">date</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>					
&nbsp;
	<span style="color: #006600; font-style: italic;">//On écrit dans le model</span>
	model.<span style="color: #660066;">items</span>.<span style="color: #660066;">push</span><span style="color: #009900;">&#40;</span>obj<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Le fichier <em>Freemarker</em> se charge ensuite de faire le rendu (soit en renvoyant du code HTML soit en renvoyant du JSON pour l’affichage des graphiques).</p>
<p style="text-align: center;">
	<img class="size-full wp-image-484" title="graph-mini" src="http://blog.atolcd.com/wp-content/graph-mini.png" alt="" height="160" /> &nbsp; <img class="size-full wp-image-485" style="border: 0pt none;" title="dashlet-mini" src="http://blog.atolcd.com/wp-content/dashlet-mini.png" alt="" height="160" />
</p>
<p align="center">&nbsp;</p>
<p style="margin:0 40px;"><strong>O Mise en page</strong></li>
<p style="text-align: justify;">
<p>La mise en page de notre application SURF est assurée essentiellement par deux choses : d’une part 	OpenFlashChart pour la génération des graphiques (histogrammes 	dans notre cas) et d’autre part YUI pour tout ce qui est lié à 	la mise en page.</p>
<p align="center">&nbsp;</p>
<ul>
<li style="margin:0 80px;">Open Flash Chart</li>
</ul>
<p lang="fr-CA">Afin de mettre en valeur les statistiques, nous avons utilisé un projet de rendu graphique Open Source : Open Flash Chart 2.</p>
<p lang="fr-CA">Cet outil propose une API JavaScript (il existe aussi des librairies PHP, Perl, Python, Ruby, …) pour produire des graphiques en Flash. Les graphiques sont soignés, et offre d’excellentes capacités d&#8217;interaction.</p>
<p lang="fr-CA">Pour générer les graphiques, Open Flash Chart prend en entrée des données au format JSON.</p>
<p lang="fr-CA">La syntaxe du JSON pour Open Flash Chart est scindée en deux parties : une partie définissant la mise ne page du graphique et une autre partie contenant les données à proprement dit.</p>
<p align="center">
	<a href="http://teethgrinder.co.uk/open-flash-chart-2/json-format.php">http://teethgrinder.co.uk/open-flash-chart-2/json-format.php</a>
</p>
<p>L’utilisation de cet outil nécessite l’installation de Flash coté client.</p>
<p align="center">&nbsp;</p>
<ul>
<li style="margin:0 80px;">YUI</li>
</ul>
<p>YUI est une librairie JavaScript développée par Yahoo (Yahoo User Interface). Cette librairie permet de mettre en place relativement facilement des effets tels que des animations, des panels, la gestion des cookies, etc&#8230; Alfresco utilise très largement cette librairie pour son interface SURF Alfresco Share.</p>
<p>YUI a été utilisé, dans AuditSurf, notamment pour :</p>
<ul>
<li>créer des effets de transitions</li>
<li>l&#8217;affichage des popups d’information</li>
<li>le Drag &amp; Drop des dashlets</li>
<li>et la gestion de cookies (pour se souvenir du positionnement des « dashlets »)</li>
</ul>
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<h2><strong>Pour finir :</strong></h2>
<p lang="fr-CA">AuditSurf est disponible dans son intégralité au téléchargement sur la forge Alfresco : <a href="http://forge.alfresco.com/projects/auditsurf/">http://forge.alfresco.com/projects/auditsurf/</a></p>
<p>AuditSurf est compatible avec</p>
<ul>
<li>les versions Entreprise : 3.0, 	3.0.1, 3.1, 3.1.1 et 3.1.2 (cependant les informations JMX avec les 	versions 3.0.x sont limitées)</li>
<li>la version Entreprise 3.2</li>
<li>les versions Community 3.2 / 3.2r / 3.2r2</li>
</ul>
<p>AuditSurf a été élu contribution du mois d&#8217;Août 2009 par Alfresco.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.atolcd.com/?feed=rss2&amp;p=321</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GeoKettle : Quand PDI flirte avec le monde des SIG</title>
		<link>http://blog.atolcd.com/?p=362</link>
		<comments>http://blog.atolcd.com/?p=362#comments</comments>
		<pubDate>Thu, 12 Nov 2009 10:42:40 +0000</pubDate>
		<dc:creator>Cédric Darbon</dc:creator>
				<category><![CDATA[OSBI]]></category>
		<category><![CDATA[etl]]></category>
		<category><![CDATA[geokettle]]></category>
		<category><![CDATA[jts]]></category>
		<category><![CDATA[kettle]]></category>

		<guid isPermaLink="false">http://blog.atolcd.com/?p=362</guid>
		<description><![CDATA[GeoKettle est une version enrichie de Kettle (PDI) incluant des fonctionnalités propres lui permettant de manipuler de l&#8217;information spatiale. L&#8217;objet de cet article est de présenter les fonctionnalités globales de l&#8217;outil et d&#8217;en faire ressortir les avantages et limites.
Les fonctionnalités
En plus des fonctionnalités proposées nativement par Kettle et sur lesquelles nous ne reviendrons pas (consulter [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;">GeoKettle est une version enrichie de Kettle (PDI) incluant des fonctionnalités propres lui permettant de manipuler de l&#8217;information spatiale. L&#8217;objet de cet article est de présenter les fonctionnalités globales de l&#8217;outil et d&#8217;en faire ressortir les avantages et limites.</p>
<h1>Les fonctionnalités</h1>
<p style="text-align: left;">En plus des fonctionnalités proposées nativement par Kettle et sur lesquelles nous ne reviendrons pas (consulter Sylvain, le spécialiste BI d&#8217;Atol pour plus d&#8217;infos !), GeoKettle apporte :</p>
<p><strong>Un nouveau type de données &laquo;&nbsp;geometry&nbsp;&raquo;</strong> en plus des types (integer, string, etc.) déjà présents dans Kettle. A la prévisualisation des données, les géométries sont visibles dans leur représentation textuelle Well Known Text (POINT, LINESTRING, POLYGON, etc.) en attendant le « viewer carto » annoncé. <span id="more-362"></span>Ce type « geometry »est exploitable lors des étapes d&#8217;extractions ou d&#8217;alimentation depuis ou vers les SGBD Oracle, Postgresql / Postgis / Mysql sans aucune manipulation spécifique (La liste des SGBD supportés devrait par ailleurs s&#8217;enrichir prochainement).  <strong> </strong></p>
<p><strong>De nouvelles étapes dédiées au « GIS »</strong> et regroupées dans la catégorie &laquo;&nbsp;Geospatial&nbsp;&raquo;</p>
<ul>
<li> GIS File Input : cette étape permet d&#8217;extraire les informations géographiques et attributaires à partir d&#8217;une couche ESRI Shapefile (fichiers shp, shx et dbf). Le nom du champ géométrique par défaut est « the_geom ».</li>
<li> GIS File Output : cette étape permet de générer une couche ESRI Shapefile à partir d&#8217;un flux de données contenant notamment un champ de type « geometry ». Si plusieurs champs de type « geometry » sont présents, il faut au préalable passer par une phase d&#8217;altération pour sélectionner celui à exporter.</li>
<li> Set SRS : cette étape permet d&#8217;affecter un système de projection cartographique à un champ de type « geometry ». Le code affecté se base sur la liste EPSG mais il est possible de définir sa propre chaine de projection au format WKT. Cette étape est impérative lors d&#8217;un import en SGBD spatial dès lors qu&#8217;une contrainte sur le système de projection est présente et que le système de projection source associé à la géométrie est inconnu. Elle permet également de de créer le fichier de projection (prj) adéquat lors d&#8217;une étape « GIS File Output ». Ce dernier est exploitable par les outils SIG bureautique courants.</li>
<li> SRS Transformation : cette étape permet de transformer une géométrie d&#8217;un système de projection vers un autre. Lors des tests, les résultats pour la transformation du système Lambert 2 Etendu vers le système WGS84 n&#8217;ont pas été concluants&#8230; Mauvaise manip ?</li>
</ul>
<p><strong>La modification d&#8217;étapes existantes par l&#8217;ajout d&#8217;opérateurs d&#8217;analyse spatiale</strong> tels que GIS_INTERSECTS, GIS_EQUALS, GIS_CONTAINS, GIS_CROSS, etc. pour réaliser les opérations de types, « A intersecte B », « A traverse B », etc. Ces opérateurs sont notamment disponibles dans les étapes « Filtrage lignes » et « Produit cartésien ». En terme d&#8217;utilisation, les étapes de filtrage de lignes pourront par exemple être utilisées pour effectuer des requêtes spatiales entre fichiers ESRI Shapefile tandis que le produit cartésien permettra de limiter le nombre d&#8217;itérations en amont d&#8217;une étape de « geoprocessing ».</p>
<p><strong>La possibilité d&#8217;exploiter les fonctionnalités de Java Topology Suite (<a href="http://www.vividsolutions.com/jts/" target="_blank">JTS</a>) </strong>à travers l&#8217;étape « Exécution Scripts Java ». Cette possibilité s&#8217;avère intéressante puisque elle permet de tirer partie des opérateurs de construction ou de modification de géométries (effacer A par B, intersecter A et B, fusionner A et B, créer une zone tampon autour de A, etc.) ou d&#8217;interroger les propriétés des objets (aire ou périmètre d&#8217;un polygone, coordonnées du premier point d&#8217;une ligne, etc.). Si les possibilités sont riches, l&#8217;utilisation de ces fonctionnalités nécessite de connaitre au minimum les objets, méthodes, etc. offerts par JTS. Cette connaissance s&#8217;avère parfois nécessaire, notamment pour effectuer certaines agrégations sur les géométries (l&#8217;équivalent du « geomunion » de PostGIS !), l&#8217;étape « Agrégation valeurs » de la catégorie statistique n&#8217;intégrant pas de fonction «Dissolve» aux cotés de la « somme » ou de la « moyenne ». Pour les habitués du SQL « spatial » allergiques à JTS qui possèdent une connexion à un SGBD spatial (PostgreSQL/PostGIS par exemple), les appels aux fonctions spatiales avec passage de paramètres sont envisageables sans à avoir à charger en amont les données dans son SGBD.</p>
<h1>Quelques exemples d&#8217;utilisation</h1>
<ul>
<li>Chargement de fichiers plats en base spatiale pour mise à jour de référentiel géographique sur un serveur de Web Mapping.</li>
</ul>
<p style="text-align: center;"><img class="size-full wp-image-395 aligncenter" title="geokettle_01" src="http://blog.atolcd.com/wp-content/geokettle_01.png" alt="geokettle_01" width="608" height="94" /></p>
<ul>
<li>Création d&#8217;un fichier Shapefile de polygones à partir d&#8217;un fichier Shapefile de polylignes et de points « label » porteurs d&#8217;attributs.</li>
</ul>
<p style="text-align: center;"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/ffvBaVfGW7E&amp;hl=fr_FR&amp;fs=1&amp;" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/ffvBaVfGW7E&amp;hl=fr_FR&amp;fs=1&amp;" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<ul>
<li>Création de fichiers Shapefile d&#8217;entités administratives à partir d&#8217;un fichier Shapefile des communes.</li>
</ul>
<p style="text-align: center;"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/VP-lifzypDY&amp;hl=fr_FR&amp;fs=1&amp;" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/VP-lifzypDY&amp;hl=fr_FR&amp;fs=1&amp;" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<h1>Conclusion</h1>
<p>GeoKettle trouve naturellement sa place dès lors qu&#8217;un processus régulier d&#8217;import ou d&#8217;export en masse de fichiers géographiques plats est à réaliser mais autorise aussi (sans atteindre les possibilités et les performances  d&#8217;un « ModelBuilder » d&#8217;ESRI ) la mise en place d&#8217;opérations de requetage spatial ou de géotraitements , son avantage principal étant de pouvoir s&#8217;affranchir là aussi des différentes sources de données. Par ailleurs et d&#8217;un point de vue pratique, l&#8217;utilisation de GeoKettle ne perturbe pas les méthodes de travail des utilisateurs de Kettle, les fonctionnalités nouvelles spécifiques étant traduites sous formes de nouvelles étapes (alimentation / extraction), d&#8217;autres ayant été intégrées au sein étapes existantes (filtrage, produit cartésien). Malgré toute la souplesse et la richesse intrinsèque offerte par GeoKettle, ce dernier possède encore quelques limites :</p>
<ul>
<li>Concernant les extractions / alimentations et même si les fichiers ESRI Shapefile restent couramment utilisés, il manque à l&#8217;outil la possibilité de pouvoir lire et écrire dans les formats SIG courants (Mapinfo TAB, GML, KML) etc. L&#8217;utilisation de la librairie Geotools devrait permettre d&#8217;offrir ces fonctionnalités prochainement. En attendant, il est toujours possible de faire appel au sein de tâches à des outils externes en lignes de commande comme OGR2OGR ou à générer et à transformer certains formats  basés sur le XML à partir de briques existantes et de transformations XSL (GML,KML).</li>
</ul>
<ul>
<li>Actuellement, l&#8217;utilisation des opérateurs de construction géométrique « Buffer, Union, Intersection, Erase, etc. » à travers les scripts reste réservée aux initiés JTS. Là aussi, la mise à disposition d&#8217;étapes et d&#8217;interfaces graphiques appropriées est annoncé.</li>
</ul>
<ul>
<li>Il manque encore quelques fonctionnalités comme les agrégations (dissolve) de géométries ou la  générations de lignes à partir de multi-géométries (Ceci peut être cependant réalisé à travers JTS)</li>
</ul>
<ul>
<li>Enfin, coté performances, si les imports et exports de données géographiques ne posent pas de problèmes particuliers, la manipulation évoluée (opérations successives d&#8217;union de buffer, etc) des géométries à travers des scripts JTS consomme beaucoup de ressources. Il faut garder  à l&#8217;esprit que GeoKettle reste un outil ETL générique et q&#8217;uil n&#8217;a pas vocation à remplacer les outils SIG spécifiques.</li>
</ul>
<h1>L&#8217;avis du spécialiste BI d&#8217;Atol</h1>
<p>GeoKettle est un projet de Business Intelligence Open Source développé par <a href="http://www.spatialytics.org" target="_blank">Spatialytics</a>, une société québecoise qui offre des services et des solutions de GeoBI. A noter que cette société développe également deux autres projets très intéressants dans le domaine du GeoBI :</p>
<ul>
<li> GeoMondrian, une version “géo-capable” du serveur OLAP Mondrian que l&#8217;on retrouve dans sa version de base dans les plates-formes OSBI Pentaho et JasperServer.GeoMondrian permet une intégration consistante d’objets spatiaux (géométries) dans une structure de données en cube plutôt que de devoir les obtenir ailleurs, à partir d’un SGBD spatial, un Service Web ou des fichiers SIG. GeoMondrian intègre également les premières extensions spatiales au langage de requête multidimensionnel MDX ajoutant ainsi de puissantes capacités de requête et d’analyse spatiale dans les cubes.</li>
</ul>
<ul>
<li> SOLAPLayers (ex « Spatialytics ») est un framework cartographique web 2.0 pouvant être intégré dans des tableaux de bord existants afin de permettre la navigation et l’interrogation spatiale (OLAP Spatial ou SOLAP) de cubes de données, comme ceux que supporte GeoMondrian. Il s&#8217;appuie sur OpenLayers et Dojo et permet la connexion à un serveur SOLAP tel que GeoMondrian, la navigation dans des cubes avec contenu géospatial, la représentation cartographique de données et mesures statistiques sous forme de cartes thématiques statiques ou dynamiques.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.atolcd.com/?feed=rss2&amp;p=362</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>L’Audit dans Alfresco</title>
		<link>http://blog.atolcd.com/?p=217</link>
		<comments>http://blog.atolcd.com/?p=217#comments</comments>
		<pubDate>Fri, 30 Oct 2009 13:00:37 +0000</pubDate>
		<dc:creator>Bertrand Forest</dc:creator>
				<category><![CDATA[ECM]]></category>
		<category><![CDATA[alfresco]]></category>
		<category><![CDATA[audit]]></category>

		<guid isPermaLink="false">http://blog.atolcd.com/?p=217</guid>
		<description><![CDATA[Présentation
Alfresco met à disposition, depuis sa version 1.4, un Framework permettant de gérer l’audit : le Framework AuditTrail. L’audit est activable et configurable via un fichier de configuration XML (à noter que par défaut il est désactivé).
Le système d’audit est basé sur des intercepteurs. Ces intercepteurs se déclenchent lorsqu’une méthode d’un service Alfresco est appelée [...]]]></description>
			<content:encoded><![CDATA[<h2><span lang="fr-CA"><em>Présentation</em></span></h2>
<p style="text-align: justify;" lang="fr-CA">Alfresco met à disposition, depuis sa version 1.4, un Framework permettant de gérer l’audit : le Framework AuditTrail. L’audit est activable et configurable via un fichier de configuration XML (<em>à noter que par défaut il est désactivé</em>).</p>
<p style="text-align: justify;">Le système d’audit est basé sur des intercepteurs. Ces intercepteurs se déclenchent lorsqu’une méthode d’un service Alfresco est appelée (<em>suivant la configuration qui a été faite de l’audit</em>).</p>
<p style="text-align: justify;"><span lang="fr-CA">L’intercepteur stocke ensuite les informations sur ce qu’il s’est passé dans la base de données (</span><span lang="fr-CA"><em>par exemple </em></span><span lang="fr-CA">: qui l’a appelée, sur quel fichier, identifiant du nœud, …).</span></p>
<p style="text-align: justify;" lang="fr-CA">
<p style="text-align: justify;"><span lang="fr-CA">Il faut savoir que suivant le service et/ou la méthode qui a été appelé, les informations d’audit stockées dans la base de données </span><span lang="fr-CA"><strong>différent</strong></span><span lang="fr-CA">.</span></p>
<p style="text-align: justify;" lang="fr-CA">Un même service peut comporter plusieurs méthodes « auditables » et si on le désire, il est possible d’auditer seulement une partie d’entre elles.</p>
<p style="text-align: justify;"><span lang="fr-CA">Par exemple, voici une liste (non-exhaustive) des méthodes « auditables » du </span><a href="http://dev.alfresco.com/resource/docs/java/repository/org/alfresco/service/cmr/model/FileFolderService.html">FileFolderService</a> : <em>rename</em>, <em>move</em>, <em>copy</em>, <em>create</em>, <em>delete</em>, <em>makeFolders</em>, <em>getWriter</em>, …</p>
<p style="text-align: justify;">
<p style="text-align: justify;" lang="fr-CA">Vous pouvez retrouver la liste complète des services qui sont « auditables » sur le <a title="Services auditables" href="http://wiki.alfresco.com/wiki/Audit_Configuration#Public_services_that_support_auditing" target="_blank">wiki Alfresco [en]</a>.</p>
<p style="text-align: justify;" lang="fr-CA">Plus d’informations sur l’Audit en général sont également disponibles sur le wiki Alfresco [en] :</p>
<p style="text-align: center;"><a href="http://wiki.alfresco.com/wiki/Audit"><span lang="fr-CA">http://wiki.alfresco.com/wiki/Audit</span></a></p>
<p style="text-align: left;"><span lang="fr-CA"><span id="more-217"></span><br />
</span></p>
<p lang="fr-CA"><span style="color: #ff0000;"><br />
</span></p>
<p><!-- 		@page { margin: 2cm } 		P { margin-bottom: 0.21cm } --></p>
<h2><span lang="fr-CA"><em><em>L&#8217;audit, à quoi ça sert</em></em> ?</span></h2>
<p><!-- 		@page { margin: 2cm } 		P { margin-bottom: 0.21cm } --></p>
<p style="text-align: justify;" lang="fr-CA"><span style="color: #000000;">L’audit peut notamment permettre de dresser des statistiques (ce qui est le cas de notre application AuditSurf), surveiller certaines actions, …</span></p>
<p style="text-align: justify;" lang="fr-CA">
<p lang="fr-CA"><span style="color: #ff0000;"><br />
</span></p>
<p><!-- 		@page { margin: 2cm } 		P { margin-bottom: 0.21cm } --></p>
<h2><span lang="fr-CA"><em>Ou sont stockées les 	données</em></span> <span lang="fr-CA">?</span></h2>
<p style="text-align: justify;">
<p style="text-align: justify;">Les informations d’audit sont stockées dans la base de données Alfresco et plus particulièrement dans les tables préfixées par « <span style="font-size: x-small;"><strong>ALF_AUDIT </strong></span><span style="font-size: x-small;"><span style="font-weight: normal;">»</span></span>.</p>
<p style="text-align: justify;">Les tables concernées sont : <span style="font-size: x-small;"><strong>ALF_AUDIT_FACT</strong></span>, <span style="font-size: x-small;"><strong>ALF_AUDIT_DATE</strong></span><strong> </strong>et <span style="font-size: x-small;"><strong>ALF_AUDIT_SOURCE</strong></span>.</p>
<p style="text-align: justify;"><img class="aligncenter size-full wp-image-228" title="tables_audit" src="http://blog.atolcd.com/wp-content/tables_fond-blanc.bmp" alt="tables_audit" /></p>
<p style="text-align: justify;">
<p style="text-align: justify;"><!-- 		@page { margin: 2cm } 		P { margin-bottom: 0.21cm } --></p>
<p style="text-align: justify;">La table <span style="font-size: x-small;"><strong>ALF_AUDIT_FACT</strong></span><strong> </strong>est le pilier du système d’audit d’Alfresco. C’est dans cette table que sont stockées les principales informations auditées.</p>
<p style="text-align: justify;"><span lang="fr-CA">A chaque action auditée correspond un service et une méthode ayant déclenché cette trace (informations stockées dans la table </span><span style="font-size: x-small;"><span lang="fr-CA"><strong>ALF_AUDIT_SOURCE</strong></span></span><span lang="fr-CA">) ainsi que la date à laquelle l’action s’est déclenchée (</span><span style="font-size: x-small;"><span lang="fr-CA"><strong>ALF_AUDIT_DATE</strong></span></span><span lang="fr-CA">).</span></p>
<p style="text-align: justify;">
<p style="text-align: justify;">La table <span style="font-size: x-small;"><strong>ALF_AUDIT_DATE</strong></span> est utile seulement si l’on souhaite avoir le détail complet sur la date. Sinon, l’attribut « timestamp » de la table <span style="font-size: x-small;"><strong>ALF_AUDIT_FACT</strong></span> est amplement suffisant.</p>
<p style="text-align: justify;"><span style="color: #ff0000;"> </span></p>
<p style="text-align: justify;"><!-- 		@page { margin: 2cm } 		P { margin-bottom: 0.21cm } --></p>
<p style="text-align: justify;"><span style="color: #ff0000;"> </span></p>
<p lang="fr-CA"><span style="color: #ff0000;"><br />
</span></p>
<p><!-- 		@page { margin: 2cm } 		P { margin-bottom: 0.21cm } --></p>
<h2><em><em>Qu’est ce qui est audité et sous quelle forme</em></em> <span lang="fr-CA">?</span></h2>
<p><!-- 		@page { margin: 2cm } 		P { margin-bottom: 0.21cm } --></p>
<p><span style="color: #000000;"><span lang="fr-CA">En dehors de la source (nom du service et nom de la méthode) et de la date de chaque audit, voici la liste des informations d’audit les plus pertinentes (stockées dans la table </span><span style="font-size: x-small;"><span lang="fr-CA"><strong>ALF_AUDIT_FACT</strong></span></span><span style="font-size: x-small;"><span lang="fr-CA">) </span></span><span lang="fr-CA">: </span></span></p>
<ul>
<li><strong><span lang="fr-CA">user_id</span></strong><strong><span lang="fr-CA"><span style="font-weight: normal;"> </span></span></strong><strong><span lang="fr-CA"><span style="font-weight: normal;">: 	identifiant de l’utilisate</span></span></strong><strong><span style="color: #000000;"><span lang="fr-CA"><span style="font-weight: normal;">ur 	qui a déclenché la trace d’audit</span></span></span></strong><span style="color: #000000;"> </span></li>
<li><strong><span lang="fr-CA">timestamp</span></strong><strong><span style="color: #ff0000;"><span lang="fr-CA"> </span></span></strong><span lang="fr-CA">: la date et l&#8217;heure à 	laquelle l&#8217;audit a eu lieu (pour avoir une date plus complète 	(numéro de la semaine, jour de l&#8217;année, &#8230;), il faut utiliser les 	champs de la table </span><span style="font-size: x-small;"><span lang="fr-CA"><strong>ALF_AUDIT_DATE</strong></span></span><span lang="fr-CA">).</span></li>
<li><strong><span lang="fr-CA">return_val</span></strong><strong><span style="color: #ff0000;"><span lang="fr-CA"> </span></span></strong><span lang="fr-CA">: c’est la valeur 	retourné par la méthode auditée. </span></li>
<li><strong><span lang="fr-CA">fail</span></strong><strong><span style="color: #ff0000;"><span lang="fr-CA"> </span></span></strong><span lang="fr-CA">: vaut </span><span lang="fr-CA"><strong>0</strong></span><span lang="fr-CA"> si l&#8217;action s&#8217;est correctement déroulée, </span><span lang="fr-CA"><strong>1</strong></span><span lang="fr-CA"> en cas d&#8217;échec.</span></li>
<li><strong><span lang="fr-CA">arg_#</span></strong><strong><span style="color: #ff0000;"><span lang="fr-CA"> </span></span></strong><span lang="fr-CA">: les informations les 	plus utiles sont stockées dans les arguments (arg_1, arg_2, arg_3, 	arg_4 et arg_5).</span>
<p lang="fr-CA">Les valeurs de ces arguments dépendent des services 	et des méthodes qui ont été audités.</p>
</li>
</ul>
<p><!-- 		@page { margin: 2cm } 		P { margin-bottom: 0.21cm } 		TD P { margin-bottom: 0cm } 		A:link { so-language: zxx } --></p>
<p lang="fr-CA">Voici deux exemples qui permettent d’illustrer et d’analyser ce qui est audité :<span lang="fr-CA"><em> </em></span></p>
<ul>
<li><span lang="fr-CA"><em>1</em></span><sup><span lang="fr-CA"><em>er</em></span></sup><span lang="fr-CA"><em> exemple</em></span> : auditer les connexions des 	utilisateurs</li>
</ul>
<p><!-- 		@page { margin: 2cm } 		P { margin-bottom: 0.21cm } 		A:link { so-language: zxx } --></p>
<blockquote>
<pre style="margin-bottom: 0.2cm;"><a href="http://dev.alfresco.com/resource/docs/java/repository/org/alfresco/service/Auditable.html"><span style="font-family: Times New Roman,serif;"><span style="font-size: small;">@Auditable</span></span></a><span style="font-family: Times New Roman,serif;"><span style="font-size: small;"><span lang="en-US">(</span></span></span><a href="http://dev.alfresco.com/resource/docs/java/repository/org/alfresco/service/Auditable.html#parameters%28%29"><span style="font-family: Times New Roman,serif;"><span style="font-size: small;">parameters</span></span></a><span style="font-family: Times New Roman,serif;"><span style="font-size: small;"><span lang="en-US">={"userName", "password"}, </span></span></span><a href="http://dev.alfresco.com/resource/docs/java/repository/org/alfresco/service/Auditable.html#recordable%28%29"><span style="font-family: Times New Roman,serif;"><span style="font-size: small;">recordable</span></span></a><span style="font-family: Times New Roman,serif;"><span style="font-size: small;"><span lang="en-US">={true, false}) </span></span></span>
<span style="font-family: Times New Roman,serif;"><span style="font-size: small;"><span lang="en-US">void </span></span></span><span style="font-family: Times New Roman,serif;"><span style="font-size: small;"><span lang="en-US"><strong>authenticate</strong></span></span></span><span style="font-family: Times New Roman,serif;"><span style="font-size: small;"><span lang="en-US">(java.lang.StringuserName, char[]password)</span></span></span></pre>
</blockquote>
<blockquote><p><span lang="fr-CA"> </span></p></blockquote>
<p lang="fr-CA">
<p lang="fr-CA"><span lang="fr-CA">Voici ce qui est audité lors de l’appel de  la méthode &laquo;&nbsp;</span><a href="http://dev.alfresco.com/resource/docs/java/repository/org/alfresco/service/cmr/security/AuthenticationService.html#authenticate%28java.lang.String,%20char[]%29"><span lang="fr-CA"><em>authenticate</em></span></a><span lang="fr-CA">&nbsp;&raquo; du service &laquo;&nbsp;</span><a href="http://dev.alfresco.com/resource/docs/java/repository/org/alfresco/service/cmr/security/AuthenticationService.html"><span lang="fr-CA"><em>AuthenticationService</em></span></a><span lang="fr-CA">&nbsp;&raquo; :</span></p>
<p><!-- 		@page { margin: 2cm } 		P { margin-bottom: 0.21cm } 		TD P { margin-bottom: 0cm } --></p>
<table border="1" cellspacing="0" cellpadding="2" width="530" bordercolor="#000000">
<tbody>
<tr>
<td width="186" height="18"><strong><span lang="fr-CA">timestamp</span></strong></td>
<td width="116"><strong><span lang="fr-CA">return_val</span></strong></td>
<td width="92"><strong><span lang="fr-CA">arg_1</span></strong></td>
<td width="92"><strong><span lang="fr-CA">arg_2</span></strong></td>
<td width="22"><strong><span lang="fr-CA">fail</span></strong></td>
</tr>
<tr>
<td width="186" height="19">
<p lang="fr-CA">2009-05-11 15:56:52</p>
</td>
<td width="116"></td>
<td width="92">
<p lang="fr-CA">admin</p>
</td>
<td width="92">
<p lang="fr-CA">********</p>
</td>
<td width="22">
<p lang="fr-CA">0</p>
</td>
</tr>
<tr>
<td width="186" height="18">
<p lang="fr-CA">2009-05-11 15:06:06</p>
</td>
<td width="116"></td>
<td width="92">
<p lang="fr-CA">Bertrand</p>
</td>
<td width="92">
<p lang="fr-CA">********</p>
</td>
<td width="22">
<p lang="fr-CA">1</p>
</td>
</tr>
</tbody>
</table>
<p lang="fr-CA">
<p lang="fr-CA">On remarque que peut de choses sont auditées dans ce cas, on peut seulement retrouver le login de l&#8217;utilisateur, l&#8217;heure à laquelle il a essayé de s&#8217;authentifier et s&#8217;il a réussi ou non.</p>
<p lang="fr-CA">Il n&#8217;est pas possible pour l&#8217;instant via l&#8217;audit de connaître le moyen de connexion utilisé par l’utilisateur pour se connecter à l&#8217;Alfresco (CIFS, WebDav, FTP, navigateur Web, &#8230;).</p>
<p lang="fr-CA">De plus <span style="text-decoration: underline;">certains types accès ne laissent pas de traces d’audit </span>(cf. section Problèmes Rencontrés).</p>
<p lang="fr-CA">
<p lang="fr-CA">
<p><!-- 		@page { margin: 2cm } 		P { margin-bottom: 0.21cm } 		TD P { margin-bottom: 0cm } 		A:link { so-language: zxx } --></p>
<ul>
<li><span lang="fr-CA"><em>2</em></span><sup><span lang="fr-CA"><em>ème</em></span></sup><span lang="fr-CA"><em> exemple </em></span><span lang="fr-CA">: auditer l’ajout de 	contenu.</span></li>
</ul>
<p><!-- 		@page { margin: 2cm } 		P { margin-bottom: 0.21cm } 		A:link { so-language: zxx } --></p>
<blockquote>
<pre style="margin-bottom: 0.2cm;"><a href="http://dev.alfresco.com/resource/docs/java/repository/org/alfresco/service/Auditable.html"><span style="font-family: Times New Roman,serif;"><span style="font-size: small;">@Auditable</span></span></a><span style="font-family: Times New Roman,serif;"><span style="font-size: small;"><span lang="en-US">(</span></span></span><a href="http://dev.alfresco.com/resource/docs/java/repository/org/alfresco/service/Auditable.html#key%28%29"><span style="font-family: Times New Roman,serif;"><span style="font-size: small;">key</span></span></a><span style="font-family: Times New Roman,serif;"><span style="font-size: small;"><span lang="en-US">=</span></span></span><a href="http://dev.alfresco.com/resource/docs/java/repository/org/alfresco/service/Auditable.Key.html#ARG_0"><span style="font-family: Times New Roman,serif;"><span style="font-size: small;">ARG_0</span></span></a><span style="font-family: Times New Roman,serif;"><span style="font-size: small;"><span lang="en-US">, </span></span></span><a href="http://dev.alfresco.com/resource/docs/java/repository/org/alfresco/service/Auditable.html#parameters%28%29"><span style="font-family: Times New Roman,serif;"><span style="font-size: small;">parameters</span></span></a><span style="font-family: Times New Roman,serif;"><span style="font-size: small;"><span lang="en-US">={"parentNodeRef", "name", "typeQName"})</span></span></span>
<a href="http://dev.alfresco.com/resource/docs/java/repository/org/alfresco/service/cmr/model/FileInfo.html"><span style="font-family: Times New Roman,serif;"><span style="font-size: small;"><span lang="en-US">FileInfo</span></span></span></a><span style="font-family: Times New Roman,serif;"><span style="font-size: small;"> </span></span><span style="font-family: Times New Roman,serif;"><span style="font-size: small;"><span lang="en-US"><strong>create</strong></span></span></span><span style="font-family: Times New Roman,serif;"><span style="font-size: small;"><span lang="en-US">(</span></span></span><a href="http://dev.alfresco.com/resource/docs/java/repository/org/alfresco/service/cmr/repository/NodeRef.html"><span style="font-family: Times New Roman,serif;"><span style="font-size: small;">NodeRef</span></span></a><span style="font-family: Times New Roman,serif;"><span style="font-size: small;"><span lang="en-US">parentNodeRef, java.lang.Stringname, </span></span></span><a href="http://dev.alfresco.com/resource/docs/java/repository/org/alfresco/service/namespace/QName.html"><span style="font-family: Times New Roman,serif;"><span style="font-size: small;">QName</span></span></a><span style="font-family: Times New Roman,serif;"><span style="font-size: small;"><span lang="en-US">typeQName)</span></span></span></pre>
</blockquote>
<p><span lang="fr-CA"> </span></p>
<p><span lang="fr-CA">Lors de l’ajout (ou la création) de contenu, la méthode &laquo;&nbsp;</span><span lang="fr-CA"><em>create</em></span><span lang="fr-CA">&nbsp;&raquo; du service &laquo;&nbsp;</span><a href="http://dev.alfresco.com/resource/docs/java/repository/org/alfresco/service/cmr/model/FileFolderService.html"><span lang="fr-CA"><em>FileFolderService</em></span></a><span lang="fr-CA">&nbsp;&raquo; est appelée. Voici les données qui sont auditées lors de l’appel de cette méthode :</span></p>
<table border="1" cellspacing="0" cellpadding="2" width="643" bordercolor="#000000">
<col width="51"></col>
<col width="81"></col>
<col width="167"></col>
<col width="98"></col>
<col width="50"></col>
<col width="137"></col>
<col width="28"></col>
<tbody>
<tr>
<td width="51" valign="TOP"><strong><span lang="fr-CA">user_id</span></strong></td>
<td width="81"><strong><span lang="fr-CA">timestamp</span></strong></td>
<td width="167"><strong><span lang="fr-CA">return_val</span></strong></td>
<td width="98"><strong><span lang="fr-CA">arg_1</span></strong></td>
<td width="50"><strong><span lang="fr-CA">arg_2</span></strong></td>
<td width="137"><strong><span lang="fr-CA">arg_3</span></strong></td>
<td width="28"><strong><span lang="fr-CA">fail</span></strong></td>
</tr>
<tr>
<td width="51">
<p lang="fr-CA">admin</p>
</td>
<td width="81">
<p lang="fr-CA">2009-05-12 09:31:08</p>
</td>
<td width="167">
<p lang="en-US">FileInfo[name=test.odt, isFolder=false, 				nodeRef=workspace://SpacesStore/5d4d4e7d-fb25-4c49-bbba-fb7aa172e321]</p>
</td>
<td width="98"><a href="workspace://SpacesStore/b091c7d6-e2de-4cd4-8b02-e6316e351cb8">workspace://SpacesStore/b091c7d6-e2de-</a><a href="workspace://SpacesStore/b091c7d6-e2de-4cd4-8b02-e6316e351cb8">4cd4-8b02-</a><a href="workspace://SpacesStore/b091c7d6-e2de-4cd4-8b02-e6316e351cb8">e6316e351cb8</a><span lang="fr-CA"> </span></td>
<td width="50"><span lang="en-US">test</span><span lang="fr-CA">.odt </span></td>
<td width="137"><span lang="fr-CA">{</span><a href="http://www.alfresco.org/model/content/1.0%7Dcontent">http://www.alfresco.org/model/content/1.0</a><a href="http://www.alfresco.org/model/content/1.0%7Dcontent">}content</a><span lang="fr-CA"> </span></td>
<td width="28">
<p lang="fr-CA">0</p>
</td>
</tr>
<tr>
<td width="51">
<p lang="fr-CA">admin</p>
</td>
<td width="81">
<p lang="fr-CA">2009-05-12 09:37:17</p>
</td>
<td width="167">
<p lang="en-US">FileInfo[name=Photos, isFolder=true, 				nodeRef=workspace://SpacesStore/066ea37e-a140-4fd8-bf09-edca4da73728]</p>
</td>
<td width="98"><a href="workspace://SpacesStore/b091c7d6-e2de-4cd4-8b02-e6316e351cb8">workspace://SpacesStore/b091c7d6-e2de-4cd4-8b02-e6316e351cb8</a><span lang="fr-CA"> </span></td>
<td width="50">
<p lang="fr-CA">Photos</p>
</td>
<td width="137"><span lang="fr-CA">{</span><a href="http://www.alfresco.org/model/content/1.0%7Dfolder">http://www.alfresco.org/model/content/1.0}folder</a><span lang="fr-CA"> </span></td>
<td width="28">
<p lang="fr-CA">0</p>
</td>
</tr>
</tbody>
</table>
<p lang="fr-CA">Ces deux enregistrements sont le résultat d&#8217;un ajout de fichier (1ère ligne) et de la création d&#8217;un espace (2ème ligne).</p>
<p style="margin-bottom: 0cm;"><span lang="fr-CA">L&#8217;audit, pour cette méthode (</span><span lang="fr-CA"><em>create</em></span><span lang="fr-CA">), est assez complet : grâce au champ &laquo;&nbsp;</span><strong><span lang="fr-CA">return_val</span></strong><span lang="fr-CA">&laquo;&nbsp;, on peut récupérer plusieurs informations sur le nœud qui vient d’être créé :</span></p>
<ul>
<li><span lang="fr-CA">son nom</span></li>
<li><span lang="fr-CA">le fait de 	savoir si c&#8217;est un espace ou non</span><span lang="fr-CA"> </span></li>
<li><span lang="fr-CA">son NodeRef</span></li>
</ul>
<p><span lang="fr-CA">Dans le cas présent, l&#8217;attribut &laquo;&nbsp;</span><strong><span lang="fr-CA">arg_1</span></strong><span lang="fr-CA">&nbsp;&raquo; stocke le NodeRef de l’espace parent ou a été créé le fichier (ou l’espace), &laquo;&nbsp;</span><strong><span lang="fr-CA">arg_2</span></strong><span lang="fr-CA">&nbsp;&raquo; stocke quand à lui le nom du fichier (ou de l’espace) et &laquo;&nbsp;</span><strong><span lang="fr-CA">arg_3</span></strong><span lang="fr-CA">&nbsp;&raquo; stocke le type du contenu (QName) : </span></p>
<ul>
<li><a href="http://www.alfresco.org/model/content/1.0%7Dcontent">{http://www.alfresco.org/model/content/1.0}content</a> <span lang="fr-CA">si c&#8217;est un fichier</span></li>
<li><span lang="fr-CA"> </span><a href="http://www.alfresco.org/model/content/1.0%7Dfolder">{http://www.alfresco.org/model/content/1.0}folder</a> <span lang="fr-CA">si c&#8217;est un espace </span></li>
</ul>
<p><!-- 		@page { margin: 2cm } 		P { margin-bottom: 0.21cm } 		A:link { so-language: zxx } --></p>
<p><span style="color: #ff9900;"> </span></p>
<p lang="fr-CA"><span style="color: #ff0000;"><br />
</span></p>
<p lang="fr-CA"><span style="color: #ff9900;"><img class="alignleft size-full wp-image-433" style="border: 0pt none; margin-top: -10px; margin-bottom: -10px;" title="important" src="http://blog.atolcd.com/wp-content/important.png" alt="important" width="30" height="25" />Cet exemple n&#8217;est plus d&#8217;actualité dans Alfresco 3.2 Entreprise. En effet, dans la dernière monture d&#8217;Alfresco, il faut s&#8217;intéresser au service « ContentService » et à sa méthode « getWriter » pour avoir des informations sur la création de contenu.</span></p>
<p lang="fr-CA"><span style="color: #ff0000;"><br />
</span></p>
<p><!-- 		@page { margin: 2cm } 		P { margin-bottom: 0.21cm } --></p>
<h2><span lang="fr-CA"><em><em>Comment activer l’audit</em></em> ?</span></h2>
<p><span lang="fr-CA">Pour activer ce service, il faut modifier le fichier XML : </span><strong><span lang="fr-CA"><em>auditConfig.xml</em></span></strong><span lang="fr-CA">, qui se trouve dans le dossier : </span><span lang="fr-CA"><em>/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/</em></span><span lang="fr-CA">.</span></p>
<p><span lang="fr-CA">Dans ce fichier, il faut passer l’attribut « </span><strong><span lang="fr-CA">enabled</span></strong><span lang="fr-CA"> » à « </span><strong><span lang="fr-CA">true</span></strong><span lang="fr-CA"> » :</span></p>
<p><!-- 		@page { margin: 2cm } 		P { margin-bottom: 0.21cm } --></p>
<blockquote>
<p style="margin-bottom: 0cm;"><span style="font-family: Times New Roman,serif;"><span style="font-size: small;"><span style="color: #0000ff;"><span lang="en-US">&lt;Audit</span></span><span style="color: #000000;"><span lang="en-US"> </span></span><span style="color: #ff0000;"><span lang="en-US">xmlns</span></span><span style="color: #000000;"><span lang="en-US">=</span></span><span style="color: #8000ff;"><span lang="en-US"><strong>&laquo;&nbsp;http://www.alfresco.org/model/audit/1.0&#8243;</strong></span></span><span style="color: #000000;"><span lang="en-US"><span style="font-weight: normal;"><br />
</span></span></span><span style="color: #ff0000;"><span lang="en-US"><span style="font-weight: normal;">xmlns:xsi</span></span></span><span style="color: #000000;"><span lang="en-US"><span style="font-weight: normal;">=</span></span></span><span style="color: #8000ff;"><span lang="en-US"><strong>&laquo;&nbsp;http://www.w3.org/2001/XMLSchema-instance&nbsp;&raquo; </strong></span></span><span style="color: #ff0000;"><span style="font-weight: normal;">enabled</span></span><span style="color: #000000;"><span style="font-weight: normal;">=</span></span><span style="color: #8000ff;"><strong>&laquo;&nbsp;true&nbsp;&raquo;</strong></span><span style="color: #000000;"><span style="font-weight: normal;"> </span></span><span style="color: #ff0000;"><span style="font-weight: normal;">auditInternal</span></span><span style="color: #000000;"><span style="font-weight: normal;">=</span></span><span style="color: #8000ff;"><strong>&laquo;&nbsp;false&nbsp;&raquo;</strong></span><span style="color: #000000;"><span style="font-weight: normal;"> </span></span><span style="color: #ff0000;"><span style="font-weight: normal;">mode</span></span><span style="color: #000000;"><span style="font-weight: normal;">=</span></span><span style="color: #8000ff;"><strong>&laquo;&nbsp;all&nbsp;&raquo;</strong></span><span style="color: #0000ff;"><span style="font-weight: normal;">&gt;</span></span></span></span></p>
</blockquote>
<blockquote><p><!-- 		@page { margin: 2cm } 		P { margin-bottom: 0.21cm } --> <!-- 		@page { margin: 2cm } 		P { margin-bottom: 0.21cm } 		A:link { so-language: zxx } --></p></blockquote>
<p><span style="color: #ff9900;"> </span></p>
<p lang="fr-CA"><span style="color: #ff0000;"><br />
</span></p>
<p lang="fr-CA"><img class="alignleft size-full wp-image-433" style="border: 0pt none; margin-top: -10px; margin-bottom: -10px;" title="important" src="http://blog.atolcd.com/wp-content/important.png" alt="important" width="30" height="25" /><span style="color: #ff9900;">Pour que l&#8217;audit fonctionne dans Alfresco 3.2 Entreprise (dans Alfresco 3.2r et 3.2r2 Community également), il faut rajouter ces deux lignes au fichier « alfresco-global.properties » :<br />
</span></p>
<ul>
<li><span style="color: #ff9900;"> audit.enabled=true</span></li>
<li><span style="color: #ff9900;"> audit.useNewConfig=false</span></li>
</ul>
<p><span style="color: #ff9900;"> </span></p>
<p lang="fr-CA">Il est ensuite possible de configurer plus précisément ce que l’on désire auditer ou non.</p>
<p><span style="color: #ff9900;"> </span></p>
<p lang="fr-CA"><span style="color: #ff0000;"><br />
</span></p>
<p><span style="text-decoration: underline;"><strong><em>Configuration </em><span lang="fr-CA"><em>de l’audit :</em></span></strong></span></p>
<p><!-- 		@page { margin: 2cm } 		P { margin-bottom: 0.21cm } 		A:link { so-language: zxx } --></p>
<p lang="fr-CA">Pour activer l’audit, sur un service ou une méthode, il suffit de passer son attribut mode à « all » ou de le passer à « none » pour le désactiver.</p>
<p><span lang="fr-CA"><em>Exemples</em></span> <span lang="fr-CA">:</span></p>
<ul>
<li>Activer l’audit sur <strong>toutes</strong> les méthodes « auditables » du FileFolderService :</li>
</ul>
<blockquote>
<p style="margin-bottom: 0cm;"><span style="font-family: Times New Roman,serif;"><span style="font-size: small;"><span style="color: #0000ff;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">&lt;Service</span></span></span><span style="color: #000000;"><span style="background: #ffffff none repeat scroll 0% 0%;"> </span></span><span style="color: #ff0000;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">name</span></span></span><span style="color: #000000;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">=</span></span></span><span style="color: #8000ff;"><span lang="en-US"><strong><span style="background: #ffffff none repeat scroll 0% 0%;">&laquo;&nbsp;FileFolderService&nbsp;&raquo;</span></strong></span></span><span style="color: #000000;"><span style="background: #ffffff none repeat scroll 0% 0%;"> </span></span><span style="color: #ff0000;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">mode</span></span></span><span style="color: #000000;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">=</span></span></span><span style="color: #8000ff;"><span lang="en-US"><strong><span style="background: #ffffff none repeat scroll 0% 0%;">&laquo;&nbsp;all&nbsp;&raquo;</span></strong></span></span><span style="color: #0000ff;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">&gt;</span></span></span></span></span></p>
<p style="margin-bottom: 0cm;"><span style="font-family: Times New Roman,serif;"><span style="font-size: small;"><span style="color: #0000ff;"><span style="background: #ffffff none repeat scroll 0% 0%;">&lt;/Service&gt;</span></span></span></span></p>
</blockquote>
<p lang="fr-CA">
<ul>
<li>Activer l’audit seulement sur certaines méthodes :</li>
</ul>
<blockquote>
<p style="margin-bottom: 0cm;"><span style="font-family: Times New Roman,serif;"><span style="font-size: small;"><span style="color: #008000;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">&lt;!&#8211; The File/Folder Service &#8211;&gt;</span></span></span></span></span></p>
<p style="margin-bottom: 0cm;"><span style="font-family: Times New Roman,serif;"><span style="font-size: small;"><span style="color: #0000ff;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">&lt;Service</span></span></span><span style="color: #000000;"><span style="background: #ffffff none repeat scroll 0% 0%;"> </span></span><span style="color: #ff0000;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">name</span></span></span><span style="color: #000000;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">=</span></span></span><span style="color: #8000ff;"><span lang="en-US"><strong><span style="background: #ffffff none repeat scroll 0% 0%;">&laquo;&nbsp;FileFolderService&nbsp;&raquo;</span></strong></span></span><span style="color: #000000;"><span style="background: #ffffff none repeat scroll 0% 0%;"> </span></span><span style="color: #ff0000;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">mode</span></span></span><span style="color: #000000;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">=</span></span></span><span style="color: #8000ff;"><span lang="en-US"><strong><span style="background: #ffffff none repeat scroll 0% 0%;">&laquo;&nbsp;none&nbsp;&raquo;</span></strong></span></span><span style="color: #0000ff;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">&gt;</span></span></span></span></span></p>
<p style="margin-bottom: 0cm;"><span style="font-family: Times New Roman,serif;"><span style="font-size: small;"><span style="color: #0000ff;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;"> &lt;Method</span></span></span><span style="color: #000000;"><span style="background: #ffffff none repeat scroll 0% 0%;"> </span></span><span style="color: #ff0000;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">name</span></span></span><span style="color: #000000;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">=</span></span></span><span style="color: #8000ff;"><span lang="en-US"><strong><span style="background: #ffffff none repeat scroll 0% 0%;">&laquo;&nbsp;create&nbsp;&raquo;</span></strong></span></span><span style="color: #000000;"><span style="background: #ffffff none repeat scroll 0% 0%;"> </span></span><span style="color: #ff0000;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">mode</span></span></span><span style="color: #000000;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">=</span></span></span><span style="color: #8000ff;"><span lang="en-US"><strong><span style="background: #ffffff none repeat scroll 0% 0%;">&laquo;&nbsp;all&nbsp;&raquo;</span></strong></span></span><span style="color: #0000ff;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">/&gt; </span></span></span><span style="color: #008000;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">&lt;!&#8211; Audit Activé &#8211;&gt;</span></span></span></span></span></p>
<p style="margin-bottom: 0cm;"><span style="font-family: Times New Roman,serif;"><span style="font-size: small;"><span style="color: #0000ff;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;"> &lt;Method</span></span></span><span style="color: #000000;"><span style="background: #ffffff none repeat scroll 0% 0%;"> </span></span><span style="color: #ff0000;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">name</span></span></span><span style="color: #000000;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">=</span></span></span><span style="color: #8000ff;"><span lang="en-US"><strong><span style="background: #ffffff none repeat scroll 0% 0%;">&laquo;&nbsp;delete&nbsp;&raquo;</span></strong></span></span><span style="color: #000000;"><span style="background: #ffffff none repeat scroll 0% 0%;"> </span></span><span style="color: #ff0000;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">mode</span></span></span><span style="color: #000000;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">=</span></span></span><span style="color: #8000ff;"><span lang="en-US"><strong><span style="background: #ffffff none repeat scroll 0% 0%;">&laquo;&nbsp;none&nbsp;&raquo;</span></strong></span></span><span style="color: #0000ff;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">/&gt; </span></span></span><span style="color: #008000;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">&lt;!—- </span></span></span><span style="color: #008000;"><span style="background: #ffffff none repeat scroll 0% 0%;">Audit Désactivé &#8211;&gt;</span></span></span></span></p>
<p style="margin-bottom: 0cm;"><span style="font-family: Times New Roman,serif;"><span style="font-size: small;"><span style="color: #0000ff;"><span style="background: #ffffff none repeat scroll 0% 0%;"> &#8230;</span></span></span></span></p>
<p style="margin-bottom: 0cm;"><span style="font-family: Times New Roman,serif;"><span style="font-size: small;"><span style="color: #0000ff;"><span style="background: #ffffff none repeat scroll 0% 0%;">&lt;/Service&gt;</span></span></span></span></p>
</blockquote>
<p lang="fr-CA">
<ul>
<li>Désactiver l’audit sur le FileFolderService :</li>
</ul>
<blockquote>
<p style="margin-bottom: 0cm;"><span style="font-family: Times New Roman,serif;"><span style="font-size: small;"><span style="color: #0000ff;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">&lt;Service</span></span></span><span style="color: #000000;"><span style="background: #ffffff none repeat scroll 0% 0%;"> </span></span><span style="color: #ff0000;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">name</span></span></span><span style="color: #000000;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">=</span></span></span><span style="color: #8000ff;"><span lang="en-US"><strong><span style="background: #ffffff none repeat scroll 0% 0%;">&laquo;&nbsp;FileFolderService&nbsp;&raquo;</span></strong></span></span><span style="color: #000000;"><span style="background: #ffffff none repeat scroll 0% 0%;"> </span></span><span style="color: #ff0000;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">mode</span></span></span><span style="color: #000000;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">=</span></span></span><span style="color: #8000ff;"><span lang="en-US"><strong><span style="background: #ffffff none repeat scroll 0% 0%;">&laquo;&nbsp;none&nbsp;&raquo;</span></strong></span></span><span style="color: #0000ff;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">&gt;</span></span></span></span></span></p>
<p style="margin-bottom: 0cm;"><span style="font-family: Times New Roman,serif;"><span style="font-size: small;"><span style="color: #0000ff;"><span style="background: #ffffff none repeat scroll 0% 0%;">&lt;/Service&gt;</span></span></span></span></p>
</blockquote>
<p lang="fr-CA">
<p lang="fr-CA">La liste des services/méthodes présentes dans le fichier de configuration n’est pas exhaustive.</p>
<p><strong><span lang="fr-CA"><span style="font-weight: normal;">Par exemple, pour pouvoir compter le nombre de workflows il faut rajouter la méthode startWorkflow dans le service WorkflowService :</span></span></strong></p>
<blockquote>
<p style="margin-bottom: 0cm;"><span style="font-family: Times New Roman,serif;"><span style="font-size: small;"><span style="color: #0000ff;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">&lt;Service</span></span></span><span style="color: #000000;"><span style="background: #ffffff none repeat scroll 0% 0%;"> </span></span><span style="color: #ff0000;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">name</span></span></span><span style="color: #000000;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">=</span></span></span><span style="color: #8000ff;"><span lang="en-US"><strong><span style="background: #ffffff none repeat scroll 0% 0%;">&laquo;&nbsp;WorkflowService&nbsp;&raquo;</span></strong></span></span><span style="color: #000000;"><span style="background: #ffffff none repeat scroll 0% 0%;"> </span></span><span style="color: #ff0000;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">auditInternal</span></span></span><span style="color: #000000;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">=</span></span></span><span style="color: #8000ff;"><span lang="en-US"><strong><span style="background: #ffffff none repeat scroll 0% 0%;">&laquo;&nbsp;true&nbsp;&raquo;</span></strong></span></span><span style="color: #0000ff;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">&gt;</span></span></span></span></span></p>
<p style="margin-bottom: 0cm;"><span style="font-family: Times New Roman,serif;"><span style="font-size: small;"><span style="color: #0000ff;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;"> &lt;Method</span></span></span><span style="color: #000000;"><span style="background: #ffffff none repeat scroll 0% 0%;"> </span></span><span style="color: #ff0000;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">name</span></span></span><span style="color: #000000;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">=</span></span></span><span style="color: #8000ff;"><span lang="en-US"><strong><span style="background: #ffffff none repeat scroll 0% 0%;">&laquo;&nbsp;startWorkflow&nbsp;&raquo;</span></strong></span></span><span style="color: #000000;"><span style="background: #ffffff none repeat scroll 0% 0%;"> </span></span><span style="color: #ff0000;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">mode</span></span></span><span style="color: #000000;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">=</span></span></span><span style="color: #8000ff;"><span lang="en-US"><strong><span style="background: #ffffff none repeat scroll 0% 0%;">&laquo;&nbsp;all&nbsp;&raquo;</span></strong></span></span><span style="color: #0000ff;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">/&gt;</span></span></span></span></span></p>
<p style="margin-bottom: 0cm;"><span style="font-family: Times New Roman,serif;"><span style="font-size: small;"><span style="color: #0000ff;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">&lt;/Service&gt;</span></span></span></span></span></p>
</blockquote>
<p><strong><span lang="fr-CA"><span style="font-weight: normal;">De même, pour pouvoir compter les lectures de document, il faut rajouter la méthode getReader sur les services FileFolderService et ContentService : </span></span></strong></p>
<blockquote>
<p style="margin-bottom: 0cm;"><span style="font-family: Times New Roman,serif;"><span style="font-size: small;"><span style="color: #0000ff;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">&lt;Service</span></span></span><span style="color: #000000;"><span style="background: #ffffff none repeat scroll 0% 0%;"> </span></span><span style="color: #ff0000;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">name</span></span></span><span style="color: #000000;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">=</span></span></span><span style="color: #8000ff;"><span lang="en-US"><strong><span style="background: #ffffff none repeat scroll 0% 0%;">&laquo;&nbsp;FileFolderService&nbsp;&raquo;</span></strong></span></span><span style="color: #000000;"><span style="background: #ffffff none repeat scroll 0% 0%;"> </span></span><span style="color: #ff0000;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">mode</span></span></span><span style="color: #000000;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">=</span></span></span><span style="color: #8000ff;"><span lang="en-US"><strong><span style="background: #ffffff none repeat scroll 0% 0%;">&laquo;&nbsp;none&nbsp;&raquo;</span></strong></span></span><span style="color: #0000ff;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">&gt;</span></span></span></span></span></p>
<p style="margin-bottom: 0cm;"><span style="font-family: Times New Roman,serif;"><span style="font-size: small;"><span style="color: #0000ff;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;"> &lt;Method</span></span></span><span style="color: #000000;"><span style="background: #ffffff none repeat scroll 0% 0%;"> </span></span><span style="color: #ff0000;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">name</span></span></span><span style="color: #000000;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">=</span></span></span><span style="color: #8000ff;"><span lang="en-US"><strong><span style="background: #ffffff none repeat scroll 0% 0%;">&laquo;&nbsp;getReader&nbsp;&raquo;</span></strong></span></span><span style="color: #000000;"><span style="background: #ffffff none repeat scroll 0% 0%;"> </span></span><span style="color: #ff0000;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">mode</span></span></span><span style="color: #000000;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">=</span></span></span><span style="color: #8000ff;"><span lang="en-US"><strong><span style="background: #ffffff none repeat scroll 0% 0%;">&laquo;&nbsp;all&nbsp;&raquo;</span></strong></span></span><span style="color: #0000ff;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">/&gt;</span></span></span></span></span></p>
<p style="margin-bottom: 0cm;"><span style="font-family: Times New Roman,serif;"><span style="font-size: small;"><span style="color: #0000ff;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">&lt;/Service&gt;</span></span></span></span></span></p>
</blockquote>
<blockquote>
<p style="margin-bottom: 0cm;"><span style="font-family: Times New Roman,serif;"><span style="font-size: small;"><span style="color: #0000ff;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">&lt;Service</span></span></span><span style="color: #000000;"><span style="background: #ffffff none repeat scroll 0% 0%;"> </span></span><span style="color: #ff0000;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">name</span></span></span><span style="color: #000000;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">=</span></span></span><span style="color: #8000ff;"><span lang="en-US"><strong><span style="background: #ffffff none repeat scroll 0% 0%;">&laquo;&nbsp;ContentService&nbsp;&raquo;</span></strong></span></span><span style="color: #000000;"><span style="background: #ffffff none repeat scroll 0% 0%;"> </span></span><span style="color: #ff0000;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">mode</span></span></span><span style="color: #000000;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">=</span></span></span><span style="color: #8000ff;"><span lang="en-US"><strong><span style="background: #ffffff none repeat scroll 0% 0%;">&laquo;&nbsp;none&nbsp;&raquo;</span></strong></span></span><span style="color: #0000ff;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">&gt;</span></span></span></span></span></p>
<p style="margin-bottom: 0cm;"><span style="font-family: Times New Roman,serif;"><span style="font-size: small;"><span style="color: #0000ff;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;"> &lt;Method</span></span></span><span style="color: #000000;"><span style="background: #ffffff none repeat scroll 0% 0%;"> </span></span><span style="color: #ff0000;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">name</span></span></span><span style="color: #000000;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">=</span></span></span><span style="color: #8000ff;"><span lang="en-US"><strong><span style="background: #ffffff none repeat scroll 0% 0%;">&laquo;&nbsp;getReader&nbsp;&raquo;</span></strong></span></span><span style="color: #000000;"><span style="background: #ffffff none repeat scroll 0% 0%;"> </span></span><span style="color: #ff0000;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">mode</span></span></span><span style="color: #000000;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">=</span></span></span><span style="color: #8000ff;"><span lang="en-US"><strong><span style="background: #ffffff none repeat scroll 0% 0%;">&laquo;&nbsp;all&nbsp;&raquo;</span></strong></span></span><span style="color: #0000ff;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">/&gt;</span></span></span></span></span></p>
<p style="margin-bottom: 0cm;"><span style="font-family: Times New Roman,serif;"><span style="font-size: small;"><span style="color: #0000ff;"><span lang="en-US"><span style="background: #ffffff none repeat scroll 0% 0%;">&lt;/Service&gt;</span></span></span></span></span></p>
</blockquote>
<p><a href="http://wiki.alfresco.com/wiki/Audit_Configuration">http://wiki.alfresco.com/wiki/Audit_Configuration</a></p>
<p><span style="color: #ff0000;"> </span></p>
<p lang="fr-CA">
<p lang="fr-CA"><span style="color: #ff0000;"><br />
</span></p>
<p><!-- 		@page { margin: 2cm } 		P { margin-bottom: 0.21cm } --></p>
<h2><span lang="fr-CA"><em><em>Bon à savoir :<br />
</em></em></span></h2>
<p><!-- 		@page { margin: 2cm } 		P { margin-bottom: 0.21cm } 		TD P { margin-bottom: 0cm } --></p>
<ul>
<li>
<p lang="fr-CA">Volumétrie</p>
</li>
</ul>
<p style="text-align: justify;" lang="fr-CA">Si vous activez beaucoup de services et que l’utilisation de votre Alfresco est conséquente, le nombre d’informations stockées en base risque de croitre très rapidement.</p>
<p lang="fr-CA"><span style="color: #ff0000;"><br />
</span></p>
<p><!-- 		@page { margin: 2cm } 		P { margin-bottom: 0.21cm } --></p>
<ul>
<li>
<p lang="fr-CA">Problèmes rencontrés</p>
</li>
</ul>
<p lang="fr-CA">L’audit ne permet pas d’auditer certaines actions suivant le type d’accès à Alfresco.</p>
<p lang="fr-CA">Suivant l&#8217;accès utilisé pour accéder à Alfresco, l&#8217;authentification (Service : <em><strong>AuthenticationService</strong></em> <em>/ Méthode : </em><em><strong>authenticate</strong></em>)  peut ne pas être auditée, voici un tableau récapitulatif :</p>
<table border="1" cellspacing="0" cellpadding="4" width="376" bordercolor="#000000">
<col width="225"></col>
<col width="133"></col>
<tbody>
<tr valign="TOP">
<td width="225">
<p lang="fr-CA"><strong>Type d&#8217;accès</strong></p>
</td>
<td width="133">
<p lang="fr-CA"><strong>Traces d’audit</strong></p>
</td>
</tr>
<tr valign="TOP">
<td width="225" height="22">
<p style="text-indent: 0.64cm;" lang="fr-CA">Explorer 				Alfresco</p>
</td>
<td width="133">
<p style="margin-left: -0.01cm; margin-right: -0.01cm;" lang="fr-CA">Oui</p>
</td>
</tr>
<tr valign="TOP">
<td width="225" height="22">
<p style="text-indent: 0.64cm;" lang="fr-CA">Share</p>
</td>
<td width="133">
<p style="margin-left: -0.01cm; margin-right: -0.01cm;" lang="fr-CA">Oui</p>
</td>
</tr>
<tr valign="TOP">
<td width="225" height="22">
<p style="text-indent: 0.64cm;" lang="fr-CA">WebDAV</p>
</td>
<td width="133">
<p style="margin-left: -0.01cm; margin-right: -0.01cm;" lang="fr-CA">Oui</p>
</td>
</tr>
<tr valign="TOP">
<td width="225" height="22">
<p style="text-indent: 0.64cm;" lang="fr-CA">FTP</p>
</td>
<td width="133">
<p style="margin-left: -0.01cm; margin-right: -0.01cm;" lang="fr-CA">Non</p>
</td>
</tr>
<tr valign="TOP">
<td width="225" height="21">
<p style="text-indent: 0.64cm;" lang="fr-CA">CIFS</p>
</td>
<td width="133">
<p style="margin-left: -0.01cm; margin-right: -0.01cm;" lang="fr-CA">Non</p>
</td>
</tr>
</tbody>
</table>
<p style="margin-bottom: 0cm;">
<p style="margin-bottom: 0cm;">
<p lang="fr-CA"><span style="color: #ff0000;"><br />
</span></p>
<p><!-- 		@page { margin: 2cm } 		P { margin-bottom: 0.21cm } --></p>
<ul>
<li>Certaines données « à prendre avec des pincettes » :</li>
</ul>
<p style="text-align: justify;" lang="fr-CA">Il semblerait que suivant le type de fichier, les audits concernant les lectures ne se fassent pas de la même manière.</p>
<p style="text-align: justify;" lang="fr-CA">Nous avons eu des problèmes, notamment avec des fichiers pdf, qui laissent en moyenne deux fois plus de traces dans les tables d&#8217;audit. Ce problème est visible sur les lectures dans le navigateur, et semble être lié au poids du fichier lu.</p>
<p lang="fr-CA">
<p lang="fr-CA">
]]></content:encoded>
			<wfw:commentRss>http://blog.atolcd.com/?feed=rss2&amp;p=217</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AtolExt3WidgetPlugin, un plugin qui défie les lois de l&#8217;entropie</title>
		<link>http://blog.atolcd.com/?p=174</link>
		<comments>http://blog.atolcd.com/?p=174#comments</comments>
		<pubDate>Tue, 06 Oct 2009 14:31:13 +0000</pubDate>
		<dc:creator>Jean-Philippe Thevenoux</dc:creator>
				<category><![CDATA[ExtJs]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[développement]]></category>
		<category><![CDATA[mvc]]></category>

		<guid isPermaLink="false">http://blog.atolcd.com/?p=174</guid>
		<description><![CDATA[
Présentation du besoin de départ
Au départ de ce projet, le sentiment de se poser souvent les même questions pour réaliser une application web de consultation/mise à jour de données issues d&#8217;une base de données. Quelle bibliothèque de composants utiliser, comment gérer mes formulaires, comment utiliser des tableaux évolués, comment accéder aux données, …
Ce genre d&#8217;application [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right"><img class="alignnone size-thumbnail wp-image-190" title="sfForm_to_extJS" src="http://blog.atolcd.com/wp-content/sfForm_to_extJS-150x150.jpg" alt="sfForm_to_extJS" width="150" height="150" /></div>
<h1>Présentation du besoin de départ</h1>
<p>Au départ de ce projet, le sentiment de se poser souvent les même questions pour réaliser une application web de consultation/mise à jour de données issues d&#8217;une base de données. Quelle bibliothèque de composants utiliser, comment gérer mes formulaires, comment utiliser des tableaux évolués, comment accéder aux données, …</p>
<p>Ce genre d&#8217;application regroupe principalement les fonctionnalités suivantes :</p>
<ul>
<li>grille avec pagination pour lister les 	enregistrements des différentes tables,</li>
<li>filtrage de ces grilles,</li>
<li>formulaire d&#8217;édition des enregistrements,</li>
<li>imbrication « complexe » de 	formulaire (e.g. : édition d&#8217;un auteur avec ses articles en 	même temps),</li>
<li>validation par rechargement des pages (et non 	pas par Ajax, afin de rassurer l&#8217;utilisateur, ce qu&#8217;il voit sur la 	page correspond bien à ce qui est en base).</li>
</ul>
<h1>La réflexion</h1>
<p><a href="http://www.symfony-project.org/"><em>Symfony</em></a> s&#8217;impose assez facilement comme base de développement. Il possède une gestion de routing très puissante, une DAO intégrée (Doctrine) , une gestion de formulaire complète (un élément important dans le choix de notre solution), une structure permettant le développement en parallèle sans gêne.</p>
<p><a href="http://www.extjs.com/"><em>ExtJs</em></a> est une bibliothèque javascript évoluée pour faire des applications riches. Elle possèdent des composants de haut niveau (grille, arbre, combo, &#8230;), un système d&#8217;évènement complet, différents <em>layout</em> offrant toutes les possibilités de mise en forme, une abstraction de l&#8217;accès au données (via les stores) &#8230;</p>
<p>Le but est donc de mettre en commun ces deux environnements.</p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-198" title="Schema-EXTJS-Symfony-1" src="http://blog.atolcd.com/wp-content/Schema-EXTJS-Symfony-11.jpg" alt="Schema-EXTJS-Symfony-1" width="500" height="386" /></p>
<p><span id="more-174"></span></p>
<h1>Explication des choix</h1>
<h2>Les autres plugins existants</h2>
<p>Il existe un plugin pour Symfony 1.0 et ExtJs 2.1 (<strong><span style="font-weight: normal;"><em><a href="http://www.symfony-project.org/plugins/sfExtjs2Plugin">sfExtjs2Plugin</a></em>)</span></strong></p>
<p>Ce plugin a pour principe de créer le code ExtJs complètement depuis symfony via un helper et des méthodes « asMethod, asVariable, &#8230; ». Au lieu d&#8217;écrire du code javascript, on écrit du php qui lui va écrire du javascript.</p>
<p>Ce principe est intéressant pour certaines applications, il permet de centraliser tout le code à un seul endroit.</p>
<p>Mais ce plugin n&#8217;est pas adapté au formulaire de symfony (version 1.2). Or c&#8217;est un des avantages que l&#8217;on voulait utiliser. Donc l&#8217;utilisation de ce plugin était dès le départ compromise.</p>
<h2>Formulaire vers Widgets</h2>
<p>Le besoin initial portait sur les formulaires, mais cela pouvait aussi s&#8217;appliquer à d&#8217;autres composants ExtJS, tels les tableaux, les fieldset, les panel, …</p>
<p>En construisant la page comme une arborescence de composants ExtJS, on peut décrire côté symfony la page comme une arborescence de widgets (panel contenant un fieldset contenant une grille), et on peut garder aussi le découplage formulaire/template.</p>
<h1>Description de la solution</h1>
<p>ExtJs 2 définissait un « xtype » pour quasiment tous les « composants » graphique, ExtJs 3 a poussé le concept en définissant un « xtype » sur tous les classes (store, colonne, &#8230;). Cela permet d&#8217;écrire une page complète uniquement via une description JSON.</p>
<p>C&#8217;est donc sur cette méthode que nous nous sommes orientés.</p>
<p>Une classe de base « PluginExt3Base » qui étend « sfWidgetForm » permet de gérer les attributs d&#8217;un objet, des gérer les sous-éléments, et possède des fonctions pour convertir cet objet en une description JSON.</p>
<p>D&#8217;autres classes, qui héritent de celle-ci, plus spécifiques, permettent une définition directe d&#8217;un type d&#8217;objet (« PluginExt3Label », « PluginExt3Panel », &#8230;) et possèdent des fonctions propre à ce type d&#8217;objet.</p>
<p>Un Helper a été mis en place pour automatiser l&#8217;écriture des objets dans les variables adéquates. Pour interpréter la description JSON, un fichier javascript récupère les variables écrite par le template Symfony, et crée les objets grâce à  la fonction  Ext.ComponentMgr.create.</p>
<p style="text-align: center;"><img class="size-full wp-image-199" title="Schema-EXTJS-Symfony-2" src="http://blog.atolcd.com/wp-content/Schema-EXTJS-Symfony-2.jpg" alt="Architecture de l'intégration de Symfony et ExtJs" width="500" height="353" /></p>
<h2>Pour les formulaires</h2>
<p>Symfony utilise un système de routing très performant et très simple en même temps. Une URL correspond à une action d&#8217;un module. Une URL est définie par son adresse mais aussi par sa méthode. Un appel en GET ou en POST peut donc être redirigé vers la même action du même module, ou bien vers 2 actions distinctes.</p>
<p>Les navigateurs ne permettent pas tous de gérer les 4 méthodes de HTTP (GET, POST, DELETE et PUT) donc Symfony a mis en place un système pour gérer cela. Dans une requête, si un paramètre « <em>sf_method</em> » est passé, alors la valeur de ce paramètre permet de définir la méthode de l&#8217;appel.</p>
<p>Lors de la création de l&#8217;objet spécifique formulaire, on passe en paramètre l&#8217;URL de destination ainsi que la méthode d&#8217;appel. Cela permet de gérer tous les cas possible.</p>
<p>Les formulaires Symfony sont composés de 2 parties, une définition des <em>widgets</em> (pour 1 champs, comment il est représenté) et une définition des <em>validators</em> (pour 1 champs, quelles sont les règles qu&#8217;il possède)</p>
<p>Les <em>widgets</em> de base de Symfony sont remplacé par les <em>widgets</em> ExtJs, et les <em>validators</em> sont gardés. Cela permet de garder toutes la puissances de traitement automatique des formulaires (validation, message d&#8217;erreur, &#8230;) tout en ayant la flexibilité de l&#8217;affichage ExtJs.</p>
<h2>Pour d&#8217;autres pages</h2>
<p>Dans les templates, l&#8217;organisation de la page est libre. Il est relativement facile de créer un panel qui contient 2 panels qui contiennent chacun des onglets qui eux mêmes contiennent chacun une grille &#8230;</p>
<p>Les templates étant des fichiers php, il est tout à fait possible d&#8217;automatiser la création de composants dans une boucle, de conditionner l&#8217;affichage, etc. Ceci autorise la création de pages relativement chargées et complexes avec très peu de code.</p>
<p>Quand un composant, ou un comportement est vraiment trop complexe, il est tout a fait possible de créer un nouveau composant ExtJs dans un fichier javascript, de lui attribuer un « xtype », et de créer le composant correspondant dans l&#8217;application.</p>
<p>Pour une application, nous avons ainsi développé un composant qui hérite d&#8217;une grille, et qui le complète avec une gestion automatique de la pagination, des filtres par colonne, des liens par ligne, et d&#8217;autres possibilités.</p>
<p>Une fois ce composant créé, il suffit, dans un template, d&#8217;instancier cet élément pour avoir accès à toutes ses fonctionnalités. Et comme ExtJs permet facilement de faire de l&#8217;héritage, il est encore plus facile de créer un composant possédant un comportement bien spécifique.</p>
<h2>Exemple de code :</h2>
<p>Définition d&#8217;un formulaire. Celui-ci permet de faire le lien entre un objet et une table de la base de donnée, de définir sous quel format apparaitrons les champs et de définir quels sont les contrôles qui seront appliqués.</p>
<p><em>lib/form/doctrineExt/usersExt3Form.php </em></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> usersExt3Form <span style="color: #000000; font-weight: bold;">extends</span> PluginExt3FormDoctrine
<span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> setup<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    parent<span style="color: #339933;">::</span><span style="color: #004000;">setup</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// create combobox &quot;type user&quot;</span>
    <span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> Doctrine<span style="color: #339933;">::</span><span style="color: #004000;">getTable</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'typeusers'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getAll</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">execute</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$cboUserType</span> <span style="color: #339933;">=</span> PluginExt3DoctrineComboBox<span style="color: #339933;">::</span><span style="color: #004000;">fromResult</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'idtypeuser'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'labeltypeuser'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$cboUserType</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'fieldLabel'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'User Type'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$cboUserType</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'allowBlank'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000088;">$widgets</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span>
    <span style="color: #0000ff;">'lname'</span><span style="color: #339933;">=&gt;</span> <span style="color: #000000; font-weight: bold;">new</span> PluginExt3TextField<span style="color: #009900;">&#40;</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'allowBlank'</span><span style="color: #339933;">=&gt;</span>false<span style="color: #339933;">,</span> <span style="color: #0000ff;">'fieldLabel'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'Last name'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'fname'</span><span style="color: #339933;">=&gt;</span> <span style="color: #000000; font-weight: bold;">new</span> PluginExt3TextField<span style="color: #009900;">&#40;</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'allowBlank'</span><span style="color: #339933;">=&gt;</span>false<span style="color: #339933;">,</span> <span style="color: #0000ff;">'fieldLabel'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'First name'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'codeidentification'</span><span style="color: #339933;">=&gt;</span> <span style="color: #000000; font-weight: bold;">new</span> PluginExt3TextField<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'fieldLabel'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'Identification code'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'login'</span><span style="color: #339933;">=&gt;</span> <span style="color: #000000; font-weight: bold;">new</span> PluginExt3TextField<span style="color: #009900;">&#40;</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'allowBlank'</span><span style="color: #339933;">=&gt;</span>false<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'email'</span><span style="color: #339933;">=&gt;</span> <span style="color: #000000; font-weight: bold;">new</span> PluginExt3EmailField<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'idusertype'</span><span style="color: #339933;">=&gt;</span><span style="color: #000088;">$cboUserType</span>
    <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setWidgets</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$widgets</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000088;">$validators</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span>
    <span style="color: #0000ff;">'lname'</span><span style="color: #339933;">=&gt;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getWidget</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'lname'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getValidator</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'fname'</span><span style="color: #339933;">=&gt;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getWidget</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'fname'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getValidator</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'codeidentification'</span><span style="color: #339933;">=&gt;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getWidget</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'codeidentification'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getValidator</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'login'</span><span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getWidget</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'login'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getValidator</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'email'</span><span style="color: #339933;">=&gt;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getWidget</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'email'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getValidator</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'idusertype'</span><span style="color: #339933;">=&gt;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getWidget</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'idusertype'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getValidator</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setValidators</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$validators</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">widgetSchema</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setNameFormat</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'users[%s]'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getModelName<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">'users'</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Le fichier d&#8217;action qui permet de créer le formulaire, de le remplir si on est en méthode « POST », de contrôler le formulaire, et enfin de sauvegarde l&#8217;objet lié au formualire</p>
<p><em>actions/actions.class.php </em></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> sfMonAppActions <span style="color: #000000; font-weight: bold;">extends</span> sfActions
<span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> executeIndex<span style="color: #009900;">&#40;</span>sfWebRequest <span style="color: #000088;">$request</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">form</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> usersExt3Form<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$request</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isMethod</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'POST'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
      <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">bind</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$request</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getParameter</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isValid</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
      <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">save</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getUser</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setMessage</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'OK'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'successful'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">redirect</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'@home'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
      <span style="color: #b1b100;">else</span>
      <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getUser</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setMessage</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'ERROR'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Forms contains error'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getErrorSchema</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Le template permet de définir l&#8217;affichage final.<br />
<em>templates/indexSuccess.php </em></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">  <span style="color: #000088;">$formPanel</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> PluginExt3FormPanel<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$form</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$formPanel</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'title'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;Hello World !&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$ret</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&lt;script type=&quot;text/javascript&quot;&gt;&lt;!--mce:0--&gt;&lt;/script&gt;'</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$ret</span><span style="color: #339933;">;</span></pre></div></div>

<p>Côté client un fichier javascript permet d&#8217;interpréter le code final généré par le template</p>
<h1>Quelques points précis</h1>
<h2>Validators</h2>
<p>Les <em>validators</em> de Symfony sont utilisés pour contrôler les formulaires. Il existe de nombreux validators (date, e-mail, url, texte, &#8230;) et il est facile de créer de nouveaux validators, ou d&#8217;étendre un validator existant pour le spécialiser.</p>
<p>Côté ExtJs, des validators « simple » peuvent être utiliser pour contrôler la saisie (champs obligatoire, champ numérique).</p>
<p>La combinaison de ces deux types de contrôles permet d&#8217;avoir une interface riche, interactive et de minimiser les échanges avec le serveur.</p>
<p><strong>Exemple :</strong><br />
<em>Définition d&#8217;un formulaire, avec des propriétés de contrôle :</em></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$widgets</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
 <span style="color: #0000ff;">'name'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000000; font-weight: bold;">new</span> PluginExt3TextField<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'fieldLabel'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'Nom'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
 <span style="color: #0000ff;">'code'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000000; font-weight: bold;">new</span> PluginExt3TextField<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'maxLength'</span><span style="color: #339933;">=&gt;</span><span style="color: #cc66cc;">5</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'minLength'</span> <span style="color: #339933;">=&gt;</span><span style="color: #cc66cc;">5</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'@maskRe'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'/^[0-9]$/'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'allowBlank'</span><span style="color: #339933;">=&gt;</span>false<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
 <span style="color: #0000ff;">'startdate'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000000; font-weight: bold;">new</span> PluginExt3DateField<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'fieldLabel'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'Date de début'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p><em>Code JSON généré :</em></p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #009900;">&#123;</span>
  xtype<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;textfield&quot;</span><span style="color: #339933;">,</span>
  autoCreate<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>tag<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;input&quot;</span><span style="color: #339933;">,</span>type<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;text&quot;</span><span style="color: #339933;">,</span>size<span style="color: #339933;">:</span><span style="color: #CC0000;">20</span><span style="color: #339933;">,</span>autocomplete<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;on&quot;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
  <span style="color: #000066;">name</span><span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;mydata[name]&quot;</span><span style="color: #339933;">,</span>
  value<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">,</span>
  fieldLabel<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;Nom&quot;</span><span style="color: #339933;">,</span>
  invalidText<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;&quot;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><span style="color: #009900;">&#123;</span>
  xtype<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;textfield&quot;</span><span style="color: #339933;">,</span>
  maxLength<span style="color: #339933;">:</span><span style="color: #CC0000;">5</span><span style="color: #339933;">,</span>
  minLength<span style="color: #339933;">:</span><span style="color: #CC0000;">5</span><span style="color: #339933;">,</span>
  maskRe<span style="color: #339933;">:/^</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">-</span><span style="color: #CC0000;">9</span><span style="color: #009900;">&#93;</span>$<span style="color: #339933;">/,</span>
  autoCreate<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>tag<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;input&quot;</span><span style="color: #339933;">,</span>type<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;text&quot;</span><span style="color: #339933;">,</span>size<span style="color: #339933;">:</span><span style="color: #CC0000;">20</span><span style="color: #339933;">,</span>autocomplete<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;on&quot;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
  <span style="color: #000066;">name</span><span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;mydata[code]&quot;</span><span style="color: #339933;">,</span>
  value<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">,</span>
  fieldLabel<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;Code&quot;</span><span style="color: #339933;">,</span>
  invalidText<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;&quot;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><span style="color: #009900;">&#123;</span>
  xtype<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;datefield&quot;</span><span style="color: #339933;">,</span>
  format<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;m/d/Y&quot;</span><span style="color: #339933;">,</span>
  invalid<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;Invalid date format : mm/dd/yyyy&quot;</span><span style="color: #339933;">,</span>
  altFormats<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;d/m/Y|d/m/y|Y-m-d&quot;</span><span style="color: #339933;">,</span>
  allowBlank<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>
  fieldLabel<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;Start date&quot;</span><span style="color: #339933;">,</span>
  autoCreate<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>tag<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;input&quot;</span><span style="color: #339933;">,</span>type<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;text&quot;</span><span style="color: #339933;">,</span>size<span style="color: #339933;">:</span><span style="color: #CC0000;">20</span><span style="color: #339933;">,</span>autocomplete<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;on&quot;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
  <span style="color: #000066;">name</span><span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;mydata[startdate]&quot;</span><span style="color: #339933;">,</span>
  value<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">,</span>
  invalidText<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;&quot;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p><em>Visuel rendu :</em></p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-202" title="Rendu visuel" src="http://blog.atolcd.com/wp-content/visu.png" alt="Rendu visuel" width="298" height="271" /></p>
<h2>Imbrication de sous-formulaires</h2>
<p>De base, les formulaires Symfony peuvent « inclure » d&#8217;autres formulaires, et utilisent un « décorateur » pour l&#8217;inclusion.</p>
<p>Symfony propose de lier un formulaire à un objet (de la DAO ou autre). Cela permet de d&#8217;avoir directement au niveau du formulaire des méthodes pour mettre à jour l&#8217;objet en question et pour le sauvegarder. Cela implique d&#8217;avoir au niveau des formulaires les méthodes nécessaires. Cela permet entre autre une gestion des formulaires imbriqués (mise à jour et sauvegarde en cascade).</p>
<p>Pour notre application, cet aspect des formulaires est important, nos formulaires héritent donc de « sfFormDoctrine ».</p>
<p>Le choix de construire toute l&#8217;arborescence de la page par une hiérarchie de composants nous oblige à imbriquer nos formulaires dans des widgets qui n&#8217;ont pas une vocation de formulaire (filedset, …).</p>
<p>Nous avons donc développé un objet « dummyExt3FormDoctrine » qui permet de faire « comme si » le formulaire était basé sur un objet, alors que ce n&#8217;est pas le cas. Cela nous permet de garder les avantages des formulaires Doctrine avec une gestion en cascade des sous-formulaires.</p>
<p>Cet objet autorise donc la création de formulaire contenant des sous-formulaires avec un décorateur spécifique (fieldset, colonne, &#8230;), mais permet aussi, grâce à l&#8217;héritage, de faire des formulaires dont une partie est lié à la base de données, les &#8216;autres parties possédant uniquement du code métier. Toutes les imbrications sont possibles.</p>
<h2>Et MVC dans tout ça ?</h2>
<p>Avec cette technique, on perd un peu le découplage Vue /Contrôleur car le contrôleur va lui-même créer les formulaires et les mettre en forme.</p>
<p>Le modèle gère complètement tout l&#8217;accès à la base de donnée, et est relativement « indépendant » de la vue et du contrôleur. Une majorité du code métier est inclus dans cette partie (création de données dans les tables annexes par exemple).</p>
<p>Le contrôleur fait peu de chose. Il instancie les formulaires, appelle les fonctions sur ces formulaires (isValid, save, &#8230;), s&#8217;occupe de récupérer les données de la DAO pour les proposer à la vue. Il possède peu de code métier.</p>
<p>La vue s&#8217;occupe de toute la mise en forme, elle s&#8217;occupe de créer les grilles, de rendre les formulaires.</p>
<p>Le découplage effectué est relativement respectueux du processus MVC.</p>
<p>Le seul point non respectueux se produit lors de l&#8217;imbrication des formulaires par le contrôleur car c&#8217;est ce contrôleur qui va définir le décorateur à utiliser, et non la vue.</p>
<p>Page officiel du plugins : <a href="http://www.symfony-project.org/plugins/atolExt3WidgetPlugin"><em>http://www.symfony-project.org/plugins/atolExt3WidgetPlugin</em></a><br />
Symfony : <a href="http://www.symfony-project.org/"><em>http://www.symfony-project.org/</em></a><br />
ExtJs : <a href="http://www.extjs.com/"><em>http://www.extjs.com/</em></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.atolcd.com/?feed=rss2&amp;p=174</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Alfresco et Sharepoint</title>
		<link>http://blog.atolcd.com/?p=168</link>
		<comments>http://blog.atolcd.com/?p=168#comments</comments>
		<pubDate>Tue, 10 Mar 2009 17:09:52 +0000</pubDate>
		<dc:creator>jlv</dc:creator>
				<category><![CDATA[ECM]]></category>
		<category><![CDATA[Alfresco Sharepoint]]></category>

		<guid isPermaLink="false">http://blog.atolcd.com/?p=168</guid>
		<description><![CDATA[Alfresco 3 implémente le protocole Sharepoint ce qui permet d&#8217;utiliser avec MS Office, les fonctions d&#8217;espaces partagés, le verrouillage des documents, les versions &#8230;
Alfresco est une alternative à Sharepoint et le tutoriel d&#8217;Alfresco en français alfresco-et-sharepoint vous donnera un aperçu de la solution.
]]></description>
			<content:encoded><![CDATA[<p>Alfresco 3 implémente le protocole Sharepoint ce qui permet d&#8217;utiliser avec MS Office, les fonctions d&#8217;espaces partagés, le verrouillage des documents, les versions &#8230;</p>
<p>Alfresco est une alternative à Sharepoint et le tutoriel d&#8217;Alfresco en français <a href="http://blog.atolcd.com/wp-content/alfresco-et-sharepoint.pdf">alfresco-et-sharepoint</a> vous donnera un aperçu de la solution.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.atolcd.com/?feed=rss2&amp;p=168</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SSO entre Share et Alfresco</title>
		<link>http://blog.atolcd.com/?p=115</link>
		<comments>http://blog.atolcd.com/?p=115#comments</comments>
		<pubDate>Thu, 27 Nov 2008 12:36:47 +0000</pubDate>
		<dc:creator>Laurent Meunier</dc:creator>
				<category><![CDATA[ECM]]></category>
		<category><![CDATA[alfresco]]></category>
		<category><![CDATA[CAS]]></category>
		<category><![CDATA[Share]]></category>
		<category><![CDATA[SSO]]></category>

		<guid isPermaLink="false">http://blog.atolcd.com/?p=115</guid>
		<description><![CDATA[Si vous avez déjà installé Alfresco 3.0, vous vous êtes sûrement rendu compte que les deux applications Share et Alfresco gèrent leur authentification indépendamment l&#8217;une de l&#8217;autre. Si vous passez de Share à Alfresco (et inversement), vous devez de nouveau montrer patte blanche en donnant votre nom d&#8217;utilisateur et votre mot de passe &#8230; ce [...]]]></description>
			<content:encoded><![CDATA[<p>Si vous avez déjà installé Alfresco 3.0, vous vous êtes sûrement rendu compte que les deux applications Share et Alfresco gèrent leur authentification indépendamment l&#8217;une de l&#8217;autre. Si vous passez de Share à Alfresco (et inversement), vous devez de nouveau montrer patte blanche en donnant votre nom d&#8217;utilisateur et votre mot de passe &#8230; ce qui est particulièrement frustrant pour nos utilisateurs.</p>
<p>Que faire ? Mettre en place un système de <a href="http://fr.wikipedia.org/wiki/Authentification_unique">SSO</a> et <a href="http://www.ja-sig.org/products/cas/">CAS</a> répond très bien à ce problème.</p>
<p><span id="more-115"></span></p>
<h1>Principes d&#8217;authentification de Share et de CAS</h1>
<p>Je ne vais pas revenir sur l&#8217;installation et la configuration d&#8217;un serveur CAS. Ceci n&#8217;est pas l&#8217;objet de ce billet. Nous verrons uniquement comment CASifier Share (ce qui va déjà nous occuper un petit moment).</p>
<p>Je vais revenir rapidement sur le principe d&#8217;authentification de Share pour bien exposer le problème :</p>
<ul>
<li>l&#8217;utilisateur ouvre l&#8217;application Share</li>
<li>Share affiche la page de login</li>
<li>l&#8217;utilisateur envoie le couple login / mot de passe</li>
<li>ce couple est envoyé vers un webscript Alfresco par Share</li>
<li>si Alfresco valide le couple, il renvoie un ticket</li>
<li>Share utilisera ce ticket pour toutes les futures communications avec Alfresco</li>
</ul>
<p>Ceci montre que le mot de passe donné sur la page de login de Share est ensuite envoyé à Alfresco. C&#8217;est la réponse d&#8217;Alfresco qui conditionne l&#8217;accès (ou non) à l&#8217;application Share.</p>
<p>Une application CASifiée utilise le principe suivant pour authentifier un utilisateur :</p>
<ul>
<li>connexion de l&#8217;utilisateur à l&#8217;application (il n&#8217;a pas encore de ticket CAS valide)</li>
<li>l&#8217;application le renvoie vers la page de login de CAS</li>
<li>l&#8217;utilisateur envoie le couple login / mot de passe à CAS</li>
<li>ce couple est validé par le backend de CAS</li>
<li>si le couple est valide, CAS redirige l&#8217;utilisateur vers l&#8217;application accompagné d&#8217;un ticket ST (Service cket)</li>
<li>l&#8217;application valide le ticket ST auprès de CAS et récupère le login de l&#8217;utilisateur</li>
<li>l&#8217;application authentifie l&#8217;utilisateur uniquement sur le login</li>
</ul>
<p>De ces deux procédures d&#8217;authentification, on peut déjà faire ressortir le principale problème : l&#8217;application CASifiée ne voit jamais le mot de passe de l&#8217;utilisateur. Dans ce cas comment Share peut-il envoyer le couple login / mot de passe à Alfresco ?</p>
<h1>Quelles sont les solutions ?</h1>
<p>Une première piste serait d&#8217;utiliser notre ticket ST dans Share et l&#8217;envoyer à la place du mot de passer à Alfresco. Il faudrait réaliser des modifications côté Alfresco pour valider ce ticket ST auprès du serveur CAS. Cependant, cela ne peut fonctionner car un ticket ST est à usage unique. Il est invalidé côté CAS après la validation de Share, il ne peut donc plus être utilisé par Alfresco.</p>
<p>La seconde piste (qui sera la bonne) est l&#8217;utilisation d&#8217;un Proxy Ticket (PT). Le système de proxy a été introduit dans CAS 2, il faudra donc utiliser un serveur et un client supportant cette architecture.<br />
Si on reprend la procédure d&#8217;authentification de CAS avec l&#8217;utilisation d&#8217;un PT, cela devient :</p>
<ul>
<li>connexion de l&#8217;utilisateur à Share (il n&#8217;a pas encore de ticket CAS valide)</li>
<li>Share le renvoie vers la page de login de CAS</li>
<li>l&#8217;utilisateur envoie le couple login / mot de passe à CAS</li>
<li>ce couple est validé par le backend de CAS</li>
<li>si le couple est valide, CAS redirige l&#8217;utilisateur vers Share accompagné d&#8217;un ticket ST (Service Ticket)</li>
<li>Share valide le ticket ST auprès de CAS et demande un PGT (Proxy Granting Ticket)</li>
<li>CAS renvoie le login de l&#8217;utilisateur et un PGT</li>
<li>Share demande un PT (Proxy Ticket) à CAS à l&#8217;aide du PGT</li>
<li>CAS renvoie le PT</li>
<li>Share envoie le PT à Alfresco via un webscript</li>
<li>Alfresco valide le PT via CAS et récupère le login</li>
<li>Alfresco crée un ticket (un ticket Alfresco, pas un ticket CAS) et le renvoie à Share pour les futures échanges</li>
</ul>
<p>Ouf ! C&#8217;est un peu long, mais ça fonctionne et c&#8217;est totalement transparent pour les utilisateurs.<br />
Bon, on a un principe qui est fonctionnel, il ne nous reste plus qu&#8217;à passer au plus intéressant : la réalisation.</p>
<h1>En pratique&#8230;</h1>
<p>En pratique, il faut modifier Share et Alfreso. Des modifications des deux côtés sont nécessaires pour mettre en place le SSO. Les modifications se résument à quelques fichiers Java et beaucoup de XML.</p>
<h2>Côté Share</h2>
<ul>
<li>web.xml : ajouter les filtres pour CAS</li>
<li>webscript-framework-config.xml : modification de classe d&#8217;authentification (envoie du PT à la place du mot de passe sur un nouveau webscript)</li>
<li>ajouter le jar du client CAS</li>
<li>ajouter deux nouvelles classes Java :
<ul>
<li>CasAuthenticationFilter : valide le ST, récupère le PT et authentifie l&#8217;utisateur dans Share</li>
<li>CasAlfrescoAuthenticator : envoie le PT vers un webscript Alfresco et récupère un ticket Alfresco</li>
</ul>
</li>
</ul>
<h2>Côté Alfresco</h2>
<ul>
<li>web.xml : ajouter les filtres pour CAS</li>
<li>ajouter le jar du client CAS</li>
<li>ajouter le webscript recevant le PT de Share</li>
<li>ajouter la classe Java pour l&#8217;authentification CAS classique</li>
</ul>
<h2>Le code</h2>
<ul>
<li><a href="http://blog.atolcd.com/wp-content/alfresco-cas.zip">alfresco-cas.zip</a></li>
<li><a href="http://blog.atolcd.com/wp-content/share-cas.zip">share-cas.zip</a></li>
</ul>
<p>Ces deux archives contiennent tout le code et les modifications nécessaires pour mettre en place un SSO basé sur CAS entre Share et Alfresco. Avant d&#8217;utiliser ces fichiers, il faut les modifier pour correspondre à votre installation (notamment les adresses des serveurs CAS et Alfresco).</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.atolcd.com/?feed=rss2&amp;p=115</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>Alfresco &#8211; Protéger un document PDF avec PDFBox</title>
		<link>http://blog.atolcd.com/?p=33</link>
		<comments>http://blog.atolcd.com/?p=33#comments</comments>
		<pubDate>Fri, 14 Nov 2008 12:58:52 +0000</pubDate>
		<dc:creator>Bertrand Magnier</dc:creator>
				<category><![CDATA[ECM]]></category>
		<category><![CDATA[alfresco]]></category>
		<category><![CDATA[développement]]></category>
		<category><![CDATA[ged]]></category>
		<category><![CDATA[pdf]]></category>

		<guid isPermaLink="false">http://blog.atolcd.com/?p=33</guid>
		<description><![CDATA[Autre fonctionnalité liée au format PDF pouvant s&#8217;avérer intéressante : la protection d&#8217;un fichier par un mot de passe, ainsi que la restriction des actions autorisées (extraction de texte, impression, &#8230;).
L&#8217;implémentation va encore une fois se faire par le biais d&#8217;une action Alfresco, mais utilisera la librairie PDFBox, embarquée par Alfresco.
PDFBox [en] est une librairie [...]]]></description>
			<content:encoded><![CDATA[<p>Autre fonctionnalité liée au format PDF pouvant s&#8217;avérer intéressante : la protection d&#8217;un fichier par un mot de passe, ainsi que la restriction des actions autorisées (extraction de texte, impression, &#8230;).</p>
<p>L&#8217;implémentation va <a href="../?p=27">encore une fois</a> se faire par le biais d&#8217;une action Alfresco, mais utilisera la librairie PDFBox, embarquée par Alfresco.</p>
<p><em><a href="http://www.pdfbox.org/">PDFBox [en]</a> est une librairie Java Open-Source (licence BSD) permettant de travailler avec des fichiers PDF (génération, modification et extraction de contenu). Elle comporte également plusieurs programmes utilisables en ligne de commande.</em><br />
<span id="more-33"></span></p>
<h1>Détails de l&#8217;action</h1>
<p>Pour cette action de protection, il va nous falloir comme paramètres :</p>
<ul>
<li>les mots de passe propriétaire et utilisateur du document,</li>
<li>le détail des actions	autorisées.</li>
</ul>
<p>Dans PDFBox, ce type de protection est représenté par les objets <a href="http://www.pdfbox.org/javadoc/org/pdfbox/pdmodel/encryption/ProtectionPolicy.html"><em>ProtectionPolicy</em></a> (pour la partie authentification) et <a href="http://www.pdfbox.org/javadoc/org/pdfbox/pdmodel/encryption/AccessPermission.html"><em>AccessPermission</em></a> (pour la partie détail); plus précisément nous utiliserons une <a href="http://www.pdfbox.org/javadoc/org/pdfbox/pdmodel/encryption/StandardProtectionPolicy.html"><em>StandardProtectionPolicy</em></a>, une protection par mot de passe (par opposition à la <a href="http://www.pdfbox.org/javadoc/org/pdfbox/pdmodel/encryption/PublicKeyProtectionPolicy.html"><em>PublicKeyProtectionPolicy</em></a>, protection par certificat).</p>
<p>Notre action va donc ouvrir le document PDF, vérifier si il n&#8217;est pas déjà protégé, puis créer la protection à partir des paramètres utilisateurs et enfin l&#8217;appliquer.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">com.atolcd.repo.action.executer</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.File</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.FileNotFoundException</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.FileOutputStream</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.IOException</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.List</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.alfresco.model.ContentModel</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.alfresco.repo.action.ParameterDefinitionImpl</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.alfresco.repo.action.executer.ActionExecuterAbstractBase</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.alfresco.repo.content.MimetypeMap</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.alfresco.service.cmr.action.Action</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.alfresco.service.cmr.action.ParameterDefinition</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.alfresco.service.cmr.dictionary.DataTypeDefinition</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.alfresco.service.cmr.repository.ContentReader</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.alfresco.service.cmr.repository.ContentService</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.alfresco.service.cmr.repository.ContentWriter</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.alfresco.service.cmr.repository.NodeRef</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.alfresco.util.TempFileProvider</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.pdfbox.exceptions.COSVisitorException</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.pdfbox.pdmodel.PDDocument</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.pdfbox.pdmodel.encryption.AccessPermission</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.pdfbox.pdmodel.encryption.BadSecurityHandlerException</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.pdfbox.pdmodel.encryption.StandardProtectionPolicy</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.springframework.beans.factory.InitializingBean</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.springframework.util.Assert</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> PDFProtectActionExecuter <span style="color: #000000; font-weight: bold;">extends</span> ActionExecuterAbstractBase
	<span style="color: #000000; font-weight: bold;">implements</span> InitializingBean <span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">String</span> NAME <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;protect&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #003399;">String</span> PARAM_OWNER_PASSWORD <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;owner_password&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #003399;">String</span> PARAM_USER_PASSWORD <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;user_password&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #003399;">String</span> PARAM_ASSEMBLY <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;assembly&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #003399;">String</span> PARAM_EXTRACT_CONTENT <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;extract_content&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #003399;">String</span> PARAM_EXTRACT_ACCESSIBILITY <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;extract_accessibility&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #003399;">String</span> PARAM_FILLING <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;filling&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #003399;">String</span> PARAM_MODIFY <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;modify&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #003399;">String</span> PARAM_MODIFY_ANNOTATIONS <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;modify_annotations&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #003399;">String</span> PARAM_PRINTING <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;printing&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #003399;">String</span> PARAM_DEGRADED_PRINTING <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;degraded_printing&quot;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">private</span> ContentService contentService<span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> afterPropertiesSet<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">Exception</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">Assert</span>.<span style="color: #006633;">notNull</span><span style="color: #009900;">&#40;</span>contentService<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setContentService<span style="color: #009900;">&#40;</span>ContentService contentService<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">contentService</span> <span style="color: #339933;">=</span> contentService<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    @Override
    <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000066; font-weight: bold;">void</span> executeImpl<span style="color: #009900;">&#40;</span><span style="color: #003399;">Action</span> action, NodeRef actionedUponNodeRef<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	ContentReader reader <span style="color: #339933;">=</span> contentService.<span style="color: #006633;">getReader</span><span style="color: #009900;">&#40;</span>actionedUponNodeRef,
		<span style="color: #003399;">ContentModel</span>.<span style="color: #006633;">PROP_CONTENT</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>MimetypeMap.<span style="color: #006633;">MIMETYPE_PDF</span>.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span>reader.<span style="color: #006633;">getMimetype</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	    PDDocument doc <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span>
	    <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #003399;">File</span> newPdf <span style="color: #339933;">=</span> TempFileProvider.<span style="color: #006633;">createTempFile</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;tmp&quot;</span>, <span style="color: #0000ff;">&quot;protect&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #003399;">FileOutputStream</span> fos <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">FileOutputStream</span><span style="color: #009900;">&#40;</span>newPdf<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		doc <span style="color: #339933;">=</span> PDDocument.<span style="color: #006633;">load</span><span style="color: #009900;">&#40;</span>reader.<span style="color: #006633;">getContentInputStream</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>doc.<span style="color: #006633;">isEncrypted</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		    <span style="color: #003399;">Boolean</span> allowAssembly <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Boolean</span><span style="color: #009900;">&#41;</span> action
			    .<span style="color: #006633;">getParameterValue</span><span style="color: #009900;">&#40;</span>PARAM_ASSEMBLY<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		    <span style="color: #003399;">Boolean</span> allowExtraction <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Boolean</span><span style="color: #009900;">&#41;</span> action
			    .<span style="color: #006633;">getParameterValue</span><span style="color: #009900;">&#40;</span>PARAM_EXTRACT_CONTENT<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		    <span style="color: #003399;">Boolean</span> allowExtractionAccessibility <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Boolean</span><span style="color: #009900;">&#41;</span> action
			    .<span style="color: #006633;">getParameterValue</span><span style="color: #009900;">&#40;</span>PARAM_EXTRACT_ACCESSIBILITY<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		    <span style="color: #003399;">Boolean</span> allowFillingInForm <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Boolean</span><span style="color: #009900;">&#41;</span> action
			    .<span style="color: #006633;">getParameterValue</span><span style="color: #009900;">&#40;</span>PARAM_FILLING<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		    <span style="color: #003399;">Boolean</span> allowModifications <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Boolean</span><span style="color: #009900;">&#41;</span> action
			    .<span style="color: #006633;">getParameterValue</span><span style="color: #009900;">&#40;</span>PARAM_MODIFY<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		    <span style="color: #003399;">Boolean</span> allowAnnotationModification <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Boolean</span><span style="color: #009900;">&#41;</span> action
			    .<span style="color: #006633;">getParameterValue</span><span style="color: #009900;">&#40;</span>PARAM_MODIFY_ANNOTATIONS<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		    <span style="color: #003399;">Boolean</span> allowPrinting <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Boolean</span><span style="color: #009900;">&#41;</span> action
			    .<span style="color: #006633;">getParameterValue</span><span style="color: #009900;">&#40;</span>PARAM_PRINTING<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		    <span style="color: #003399;">Boolean</span> allowDegradedPrinting <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Boolean</span><span style="color: #009900;">&#41;</span> action
			    .<span style="color: #006633;">getParameterValue</span><span style="color: #009900;">&#40;</span>PARAM_DEGRADED_PRINTING<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		    AccessPermission ap <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> AccessPermission<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		    ap
			    .<span style="color: #006633;">setCanAssembleDocument</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>allowAssembly <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span> <span style="color: #339933;">&amp;&amp;</span> allowAssembly
				    .<span style="color: #006633;">booleanValue</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		    ap
			    .<span style="color: #006633;">setCanExtractContent</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>allowExtraction <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span> <span style="color: #339933;">&amp;&amp;</span> allowExtraction
				    .<span style="color: #006633;">booleanValue</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		    ap
			    .<span style="color: #006633;">setCanExtractForAccessibility</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>allowExtractionAccessibility <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span> <span style="color: #339933;">&amp;&amp;</span> allowExtractionAccessibility
				    .<span style="color: #006633;">booleanValue</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		    ap
			    .<span style="color: #006633;">setCanFillInForm</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>allowFillingInForm <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span> <span style="color: #339933;">&amp;&amp;</span> allowFillingInForm
				    .<span style="color: #006633;">booleanValue</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		    ap
			    .<span style="color: #006633;">setCanModify</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>allowModifications <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span> <span style="color: #339933;">&amp;&amp;</span> allowModifications
				    .<span style="color: #006633;">booleanValue</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		    ap
			    .<span style="color: #006633;">setCanModifyAnnotations</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>allowAnnotationModification <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span> <span style="color: #339933;">&amp;&amp;</span> allowAnnotationModification
				    .<span style="color: #006633;">booleanValue</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		    ap.<span style="color: #006633;">setCanPrint</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>allowPrinting <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span> <span style="color: #339933;">&amp;&amp;</span> allowPrinting
			    .<span style="color: #006633;">booleanValue</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		    ap
			    .<span style="color: #006633;">setCanPrintDegraded</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>allowDegradedPrinting <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span> <span style="color: #339933;">&amp;&amp;</span> allowDegradedPrinting
				    .<span style="color: #006633;">booleanValue</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		    StandardProtectionPolicy policy <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> StandardProtectionPolicy<span style="color: #009900;">&#40;</span>
			    <span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#41;</span> action
				    .<span style="color: #006633;">getParameterValue</span><span style="color: #009900;">&#40;</span>PARAM_OWNER_PASSWORD<span style="color: #009900;">&#41;</span>,
			    <span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#41;</span> action
				    .<span style="color: #006633;">getParameterValue</span><span style="color: #009900;">&#40;</span>PARAM_USER_PASSWORD<span style="color: #009900;">&#41;</span>, ap<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		    doc.<span style="color: #006633;">protect</span><span style="color: #009900;">&#40;</span>policy<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		    doc.<span style="color: #006633;">save</span><span style="color: #009900;">&#40;</span>fos<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		    fos.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		    doc.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		    ContentWriter writer <span style="color: #339933;">=</span> contentService.<span style="color: #006633;">getWriter</span><span style="color: #009900;">&#40;</span>
			    actionedUponNodeRef, <span style="color: #003399;">ContentModel</span>.<span style="color: #006633;">PROP_CONTENT</span>,
			    <span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		    writer.<span style="color: #006633;">putContent</span><span style="color: #009900;">&#40;</span>newPdf<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
		    doc.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		    <span style="color: #000000; font-weight: bold;">throw</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">RuntimeException</span><span style="color: #009900;">&#40;</span>
			    <span style="color: #0000ff;">&quot;This document is already encrypted&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	    <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">FileNotFoundException</span> fnfe<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		fnfe.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	    <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span>BadSecurityHandlerException bshe<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		bshe.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	    <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span>COSVisitorException cosve<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		cosve.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	    <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">IOException</span> ioe<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		ioe.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	    <span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    @Override
    <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000066; font-weight: bold;">void</span> addParameterDefinitions<span style="color: #009900;">&#40;</span><span style="color: #003399;">List</span> paramList<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	paramList.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> ParameterDefinitionImpl<span style="color: #009900;">&#40;</span>PARAM_OWNER_PASSWORD,
		DataTypeDefinition.<span style="color: #006633;">TEXT</span>, <span style="color: #000066; font-weight: bold;">true</span>,
		getParamDisplayLabel<span style="color: #009900;">&#40;</span>PARAM_OWNER_PASSWORD<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	paramList.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> ParameterDefinitionImpl<span style="color: #009900;">&#40;</span>PARAM_USER_PASSWORD,
		DataTypeDefinition.<span style="color: #006633;">TEXT</span>, <span style="color: #000066; font-weight: bold;">true</span>,
		getParamDisplayLabel<span style="color: #009900;">&#40;</span>PARAM_USER_PASSWORD<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	paramList.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> ParameterDefinitionImpl<span style="color: #009900;">&#40;</span>PARAM_ASSEMBLY,
		DataTypeDefinition.<span style="color: #006633;">BOOLEAN</span>, <span style="color: #000066; font-weight: bold;">false</span>,
		getParamDisplayLabel<span style="color: #009900;">&#40;</span>PARAM_ASSEMBLY<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	paramList.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> ParameterDefinitionImpl<span style="color: #009900;">&#40;</span>PARAM_EXTRACT_CONTENT,
		DataTypeDefinition.<span style="color: #006633;">BOOLEAN</span>, <span style="color: #000066; font-weight: bold;">false</span>,
		getParamDisplayLabel<span style="color: #009900;">&#40;</span>PARAM_EXTRACT_CONTENT<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	paramList.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> ParameterDefinitionImpl<span style="color: #009900;">&#40;</span>PARAM_EXTRACT_ACCESSIBILITY,
		DataTypeDefinition.<span style="color: #006633;">BOOLEAN</span>, <span style="color: #000066; font-weight: bold;">false</span>,
		getParamDisplayLabel<span style="color: #009900;">&#40;</span>PARAM_EXTRACT_ACCESSIBILITY<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	paramList.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> ParameterDefinitionImpl<span style="color: #009900;">&#40;</span>PARAM_FILLING,
		DataTypeDefinition.<span style="color: #006633;">BOOLEAN</span>, <span style="color: #000066; font-weight: bold;">false</span>,
		getParamDisplayLabel<span style="color: #009900;">&#40;</span>PARAM_FILLING<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	paramList.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> ParameterDefinitionImpl<span style="color: #009900;">&#40;</span>PARAM_MODIFY,
		DataTypeDefinition.<span style="color: #006633;">BOOLEAN</span>, <span style="color: #000066; font-weight: bold;">false</span>,
		getParamDisplayLabel<span style="color: #009900;">&#40;</span>PARAM_MODIFY<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	paramList.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> ParameterDefinitionImpl<span style="color: #009900;">&#40;</span>PARAM_MODIFY_ANNOTATIONS,
		DataTypeDefinition.<span style="color: #006633;">BOOLEAN</span>, <span style="color: #000066; font-weight: bold;">false</span>,
		getParamDisplayLabel<span style="color: #009900;">&#40;</span>PARAM_MODIFY_ANNOTATIONS<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	paramList.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> ParameterDefinitionImpl<span style="color: #009900;">&#40;</span>PARAM_PRINTING,
		DataTypeDefinition.<span style="color: #006633;">BOOLEAN</span>, <span style="color: #000066; font-weight: bold;">false</span>,
		getParamDisplayLabel<span style="color: #009900;">&#40;</span>PARAM_PRINTING<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	paramList.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> ParameterDefinitionImpl<span style="color: #009900;">&#40;</span>PARAM_DEGRADED_PRINTING,
		DataTypeDefinition.<span style="color: #006633;">BOOLEAN</span>, <span style="color: #000066; font-weight: bold;">false</span>,
		getParamDisplayLabel<span style="color: #009900;">&#40;</span>PARAM_DEGRADED_PRINTING<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></div></div>

<h1>Module</h1>
<p>Encore une fois, nous vous proposons <a href="http://blog.atolcd.com/wp-content/pdfprotection.amp">ici</a> l&#8217;action sous la forme d&#8217;un module Alfresco, les sources complètes étant disponibles <a href="http://blog.atolcd.com/wp-content/pdfprotection-sources.zip">ici.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.atolcd.com/?feed=rss2&amp;p=33</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Personnalisation de Pentaho</title>
		<link>http://blog.atolcd.com/?p=78</link>
		<comments>http://blog.atolcd.com/?p=78#comments</comments>
		<pubDate>Thu, 23 Oct 2008 12:07:26 +0000</pubDate>
		<dc:creator>Sylvain Decloix</dc:creator>
				<category><![CDATA[OSBI]]></category>
		<category><![CDATA[pentaho openflashchart traduction]]></category>

		<guid isPermaLink="false">http://blog.atolcd.com/?p=78</guid>
		<description><![CDATA[Dans le cadre d&#8217;un projet Pentaho pour un client du secteur médical, nous avons étendu et amélioré certaines fonctionnalités de base de la plate-forme, notamment en ce qui concerne la partie restitution Web.
Traduction française de la plate-forme
Atol CD a entièrement effectué la traduction de la plate-forme Pentaho 1.7 GA PCI (Pre-configured Installation).

L&#8217;ensemble des fichiers de [...]]]></description>
			<content:encoded><![CDATA[<p>Dans le cadre d&#8217;un projet Pentaho pour un client du secteur médical, nous avons étendu et amélioré certaines fonctionnalités de base de la plate-forme, notamment en ce qui concerne la partie restitution Web.</p>
<h5>Traduction française de la plate-forme</h5>
<p>Atol CD a entièrement effectué la traduction de la plate-forme Pentaho 1.7 GA PCI (Pre-configured Installation).<br />
<span id="more-78"></span><br />
L&#8217;ensemble des fichiers de traduction sont disponibles sur GoogleCode à cette adresse :<br />
<a href="http://code.google.com/p/pentaho-french-translation/" target="_blank">http://code.google.com/p/pentaho-french-translation</a></p>
<p>Un zip complet des fichiers traduits est téléchargeable dans l&#8217;onglet &laquo;&nbsp;Download&nbsp;&raquo;.</p>
<p>Merci à Sébastien, Nicolas et Bénédicte pour leur contribution&#8230; <img src='http://blog.atolcd.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<h5>Amélioration du rendu des Tableaux de bord</h5>
<p>Depuis que nous mettons en place des dashboards et des rapports sur des projets BI avec Pentaho, nous avons souvent été frustrés par l&#8217;aspect graphique rudimentaire et &laquo;&nbsp;old school&nbsp;&raquo; proposé par JFree. <img src='http://blog.atolcd.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p style="text-align: justify;">Bien heureusement, Pentaho est dans le domaine de l&#8217;Open Source, par définition on peut alors assez facilement se proposer d&#8217;enrichir l&#8217;outil.</p>
<p>C&#8217;est donc ce que nous avons décidé de faire en créant une nouvelle couche de restitution plus vivante et conviviale à l&#8217;aide d&#8217;un projet de rendu graphique Open Source: <a href="http://teethgrinder.co.uk/open-flash-chart/" target="_blank"><strong>Open Flash Chart</strong>.</a></p>
<p>Voyons tout d&#8217;abord un exemple de tableau de bord réalisé nativement avec Pentaho (avec JFreeChart donc) :</p>
<p><a href="http://blog.atolcd.com/wp-content/jfree-dahsboard.jpg"><img class="alignnone size-full wp-image-77" title="jfree-dahsboard" src="http://blog.atolcd.com/wp-content/jfree-dahsboard.jpg" alt="" width="702" height="537" /></a></p>
<h5>Développement d&#8217;une couche de restitution web avec Open Flash Chart :</h5>
<p>Puisque Pentaho est une plate-forme OSBI plutôt bien conçue, il est plutôt simple d&#8217;y ajouter un composant personnalisé (un &laquo;&nbsp;plugin&nbsp;&raquo; en quelque sorte&#8230;).</p>
<p style="margin-bottom: 0cm;" align="left">Ainsi, les graphiques OpenFlashChart que nous avons mis en place s&#8217;appellent de la même manière que les graphiques JFreeChart :</p>
<ul>
<li>Un fichier xaction pour ramener les données</li>
</ul>
<ul>
<li>Un fichier xml pour décrire le graphique (le &laquo;&nbsp;widget&nbsp;&raquo;)</li>
</ul>
<ul>
<li>Une page jsp pour l&#8217;affichage du graphique</li>
</ul>
<p>Une nouvelle classe java &laquo;&nbsp;OpenFlashChartHelper&nbsp;&raquo; a été développée afin que les données fournies par l&#8217;xaction puissent être chargées dans les graphes en Flash.</p>
<p>Le code de la page JSP ressemble à ceci :</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #339933;">&lt;%</span>
	        SimpleParameterProvider parameters <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> SimpleParameterProvider<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	        parameters.<span style="color: #006633;">setParameter</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;drill-url&quot;</span>, <span style="color: #0000ff;">&quot;SibDashboardFlash?gir={gir}&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	        parameters.<span style="color: #006633;">setParameter</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;inner-param&quot;</span>, <span style="color: #0000ff;">&quot;gir&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	        parameters.<span style="color: #006633;">setParameter</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;image-width&quot;</span>, <span style="color: #0000ff;">&quot;500&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        	        parameters.<span style="color: #006633;">setParameter</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;image-height&quot;</span>, <span style="color: #0000ff;">&quot;350&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	        <span style="color: #003399;">StringBuffer</span> content <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">StringBuffer</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	        <span style="color: #003399;">ArrayList</span> messages <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">ArrayList</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	        OpenFlashChartHelper.<span style="color: #006633;">doFlashChart</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;samples&quot;</span>, <span style="color: #0000ff;">&quot;formation&quot;</span>,
 		<span style="color: #0000ff;">&quot;synthese_gir.widgetFlash.xml&quot;</span>, parameters,
		content, userSession, messages, <span style="color: #000066; font-weight: bold;">null</span>, <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">%&gt;</span>
		<span style="color: #339933;">&lt;%=</span> content.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">%&gt;</span></pre></div></div>

<p>La seule chose qui change par rapport au code standard de Pentaho appelant JFreeChart est la méthode d&#8217;appel. Ainsi, l&#8217;objet et la méthode appelante est <em>OpenFlashChartHelper.doFlashChart()</em>.</p>
<p>Les attributs de cette méthode sont les mêmes que pour le code de JfreeChart, à part qu&#8217;un nouvel attribut a été ajouté : il s&#8217;agit du numéro de graphe dans la page ( il est utilisé seulement pour différencier les appels à la bibliothèques Flash )</p>
<p>Le widget xml ressemble à ceci :</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>chart<span style="color: #339933;">&gt;</span> 
	 <span style="color: #339933;">&lt;</span>data<span style="color: #339933;">&gt;</span> 
		<span style="color: #339933;">&lt;</span>data<span style="color: #339933;">-</span>solution<span style="color: #339933;">&gt;</span>samples<span style="color: #339933;">&lt;/</span>data<span style="color: #339933;">-</span>solution<span style="color: #339933;">&gt;</span> 
		<span style="color: #339933;">&lt;</span>data<span style="color: #339933;">-</span>path<span style="color: #339933;">&gt;</span>formation<span style="color: #339933;">&lt;/</span>data<span style="color: #339933;">-</span>path<span style="color: #339933;">&gt;</span> 
		<span style="color: #339933;">&lt;</span>data<span style="color: #339933;">-</span>action<span style="color: #339933;">&gt;</span>synthese_gir_data.<span style="color: #006633;">xaction</span><span style="color: #339933;">&lt;/</span>data<span style="color: #339933;">-</span>action<span style="color: #339933;">&gt;</span> 
		<span style="color: #339933;">&lt;</span>data<span style="color: #339933;">-</span>output<span style="color: #339933;">&gt;</span>rule_result<span style="color: #339933;">&lt;/</span>data<span style="color: #339933;">-</span>output<span style="color: #339933;">&gt;</span> 
		<span style="color: #339933;">&lt;</span>data<span style="color: #339933;">-</span>name<span style="color: #339933;">&gt;</span>gir<span style="color: #339933;">&lt;/</span>data<span style="color: #339933;">-</span>name<span style="color: #339933;">&gt;</span> 
		<span style="color: #339933;">&lt;</span>data<span style="color: #339933;">-</span>value<span style="color: #339933;">&gt;</span>nb_patients<span style="color: #339933;">&lt;/</span>data<span style="color: #339933;">-</span>value<span style="color: #339933;">&gt;</span> 
		<span style="color: #339933;">&lt;</span>data<span style="color: #339933;">-</span>orientation<span style="color: #339933;">&gt;</span>columns<span style="color: #339933;">&lt;/</span>data<span style="color: #339933;">-</span>orientation<span style="color: #339933;">&gt;</span> 
	<span style="color: #339933;">&lt;/</span>data<span style="color: #339933;">&gt;</span> 	 
	<span style="color: #339933;">&lt;!--</span> <span style="color: #cc66cc;">1</span> ou <span style="color: #cc66cc;">2</span> suivant la version de OFC utilisé <span style="color: #339933;">--&gt;</span> 
	<span style="color: #339933;">&lt;</span>OFC<span style="color: #339933;">-</span>render<span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">&lt;/</span>OFC<span style="color: #339933;">-</span>render<span style="color: #339933;">&gt;</span> 
	<span style="color: #339933;">&lt;</span>width<span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">500</span><span style="color: #339933;">&lt;/</span>width<span style="color: #339933;">&gt;</span> 
	<span style="color: #339933;">&lt;</span>height<span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">400</span><span style="color: #339933;">&lt;/</span>height<span style="color: #339933;">&gt;</span> 
	<span style="color: #339933;">&lt;</span>title<span style="color: #339933;">&gt;</span> 
		<span style="color: #339933;">&lt;</span>text<span style="color: #339933;">&gt;</span>Nombre de patients par code GIR<span style="color: #339933;">&lt;/</span>text<span style="color: #339933;">&gt;</span> 
		<span style="color: #339933;">&lt;</span>style<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#123;</span>font<span style="color: #339933;">-</span>size<span style="color: #339933;">:</span> 20px<span style="color: #339933;">;</span> color<span style="color: #339933;">:</span>#736AFF<span style="color: #009900;">&#125;</span><span style="color: #339933;">&lt;/</span>style<span style="color: #339933;">&gt;</span> 
	<span style="color: #339933;">&lt;/</span>title<span style="color: #339933;">&gt;</span> 
	<span style="color: #339933;">&lt;</span>bg<span style="color: #339933;">-</span>colour<span style="color: #339933;">&gt;</span>#C548D1<span style="color: #339933;">&lt;/</span>bg<span style="color: #339933;">-</span>colour<span style="color: #339933;">&gt;</span> 
	<span style="color: #339933;">&lt;</span>elements<span style="color: #339933;">&gt;</span> 
		<span style="color: #339933;">&lt;</span>element<span style="color: #339933;">&gt;</span> <span style="color: #339933;">&lt;!--</span> autre exemple de pie chart <span style="color: #339933;">--&gt;</span> 
			<span style="color: #339933;">&lt;</span>type<span style="color: #339933;">&gt;</span>pie<span style="color: #339933;">&lt;/</span>type<span style="color: #339933;">&gt;</span> 
	  		<span style="color: #339933;">&lt;</span>colours<span style="color: #339933;">&gt;</span> 
				<span style="color: #339933;">&lt;</span>colour<span style="color: #339933;">&gt;</span>#d01f3c<span style="color: #339933;">&lt;/</span>colour<span style="color: #339933;">&gt;</span> 
				<span style="color: #339933;">&lt;</span>colour<span style="color: #339933;">&gt;</span>#356aa0<span style="color: #339933;">&lt;/</span>colour<span style="color: #339933;">&gt;</span> 
				<span style="color: #339933;">&lt;</span>colour<span style="color: #339933;">&gt;</span>#C79810<span style="color: #339933;">&lt;/</span>colour<span style="color: #339933;">&gt;</span> 
				<span style="color: #339933;">&lt;</span>colour<span style="color: #339933;">&gt;</span>#65a111<span style="color: #339933;">&lt;/</span>colour<span style="color: #339933;">&gt;</span> 
				<span style="color: #339933;">&lt;</span>colour<span style="color: #339933;">&gt;</span>#f121f1<span style="color: #339933;">&lt;/</span>colour<span style="color: #339933;">&gt;</span> 
			<span style="color: #339933;">&lt;/</span>colours<span style="color: #339933;">&gt;</span> 
			<span style="color: #339933;">&lt;</span>alpha<span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">50</span><span style="color: #339933;">&lt;/</span>alpha<span style="color: #339933;">&gt;</span> 
			<span style="color: #339933;">&lt;</span>border<span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">2</span><span style="color: #339933;">&lt;/</span>border<span style="color: #339933;">&gt;</span> 
			<span style="color: #339933;">&lt;</span>animate<span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">&lt;/</span>animate<span style="color: #339933;">&gt;</span> 
			<span style="color: #339933;">&lt;</span>start<span style="color: #339933;">-</span>angle<span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">45</span><span style="color: #339933;">&lt;/</span>start<span style="color: #339933;">-</span>angle<span style="color: #339933;">&gt;</span> 
			<span style="color: #339933;">&lt;</span>tip<span style="color: #339933;">&gt;</span>GIR<span style="color: #339933;">=%</span>23x_label<span style="color: #339933;">%</span>23<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>br<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;%</span>23val<span style="color: #339933;">%</span>23<span style="color: #339933;">&lt;/</span>tip<span style="color: #339933;">&gt;</span> 
			<span style="color: #339933;">&lt;</span>gradient<span style="color: #339933;">-</span>fill<span style="color: #339933;">&gt;</span>true<span style="color: #339933;">&lt;/</span>gradient<span style="color: #339933;">-</span>fill<span style="color: #339933;">&gt;</span> 
			<span style="color: #339933;">&lt;</span>label<span style="color: #339933;">-</span>colour<span style="color: #339933;">&gt;</span>#0000d0<span style="color: #339933;">&lt;/</span>label<span style="color: #339933;">-</span>colour<span style="color: #339933;">&gt;</span> 
			<span style="color: #339933;">&lt;</span>dynamic<span style="color: #339933;">-</span>tips<span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">&lt;/</span>dynamic<span style="color: #339933;">-</span>tips<span style="color: #339933;">&gt;</span> 
			<span style="color: #339933;">&lt;</span>dynamic<span style="color: #339933;">-</span>links<span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">&lt;/</span>dynamic<span style="color: #339933;">-</span>links<span style="color: #339933;">&gt;</span> 
		<span style="color: #339933;">&lt;/</span>element<span style="color: #339933;">&gt;</span> 
	<span style="color: #339933;">&lt;/</span>elements<span style="color: #339933;">&gt;</span> 
<span style="color: #339933;">&lt;/</span>chart<span style="color: #339933;">&gt;</span></pre></div></div>

<p>Au final, le tableau de bord en Open Flash Chart ressemble à ça :</p>
<p><a href="http://blog.atolcd.com/wp-content/ofc-dahsboard.jpg"><img class="alignnone size-full wp-image-80" title="ofc-dahsboard" src="http://blog.atolcd.com/wp-content/ofc-dahsboard.jpg" alt="" width="650" height="497" /></a></p>
<p>Comme souvent les vidéos sont plus parlantes que des copies d&#8217;écrans.</p>
<p><strong>Voici donc celle du dashboard Pentaho natif (Jfree) :</strong></p>
<div><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="520" height="383" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="src" value="http://www.dailymotion.com/swf/k7sxgzxFkjdgruOu8N&amp;related=1" /><embed type="application/x-shockwave-flash" width="520" height="383" src="http://www.dailymotion.com/swf/k7sxgzxFkjdgruOu8N&amp;related=1" allowscriptaccess="always" allowfullscreen="true"></embed></object><br />
<strong><a href="http://www.dailymotion.com/video/x75w5l_dashboard-pentaho-jfree-atol-cd_tech">Dashboard Pentaho JFree (Atol CD)</a></strong><br />
<em>envoyé par <a href="http://www.dailymotion.com/sdecloix">sdecloix</a></em></div>
<p><strong>Et celle avec le dahsboard Open Flash Chart made by atolcd :</strong></p>
<div><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="520" height="381" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="src" value="http://www.dailymotion.com/swf/k7aklg67o3hxKcOu9s&amp;related=1" /><embed type="application/x-shockwave-flash" width="520" height="381" src="http://www.dailymotion.com/swf/k7aklg67o3hxKcOu9s&amp;related=1" allowscriptaccess="always" allowfullscreen="true"></embed></object><br />
<strong><a href="http://www.dailymotion.com/video/x75w6q_dashboard-pentaho-open-flash-chart_tech">Dashboard Pentaho Open Flash Chart (Atol CD)</a></strong><br />
<em>envoyé par <a href="http://www.dailymotion.com/sdecloix">sdecloix</a></em></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.atolcd.com/?feed=rss2&amp;p=78</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Atol, nouveau spot de Surf !</title>
		<link>http://blog.atolcd.com/?p=26</link>
		<comments>http://blog.atolcd.com/?p=26#comments</comments>
		<pubDate>Wed, 22 Oct 2008 13:02:15 +0000</pubDate>
		<dc:creator>Thomas Broyer</dc:creator>
				<category><![CDATA[ECM]]></category>
		<category><![CDATA[alfresco]]></category>
		<category><![CDATA[développement]]></category>
		<category><![CDATA[ged]]></category>
		<category><![CDATA[geide]]></category>
		<category><![CDATA[mvc]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://blog.atolcd.com/?p=26</guid>
		<description><![CDATA[Mercredi dernier (15 octobre), j&#8217;étais à Munich pour apprendre à surfer !
Le cours était donné par la crème d&#8217;Alfresco : Michael &#171;&#160;Uzi&#160;&#187; Uzquiano (Director of WCM Products), soutenu par David &#171;&#160;davidc&#160;&#187; Caruana (Chief Architect) et Mike Farman (Director of ECM Products) ; et organisé par Nancy Garrity (Community Manager) en marge de la European Community [...]]]></description>
			<content:encoded><![CDATA[<p><em>Mercredi dernier (15 octobre), j&#8217;étais à Munich pour apprendre à <a title="Surf Platform" href="http://wiki.alfresco.com/wiki/Surf_Platform">surfer</a> !</em></p>
<p>Le cours était donné par la crème d&#8217;Alfresco : <a title="Uzi's Blog" href="http://blogs.alfresco.com/wp/uzi/">Michael &laquo;&nbsp;Uzi&nbsp;&raquo; Uzquiano</a> (Director of WCM Products), soutenu par <a title="Dave's Alfresco Chatter" href="http://blogs.alfresco.com/wp/davidc/">David &laquo;&nbsp;davidc&nbsp;&raquo; Caruana</a> (Chief Architect) et Mike Farman (Director of ECM Products) ; et organisé par <a title="Alfresco Community News" href="http://blogs.alfresco.com/wp/nancy/">Nancy Garrity</a> (Community Manager) en marge de la <a title="Alfresco Events - Alfresco European Community Conference" href="http://www.alfresco.com/about/events/2008/10/cc-emea-1008/">European Community Conference</a>.</p>
<h5>Architecture</h5>
<p>Tout d&#8217;abord et contrairement à ce que je disais <a title="MVC Web" href="http://blog.atolcd.com/?p=24">en mai dernier</a>, Surf n&#8217;est pas une évolution des Web Scripts, mais une plate-forme de développement Web à part entière, qui tire parti des Web Scripts, mais pas uniquement (et pas même forcément). Au final, une application Surf reste globalement un ensemble de fichiers XML.<br />
<span id="more-26"></span><br />
La plate-forme Surf est orientée <em>page</em>, <em>composant</em> et <em>contenu</em>, ce contenu pouvant provenir d&#8217;où bon vous semble : un entrepôt documentaire Alfresco bien entendu, mais là encore pas uniquement ni forcément (<a href="http://network.alfresco.com">Alfresco Network</a> par exemple est une application Surf qui n&#8217;utilise pas du tout Alfresco).</p>
<p>La notion de <em>contenu</em> ici est également particulière dans le sens où du contenu peut être fourni par les pages et les composants eux-même. Disons pour simplifier qu&#8217;un <em>contenu</em> provient d&#8217;une source de données externe à l&#8217;application. Oui oui, j&#8217;ai bien dit <em>externe</em> : une application Surf utilisant Alfresco –probablement le cas le plus courant– n&#8217;est pas tenue d&#8217;être déployée sur la même machine que l&#8217;entrepôt Alfresco, il y accède par des requêtes HTTP sur les Web Scripts mis à disposition et qui donnent accès à toutes les APIs disponibles en Java (ou presque), à savoir la gestion des utilisateurs, des catégories, des droits d&#8217;accès, des documents et espaces, etc. Et contrairement à ce qu&#8217;on pourrait croire, cette architecture a permis d&#8217;améliorer les performances de l&#8217;ensemble en forçant les développeurs à limiter le nombre de requêtes effectuées, et donc le nombre d&#8217;accès à la base de données et au file-system (et pour ceux qui testeraient l&#8217;application Share dans une Labs 3B, sachez que la version 3.0 Entreprise est quasi-identique en fonctionnalités mais avec de bien meilleures performances).</p>
<p>Les échanges avec les fournisseurs de contenus et/ou de services (<em>endpoints</em>) s&#8217;effectue au travers de <em>connecteurs</em> qui gèrent les interactions (HTTP, JDBC, SOAP, etc.) ainsi que le mode d&#8217;authentification (délégué à des <em>authentifieurs</em>). Des <em>credential vaults</em> s&#8217;occupent de gérer les différentes identités de l&#8217;utilisateur selon l&#8217;<em>endpoint</em> contacté, faisant office de Single-Sign On. Ainsi, même si ce n&#8217;est pas tout à fait opérationnel au moment où j&#8217;écris, Alfresco Network sert de point d&#8217;entrée unique, à authentification unique, pour les différentes applications d&#8217;Alfresco : forums, JIRA, support technique, wiki, etc.</p>
<h5>Fonctionnement</h5>
<p>Basiquement, dans Surf, une URL identifie une <em>page</em>, un <em>type de page</em> ou un <em>contenu</em>. Un <em>type de page</em> se résoud en une <em>page</em> selon le <em>theme</em> courant (par exemple, une page d&#8217;édition du profil utilisateur pourra être différente selon que l&#8217;utilisateur est un employé, un fournisseur ou un client). De même, un <em>contenu</em> se résoud en une <em>page</em> selon son <em>type</em> et les <em>content associations</em> (pour un contenu Alfresco, son type Alfresco : <code>cm:content</code>, <code>cm:folder</code>, etc. ce qui fait tout de suite penser au <a title="Dispatch Mechanism" href="http://wiki.alfresco.com/wiki/Dispatch_Mechanism">mécanisme de dispatch</a> déjà présent dans le client JSF).</p>
<p>Nous avons donc une <em>page</em>. Celle-ci indique un niveau d&#8217;authentification requis (même principe que pour les Web Scripts) et référence un <em>template instance</em>. Ce <em>template instance</em> se contente la plupart du temps de donner le nom d&#8217;un <em>template</em> FreeMarker, dans lequel des directives particulières pourront être utilisées pour définir des <em>régions</em> dans lesquels viendront se loger les <em>composants</em>. Le rôle d&#8217;un <em>template instance</em> et de son <em>template</em> est de définir une présentation globale de la page (<em>layout</em>) et d&#8217;assembler des <em>composants</em>.</p>
<p>Chaque <em>région</em> est nommée et a une <em>portée</em> (globale, <em>template instance</em> ou <em>page</em>). C&#8217;est grâce à ces deux propriétés, complétées le cas échéant du nom du <em>template instance</em> ou de la <em>page</em>, que sont définis les <em>component bindings</em>, à savoir la configuration déterminant quel <em>composant</em> viendra se loger dans chaque <em>région</em>.</p>
<p>Le <em>composant</em> est la pièce maîtresse d&#8217;une application Surf, et correspond la plupart du temps simplement à un Web Script. L&#8217;<a title="Surf Platform - Freemarker Template and JavaScript API" href="http://wiki.alfresco.com/wiki/Surf_Platform_-_Freemarker_Template_and_JavaScript_API">API disponible</a> pour ces Web Scripts est bien évidemment différente de celle des Web Scripts côté entrepôt Alfresco, et pour une fois est unifiée entre JavaScript et FreeMarker (et même Java d&#8217;ailleurs ; on parlera donc plutôt d&#8217;API Surf).</p>
<p>Enfin, il faut ajouter à cela les <em>associations de pages</em> qui permettent de définir de façon centralisée les liens entre les différentes pages de l&#8217;application (on construira donc les menus de navigation et autres &laquo;&nbsp;plan du site&nbsp;&raquo; de façon dynamique à partir de ces informations), les composants de <em>chrome</em> qui peuvent s&#8217;intercaler entre le <em>template</em> et le <em>composant</em> pour générer du code HTML complémentaire, à des fins de mise en forme principalement (dans un esprit de &laquo;&nbsp;thème graphique&nbsp;&raquo; donc), et les éléments de <em>configuration</em>, définissables à différents niveaux (global, composant, Web Script) et accessible par l&#8217;API Surf.</p>
<p>Tout ceci sans oublier les fonctionnalités nouvelles ou améliorées de dispatch sur URL (avec <em>placeholders</em> accessibles par l&#8217;API Surf, contrairement aux Web Scripts 2.1/2.2), internationalisation / régionalisation (I18N / L10N), négociation de contenu (voire de langue), le JavaScript d&#8217;un Web Script peut être différent selon le type de données envoyé par le client (pour les requêtes POST et PUT) avec en sus accès direct à ces données, éventuellement pré-parsées (cas de JSON ou XML par exemple), etc. et la possibilité de remplacer chaque composante du système : créateur de liens, <em>page mapper</em>, fabrique d&#8217;utilisateurs, etc.</p>
<p>Ah, j&#8217;oubliais encore : une application Surf étant un ensemble de fichiers XML, ils peuvent également être stockés dans un Alfresco, et plus particulièrement dans les AVM de WCM. Et Alfresco nous prépare un &laquo;&nbsp;studio&nbsp;&raquo; d&#8217;édition de sites WCM &laquo;&nbsp;à la volée&nbsp;&raquo; pour la version 3.1, ça promet !</p>
<h5>Le mot de la fin</h5>
<p>Et pour résumer tout ça, disons tout simplement que Surf est la brique qui nous manquait pour faciliter le développement d&#8217;applications métier gérant des documents : parapheur électronique, gestion de courrier, etc.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.atolcd.com/?feed=rss2&amp;p=26</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
