class AttachmentFileManager {

    public DataStorageStreamingContent downloadAttachment(long attachmentId) {
        String systemDataStorageName = preferenceManager.getPreference(
            SystemPreferences.DATA_STORAGE_SYSTEM_DATA_STORAGE_NAME);
        Assert.notNull(systemDataStorageName, messageHelper.getMessage(
            MessageConstants.ERROR_ATTACHMENT_SYSTEM_DATA_STORAGE_NOT_CONFIGURED));

        AbstractDataStorage attachmentStorage = dataStorageManager.loadByNameOrId(systemDataStorageName);
        Attachment attachment = attachmentManager.load(attachmentId);

        DataStorageStreamingContent content = dataStorageManager.getStreamingContent(attachmentStorage.getId(),
                                                                                     attachment.getPath(), null);
        return new DataStorageStreamingContent(content.getContent(), attachment.getName());
    }

    @Autowired public  AttachmentFileManager(DataStorageManager dataStorageManager, PreferenceManager preferenceManager,
                                 AttachmentManager attachmentManager, MessageHelper messageHelper,
                                 AuthManager authManager);

}