public void generatePropertiesClass(PropertiesClass propertiesClass, Writer out)
     throws IOException, TemplateException {
   Template template = cfg.getTemplate("properties_class.ftl");
   Environment env = template.createProcessingEnvironment(propertiesClass, out);
   env.setOutputEncoding(outputCharset);
   env.process();
 }
  @SuppressWarnings("unchecked")
  public void execute(
      Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body)
      throws TemplateException, IOException {
    CmsSite site = FrontUtils.getSite(env);
    List<ContentTag> list = contentTagMng.getListForTag(FrontUtils.getCount(params));

    Map<String, TemplateModel> paramWrap = new HashMap<String, TemplateModel>(params);
    paramWrap.put(OUT_LIST, DEFAULT_WRAPPER.wrap(list));
    Map<String, TemplateModel> origMap = DirectiveUtils.addParamsToVariable(env, paramWrap);
    InvokeType type = DirectiveUtils.getInvokeType(params);
    String listStyle = DirectiveUtils.getString(PARAM_STYLE_LIST, params);
    if (InvokeType.sysDefined == type) {
      if (StringUtils.isBlank(listStyle)) {
        throw new ParamsRequiredException(PARAM_STYLE_LIST);
      }
      env.include(TPL_STYLE_LIST + listStyle + TPL_SUFFIX, UTF8, true);
    } else if (InvokeType.userDefined == type) {
      if (StringUtils.isBlank(listStyle)) {
        throw new ParamsRequiredException(PARAM_STYLE_LIST);
      }
      FrontUtils.includeTpl(TPL_STYLE_LIST, site, env);
    } else if (InvokeType.custom == type) {
      FrontUtils.includeTpl(TPL_NAME, site, params, env);
    } else if (InvokeType.body == type) {
      body.render(env.getOut());
    } else {
      throw new RuntimeException("invoke type not handled: " + type);
    }
    DirectiveUtils.removeParamsFromVariable(env, paramWrap, origMap);
  }
Example #3
0
  /**
   * método que permite generar fichero de metadatos en carpeta separada comprueba si el fichero
   * manifest tiene un lomes integrado o un metadato externo. si el ODE no tiene metadatos.. no
   * genera nada
   */
  private void obtenerLOMES(String lomFileName) throws Exception {
    FileOutputStream fo = null;
    FileInputStream fin = null;
    Writer out = null;
    File lomes = null;
    Template template;
    try {
      if (pathLomesExterno != null) {
        lomes = new File(dirDestino + File.separator + lomFileName);
        if (!lomes.exists()) lomes.createNewFile();
      }

      if (pathLomesExterno != null && pathLomesExterno.equals("")) {
        // tiene lomes y no es un fichero externo adlcp:location
        template = cfg.getTemplate("lomes.ftl");
        cfg.setDefaultEncoding("UTF-8");
        fo = new FileOutputStream(lomes);
        out = new OutputStreamWriter(fo, "UTF-8");
        Environment env = template.createProcessingEnvironment(root, out);
        env.setOutputEncoding("UTF-8");
        env.process();

        out.flush();

      } else if (pathLomesExterno != null
          && !pathLomesExterno.equals(
              "")) { // fichero externo.. por lo que solamente lo copio al destino
        File origen = new File(pathOde + "/" + pathLomesExterno);
        fin = new FileInputStream(origen);
        fo = new FileOutputStream(lomes);
        int c;
        while ((c = fin.read()) >= 0) {
          fo.write(c);
        }
        fin.close();
        fo.close();
        origen = null;
      }
    } catch (Exception e) {
      if (logger.isDebugEnabled()) {
        logger.debug("Error en GeneradorHTML:obtenerLOMES .. " + e.getMessage());
      }
      throw e;
    } finally {
      lomes = null;
      if (fo != null) {
        try {
          fo.close();
        } catch (IOException e) {
        }
      }
      if (fin != null) {
        try {
          fin.close();
        } catch (IOException e) {
        }
      }
    }
  }
