Coverage Report - org.kuali.rice.kns.service.AttachmentService
 
Classes in this File Line Coverage Branch Coverage Complexity
AttachmentService
N/A
N/A
1
 
 1  
 /*
 2  
  * Copyright 2007 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.kns.service;
 17  
 
 18  
 import java.io.IOException;
 19  
 import java.io.InputStream;
 20  
 import java.util.List;
 21  
 
 22  
 import org.kuali.rice.kns.bo.Attachment;
 23  
 import org.kuali.rice.kns.bo.PersistableBusinessObject;
 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 notes
 63  
      * @param objectId
 64  
      */
 65  
     public void moveAttachmentsWherePending(List notes, String objectId);
 66  
     
 67  
     /**
 68  
      * Deletes pending attachments that were last modified before the given time.  Java does not have easy access to a file's creation
 69  
      * time, so we use modification time instead.
 70  
      * 
 71  
      * @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
 72  
      *  methods return time in this format.  If a pending attachment was modified before this time, then it will be deleted (unless an error occurs)
 73  
      */
 74  
     public void deletePendingAttachmentsModifiedBefore(long modificationTime);
 75  
     
 76  
     public Attachment getAttachmentByNoteId(Long noteId);
 77  
 }