public void executeNotifyFlow(Notifiable target) { if (target == null) { throw new RuntimeException("Cannot execute flow on null target"); } EngineFlow ef = workspace.getFlow(target.getNotifyFlowName()); if (ef == null) { return; } Set users = new HashSet(); for (Iterator itor = ef.execute(target).iterator(); itor.hasNext(); ) { RuleConsequence rc = (RuleConsequence) itor.next(); User notifier = rc.getUser(); if (!users.contains(notifier)) { /* * 重新load User, 个人信息可能已经修改 */ notifier = userManager.getUser(notifier.getId()); if (EnabledDisabled.ENABLED.equals(notifier.getEnabled())) { Map context = target.getNotifyEmailContext(); context.put("user", notifier); context.put("role", EmailManager.EMAIL_ROLE_NOTIFIER); emailManager.insertEmail( target.getLogSite(), notifier.getEmail(), target.getNotifyEmailTemplateName(), context); } users.add(notifier); } } }