Example #4
0
 /**
  * Like {@link #process(Object, Writer)}, but also sets a (XML-)node to be recursively processed
  * by the template. That node is accessed in the template with <tt>.node</tt>, <tt>#recurse</tt>,
  * etc. See the <a href="http://freemarker.org/docs/xgui_declarative.html"
  * target="_blank">Declarative XML Processing</a> as a typical example of recursive node
  * processing.
  *
  * @param rootNode The root node for recursive processing or {@code null}.
  * @throws TemplateException if an exception occurs during template processing
  * @throws IOException if an I/O exception occurs during writing to the writer.
  */
 public void process(
     Object dataModel, Writer out, ObjectWrapper wrapper, TemplateNodeModel rootNode)
     throws TemplateException, IOException {
   Environment env = createProcessingEnvironment(dataModel, out, wrapper);
   if (rootNode != null) {
     env.setCurrentVisitorNode(rootNode);
   }
   env.process();
 }
Example #5
0
 /**
  * 设置变量
  *
  * @param name 名称
  * @param value 变量值
  * @param env Environment
  */
 public static void setVariable(String name, Object value, Environment env)
     throws TemplateException {
   Assert.hasText(name);
   Assert.notNull(env);
   if (value instanceof TemplateModel) {
     env.setVariable(name, (TemplateModel) value);
   } else {
     env.setVariable(name, ObjectWrapper.BEANS_WRAPPER.wrap(value));
   }
 }
Example #6
0
 private void executeMacro(Appendable writer, String macro) throws IOException, TemplateException {
   Environment environment = getEnvironment(writer);
   Reader templateReader = new StringReader(macro);
   macroCount++;
   String templateName = toString().concat("_") + macroCount;
   Template template =
       new Template(templateName, templateReader, FreeMarkerWorker.getDefaultOfbizConfig());
   templateReader.close();
   environment.include(template);
 }
Example #7
0
  @SuppressWarnings("rawtypes")
  public void execute(
      Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body)
      throws TemplateException, IOException {

    String name = DirectiveUtils.getRequiredParam(params, "name");
    String encoding = DirectiveUtils.getParam(params, "encoding", null);
    String includeTemplateName = env.toFullTemplateName(getTemplatePath(env), name);
    env.include(includeTemplateName, encoding, true);
  }
 @Override
 public void render(Writer out) throws TemplateException, IOException {
   if (body == null) return;
   TemplateDirectiveBodyOverrideWraper preOverridy =
       (TemplateDirectiveBodyOverrideWraper) env.getVariable(DirectiveKit.OVERRIDE_CURRENT_NODE);
   try {
     env.setVariable(DirectiveKit.OVERRIDE_CURRENT_NODE, this);
     body.render(out);
   } finally {
     env.setVariable(DirectiveKit.OVERRIDE_CURRENT_NODE, preOverridy);
   }
 }
Example #9
0
 /**
  * 设置变量
  *
  * @param variables 变量
  * @param env Environment
  */
 public static void setVariables(Map<String, Object> variables, Environment env)
     throws TemplateException {
   Assert.notNull(variables);
   Assert.notNull(env);
   for (Entry<String, Object> entry : variables.entrySet()) {
     String name = entry.getKey();
     Object value = entry.getValue();
     if (value instanceof TemplateModel) {
       env.setVariable(name, (TemplateModel) value);
     } else {
       env.setVariable(name, ObjectWrapper.BEANS_WRAPPER.wrap(value));
     }
   }
 }
Example #10
0
  @Override
  public void execute(
      Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body)
      throws TemplateException, IOException {

    Integer folderId = Integer.parseInt(params.get("folderId").toString());

    try {
      Folder folder = folderService.getFolderById(folderId);
      env.setVariable("tag_folder", DEFAULT_WRAPPER.wrap(folder));
    } catch (FolderNotFoundException e) {
      env.setVariable("tag_folder", DEFAULT_WRAPPER.wrap(new Folder()));
    }
    body.render(env.getOut());
  }
