public class Attachments extends Object
Modifier and Type | Field and Description |
---|---|
static String |
attachmentDirName |
Constructor and Description |
---|
Attachments() |
Modifier and Type | Method and Description |
---|---|
AttachmentInfo |
addAttachmentToEntry(String userId,
long partId,
AttachmentInfo info) |
boolean |
delete(String userId,
long partId,
long attachmentId) |
ByteArrayWrapper |
getAttachmentByFileId(String userId,
String fileId)
Retrieves a previously uploaded attachment to an entry by it's unique file identifier
This file identifier is assigned on upload
|
ArrayList<AttachmentInfo> |
getByEntry(String userId,
long entryId) |
String |
getFileName(String userId,
String fileId)
Retrieves the name of the file represented by the file identifer
|
Attachment |
save(String userId,
Attachment attachment,
InputStream inputStream)
Save attachment to the database and the disk.
|
public static final String attachmentDirName
public ByteArrayWrapper getAttachmentByFileId(String userId, String fileId) throws IOException
PermissionException
- if the attachment referenced by the fileId exists but
the user does not have read permissions on the entry associated with the attachmentIOException
- on exception retrieving filepublic String getFileName(String userId, String fileId)
userId
- unique identifier for user making requestfileId
- unique file identifier for attachmentPermissionException
- if the user making the request does not have read permissions on the entry
associated with the attachmentpublic Attachment save(String userId, Attachment attachment, InputStream inputStream)
userId
- account for user making request. Can be null if method is called as a result of a transferattachment
- attachmentinputStream
- The data stream of the file.public boolean delete(String userId, long partId, long attachmentId)
public ArrayList<AttachmentInfo> getByEntry(String userId, long entryId)
public AttachmentInfo addAttachmentToEntry(String userId, long partId, AttachmentInfo info)
Copyright © 2017. All rights reserved.