Examples of IWebMailManager


Examples of com.agiletec.plugins.jpwebmail.aps.system.services.webmail.IWebMailManager

public class WebmailIntroTag extends TagSupport {
 
  @Override
  public int doStartTag() throws JspException {
    HttpSession session = this.pageContext.getSession();
    IWebMailManager webmailManager = (IWebMailManager) ApsWebApplicationUtils.getBean(JpwebmailSystemConstants.WEBMAIL_MANAGER, pageContext);
    Store store = null;
    WebMailIntroInfo info = new WebMailIntroInfo();
    try {
      UserDetails currentUser = (UserDetails) session.getAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER);
      if (currentUser.getUsername().equals(SystemConstants.GUEST_USER_NAME)) return super.doStartTag();
      if (currentUser.getUsername().equals(SystemConstants.ADMIN_USER_NAME) && !this.isCheckAdmin()) return super.doStartTag();
      store = webmailManager.initInboxConnection(currentUser.getUsername(), currentUser.getPassword());
    } catch (Throwable t) {
      webmailManager.closeConnection(store);
      this.pageContext.setAttribute(this.getVar(), info);
      ApsSystemUtils.logThrowable(t, this, "doStartTag");
      return super.doStartTag();
    }
    try {
      Folder inboxFolder = store.getFolder("INBOX");
      info.setExistMailbox(true);
      info.setMessageCount(inboxFolder.getMessageCount());
      info.setNewMessageCount(inboxFolder.getNewMessageCount());
      info.setUnreadMessageCount(inboxFolder.getUnreadMessageCount());
      this.pageContext.setAttribute(this.getVar(), info);
    } catch (Throwable t) {
      ApsSystemUtils.logThrowable(t, this, "doStartTag");
      throw new JspException("Errore inizializzazione tag", t);
    } finally {
      webmailManager.closeConnection(store);
    }
    return super.doStartTag();
  }
View Full Code Here

Examples of com.agiletec.plugins.jpwebmail.aps.system.services.webmail.IWebMailManager

*/
public class WebMailStoreFactoryInterceptor extends AbstractInterceptor {
 
  @Override
  public String intercept(ActionInvocation invocation) throws Exception {
    IWebMailManager webmailManager = (IWebMailManager) ApsWebApplicationUtils.getBean(JpwebmailSystemConstants.WEBMAIL_MANAGER, ServletActionContext.getRequest());
    Store store = this.getStore(webmailManager);
    if (null == store) return "noStore";
    IWebMailBaseAction webMailAction = (IWebMailBaseAction) invocation.getAction();
    webMailAction.setStore(store);
    String result = invocation.invoke();
    webMailAction.closeFolders();
    webmailManager.closeConnection(store);
    return result;
  }
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.