Example #11
0
  public void execute(
      Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body)
      throws TemplateException, IOException {

    TemplateDirectiveBodyOverrideWraper current =
        (TemplateDirectiveBodyOverrideWraper) env.getVariable(DirectiveUtils.OVERRIDE_CURRENT_NODE);
    if (current == null) {
      throw new TemplateException("<@super/> direction must be child of override", env);
    }
    TemplateDirectiveBody parent = current.parentBody;
    if (parent == null) {
      throw new TemplateException("not found parent for <@super/>", env);
    }
    parent.render(env.getOut());
  }
 @SuppressWarnings("unchecked")
 public void execute(
     Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body)
     throws TemplateException, IOException {
   CmsSite site = FrontUtils.getSite(env);
   InvokeType type = DirectiveUtils.getInvokeType(params);
   Pagination page =
       bbsTopicMng.getMemberTopic(
           site.getId(),
           getCreaterId(params),
           FrontUtils.getPageNo(env),
           FrontUtils.getCount(params));
   Map<String, TemplateModel> paramWrap = new HashMap<String, TemplateModel>(params);
   paramWrap.put(OUT_PAGINATION, DEFAULT_WRAPPER.wrap(page));
   Map<String, TemplateModel> origMap = DirectiveUtils.addParamsToVariable(env, paramWrap);
   if (InvokeType.custom == type) {
     FrontUtils.includeTpl(TPL_MY_TOPIC, site, params, env);
     FrontUtils.includePagination(site, params, env);
   } else if (InvokeType.body == type) {
     body.render(env.getOut());
     FrontUtils.includePagination(site, params, env);
   } else {
     throw new RuntimeException("invoke type not handled: " + type);
   }
   DirectiveUtils.removeParamsFromVariable(env, paramWrap, origMap);
 }
 @SuppressWarnings("rawtypes")
 public void execute(
     Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body)
     throws TemplateException, IOException {
   RequestAttributes requestAttributes = RequestContextHolder.currentRequestAttributes();
   if (requestAttributes != null) {
     Message message =
         (Message)
             requestAttributes.getAttribute(
                 FLASH_MESSAGE_ATTRIBUTE_NAME, RequestAttributes.SCOPE_REQUEST);
     if (body != null) {
       setLocalVariable(VARIABLE_NAME, message, env, body);
     } else {
       if (message != null) {
         Writer out = env.getOut();
         out.write(
             "data-msg-type=\""
                 + message.getType()
                 + "\" data-msg-content=\""
                 + message.getContent()
                 + "\"");
       }
     }
   }
 }
 /**
  * @param env
  * @param body
  * @param variables
  * @throws TemplateException
  * @throws IOException
  */
 public void render(
     Environment env, TemplateDirectiveBody body, Map<String, TemplateModel> variables)
     throws TemplateException, IOException {
   Map<String, TemplateModel> origVariables = addVariables(env, variables);
   body.render(env.getOut());
   removeVariables(env, variables, origVariables);
 }
Example #15
0
 /*    */ public void execute(
     Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body)
     /*    */ throws TemplateException, IOException
       /*    */ {
   /* 32 */ Site site = ViewTools.getSite(env);
   /* 33 */ Integer parentId = TagModelTools.getInt("parentId", params);
   /* 34 */ List industryList = new ArrayList();
   /* 35 */ if (parentId != null)
     /* 36 */ industryList = this.industryService.getIndustryChild(parentId);
   /*    */ else {
     /* 38 */ industryList = this.industryService.getIndustryList(null);
     /*    */ }
   /* 40 */ env.setVariable("list", ObjectWrapper.DEFAULT_WRAPPER.wrap(industryList));
   /* 41 */ body.render(env.getOut());
   /* 42 */ ViewTools.includePagination(site, params, env);
   /*    */ }
  @SuppressWarnings("unchecked")
  public void execute(
      Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body)
      throws TemplateException, IOException {
    CmsSite site = FrontUtils.getSite(env);
    Integer parentId = DirectiveUtils.getInt(PARAM_PARENT_ID, params);
    Integer siteId = DirectiveUtils.getInt(PARAM_SITE_ID, params);
    boolean hasContentOnly = getHasContentOnly(params);

    Pagination page;
    if (parentId != null) {
      page =
          channelMng.getChildPageForTag(
              parentId, hasContentOnly, FrontUtils.getPageNo(env), FrontUtils.getCount(params));
    } else {
      if (siteId == null) {
        siteId = site.getId();
      }
      page =
          channelMng.getTopPageForTag(
              siteId, hasContentOnly, FrontUtils.getPageNo(env), FrontUtils.getCount(params));
    }

    Map<String, TemplateModel> paramWrap = new HashMap<String, TemplateModel>(params);
    paramWrap.put(OUT_PAGINATION, DEFAULT_WRAPPER.wrap(page));
    Map<String, TemplateModel> origMap = DirectiveUtils.addParamsToVariable(env, paramWrap);
    InvokeType type = DirectiveUtils.getInvokeType(params);
    String listStyle = DirectiveUtils.getString(PARAM_STYLE_LIST, params);
    if (InvokeType.sysDefined == type) {
      if (StringUtils.isBlank(listStyle)) {
        throw new ParamsRequiredException(PARAM_STYLE_LIST);
      }
      env.include(TPL_STYLE_LIST + listStyle + TPL_SUFFIX, UTF8, true);
    } else if (InvokeType.userDefined == type) {
      if (StringUtils.isBlank(listStyle)) {
        throw new ParamsRequiredException(PARAM_STYLE_LIST);
      }
      FrontUtils.includeTpl(TPL_STYLE_LIST, site, env);
    } else if (InvokeType.custom == type) {
      FrontUtils.includeTpl(TPL_NAME, site, params, env);
    } else if (InvokeType.body == type) {
      body.render(env.getOut());
    } else {
      throw new RuntimeException("invoke type not handled: " + type);
    }
    DirectiveUtils.removeParamsFromVariable(env, paramWrap, origMap);
  }
