01: /*
02: * Copyright 2007 The Kuali Foundation.
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
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.core.service;
17:
18: import java.io.IOException;
19: import java.io.InputStream;
20: import java.util.List;
21:
22: import org.kuali.core.bo.Attachment;
23: import org.kuali.core.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(
41: PersistableBusinessObject parent, String uploadedFileName,
42: String mimeType, int fileSize, InputStream fileContents,
43: String attachmentType) throws IOException;
44:
45: /**
46: * Retrieves a given Attachments contents from the corresponding Attachment object
47: *
48: * @param documentAttachment
49: *
50: * @return OutputStream
51: * @throws IOException
52: */
53: public InputStream retrieveAttachmentContents(Attachment attachment)
54: throws IOException;
55:
56: /**
57: * Deletes a given DocumentAttachment contents from the corresponding Attachment object
58: *
59: * @param documentAttachment
60: */
61: public void deleteAttachmentContents(Attachment attachment);
62:
63: /**
64: *
65: * Moves attachments on notes from the pending directory to the real one
66: * @param notes
67: * @param objectId
68: */
69: public void moveAttachmentsWherePending(List notes, String objectId);
70:
71: /**
72: * Deletes pending attachments that were last modified before the given time. Java does not have easy access to a file's creation
73: * time, so we use modification time instead.
74: *
75: * @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
76: * methods return time in this format. If a pending attachment was modified before this time, then it will be deleted (unless an error occurs)
77: */
78: public void deletePendingAttachmentsModifiedBefore(
79: long modificationTime);
80: }
|