@Test public void testDelete() throws IOException, MessagingException, PasswordException, GeneralSecurityException { folder1.add(email1); folder1.delete(email1.getMessageID()); assertEquals("The email file and/or the metadata were not deleted!", 0, folderDir1.list().length); }
public boolean delete(String messageId) { File metadataFile = getMetadataFile(messageId); if (metadataFile.exists()) metadataFile.delete(); File emailFile = getEmailFile(messageId); boolean deleted; if (emailFile != null) deleted = emailFile.delete(); else deleted = false; for (FolderListener listener: folderListeners) listener.elementRemoved(messageId); return deleted; }
EmailFolder extends Folder<Email> { public boolean delete(String messageId) { File metadataFile = getMetadataFile(messageId); if (metadataFile.exists()) metadataFile.delete(); File emailFile = getEmailFile(messageId); boolean deleted; if (emailFile != null) deleted = emailFile.delete(); else deleted = false; for (FolderListener listener: folderListeners) listener.elementRemoved(messageId); return deleted; } }
EmailFolder extends Folder<Email> { public boolean delete(String messageId) { File metadataFile = getMetadataFile(messageId); if (metadataFile.exists()) metadataFile.delete(); File emailFile = getEmailFile(messageId); boolean deleted; if (emailFile != null) deleted = emailFile.delete(); else deleted = false; for (FolderListener listener: folderListeners) listener.elementRemoved(messageId); return deleted; } EmailFolder(File storageDir, PasswordHolder passwordHolder); }
EmailFolder extends Folder<Email> { public boolean delete(String messageId) { File metadataFile = getMetadataFile(messageId); if (metadataFile.exists()) metadataFile.delete(); File emailFile = getEmailFile(messageId); boolean deleted; if (emailFile != null) deleted = emailFile.delete(); else deleted = false; for (FolderListener listener: folderListeners) listener.elementRemoved(messageId); return deleted; } EmailFolder(File storageDir, PasswordHolder passwordHolder); void add(Email email); void changePassword(byte[] oldPassword, DerivedKey newKey); List<Email> getElements(AddressDisplayFilter displayFilter, EmailAttribute sortColumn, boolean descending); Email getEmail(String messageId); boolean move(String messageId, EmailFolder newFolder); boolean move(Email email, EmailFolder newFolder); int getNumNewEmails(); Email getLatestUnreadEmail(); void setRecent(String messageId, boolean isRecent); void setNew(String messageId, boolean isNew); void setNew(Email email, boolean isNew); void setReplied(String messageId, boolean replied); void saveMetadata(Email email); boolean delete(String messageId); void addFolderListener(FolderListener folderListener); void removeFolderListener(FolderListener folderListener); }
EmailFolder extends Folder<Email> { public boolean delete(String messageId) { File metadataFile = getMetadataFile(messageId); if (metadataFile.exists()) metadataFile.delete(); File emailFile = getEmailFile(messageId); boolean deleted; if (emailFile != null) deleted = emailFile.delete(); else deleted = false; for (FolderListener listener: folderListeners) listener.elementRemoved(messageId); return deleted; } EmailFolder(File storageDir, PasswordHolder passwordHolder); void add(Email email); void changePassword(byte[] oldPassword, DerivedKey newKey); List<Email> getElements(AddressDisplayFilter displayFilter, EmailAttribute sortColumn, boolean descending); Email getEmail(String messageId); boolean move(String messageId, EmailFolder newFolder); boolean move(Email email, EmailFolder newFolder); int getNumNewEmails(); Email getLatestUnreadEmail(); void setRecent(String messageId, boolean isRecent); void setNew(String messageId, boolean isNew); void setNew(Email email, boolean isNew); void setReplied(String messageId, boolean replied); void saveMetadata(Email email); boolean delete(String messageId); void addFolderListener(FolderListener folderListener); void removeFolderListener(FolderListener folderListener);  }