예제 #1
0
 @Override
 public void onStop() {
   if (hr != null) {
     hr.removeHandler();
   }
   view.clear();
   view.setPresenter(null);
 }
예제 #2
0
 @Override
 public void onMailChangeModifiedEvent(MailChangeModifiedEvent event) {
   if (view == null) {
     return;
   }
   view.clear();
   updateMailsFromPerson();
 }
예제 #3
0
  @Override
  public void persist() {

    final String mailChangeText = view.getMail();
    final String mailChangeTextRepeat = view.getMailRepeat();

    if (mailChangeText == null && (mailChangeText.trim().equals(""))) {
      showMessage("Error: El email no puede estar vacio");
      return;
    }

    if (!mailChangeText.equals(mailChangeTextRepeat.trim())) {
      showMessage("Error: Los emails no coinciden");
      return;
    }

    if (loggedPerson == null) {
      showMessage("No se ha podido encontrar la persona logueada en el sistema");
      return;
    }

    Mail mail = personFactory.mail().as();
    mail.setMail(mailChangeText);
    ar.com.dcsys.data.person.MailChange mailChange = personFactory.mailChange().as();
    mailChange.setMail(mail);
    mailChange.setConfirmed(false);
    mailChange.setToken(null);

    mailChangesManager.persist(
        mailChange,
        loggedPerson,
        new Receiver<String>() {
          @Override
          public void onSuccess(String mailChangeId) {
            updateMailsFromPerson();
          }

          @Override
          public void onFailure(Throwable t) {
            showMessage(t.getMessage());
          }
        });
  }