예제 #1
0
 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;
 }
예제 #2
0
파일: Sender.java 프로젝트: afesteves/fenix
  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;
  }
예제 #3
0
파일: Sender.java 프로젝트: afesteves/fenix
  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;
  }
예제 #4
0
  @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");
  }
예제 #5
0
 public PersonSender() {
   super();
   setFromAddress(Sender.getNoreplyMail());
   addReplyTos(new CurrentUserReplyTo());
 }
예제 #6
0
파일: Sender.java 프로젝트: afesteves/fenix
 @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;
 }