/** * Implement this method if you wish to be notified when the User has been Unbound from the * session. * * @param hsbe The HttpSessionBindingEvent. */ public void valueUnbound(HttpSessionBindingEvent hsbe) { try { java.util.Date now = new java.util.Date(); // System.out.println("*********** value unbound ********************: " + // now.toString()); if (this.hasLoggedIn()) { if (JetspeedResources.getBoolean("automatic.logout.save", false)) { JetspeedUserManagement.saveUser(this); } JetspeedAuthentication.logout(); } } catch (Exception e) { logger.error("TurbineUser.valueUnbound(): " + e.getMessage(), e); // To prevent messages being lost in case the logging system // goes away before sessions get unbound on servlet container // shutdown, print the stcktrace to the container's console. ByteArrayOutputStream ostr = new ByteArrayOutputStream(); e.printStackTrace(new PrintWriter(ostr, true)); String stackTrace = ostr.toString(); System.out.println(stackTrace); } }
/** * 送信するメールの内容を作成する. * * @return */ public static String createTaskMemberMsg( RunData rundata, String addr, EipTProjectTask task, EipTProject project) { VelocityContext context = new VelocityContext(); boolean enableAsp = JetspeedResources.getBoolean("aipo.asp", false); String CR = ALMailUtils.CR; context.put("user_email", addr); // (さんの申請は承認されました。など) StringBuffer message = new StringBuffer(""); message.append(CR); message .append(getl10nFormat("PROJECT_MAIL_TEXT", project.getProjectName(), task.getTaskName())) .append(CR); context.put("message", message); // サービス context.put("serviceAlias", ALOrgUtilsService.getAlias()); // サービス(Aipo)へのアクセス context.put("enableAsp", enableAsp); context.put("globalurl", ALMailUtils.getGlobalurl()); context.put("localurl", ALMailUtils.getLocalurl()); CustomLocalizationService locService = (CustomLocalizationService) ServiceUtil.getServiceByName(LocalizationService.SERVICE_NAME); String lang = locService.getLocale(rundata).getLanguage(); StringWriter writer = new StringWriter(); try { if (lang != null && lang.equals("ja")) { Template template = Velocity.getTemplate( "portlets/mail/" + lang + "/project-notification-mail.vm", "utf-8"); template.merge(context, writer); } else { Template template = Velocity.getTemplate("portlets/mail/project-notification-mail.vm", "utf-8"); template.merge(context, writer); } } catch (Exception e) { e.printStackTrace(); } writer.flush(); String ret = writer.getBuffer().toString(); return ret; }