@Override
  protected Object getMasterObject(String keyValue) throws Throwable {
    String managerNameValue = (String) super.findValue(keyValue, String.class);
    try {
      IEntityManager entityManager =
          (IEntityManager) ApsWebApplicationUtils.getBean(managerNameValue, this.pageContext);
      if (null != entityManager) {
        List<IApsEntity> entityTypes = new ArrayList<IApsEntity>();
        Map<String, IApsEntity> typeMap = entityManager.getEntityPrototypes();
        if (null != typeMap) {
          BeanComparator c = new BeanComparator(this.getOrderBy());
          entityTypes.addAll(typeMap.values());
          Collections.sort(entityTypes, c);
        }
        return entityTypes;
      } else {
        _logger.debug("Null entity manager : service name '{}'", managerNameValue);
      }
    } catch (Throwable t) {
      String message = "Error extracting entity types : entity manager '" + managerNameValue + "'";

      _logger.error("Error extracting entity types : entity manager '{}'", managerNameValue, t);
      // ApsSystemUtils.logThrowable(t, this, "getMasterObject", message);
      throw new ApsSystemException(message, t);
    }
    return null;
  }
 @Override
 public String intercept(ActionInvocation invocation) throws Exception {
   HttpServletRequest request = ServletActionContext.getRequest();
   Map<String, Object> params = invocation.getInvocationContext().getParameters();
   ILangManager langManager =
       (ILangManager) ApsWebApplicationUtils.getBean(SystemConstants.LANGUAGE_MANAGER, request);
   String langCode = (String) this.findParameter(params, "langCode");
   Lang currentLang = (null != langCode) ? langManager.getLang(langCode) : null;
   if (null == currentLang) {
     currentLang = langManager.getDefaultLang();
   }
   Locale locale = new Locale(currentLang.getCode(), "");
   invocation.getInvocationContext().setLocale(locale);
   return invocation.invoke();
 }
 private String extractTitle(Widget widget) {
   ServletRequest request = this.pageContext.getRequest();
   RequestContext reqCtx = (RequestContext) request.getAttribute(RequestContext.REQCTX);
   Lang currentLang = (Lang) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_LANG);
   WidgetType type = widget.getType();
   String value = type.getTitles().getProperty(currentLang.getCode());
   if (null == value || value.trim().length() == 0) {
     ILangManager langManager =
         (ILangManager)
             ApsWebApplicationUtils.getBean(SystemConstants.LANGUAGE_MANAGER, this.pageContext);
     Lang defaultLang = langManager.getDefaultLang();
     value = type.getTitles().getProperty(defaultLang.getCode());
   }
   return value;
 }
 @Override
 public int doStartTag() throws JspException {
   IPageManager pageManager =
       (IPageManager)
           ApsWebApplicationUtils.getBean(SystemConstants.PAGE_MANAGER, this.pageContext);
   try {
     List<IPage> pages = pageManager.getWidgetUtilizers(this.getWidgetTypeCode());
     if (this.isListResult()) {
       this.pageContext.setAttribute(this.getVar(), pages);
     } else if (null != pages && pages.size() > 0) {
       this.pageContext.setAttribute(this.getVar(), pages.get(0));
     }
   } catch (Throwable t) {
     _logger.error("error in doStartTag", t);
     throw new JspException("Errore tag", t);
   }
   return super.doStartTag();
 }
 public int doEndTag() throws JspException {
   try {
     if (null == _root) {
       ConfigInterface configService =
           (ConfigInterface)
               ApsWebApplicationUtils.getBean(
                   SystemConstants.BASE_CONFIG_MANAGER, this.pageContext);
       _root = configService.getParam(SystemConstants.PAR_RESOURCES_ROOT_URL);
     }
     if (null == _folder) {
       _folder = "";
     }
     pageContext.getOut().print(_root + _folder);
   } catch (Throwable e) {
     ApsSystemUtils.logThrowable(e, this, "doEndTag");
     throw new JspException("Error closing the tag", e);
   }
   return EVAL_PAGE;
 }
  @Override
  public int doStartTag() throws JspException {

    IRssManager rssManager =
        (IRssManager)
            ApsWebApplicationUtils.getBean(JpRssSystemConstants.RSS_MANAGER, this.pageContext);

    try {

      List<Channel> activeChannels = rssManager.getChannels(Channel.STATUS_ACTIVE);

      this.pageContext.setAttribute(this.getListName(), activeChannels);

    } catch (Throwable t) {
      _logger.error("error in doStartTag", t);

      throw new JspException("Error in RssListTag - doStartTag", t);
    }

    return super.doStartTag();
  }
  public int doEndTag() throws JspException {
    try {
      IAvatarManager avatarManager =
          (IAvatarManager)
              ApsWebApplicationUtils.getBean(JpAvatarSystemConstants.AVATAR_MANAGER, pageContext);
      HttpServletRequest request = (HttpServletRequest) this.pageContext.getRequest();
      UserDetails currentUser =
          (UserDetails)
              request.getSession().getAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER);

      boolean isCurrentUserGuest =
          null == currentUser
              || currentUser.getUsername().trim().length() == 0
              || currentUser.getUsername().equalsIgnoreCase(SystemConstants.GUEST_USER_NAME);
      if (StringUtils.isBlank(this.getUsername()) && isCurrentUserGuest) {
        this.doOut(this.getNullAvatar(avatarManager));
      } else {
        String username = this.getUsername();
        if (StringUtils.isBlank(username)) {
          username = currentUser.getUsername();
        }
        String avatarName = avatarManager.getAvatarUrl(username);
        if (null != avatarName) {
          this.doOut(avatarName);
        } else {
          this.doOut(this.getNullAvatar(avatarManager));
        }
      }
      if (StringUtils.isNotBlank(this.getAvatarStyleVar())) {
        this.pageContext
            .getRequest()
            .setAttribute(this.getAvatarStyleVar(), avatarManager.getConfig().getStyle());
      }
    } catch (Throwable e) {
      ApsSystemUtils.logThrowable(e, this, "doEndTag");
      throw new JspException("Error in AvatarTag", e);
    }
    return EVAL_PAGE;
  }