Coverage Report - org.apache.tiles.velocity.template.DefinitionDirective
 
Classes in this File Line Coverage Branch Coverage Complexity
DefinitionDirective
0%
0/11
0%
0/2
1.333
 
 1  
 /*
 2  
  * This file was automatically generated by Apache Tiles Autotag.
 3  
  */
 4  
 package org.apache.tiles.velocity.template;
 5  
 
 6  
 import java.io.IOException;
 7  
 import java.io.Writer;
 8  
 
 9  
 import org.apache.tiles.autotag.core.runtime.ModelBody;
 10  
 import org.apache.tiles.autotag.core.runtime.AutotagRuntime;
 11  
 import org.apache.velocity.context.InternalContextAdapter;
 12  
 import org.apache.velocity.runtime.directive.Directive;
 13  
 import org.apache.velocity.runtime.parser.node.Node;
 14  
 
 15  
 /**
 16  
  * <p>
 17  
  * <strong>Create a definition at runtime. </strong>
 18  
  * </p>
 19  
  * <p>
 20  
  * Create a new definition at runtime. Newly created definition will be
 21  
  * available across the entire request.
 22  
  * </p>
 23  
  */
 24  0
 public class DefinitionDirective extends Directive {
 25  
 
 26  
     /**
 27  
      * The template model.
 28  
      */
 29  0
     private org.apache.tiles.template.DefinitionModel model = new org.apache.tiles.template.DefinitionModel();
 30  
 
 31  
     /** {@inheritDoc} */
 32  
     @Override
 33  
     public String getName() {
 34  0
         return "tiles_definition";
 35  
     }
 36  
 
 37  
     /** {@inheritDoc} */
 38  
     @Override
 39  
     public int getType() {
 40  0
         return BLOCK;
 41  
     }
 42  
 
 43  
     /** {@inheritDoc} */
 44  
     @Override
 45  
     public boolean render(InternalContextAdapter context, Writer writer, Node node)
 46  
             throws IOException {
 47  0
         AutotagRuntime<org.apache.tiles.request.Request> runtime = new org.apache.tiles.request.velocity.autotag.VelocityAutotagRuntime();
 48  0
         if (runtime instanceof Directive) {
 49  0
             ((Directive) runtime).render(context, writer, node);
 50  
         }
 51  0
         org.apache.tiles.request.Request request = runtime.createRequest();
 52  0
         ModelBody modelBody = runtime.createModelBody();
 53  0
         model.execute(
 54  
             runtime.getParameter("name", java.lang.String.class, null),
 55  
             runtime.getParameter("template", java.lang.String.class, null),
 56  
             runtime.getParameter("role", java.lang.String.class, null),
 57  
             runtime.getParameter("extends", java.lang.String.class, null),
 58  
             runtime.getParameter("preparer", java.lang.String.class, null),
 59  
             request, modelBody
 60  
         );
 61  0
         return true;
 62  
     }
 63  
 }