Example #17
0
  public void execute(
      Environment env, Map map, TemplateModel[] loopVars, TemplateDirectiveBody body)
      throws TemplateException, IOException {

    Iterator<?> it = map.entrySet().iterator();
    String name = "";
    String id = "";
    String clazz = "";
    String defaultvalue = "";
    String nid = "";
    String disabled = "";
    String type = "";
    String noselect = "";
    int typeid = 0;
    boolean plantext = false;
    while (it.hasNext()) {
      Map.Entry<?, ?> entry = (Map.Entry) it.next();
      String paramName = entry.getKey().toString();
      TemplateModel paramValue = (TemplateModel) entry.getValue();
      if (paramName.equals("plantext")) {
        if (!(paramValue instanceof TemplateBooleanModel)) {
          throw new TemplateModelException(
              "The \"" + plantext + "\" parameter " + "must be a boolean.");
        }
        plantext = ((TemplateBooleanModel) paramValue).getAsBoolean();
      }
      if (paramName.equals("name")) {
        name = paramValue.toString();
      } else if (paramName.equals("id")) {
        id = paramValue.toString();
      } else if (paramName.equals("class")) {
        clazz = paramValue.toString();
      } else if (paramName.equals("default")) {
        defaultvalue = paramValue.toString();
      } else if (paramName.equals("nid")) {
        nid = paramValue.toString();
      } else if (paramName.equals("disabled")) {
        disabled = paramValue.toString();
      } else if (paramName.equals("noselect")) {
        noselect = paramValue.toString();
      } else if (paramName.equals("type")) {
        type = paramValue.toString();
      } else if (paramName.equals("typeid")) {
        if (!(paramValue instanceof TemplateNumberModel)) {
          throw new TemplateModelException("The \"typeid\" parameter must be a number.");
        }

        typeid = ((TemplateNumberModel) paramValue).getAsNumber().intValue();
      }
    }
    String result = "";
    if (plantext)
      result = plaintext(name, id, clazz, defaultvalue, typeid, nid, disabled, type, noselect);
    else {
      result = html(name, id, clazz, defaultvalue, typeid, nid, disabled, type, noselect);
    }
    Writer out = env.getOut();
    out.write(result);
  }
