Search in sources :

Example 1 with ImapMailHelper

use of org.dataportabilityproject.serviceProviders.common.mail.ImapMailHelper in project data-transfer-project by google.

the class MicrosoftMailService method export.

@Override
public MailModelWrapper export(ExportInformation exportInformation) throws IOException {
    ImapMailHelper helper = new ImapMailHelper();
    Optional<Resource> resource = exportInformation.getResource();
    try {
        if (resource.isPresent()) {
            IdOnlyResource folder = (IdOnlyResource) resource.get();
            return helper.getFolderContents(HOST, account, password, folder.getId(), getPaginationInformation(exportInformation));
        } else {
            return helper.getFolderContents(HOST, account, password, null, getPaginationInformation(exportInformation));
        }
    } catch (MessagingException e) {
        throw new IOException(e);
    }
}
Also used : MessagingException(javax.mail.MessagingException) Resource(org.dataportabilityproject.dataModels.Resource) IdOnlyResource(org.dataportabilityproject.shared.IdOnlyResource) IdOnlyResource(org.dataportabilityproject.shared.IdOnlyResource) IOException(java.io.IOException) ImapMailHelper(org.dataportabilityproject.serviceProviders.common.mail.ImapMailHelper)

Aggregations

IOException (java.io.IOException)1 MessagingException (javax.mail.MessagingException)1 Resource (org.dataportabilityproject.dataModels.Resource)1 ImapMailHelper (org.dataportabilityproject.serviceProviders.common.mail.ImapMailHelper)1 IdOnlyResource (org.dataportabilityproject.shared.IdOnlyResource)1