private Sender getPublicRelationsSender() { for (final Sender sender : Sender.getAvailableSenders()) { if (sender.getFromName().equalsIgnoreCase("Gabinete de Comunica��o e Rela��es P�blicas")) { return sender; } } return null; }
public static Set<Sender> getAvailableSenders() { final User userView = Authenticate.getUser(); final Set<Sender> senders = new TreeSet<Sender>(Sender.COMPARATOR_BY_FROM_NAME); for (final Sender sender : Bennu.getInstance().getUtilEmailSendersSet()) { if (sender.getMembers().isMember(userView) || (userView != null && userView.getPerson().hasRole(RoleType.MANAGER))) { senders.add(sender); } } return senders; }
public static boolean hasAvailableSender() { final User userView = Authenticate.getUser(); if (userView != null) { if (userView.getPerson().hasRole(RoleType.MANAGER)) { return true; } final Person person = userView.getPerson(); if (person != null && !person.getMessagesSet().isEmpty()) { return true; } for (final Sender sender : Bennu.getInstance().getUtilEmailSendersSet()) { if (sender.allows(userView)) { return true; } } } return false; }
@EntryPoint public ActionForward newEmail( ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) { EmailBean emailBean = getRenderedObject("emailBean"); if (emailBean == null) { emailBean = (EmailBean) request.getAttribute("emailBean"); } if (emailBean == null) { emailBean = new EmailBean(); final Set<Sender> availableSenders = Sender.getAvailableSenders(); if (availableSenders.size() == 1) { emailBean.setSender(availableSenders.iterator().next()); } } RenderUtils.invalidateViewState(); request.setAttribute("emailBean", emailBean); return mapping.findForward("new.email"); }
public PersonSender() { super(); setFromAddress(Sender.getNoreplyMail()); addReplyTos(new CurrentUserReplyTo()); }
@Override public int compare(final Sender sender1, final Sender sender2) { final int c = sender1.getFromName().compareTo(sender2.getFromName()); return c == 0 ? DomainObjectUtil.COMPARATOR_BY_ID.compare(sender1, sender2) : c; }