com.xpn.xwiki.api
Class Attachment

java.lang.Object
  extended by com.xpn.xwiki.api.Api
      extended by com.xpn.xwiki.api.Attachment

public class Attachment
extends Api


Field Summary
 
Fields inherited from class com.xpn.xwiki.api.Api
context
 
Constructor Summary
Attachment(Document doc, com.xpn.xwiki.doc.XWikiAttachment attachment, com.xpn.xwiki.XWikiContext context)
           
 
Method Summary
 com.xpn.xwiki.doc.XWikiAttachment getAttachment()
           
 Attachment getAttachmentRevision(String rev)
          Allow to easily access any revision of an attachment.
 String getAuthor()
           
 String getComment()
           
 byte[] getContent()
           
 byte[] getContentAsBytes()
           
 String getContentAsString()
           
 String getContentAsString(String charset)
           
 Date getDate()
           
 long getDocId()
           
 Document getDocument()
           
 String getFilename()
           
 int getFilesize()
           
 long getId()
           
 String getMimeType()
           
 org.suigeneris.jrcs.rcs.Version getRCSVersion()
           
 String getVersion()
           
 List<org.suigeneris.jrcs.rcs.Version> getVersionList()
           
 org.suigeneris.jrcs.rcs.Version[] getVersions()
           
 boolean isImage()
           
 
Methods inherited from class com.xpn.xwiki.api.Api
convert, convert, getXWikiContext, hasAccessLevel, hasAdminRights, hasProgrammingRights, hasWikiAdminRights
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Attachment

public Attachment(Document doc,
                  com.xpn.xwiki.doc.XWikiAttachment attachment,
                  com.xpn.xwiki.XWikiContext context)
Method Detail

getDocument

public Document getDocument()
Returns:
the document the file is attached to

getId

public long getId()
Returns:
the document Id of the attachment

getDocId

public long getDocId()
Returns:
the id of the document the file is attached to

getFilesize

public int getFilesize()
Returns:
the Attachment size

getFilename

public String getFilename()
Returns:
the attachment name

getAuthor

public String getAuthor()
Returns:
the login of the person who attach the file

getVersion

public String getVersion()
Returns:
the last version number of the document

getRCSVersion

public org.suigeneris.jrcs.rcs.Version getRCSVersion()
Returns:
the RCS object version of the document

getComment

public String getComment()
Returns:
the list of comments

getDate

public Date getDate()
Returns:
the date of the last uploaded version

getContent

public byte[] getContent()
                  throws com.xpn.xwiki.XWikiException
Returns:
the content of the attachment
Throws:
com.xpn.xwiki.XWikiException

getContentAsBytes

public byte[] getContentAsBytes()
                         throws com.xpn.xwiki.XWikiException
Throws:
com.xpn.xwiki.XWikiException

getContentAsString

public String getContentAsString()
                          throws com.xpn.xwiki.XWikiException
Throws:
com.xpn.xwiki.XWikiException

getContentAsString

public String getContentAsString(String charset)
                          throws com.xpn.xwiki.XWikiException
Throws:
com.xpn.xwiki.XWikiException

getVersions

public org.suigeneris.jrcs.rcs.Version[] getVersions()
                                              throws com.xpn.xwiki.XWikiException
Throws:
com.xpn.xwiki.XWikiException

getVersionList

public List<org.suigeneris.jrcs.rcs.Version> getVersionList()
                                                     throws com.xpn.xwiki.XWikiException
Returns:
a list of string with all the versions number in String
Throws:
com.xpn.xwiki.XWikiException

getAttachment

public com.xpn.xwiki.doc.XWikiAttachment getAttachment()
Returns:
the XWikiAttachment object (without the wrapping) if you have the programming right
See Also:
XWikiAttachment

getMimeType

public String getMimeType()
Returns:
the mimetype of the attachment

isImage

public boolean isImage()
Returns:
true if it's an image

getAttachmentRevision

public Attachment getAttachmentRevision(String rev)
                                 throws com.xpn.xwiki.XWikiException
Allow to easily access any revision of an attachment.

Parameters:
rev - Version to access, in the "Major.minor" format.
Returns:
Attachment API object, or null if the requested version does not exist.
Throws:
com.xpn.xwiki.XWikiException - In case of an error.


Copyright © 2004-2011 XWiki. All Rights Reserved.