Package org.kuali.rice.krad.service
Interface AttachmentService
public interface AttachmentService
Defines the methods common to all AttachmentService implementations
- Author:
- Kuali Rice Team (rice.collab@kuali.org)
-
Method Summary
Modifier and TypeMethodDescriptioncreateAttachment(org.kuali.rice.core.api.mo.common.GloballyUnique parent, String uploadedFileName, String mimeType, int fileSize, InputStream fileContents, String attachmentType) Stores the given fileContents and returns referring Attachment object which acts as a momento to the archived object.voiddeleteAttachmentContents(Attachment attachment) Deletes a given DocumentAttachment contents from the corresponding Attachment objectvoiddeletePendingAttachmentsModifiedBefore(long modificationTime) Deletes pending attachments that were last modified before the given time.getAttachmentByNoteId(Long noteId) voidMoves attachments on notes from the pending directory to the real oneretrieveAttachmentContents(Attachment attachment) Retrieves a given Attachments contents from the corresponding Attachment object
-
Method Details
-
createAttachment
Attachment createAttachment(org.kuali.rice.core.api.mo.common.GloballyUnique parent, String uploadedFileName, String mimeType, int fileSize, InputStream fileContents, String attachmentType) throws IOException Stores the given fileContents and returns referring Attachment object which acts as a momento to the archived object.- Parameters:
parent- - the document to which the attachment belongsuploadedFileName- - the name of the uploaded filemimeType- - the uploaded file's mime typefileSize- - the size of the uploaded file in bytesfileContents- - an input stream used to read the file's contentsattachmentType- -the attachment type code- Returns:
- Attachment - the attachment, having been written to the file system
- Throws:
IOException
-
retrieveAttachmentContents
Retrieves a given Attachments contents from the corresponding Attachment object- Parameters:
attachment- - the attachment whose contents are to be retrieved- Returns:
- OutputStream
- Throws:
IOException
-
deleteAttachmentContents
Deletes a given DocumentAttachment contents from the corresponding Attachment object- Parameters:
attachment- - the attachment whose contents are to be deleted
-
moveAttachmentWherePending
Moves attachments on notes from the pending directory to the real one- Parameters:
note- the Note from which to move attachments. If this Note does not have an attachment then this method does nothing.- Throws:
IllegalArgumentException- if the given Note is nullIllegalArgumentException- if the Note does not have a valid object id
-
deletePendingAttachmentsModifiedBefore
void deletePendingAttachmentsModifiedBefore(long modificationTime) Deletes pending attachments that were last modified before the given time. Java does not have easy access to a file's creation time, so we use modification time instead.- Parameters:
modificationTime- the number of milliseconds since "the epoch" (i.e.January 1, 1970, 00:00:00 GMT). java.util.Date and java.util.Calendar's methods return time in this format. If a pending attachment was modified before this time, then it will be deleted (unless an error occurs)
-
getAttachmentByNoteId
-