Example #18
0
 public void execute(
     Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body)
     throws TemplateException, IOException {
   Integer folderId = Integer.parseInt(params.get("folderId").toString());
   String basePath = HttpUtils.getBasePath(request);
   try {
     Folder folder = folderService.getFolderById(folderId);
     if (Boolean.getBoolean(PropertyUtils.getValue("shishuo.static"))) {
       env.getOut().write(basePath + "/html/folder/" + folder.getEname() + ".html");
     } else {
       env.getOut()
           .write(basePath + "/folder/" + folder.getEname() + ".htm?classifyId=" + folderId);
     }
   } catch (FolderNotFoundException e) {
     e.printStackTrace();
   }
 }
 /**
  * 將要輸出的TemplateModel放到env的variable中
  *
  * @param env
  * @param variables
  * @return
  * @throws TemplateException
  */
 public Map<String, TemplateModel> addVariables(
     Environment env, Map<String, TemplateModel> variables) throws TemplateException {
   Map<String, TemplateModel> origVariables = new HashMap<String, TemplateModel>();
   if (variables.size() <= 0) {
     return origVariables;
   }
   //
   for (Map.Entry<String, TemplateModel> entry : variables.entrySet()) {
     String key = entry.getKey();
     TemplateModel value = env.getVariable(key);
     if (value != null) {
       origVariables.put(key, value);
     }
     env.setVariable(key, entry.getValue());
   }
   return origVariables;
 }
 private void executeMacro(Appendable writer, String macro) throws IOException {
   try {
     Environment environment = getEnvironment(writer);
     Reader templateReader = new StringReader(macro);
     // FIXME: I am using a Date as an hack to provide a unique name for the template...
     Template template =
         new Template(
             (new java.util.Date()).toString(),
             templateReader,
             FreeMarkerWorker.getDefaultOfbizConfig());
     templateReader.close();
     environment.include(template);
   } catch (TemplateException e) {
     Debug.logError(e, "Error rendering screen macro [" + macro + "] thru ftl", module);
   } catch (IOException e) {
     Debug.logError(e, "Error rendering screen macro [" + macro + "] thru ftl", module);
   }
 }
 @Override
 public void execute(
     Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body)
     throws TemplateException, IOException {
   Integer count = Integer.valueOf(params.get("count").toString());
   for (int i = 0; i < count.intValue(); i++) {
     body.render(env.getOut());
   }
 }
  @Override
  public void execute(Environment e, Map map, TemplateModel[] tms, TemplateDirectiveBody tdb)
      throws TemplateException, IOException {
    tagParameter = map;
    request = (HttpServletRequest) e.getCustomAttribute("request");
    urlSetter = (URLQueryHandler) e.getCustomAttribute("urlSetter");
    out = e.getOut();

    HashMap<String, Object> mapx = this.doService();
    if (mapx != null) {
      for (Entry<String, Object> c : mapx.entrySet()) {
        e.setVariable(c.getKey(), ObjectWrapper.DEFAULT_WRAPPER.wrap(c.getValue()));
      }
    }

    if (tdb != null) {
      tdb.render(e.getOut());
    }
  }
  /* (non-Javadoc)
   * @see org.alfresco.web.scripts.TemplateProcessor#process(java.lang.String, java.lang.Object, java.io.Writer)
   */
  public void process(String template, Object model, Writer out) {
    if (template == null || template.length() == 0) {
      throw new IllegalArgumentException("Template name is mandatory.");
    }
    if (model == null) {
      throw new IllegalArgumentException("Model is mandatory.");
    }
    if (out == null) {
      throw new IllegalArgumentException("Output Writer is mandatory.");
    }

    try {
      long startTime = 0;
      if (logger.isDebugEnabled()) {
        logger.debug("Executing template: " + template);
        startTime = System.nanoTime();
      }

      addProcessorModelExtensions(model);

      Template t = templateConfig.getTemplate(template);
      if (t != null) {
        try {
          // perform the template processing against supplied data model
          Environment env = t.createProcessingEnvironment(model, out);
          // set the locale to ensure dates etc. are appropriate localised
          env.setLocale(I18NUtil.getLocale());
          env.process();
        } catch (Throwable err) {
          throw new WebScriptException("Failed to process template " + template, err);
        }
      } else {
        throw new WebScriptException("Cannot find template " + template);
      }

      if (logger.isDebugEnabled()) {
        long endTime = System.nanoTime();
        logger.debug("Time to execute template: " + (endTime - startTime) / 1000000f + "ms");
      }
    } catch (IOException ioerr) {
      throw new WebScriptException("Failed to process template " + template, ioerr);
    }
  }
  @Override
  public void execute(
      Environment env,
      Map map,
      TemplateModel[] templateModel,
      TemplateDirectiveBody templateDirectiveBody)
      throws TemplateException, IOException {
    StringModel stringModel = (StringModel) map.get("archive");
    ArchiveReport archiveReport = (ArchiveReport) stringModel.getWrappedObject();
    Map<String, Integer> data = PieSerializer.recursePie(archiveReport);
    if (data.keySet().size() > 0) {
      env.getOut().append("<div class='rightColumn'>");
      env.getOut().append("<div class='windupPieGraph'>");
      PieSerializer.drawPie(env.getOut(), archiveReport.getRelativePathFromRoot(), data);
      env.getOut().append("</div>");
      env.getOut().append("</div>");
    }

    draw(env.getOut(), archiveReport);
  }
