Modifier and Type | Class and Description |
---|---|
static interface |
XWikiAttachment.AttachmentContainer |
Constructor and Description |
---|
XWikiAttachment() |
XWikiAttachment(XWikiDocument doc,
String filename) |
Modifier and Type | Method and Description |
---|---|
boolean |
apply(XWikiAttachment attachment)
Apply the provided attachment so that the current one contains the same informations and indicate if it was
necessary to modify it in any way.
|
XWikiAttachment |
clone() |
boolean |
contentExists(XWikiContext xcontext) |
boolean |
equalsData(XWikiAttachment otherAttachment,
XWikiContext xcontext) |
void |
fromXML(org.dom4j.Element docel) |
void |
fromXML(org.xwiki.filter.input.InputSource source) |
void |
fromXML(String source) |
org.suigeneris.jrcs.rcs.Archive |
getArchive()
Deprecated.
since 2.6M1 please do not use this, it is bound to a jrcs based implementation.
|
String |
getArchiveStore() |
XWikiAttachmentArchive |
getAttachment_archive() |
XWikiAttachmentContent |
getAttachment_content() |
XWikiAttachmentArchive |
getAttachmentArchive(XWikiContext xcontext) |
XWikiAttachmentContent |
getAttachmentContent(XWikiContext xcontext) |
XWikiAttachment |
getAttachmentRevision(String rev,
XWikiContext context) |
String |
getAuthor()
Deprecated.
since 6.4M1 use
getAuthorReference() instead |
DocumentReference |
getAuthorReference() |
String |
getCharset() |
String |
getComment() |
byte[] |
getContent(XWikiContext xcontext)
Deprecated.
use
getContentInputStream(XWikiContext) instead |
InputStream |
getContentInputStream(XWikiContext xcontext)
Retrieve the content of this attachment as an input stream.
|
long |
getContentLongSize(XWikiContext context) |
int |
getContentSize(XWikiContext context)
Deprecated.
since 9.0RC1, use
getContentLongSize(XWikiContext) instead |
String |
getContentStore() |
Date |
getDate() |
XWikiDocument |
getDoc() |
long |
getDocId() |
String |
getFilename() |
int |
getFilesize()
Deprecated.
since 9.0RC1, use
getLongSize() instead |
long |
getId() |
long |
getLongSize() |
String |
getMimeType()
Return the stored media type.
|
String |
getMimeType(XWikiContext xcontext)
Return the stored media type.
|
String |
getNextVersion() |
org.suigeneris.jrcs.rcs.Version |
getRCSVersion() |
AttachmentReference |
getReference() |
String |
getVersion() |
List<org.suigeneris.jrcs.rcs.Version> |
getVersionList()
Get the list of all versions up to the current.
|
org.suigeneris.jrcs.rcs.Version[] |
getVersions() |
void |
incrementVersion() |
boolean |
isArchiveStoreSet() |
boolean |
isContentDirty() |
boolean |
isContentStoreSet() |
boolean |
isImage(XWikiContext context) |
boolean |
isMetaDataDirty() |
XWikiAttachmentArchive |
loadArchive(XWikiContext xcontext) |
void |
loadAttachmentContent(XWikiContext xcontext) |
void |
loadContent(XWikiContext xcontext)
Deprecated.
since 9.11RC1, use
loadAttachmentContent(XWikiContext) instead |
void |
merge(XWikiAttachment previousAttachment,
XWikiAttachment nextAttachment,
MergeConfiguration configuration,
XWikiContext xcontext,
MergeResult mergeResult) |
void |
resetMimeType(XWikiContext xcontext)
Extract the mime type from the file name and content and remember it to be stored.
|
void |
setArchive(org.suigeneris.jrcs.rcs.Archive archive)
Deprecated.
since 2.6M1 please do not use this, it is bound to a jrcs based implementation.
|
void |
setArchive(String data) |
void |
setArchiveStore(String archiveStore) |
void |
setAttachment_archive(XWikiAttachmentArchive attachment_archive) |
void |
setAttachment_content(XWikiAttachmentContent attachment_content) |
void |
setAttachmentContainer(XWikiAttachment.AttachmentContainer container) |
void |
setAuthor(String author)
Deprecated.
since 6.4M1 use
setAuthorReference(org.xwiki.model.reference.DocumentReference) instead |
void |
setAuthorReference(DocumentReference authorReference) |
void |
setCharset(String charset) |
void |
setComment(String comment) |
void |
setContent(byte[] data)
Deprecated.
use
setContent(java.io.InputStream, int) instead |
void |
setContent(InputStream is)
Set the content of the attachment from an InputStream.
|
void |
setContent(InputStream is,
int length)
Set the content of an attachment from an InputStream.
|
void |
setContentStore(String contentStore) |
void |
setDate(Date date) |
void |
setDoc(XWikiDocument doc) |
void |
setDoc(XWikiDocument doc,
boolean updateDirty) |
void |
setDocId(long id) |
void |
setFilename(String filename) |
void |
setFilesize(int filesize)
Deprecated.
since 9.0RC1, use
setLongSize(long) instead |
void |
setId(long id) |
void |
setLongSize(long size)
The size is automatically calculated from the attachment content so this method is mostly internal API that
should not be used.
|
void |
setMetaDataDirty(boolean metaDataDirty) |
void |
setMimeType(String mimeType) |
void |
setRCSVersion(org.suigeneris.jrcs.rcs.Version version) |
void |
setVersion(String version) |
String |
toString() |
String |
toStringXML(boolean bWithAttachmentContent,
boolean bWithVersions,
XWikiContext context)
Retrieve an attachment as an XML string.
|
String |
toXML()
Retrieve an attachment as an XML string.
|
org.dom4j.Element |
toXML(boolean bWithAttachmentContent,
boolean bWithVersions,
XWikiContext context)
Retrieve XML representation of attachment's metadata into an
Element . |
void |
toXML(org.xwiki.filter.output.OutputTarget out,
boolean bWithAttachmentContent,
boolean bWithVersions,
boolean format,
String encoding)
Write an XML representation of the attachment into an
XMLWriter |
void |
toXML(org.xwiki.filter.output.OutputTarget out,
boolean bWithAttachmentContent,
boolean bWithVersions,
boolean format,
XWikiContext context)
Write an XML representation of the attachment into an
XMLWriter |
void |
toXML(com.xpn.xwiki.internal.xml.XMLWriter wr,
boolean bWithAttachmentContent,
boolean bWithVersions,
XWikiContext context)
Write an XML representation of the attachment into an
XMLWriter |
org.dom4j.Element |
toXML(XWikiContext context)
Retrieve XML representation of attachment's metadata into an
Element . |
void |
updateContentArchive(XWikiContext context) |
public XWikiAttachment(XWikiDocument doc, String filename)
public XWikiAttachment()
public AttachmentReference getReference()
public long getId()
public void setDocId(long id)
public long getDocId()
public void setId(long id)
public XWikiAttachment clone()
@Deprecated public int getFilesize()
getLongSize()
instead@Deprecated public void setFilesize(int filesize)
setLongSize(long)
insteadfilesize
- the number of bytes in this attachment contentpublic long getLongSize()
public void setLongSize(long size)
size
- the metadata holding the number of bytes in this attachment content@Deprecated public int getContentSize(XWikiContext context) throws XWikiException
getContentLongSize(XWikiContext)
insteadcontext
- current XWikiContextXWikiException
public long getContentLongSize(XWikiContext context) throws XWikiException
context
- current XWikiContextXWikiException
public String getFilename()
public void setFilename(String filename)
public DocumentReference getAuthorReference()
public void setAuthorReference(DocumentReference authorReference)
@Deprecated public String getAuthor()
getAuthorReference()
instead@Deprecated public void setAuthor(String author)
setAuthorReference(org.xwiki.model.reference.DocumentReference)
insteadpublic String getVersion()
public void setVersion(String version)
public String getNextVersion()
public org.suigeneris.jrcs.rcs.Version getRCSVersion()
public void setRCSVersion(org.suigeneris.jrcs.rcs.Version version)
public String getComment()
public void setComment(String comment)
public XWikiDocument getDoc()
public void setDoc(XWikiDocument doc)
public void setDoc(XWikiDocument doc, boolean updateDirty)
doc
- the document to associate to the attachmentupdateDirty
- false if the document metadata dirty flag should not be modifiedpublic Date getDate()
public void setDate(Date date)
public boolean isContentDirty()
public void incrementVersion()
public boolean isMetaDataDirty()
public void setMetaDataDirty(boolean metaDataDirty)
public String toStringXML(boolean bWithAttachmentContent, boolean bWithVersions, XWikiContext context) throws XWikiException
toXML(OutputTarget, boolean, boolean, boolean, XWikiContext)
to avoid memory loads when appropriate.bWithAttachmentContent
- if true, binary content of the attachment is included (base64 encoded)bWithVersions
- if true, all archived versions are also includedcontext
- current XWikiContextXWikiException
- when an error occurs during wiki operationspublic String toXML() throws XWikiException
toXML(OutputTarget, boolean, boolean, boolean, String)
to avoid memory loads when appropriate.XWikiException
- when an error occurs during wiki operationspublic org.dom4j.Element toXML(XWikiContext context) throws XWikiException
Element
.Element
containing an XML representation of the attachment without contentXWikiException
- when an error occurs during wiki operationspublic void toXML(com.xpn.xwiki.internal.xml.XMLWriter wr, boolean bWithAttachmentContent, boolean bWithVersions, XWikiContext context) throws IOException, XWikiException
XMLWriter
wr
- the XMLWriter to write tobWithAttachmentContent
- if true, binary content of the attachment is included (base64 encoded)bWithVersions
- if true, all archive version is also includedcontext
- current XWikiContextIOException
- when an error occurs during streaming operationXWikiException
- when an error occurs during xwiki operationpublic void toXML(org.xwiki.filter.output.OutputTarget out, boolean bWithAttachmentContent, boolean bWithVersions, boolean format, XWikiContext context) throws IOException, XWikiException
XMLWriter
out
- the output where to write the XMLbWithAttachmentContent
- if true, binary content of the attachment is included (base64 encoded)bWithVersions
- if true, all archive version is also includedformat
- true if the XML should be formatedcontext
- current XWikiContextIOException
- when an error occurs during streaming operationXWikiException
- when an error occurs during xwiki operationpublic void toXML(org.xwiki.filter.output.OutputTarget out, boolean bWithAttachmentContent, boolean bWithVersions, boolean format, String encoding) throws XWikiException
XMLWriter
out
- the output where to write the XMLbWithAttachmentContent
- if true, binary content of the attachment is included (base64 encoded)bWithVersions
- if true, all archive version is also includedformat
- true if the XML should be formatedencoding
- the encoding to use when serializing XMLXWikiException
- when an error occurs during xwiki operationpublic org.dom4j.Element toXML(boolean bWithAttachmentContent, boolean bWithVersions, XWikiContext context) throws XWikiException
Element
. You should prefer
toXML(com.xpn.xwiki.internal.xml.XMLWriter, boolean, boolean, com.xpn.xwiki.XWikiContext)
to avoid
memory loads when appropriate.bWithAttachmentContent
- if true, binary content of the attachment is included (base64 encoded)bWithVersions
- if true, all archived versions are also includedcontext
- current XWikiContextElement
containing an XML representation of the attachmentXWikiException
- when an error occurs during wiki operationspublic void fromXML(String source) throws XWikiException
XWikiException
public void fromXML(org.xwiki.filter.input.InputSource source) throws XWikiException
source
- the XML source to parseXWikiException
- when failing to parse the XMLpublic void fromXML(org.dom4j.Element docel) throws XWikiException
XWikiException
public String getContentStore()
public boolean isContentStoreSet()
public void setContentStore(String contentStore)
contentStore
- the type of the store used for the contentpublic XWikiAttachmentContent getAttachmentContent(XWikiContext xcontext) throws XWikiException
XWikiException
- when failing to load the attachment contentpublic boolean contentExists(XWikiContext xcontext) throws XWikiException
xcontext
- the XWiki contextXWikiException
public XWikiAttachmentContent getAttachment_content()
public void setAttachment_content(XWikiAttachmentContent attachment_content)
public String getArchiveStore()
public boolean isArchiveStoreSet()
public void setArchiveStore(String archiveStore)
archiveStore
- the type of the store used for the archivepublic XWikiAttachmentArchive getAttachmentArchive(XWikiContext xcontext) throws XWikiException
XWikiException
- when failing to load the attachment archivepublic XWikiAttachmentArchive getAttachment_archive()
public void setAttachment_archive(XWikiAttachmentArchive attachment_archive)
@Deprecated public byte[] getContent(XWikiContext xcontext) throws XWikiException
getContentInputStream(XWikiContext)
insteadxcontext
- current XWikiContextXWikiException
- when an error occurs during wiki operationpublic InputStream getContentInputStream(XWikiContext xcontext) throws XWikiException
xcontext
- current XWikiContextXWikiException
- when an error occurs during wiki operation@Deprecated public org.suigeneris.jrcs.rcs.Archive getArchive()
@Deprecated public void setArchive(org.suigeneris.jrcs.rcs.Archive archive)
public void setArchive(String data) throws XWikiException
XWikiException
public org.suigeneris.jrcs.rcs.Version[] getVersions()
public List<org.suigeneris.jrcs.rcs.Version> getVersionList() throws XWikiException
XWikiException
- never happens.@Deprecated public void setContent(byte[] data)
setContent(java.io.InputStream, int)
insteaddata
- a byte array with the binary content of the attachmentpublic void setContent(InputStream is, int length) throws IOException
is
- the input stream that will be readlength
- the length in byte to readIOException
- when an error occurs during streaming operationpublic void setContent(InputStream is) throws IOException
is
- the input stream that will be readIOException
- when an error occurs during streaming operationpublic void loadAttachmentContent(XWikiContext xcontext) throws XWikiException
XWikiException
@Deprecated public void loadContent(XWikiContext xcontext)
loadAttachmentContent(XWikiContext)
insteadpublic XWikiAttachmentArchive loadArchive(XWikiContext xcontext)
public void updateContentArchive(XWikiContext context) throws XWikiException
XWikiException
public String getMimeType(XWikiContext xcontext)
Tika
. We first try to determine the media type based on the file name extension and if the extension is
unknown we try to determine the media type by reading the first bytes of the attachment content.xcontext
- the XWiki contextpublic String getMimeType()
public void setMimeType(String mimeType)
mimeType
- the explicit mime type of the filepublic void resetMimeType(XWikiContext xcontext)
xcontext
- the XWikiContext
use to load the content if it's not already loadedpublic String getCharset()
public void setCharset(String charset)
charset
- the character encoding associated with the attachment contentpublic boolean isImage(XWikiContext context)
public XWikiAttachment getAttachmentRevision(String rev, XWikiContext context) throws XWikiException
XWikiException
public boolean apply(XWikiAttachment attachment)
attachment
- the attachment to applypublic boolean equalsData(XWikiAttachment otherAttachment, XWikiContext xcontext) throws XWikiException
XWikiException
public void merge(XWikiAttachment previousAttachment, XWikiAttachment nextAttachment, MergeConfiguration configuration, XWikiContext xcontext, MergeResult mergeResult)
public void setAttachmentContainer(XWikiAttachment.AttachmentContainer container)
Copyright © 2004–2022 XWiki. All rights reserved.