Examples of IAvatarManager


Examples of com.agiletec.plugins.jpavatar.aps.system.services.avatar.IAvatarManager

public class AvatarTag extends TagSupport {

  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);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.