Examples of EmailModel


Examples of com.nilhcem.fakesmtp.model.EmailModel

        return;
      }
    }

    // We move everything that we can move outside the synchronized block to limit the impact
    EmailModel model = new EmailModel();
    model.setFrom(from);
    model.setTo(to);
    String mailContent = convertStreamToString(data);
    model.setSubject(getSubjectFromStr(mailContent));
    model.setEmailStr(mailContent);

    synchronized (getLock()) {
      String filePath = saveEmailToFile(mailContent);

      model.setReceivedDate(new Date());
      model.setFilePath(filePath);

      setChanged();
      notifyObservers(model);
    }
  }
View Full Code Here

Examples of com.nilhcem.fakesmtp.model.EmailModel

   * a {@code MailSaver} observable) containing all the information about the email.
   */
  @Override
  public void update(Observable o, Object arg) {
    if (o instanceof MailSaver) {
      EmailModel email = (EmailModel) arg;
      String subject;
      try {
        subject = MimeUtility.decodeText(email.getSubject());
      } catch (UnsupportedEncodingException e) {
        LOGGER.error("", e);
        subject = email.getSubject();
      }

      model.addRow(new Object[] {dateFormat.format(email.getReceivedDate()), email.getFrom(), email.getTo(), subject});
      UIModel.INSTANCE.getListMailsMap().put(nbElements++, email.getFilePath());
    } else if (o instanceof ClearAllButton) {
      // Delete information from the map
      UIModel.INSTANCE.getListMailsMap().clear();

      // Remove elements from the list
View Full Code Here

Examples of com.nilhcem.fakesmtp.model.EmailModel

   * @param data optional parameters (an {@code EmailModel} object, for the case of a {@code MailSaver} observable).
   */
  @Override
  public synchronized void update(Observable o, Object data) {
    if (o instanceof MailSaver) {
      EmailModel model = (EmailModel) data;
      lastMailArea.setText(model.getEmailStr());
    } else if (o instanceof ClearAllButton) {
      lastMailArea.setText("");
    }
  }
View Full Code Here

Examples of com.nilhcem.fakesmtp.model.EmailModel

    // Save
    final InputStream data = fromString(getMockEmail(from, to, subject, content));
    Observer mockObserver = new Observer() {
      @Override
      public void update(Observable o, Object arg) {
        EmailModel model = (EmailModel)arg;

        assertEquals(from, model.getFrom());
        assertEquals(to, model.getTo());
        assertEquals(subject, model.getSubject());
        assertEquals(to, model.getTo());
        assertNotNull(model.getEmailStr());
        assertFalse(model.getEmailStr().isEmpty());
        assertNotNull(model.getFilePath());
        assertFalse(model.getFilePath().isEmpty());

        File file = new File(model.getFilePath());
        assertTrue(file.exists());

        // Delete
        UIModel.INSTANCE.getListMailsMap().put(0, model.getFilePath());
        saver.deleteEmails();
        assertFalse(file.exists());
      }
    };
    saver.addObserver(mockObserver);
View Full Code Here

Examples of com.sparc.knappsack.models.EmailModel

        }
        return null;
    }

    public static void main(String[] args) {
        EmailModel emailModel = JsonUtil.unmarshall("{\"eventType\":\"USER_INVITE\",\"params\":{\"userId\":2,\"invitationIds\":[829,828]}}", EmailModel.class);
        convertIntegersToLongs(emailModel);
        Long fromUserId = (Long) emailModel.getParams().get("userId");
        List<Long> invitationIds = (List<Long>) emailModel.getParams().get("invitationIds");

//        SQSResignerModel model = new SQSResignerModel("myBucket", ApplicationType.IOS, "my/file/to/resign.ipa", "the/distribution/cert/dist.cert", "the/distribution/key/key.p12", "superSecretPassword", "the/distribution/profile/profile.mobileprovision", "https://mycallbackural.com/blahblah");
//
//        String json = JsonUtil.marshall(model);
//        System.out.println(json);
View Full Code Here

Examples of com.sparc.knappsack.models.EmailModel

    @Override
    public boolean sendActivationEmail(Long userId) {
        boolean success = false;
        if (userId != null) {
            EmailModel model = new EmailModel();
            model.setEventType(EventType.USER_ACCOUNT_ACTIVATION);
            model.getParams().put("userId", userId);

            success = sendMessageToQueue(model);
        }
        return success;
    }
View Full Code Here

Examples of com.sparc.knappsack.models.EmailModel

    @Override
    public boolean sendActivationSuccessEmail(Long userId) {
        boolean success = false;
        if (userId != null) {
            EmailModel model = new EmailModel();
            model.setEventType(EventType.USER_ACCOUNT_ACTIVATION_SUCCESS);
            model.getParams().put("userId", userId);

            success = sendMessageToQueue(model);
        }
        return success;
    }
View Full Code Here

Examples of com.sparc.knappsack.models.EmailModel

    @Override
    public List<Long> sendInvitationsEmail(Long fromUserId, List<Long> invitationIds) {
        List<Long> invitationsSent = new ArrayList<Long>();
        if (!CollectionUtils.isEmpty(invitationIds)) {
            EmailModel model = new EmailModel();
            model.setEventType(EventType.USER_INVITE);
            model.getParams().put("userId", (fromUserId != null ? fromUserId : 0));
            model.getParams().put("invitationIds", invitationIds);

            if (sendMessageToQueue(model)) {
                invitationsSent.addAll(invitationIds);
            }
        }
View Full Code Here

Examples of com.sparc.knappsack.models.EmailModel

    @Override
    public boolean sendPasswordResetEmail(Long userId, String password) {
        boolean success = false;
        if (userId != null && StringUtils.hasText(password)) {
            EmailModel model = new EmailModel();
            model.setEventType(EventType.USER_PASSWORD_RESET);
            model.getParams().put("userId", userId);
            model.getParams().put("password", password);

            success = sendMessageToQueue(model);
        }
        return success;
    }
View Full Code Here

Examples of com.sparc.knappsack.models.EmailModel

    @Override
    public boolean sendApplicationPublishRequestEmail(Long applicationVersionId, UserModel userModel) {
        boolean success = false;
        if (applicationVersionId != null && userModel != null) {
            EmailModel model = new EmailModel();
            model.setEventType(EventType.APPLICATION_VERSION_ORGANIZATION_PUBLISH_REQUEST);
            model.getParams().put("applicationVersionId", applicationVersionId);
            model.getParams().put("userModel", userModel);

            success = sendMessageToQueue(model);
        }
        return success;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.