@Test public void fromXML() throws Exception { XWikiAttachment attachment = new XWikiAttachment(); attachment.fromXML("<attachment>\n" + "<filename>XWikiLogo.png</filename>\n" + "<filesize>1390</filesize>\n" + "<mimetype>image/png2</mimetype>\n" + "<author>xwiki:XWiki.Admin</author>\n" + "<date>1252454400000</date>\n" + "<version>1.1</version>\n" + "<comment/>\n" + "<content>MDEyMzQ1Njc4OQ==</content>\n" + "</attachment>"); assertEquals("XWikiLogo.png", attachment.getFilename()); assertEquals(new Date(1252454400000L), attachment.getDate()); assertEquals("1.1", attachment.getVersion()); assertEquals("0123456789", IOUtils.toString(attachment.getContentInputStream(null))); assertEquals("image/png2", attachment.getMimeType()); assertEquals("image/png2", attachment.getMimeType(null)); assertFalse(attachment.isMetaDataDirty()); }
public void fromXML(String source) throws XWikiException { if (!source.isEmpty()) { fromXML(new StringInputSource(source)); } }
XWikiAttachment implements Cloneable { public void fromXML(String source) throws XWikiException { if (!source.isEmpty()) { fromXML(new StringInputSource(source)); } } }
XWikiAttachment implements Cloneable { public void fromXML(String source) throws XWikiException { if (!source.isEmpty()) { fromXML(new StringInputSource(source)); } } XWikiAttachment(XWikiDocument doc, String filename);  XWikiAttachment(); }
XWikiAttachment implements Cloneable { public void fromXML(String source) throws XWikiException { if (!source.isEmpty()) { fromXML(new StringInputSource(source)); } } XWikiAttachment(XWikiDocument doc, String filename);  XWikiAttachment(); AttachmentReference getReference(); long getId(); void setDocId(long id); long getDocId(); void setId(long id); @Override XWikiAttachment clone(); @Deprecated int getFilesize(); @Deprecated void setFilesize(int filesize); long getLongSize(); void setLongSize(long size); @Deprecated int getContentSize(XWikiContext context); long getContentLongSize(XWikiContext context); String getFilename(); void setFilename(String filename); DocumentReference getAuthorReference(); void setAuthorReference(DocumentReference authorReference); @Deprecated String getAuthor(); @Deprecated void setAuthor(String author); String getVersion(); void setVersion(String version); String getNextVersion(); Version getRCSVersion(); void setRCSVersion(Version version); String getComment(); void setComment(String comment); XWikiDocument getDoc(); void setDoc(XWikiDocument doc); void setDoc(XWikiDocument doc, boolean updateDirty); Date getDate(); void setDate(Date date); boolean isContentDirty(); void incrementVersion(); boolean isMetaDataDirty(); void setMetaDataDirty(boolean metaDataDirty); String toStringXML(boolean bWithAttachmentContent, boolean bWithVersions, XWikiContext context); String toXML(); Element toXML(XWikiContext context); void toXML(XMLWriter wr, boolean bWithAttachmentContent, boolean bWithVersions, XWikiContext context); void toXML(OutputTarget out, boolean bWithAttachmentContent, boolean bWithVersions, boolean format,
        XWikiContext context); void toXML(OutputTarget out, boolean bWithAttachmentContent, boolean bWithVersions, boolean format,
        String encoding); Element toXML(boolean bWithAttachmentContent, boolean bWithVersions, XWikiContext context); void fromXML(String source); void fromXML(InputSource source); void fromXML(Element docel); String getContentStore(); boolean isContentStoreSet(); void setContentStore(String contentStore); XWikiAttachmentContent getAttachmentContent(XWikiContext xcontext); XWikiAttachmentContent getAttachment_content(); void setAttachment_content(XWikiAttachmentContent attachment_content); String getArchiveStore(); boolean isArchiveStoreSet(); void setArchiveStore(String archiveStore); XWikiAttachmentArchive getAttachmentArchive(XWikiContext xcontext); XWikiAttachmentArchive getAttachment_archive(); void setAttachment_archive(XWikiAttachmentArchive attachment_archive); @Deprecated byte[] getContent(XWikiContext xcontext); InputStream getContentInputStream(XWikiContext xcontext); @Deprecated Archive getArchive(); @Deprecated void setArchive(Archive archive); void setArchive(String data); synchronized Version[] getVersions(); List<Version> getVersionList(); @Deprecated void setContent(byte[] data); void setContent(InputStream is, int length); void setContent(InputStream is); void loadAttachmentContent(XWikiContext xcontext); @Deprecated void loadContent(XWikiContext xcontext); XWikiAttachmentArchive loadArchive(XWikiContext xcontext); void updateContentArchive(XWikiContext context); String getMimeType(XWikiContext xcontext); String getMimeType(); void setMimeType(String mimeType); void resetMimeType(XWikiContext xcontext); String getCharset(); void setCharset(String charset); boolean isImage(XWikiContext context); XWikiAttachment getAttachmentRevision(String rev, XWikiContext context); boolean apply(XWikiAttachment attachment); boolean equalsData(XWikiAttachment otherAttachment, XWikiContext xcontext); void merge(XWikiAttachment previousAttachment, XWikiAttachment nextAttachment,
        MergeConfiguration configuration, XWikiContext xcontext, MergeResult mergeResult); void setAttachmentContainer(AttachmentContainer container); @Override String toString(); }
