Coverage Report - org.apache.tiles.freemarker.template.AddAttributeFMModel
 
Classes in this File Line Coverage Branch Coverage Complexity
AddAttributeFMModel
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>Add an element to the surrounding list. Equivalent to 'putAttribute',
 21  
  * but for list element.</strong>
 22  
  * </p>
 23  
  * 
 24  
  * <p>
 25  
  * Add an element to the surrounding list. This tag can only be used inside
 26  
  * 'putListAttribute' or 'addListAttribute' tags. Value can come from a direct
 27  
  * assignment (value="aValue")
 28  
  * </p>
 29  
  */
 30  
 public class AddAttributeFMModel implements TemplateDirectiveModel {
 31  
 
 32  
     /**
 33  
      * The template model.
 34  
      */
 35  
     private org.apache.tiles.template.AddAttributeModel model;
 36  
 
 37  
     /**
 38  
      * Constructor.
 39  
      *
 40  
      * @param model
 41  
      *            The template model.
 42  
      */
 43  1
     public AddAttributeFMModel(org.apache.tiles.template.AddAttributeModel model) {
 44  1
         this.model = model;
 45  1
     }
 46  
 
 47  
     /** {@inheritDoc} */
 48  
     @SuppressWarnings("unchecked")
 49  
     @Override
 50  
     public void execute(Environment env, @SuppressWarnings("rawtypes") Map params, TemplateModel[] loopVars,
 51  
             TemplateDirectiveBody body) throws TemplateException, IOException {
 52  0
         AutotagRuntime<org.apache.tiles.request.Request> runtime = new org.apache.tiles.request.freemarker.autotag.FreemarkerAutotagRuntime();
 53  0
         if (runtime instanceof TemplateDirectiveModel) {
 54  0
             ((TemplateDirectiveModel) runtime).execute(env, params, loopVars, body);
 55  
         }
 56  0
         org.apache.tiles.request.Request request = runtime.createRequest();
 57  0
         ModelBody modelBody = runtime.createModelBody();
 58  0
         model.execute(
 59  
             runtime.getParameter("value", java.lang.Object.class, null),
 60  
             runtime.getParameter("expression", java.lang.String.class, null),
 61  
             runtime.getParameter("role", java.lang.String.class, null),
 62  
             runtime.getParameter("type", java.lang.String.class, null),
 63  
                 request, modelBody
 64  
         );
 65  0
     }
 66  
 }