org.kuali.rice.krad.service.impl
Class AttachmentServiceImpl

java.lang.Object
  extended by org.kuali.rice.krad.service.impl.AttachmentServiceImpl
All Implemented Interfaces:
AttachmentService

@Transactional
public class AttachmentServiceImpl
extends Object
implements AttachmentService

Attachment service implementation


Constructor Summary
AttachmentServiceImpl()
           
 
Method Summary
 Attachment createAttachment(PersistableBusinessObject parent, String uploadedFileName, String mimeType, int fileSize, InputStream fileContents, String attachmentTypeCode)
          Stores the given fileContents and returns referring Attachment object which acts as a momento to the archived object.
 void deleteAttachmentContents(Attachment attachment)
          Deletes a given DocumentAttachment contents from the corresponding Attachment object
 void deletePendingAttachmentsModifiedBefore(long modificationTime)
          Deletes pending attachments that were last modified before the given time.
 Attachment getAttachmentByNoteId(Long noteId)
          Retrieves an Attachment by note identifier.
 AttachmentDao getAttachmentDao()
          Retrieves a data access object
 ConfigurationService getKualiConfigurationService()
          Gets the configService attribute.
 void moveAttachmentWherePending(Note note)
          Moves attachments on notes from the pending directory to the real one
 InputStream retrieveAttachmentContents(Attachment attachment)
          /* (non-Javadoc)
 void setAttachmentDao(AttachmentDao d)
          Sets the data access object
 void setKualiConfigurationService(ConfigurationService configService)
          Sets the configService attribute value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AttachmentServiceImpl

public AttachmentServiceImpl()
Method Detail

getAttachmentByNoteId

public Attachment getAttachmentByNoteId(Long noteId)
Retrieves an Attachment by note identifier.

Specified by:
getAttachmentByNoteId in interface AttachmentService
See Also:
AttachmentService.getAttachmentByNoteId(java.lang.Long)

createAttachment

public Attachment createAttachment(PersistableBusinessObject parent,
                                   String uploadedFileName,
                                   String mimeType,
                                   int fileSize,
                                   InputStream fileContents,
                                   String attachmentTypeCode)
                            throws IOException
Description copied from interface: AttachmentService
Stores the given fileContents and returns referring Attachment object which acts as a momento to the archived object.

Specified by:
createAttachment in interface AttachmentService
Parameters:
parent - - the document to which the attachment belongs
uploadedFileName - - the name of the uploaded file
mimeType - - the uploaded file's mime type
fileSize - - the size of the uploaded file in bytes
fileContents - - an input stream used to read the file's contents
attachmentTypeCode - -the attachment type code
Returns:
Attachment - the attachment, having been written to the file system
Throws:
IOException
See Also:
AttachmentService.createAttachment(org.kuali.rice.krad.bo.PersistableBusinessObject, String, String, int, java.io.InputStream, String)

moveAttachmentWherePending

public void moveAttachmentWherePending(Note note)
Description copied from interface: AttachmentService
Moves attachments on notes from the pending directory to the real one

Specified by:
moveAttachmentWherePending in interface AttachmentService
Parameters:
note - the Note from which to move attachments. If this Note does not have an attachment then this method does nothing.

deleteAttachmentContents

public void deleteAttachmentContents(Attachment attachment)
Description copied from interface: AttachmentService
Deletes a given DocumentAttachment contents from the corresponding Attachment object

Specified by:
deleteAttachmentContents in interface AttachmentService
Parameters:
attachment - - the attachment whose contents are to be deleted

retrieveAttachmentContents

public InputStream retrieveAttachmentContents(Attachment attachment)
                                       throws IOException
/* (non-Javadoc)

Specified by:
retrieveAttachmentContents in interface AttachmentService
Parameters:
attachment - - the attachment whose contents are to be retrieved
Returns:
OutputStream
Throws:
IOException
See Also:
AttachmentService.retrieveAttachmentContents(org.kuali.rice.krad.bo.Attachment)

deletePendingAttachmentsModifiedBefore

public void deletePendingAttachmentsModifiedBefore(long modificationTime)
Description copied from interface: AttachmentService
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.

Specified by:
deletePendingAttachmentsModifiedBefore in interface AttachmentService
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)
See Also:
AttachmentService.deletePendingAttachmentsModifiedBefore(long)

setAttachmentDao

public void setAttachmentDao(AttachmentDao d)
Sets the data access object

Parameters:
d -

getAttachmentDao

public AttachmentDao getAttachmentDao()
Retrieves a data access object


getKualiConfigurationService

public ConfigurationService getKualiConfigurationService()
Gets the configService attribute.

Returns:
Returns the configService.

setKualiConfigurationService

public void setKualiConfigurationService(ConfigurationService configService)
Sets the configService attribute value.

Parameters:
configService - The configService to set.


Copyright © 2005-2013 The Kuali Foundation. All Rights Reserved.