XWikiAttachment implements Cloneable { public void fromXML(String source) throws XWikiException { if (!source.isEmpty()) { fromXML(new StringInputSource(source)); } } XWikiAttachment(XWikiDocument doc, String filename);  XWikiAttachment(); AttachmentReference getReference(); long getId(); void setDocId(long id); long getDocId(); void setId(long id); @Override XWikiAttachment clone(); @Deprecated int getFilesize(); @Deprecated void setFilesize(int filesize); long getLongSize(); void setLongSize(long size); @Deprecated int getContentSize(XWikiContext context); long getContentLongSize(XWikiContext context); String getFilename(); void setFilename(String filename); DocumentReference getAuthorReference(); void setAuthorReference(DocumentReference authorReference); @Deprecated String getAuthor(); @Deprecated void setAuthor(String author); String getVersion(); void setVersion(String version); String getNextVersion(); Version getRCSVersion(); void setRCSVersion(Version version); String getComment(); void setComment(String comment); XWikiDocument getDoc(); void setDoc(XWikiDocument doc); void setDoc(XWikiDocument doc, boolean updateDirty); Date getDate(); void setDate(Date date); boolean isContentDirty(); void incrementVersion(); boolean isMetaDataDirty(); void setMetaDataDirty(boolean metaDataDirty); String toStringXML(boolean bWithAttachmentContent, boolean bWithVersions, XWikiContext context); String toXML(); Element toXML(XWikiContext context); void toXML(XMLWriter wr, boolean bWithAttachmentContent, boolean bWithVersions, XWikiContext context); void toXML(OutputTarget out, boolean bWithAttachmentContent, boolean bWithVersions, boolean format,
        XWikiContext context); void toXML(OutputTarget out, boolean bWithAttachmentContent, boolean bWithVersions, boolean format,
        String encoding); Element toXML(boolean bWithAttachmentContent, boolean bWithVersions, XWikiContext context); void fromXML(String source); void fromXML(InputSource source); void fromXML(Element docel); String getContentStore(); boolean isContentStoreSet(); void setContentStore(String contentStore); XWikiAttachmentContent getAttachmentContent(XWikiContext xcontext); XWikiAttachmentContent getAttachment_content(); void setAttachment_content(XWikiAttachmentContent attachment_content); String getArchiveStore(); boolean isArchiveStoreSet(); void setArchiveStore(String archiveStore); XWikiAttachmentArchive getAttachmentArchive(XWikiContext xcontext); XWikiAttachmentArchive getAttachment_archive(); void setAttachment_archive(XWikiAttachmentArchive attachment_archive); @Deprecated byte[] getContent(XWikiContext xcontext); InputStream getContentInputStream(XWikiContext xcontext); @Deprecated Archive getArchive(); @Deprecated void setArchive(Archive archive); void setArchive(String data); synchronized Version[] getVersions(); List<Version> getVersionList(); @Deprecated void setContent(byte[] data); void setContent(InputStream is, int length); void setContent(InputStream is); void loadAttachmentContent(XWikiContext xcontext); @Deprecated void loadContent(XWikiContext xcontext); XWikiAttachmentArchive loadArchive(XWikiContext xcontext); void updateContentArchive(XWikiContext context); String getMimeType(XWikiContext xcontext); String getMimeType(); void setMimeType(String mimeType); void resetMimeType(XWikiContext xcontext); String getCharset(); void setCharset(String charset); boolean isImage(XWikiContext context); XWikiAttachment getAttachmentRevision(String rev, XWikiContext context); boolean apply(XWikiAttachment attachment); boolean equalsData(XWikiAttachment otherAttachment, XWikiContext xcontext); void merge(XWikiAttachment previousAttachment, XWikiAttachment nextAttachment,
        MergeConfiguration configuration, XWikiContext xcontext, MergeResult mergeResult); void setAttachmentContainer(AttachmentContainer container); @Override String toString();  }