01: package org.emforge.attachment;
02:
03: import org.apache.commons.collections.Transformer;
04: import org.emforge.xfer.AttachmentTO;
05:
06: import com.ecyrd.jspwiki.attachment.Attachment;
07:
08: /** Transformer from JspWiki attchment to AttachmentTO
09: *
10: */
11: public class AttachmentTransformer implements Transformer {
12:
13: public AttachmentTO transform(Object i_input) {
14: Attachment attachment = (Attachment) i_input;
15:
16: AttachmentTO att = new AttachmentTO();
17: att.setParentName(attachment.getParentName());
18: att.setFileName(attachment.getFileName());
19: att.setVersion(attachment.getVersion());
20: att.setLastModified(attachment.getLastModified());
21: att.setAuthor(attachment.getAuthor());
22: att.setFileSize(Long.valueOf(attachment.getSize()).intValue());
23:
24: return att;
25: }
26:
27: }
|