@SuppressWarnings("unchecked")
  public void execute(
      Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body)
      throws TemplateException, IOException {
    Integer siteId = getSiteId(params);
    if (siteId == null) {
      siteId = FrontUtils.getSite(env).getId();
    }
    List<CmsFriendlinkCtg> list = cmsFriendlinkCtgMng.getList(siteId);

    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);
    body.render(env.getOut());
    DirectiveUtils.removeParamsFromVariable(env, paramWrap, origMap);
  }
 private Integer getSiteId(Map<String, TemplateModel> params) throws TemplateException {
   return DirectiveUtils.getInt(PARAM_SITE_ID, params);
 }