Author: buildbot
Date: Fri Mar  6 12:41:28 2015
New Revision: 942581

Log:
Staging update by buildbot for sling

Modified:
    websites/staging/sling/trunk/content/   (props changed)
    websites/staging/sling/trunk/content/documentation/bundles/validation.html

Propchange: websites/staging/sling/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Fri Mar  6 12:41:28 2015
@@ -1 +1 @@
-1664257
+1664603

Modified: 
websites/staging/sling/trunk/content/documentation/bundles/validation.html
==============================================================================
--- websites/staging/sling/trunk/content/documentation/bundles/validation.html 
(original)
+++ websites/staging/sling/trunk/content/documentation/bundles/validation.html 
Fri Mar  6 12:41:28 2015
@@ -124,6 +124,21 @@ This documentation is still work in prog
 </pre></div>
 
 
+<p>Apart from that it is also possible to validate resources including all 
child resources having their own validation model (i.e. a merged view of the 
validation models is applied). The appropriate validation model is being looked 
up by getting the resource type for each node. Since by default the JCR will 
return the primary type in case there is no <code>sling:resourceType</code> 
property found on the node, either the 2nd parameter 
<code>enforceValidation</code> should be set to <code>false</code> or some 
resource types must be explicitly ignored to also properly support validation 
models which have children on its own.</p>
+<div class="codehilite"><pre><span class="k">try</span> <span 
class="o">{</span>
+    <span class="n">ValidationResult</span> <span class="n">result</span> 
<span class="o">=</span> <span class="n">validationService</span><span 
class="o">.</span><span 
class="na">validateAllResourceTypesInResource</span><span 
class="o">(</span><span class="n">resource</span><span class="o">,</span> <span 
class="kc">false</span><span class="o">,</span> <span 
class="kc">null</span><span class="o">);</span>
+    <span class="k">if</span> <span class="o">(!</span><span 
class="n">result</span><span class="o">.</span><span 
class="na">isValid</span><span class="o">())</span> <span class="o">{</span>
+        <span class="c1">// give out validation messages from result.get</span>
+    <span class="o">}</span>
+
+<span class="o">}</span> <span class="k">catch</span> <span 
class="o">(</span><span class="n">IllegalStateException</span> <span 
class="n">e</span><span class="o">)</span> <span class="o">{</span>
+    <span class="c1">// give out error message that an invalid validation 
model for at least one sub resource was found</span>
+<span class="o">}</span> <span class="k">catch</span> <span 
class="o">(</span><span class="n">IllegalArgumentException</span> <span 
class="n">e</span><span class="o">)</span> <span class="o">{</span>
+    <span class="c1">// one of the resource types is absolute or there was no 
validation model found for at least one sub resource</span>
+<span class="o">}</span>
+</pre></div>
+
+
 <h1 id="validation-model-resources">Validation Model Resources</h1>
 <p>The <code>ValidationModel</code> is constructed from resources with the 
resourceType <strong>sling/validation/model</strong>. Those resources are 
considered validation model resources if they are located</p>
 <ul>
@@ -276,7 +291,7 @@ That interface defines the method <code>
 <li><a 
href="http://www.slideshare.net/raducotescu/apache-sling-generic-validation-framework";>Apache
 Sling Generic Validation Framework, adaptTo 2014</a></li>
 </ol>
       <div class="timestamp" style="margin-top: 30px; font-size: 80%; 
text-align: right;">
-        Rev. 1651749 by kwin on Wed, 14 Jan 2015 17:49:41 +0000
+        Rev. 1664603 by kwin on Fri, 6 Mar 2015 12:41:15 +0000
       </div>
       <div class="trademarkFooter"> 
         Apache Sling, Sling, Apache, the Apache feather logo, and the Apache 
Sling project


Reply via email to