Example #25
0
  @Override
  public void execute(
      Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body)
      throws TemplateException, IOException {

    String sql = params.get("sql").toString();
    System.out.println(loopVars.length);
    System.out.println(sql);
    Channel r = new Channel();
    r.setName("dsadsadasd");
    List a = new ArrayList();
    a.add(r);
    a.add(r);
    a.add(r);
    a.add(r);
    a.add(r);
    env.setVariable("userlist", ObjectWrapper.DEFAULT_WRAPPER.wrap(a));

    env.getOut().write("3424234234");
    body.render(env.getOut());
  }
  @Override
  public void execute(
      Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body)
      throws TemplateException, IOException {

    String siteLanguage = LocaleContextHolder.getLocale().getLanguage();
    String langValue = ((TemplateScalarModel) params.get("lang")).getAsString();

    if (langValue.equals(siteLanguage)) {
      body.render(env.getOut());
    }
  }
 /**
  * 移出先前放入env的variable中,TemplateModel
  *
  * @param env
  * @param variables
  * @param origVariables
  */
 public void removeVariables(
     Environment env,
     Map<String, TemplateModel> variables,
     Map<String, TemplateModel> origVariables)
     throws TemplateException {
   if (variables.size() <= 0) {
     return;
   }
   //
   for (String key : variables.keySet()) {
     env.setVariable(key, origVariables.get(key));
   }
 }
Example #28
0
 @SuppressWarnings("unchecked")
 public void execute(
     Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body)
     throws TemplateException, IOException {
   CmsSite site = FrontUtils.getSite(env);
   String content = DirectiveUtils.getString(PARAM_CONTENT, params);
   if ("1".equals(content)) {
     String sysPage = DirectiveUtils.getString(PARAM_SYS_PAGE, params);
     String userPage = DirectiveUtils.getString(PARAM_USER_PAGE, params);
     if (!StringUtils.isBlank(sysPage)) {
       String tpl = TPL_STYLE_PAGE_CONTENT + sysPage + TPL_SUFFIX;
       env.include(tpl, UTF8, true);
     } else if (!StringUtils.isBlank(userPage)) {
       String tpl = getTplPath(site.getSolutionPath(), TPLDIR_STYLE_PAGE, userPage);
       env.include(tpl, UTF8, true);
     } else {
       // 没有包含分页
     }
   } else {
     FrontUtils.includePagination(site, params, env);
   }
 }
  public void execute(
      Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body)
      throws TemplateException, IOException {

    String pic = params.get("pic").toString();
    if (StringUtil.isEmpty(pic))
      pic = "http://" + EopSetting.IMG_SERVER_DOMAIN + "/images/no_picture.jpg";
    if (pic.startsWith("fs:")) {
      pic = UploadUtil.replacePath(pic);
    }
    String postfix = params.get("postfix").toString();
    env.getOut().write(UploadUtil.getThumbPath(pic, postfix));
  }
Example #30
0
  public void execute(
      Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body)
      throws TemplateException, IOException {

    // 获取参数
    // 信息id
    String infoid = getParam(params, "infoid");
    Writer out = env.getOut();
    if (body != null) {
      // 设置循环变量
      if (loopVars != null && loopVars.length > 0 && infoid.trim().length() > 0) {
        // 查询信息图片集
        InfoImg infoImg = new InfoImg();
        infoImg.setInfoid(infoid);
        List<InfoImg> infoImgList = infoImgService.find(infoImg, " ordernum ");
        if (infoImgList != null && infoImgList.size() > 0) {
          loopVars[0] = new ArrayModel(infoImgList.toArray(), new BeansWrapper());
          body.render(env.getOut());
        }
      }
    }
  }