import org.apache.commons.logging.LogFactory;
import org.argeo.slc.SlcException;
import org.springframework.beans.factory.InitializingBean;
+import org.springframework.core.io.Resource;
public class FileAttachmentsStorage implements AttachmentsStorage,
- InitializingBean {
+ AttachmentUploader, InitializingBean {
private final static Log log = LogFactory
.getLog(FileAttachmentsStorage.class);
}
+ public void upload(Attachment attachment, Resource resource) {
+ try {
+ storeAttachment(attachment, resource.getInputStream());
+ } catch (IOException e) {
+ throw new SlcException("Cannot upload attachment " + attachment, e);
+ }
+ }
+
/** For monitoring purposes only */
protected void updateAttachmentToc(Attachment attachment, File file) {
Date date = new Date(file.lastModified());