Coverage Report - org.kuali.rice.krad.service.AttachmentService
 
Classes in this File Line Coverage Branch Coverage Complexity
AttachmentService
N/A
N/A
1
 
 1  
 /**
 2  
  * Copyright 2005-2011 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  * http://www.opensource.org/licenses/ecl2.php
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 package org.kuali.rice.krad.service;
 17  
 
 18  
 import org.kuali.rice.krad.bo.Attachment;
 19  
 import org.kuali.rice.krad.bo.Note;
 20  
 import org.kuali.rice.krad.bo.PersistableBusinessObject;
 21  
 
 22  
 import java.io.IOException;
 23  
 import java.io.InputStream;
 24  
 
 25  
 /**
 26  
  * Defines the methods common to all AttachmentService implementations
 27  
  *
 28  
  *
 29  
  */
 30  
 public interface AttachmentService {
 31  
     /**
 32  
      * Stores the given fileContents and returns referring Attachment object whieh acts as a momento to the archived object.
 33  
      *
 34  
      * @param document TODO
 35  
      * @param foo
 36  
      *
 37  
      * @return Attachment
 38  
      * @throws IOException
 39  
      */
 40  
     public Attachment createAttachment(PersistableBusinessObject parent, String uploadedFileName, String mimeType, int fileSize, InputStream fileContents, String attachmentType) throws IOException;
 41  
 
 42  
     /**
 43  
      * Retrieves a given Attachments contents from the corresponding Attachment object
 44  
      *
 45  
      * @param documentAttachment
 46  
      *
 47  
      * @return OutputStream
 48  
      * @throws IOException
 49  
      */
 50  
     public InputStream retrieveAttachmentContents(Attachment attachment) throws IOException;
 51  
 
 52  
     /**
 53  
      * Deletes a given DocumentAttachment contents from the corresponding Attachment object
 54  
      *
 55  
      * @param documentAttachment
 56  
      */
 57  
     public void deleteAttachmentContents(Attachment attachment);
 58  
     
 59  
     /**
 60  
      * 
 61  
      * Moves attachments on notes from the pending directory to the real one
 62  
      * @param note the Note from which to move attachments.  If this Note does not
 63  
      * have an attachment then this method does nothing.
 64  
      * 
 65  
      * @throws IllegalArgumentException if the given Note is null
 66  
      * @throws IllegalArgumentException if the Note does not have a valid object id
 67  
      */
 68  
     public void moveAttachmentWherePending(Note note);
 69  
     
 70  
     /**
 71  
      * Deletes pending attachments that were last modified before the given time.  Java does not have easy access to a file's creation
 72  
      * time, so we use modification time instead.
 73  
      * 
 74  
      * @param 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
 75  
      *  methods return time in this format.  If a pending attachment was modified before this time, then it will be deleted (unless an error occurs)
 76  
      */
 77  
     public void deletePendingAttachmentsModifiedBefore(long modificationTime);
 78  
     
 79  
     public Attachment getAttachmentByNoteId(Long noteId);
 80  
 }