Coverage Report - org.apache.tiles.freemarker.template.DefinitionFMModel
 
Classes in this File Line Coverage Branch Coverage Complexity
DefinitionFMModel
30%
3/10
0%
0/2
1.5
 
 1  
 /*
 2  
  * This file was automatically generated by Apache Tiles Autotag.
 3  
  */
 4  
 package org.apache.tiles.freemarker.template;
 5  
 
 6  
 import java.io.IOException;
 7  
 import java.util.Map;
 8  
 
 9  
 import org.apache.tiles.autotag.core.runtime.ModelBody;
 10  
 import org.apache.tiles.autotag.core.runtime.AutotagRuntime;
 11  
 
 12  
 import freemarker.core.Environment;
 13  
 import freemarker.template.TemplateDirectiveBody;
 14  
 import freemarker.template.TemplateDirectiveModel;
 15  
 import freemarker.template.TemplateException;
 16  
 import freemarker.template.TemplateModel;
 17  
 
 18  
 /**
 19  
  * <p>
 20  
  * <strong>Create a definition at runtime. </strong>
 21  
  * </p>
 22  
  * <p>
 23  
  * Create a new definition at runtime. Newly created definition will be
 24  
  * available across the entire request.
 25  
  * </p>
 26  
  */
 27  
 public class DefinitionFMModel implements TemplateDirectiveModel {
 28  
 
 29  
     /**
 30  
      * The template model.
 31  
      */
 32  
     private org.apache.tiles.template.DefinitionModel model;
 33  
 
 34  
     /**
 35  
      * Constructor.
 36  
      *
 37  
      * @param model
 38  
      *            The template model.
 39  
      */
 40  1
     public DefinitionFMModel(org.apache.tiles.template.DefinitionModel model) {
 41  1
         this.model = model;
 42  1
     }
 43  
 
 44  
     /** {@inheritDoc} */
 45  
     @SuppressWarnings("unchecked")
 46  
     @Override
 47  
     public void execute(Environment env, @SuppressWarnings("rawtypes") Map params, TemplateModel[] loopVars,
 48  
             TemplateDirectiveBody body) throws TemplateException, IOException {
 49  0
         AutotagRuntime<org.apache.tiles.request.Request> runtime = new org.apache.tiles.request.freemarker.autotag.FreemarkerAutotagRuntime();
 50  0
         if (runtime instanceof TemplateDirectiveModel) {
 51  0
             ((TemplateDirectiveModel) runtime).execute(env, params, loopVars, body);
 52  
         }
 53  0
         org.apache.tiles.request.Request request = runtime.createRequest();
 54  0
         ModelBody modelBody = runtime.createModelBody();
 55  0
         model.execute(
 56  
             runtime.getParameter("name", java.lang.String.class, null),
 57  
             runtime.getParameter("template", java.lang.String.class, null),
 58  
             runtime.getParameter("role", java.lang.String.class, null),
 59  
             runtime.getParameter("extends", java.lang.String.class, null),
 60  
             runtime.getParameter("preparer", java.lang.String.class, null),
 61  
                 request, modelBody
 62  
         );
 63  0
     }
 64  
 }