com.xpn.xwiki.store
Class VoidAttachmentVersioningStore.VoidAttachmentArchive

java.lang.Object
  extended by com.xpn.xwiki.doc.XWikiAttachmentArchive
      extended by com.xpn.xwiki.store.VoidAttachmentVersioningStore.VoidAttachmentArchive
All Implemented Interfaces:
Cloneable
Enclosing class:
VoidAttachmentVersioningStore

public static class VoidAttachmentVersioningStore.VoidAttachmentArchive
extends XWikiAttachmentArchive

Void realization of AttachmentArchive. It says what there is only one version of attachment - latest. Class is public because used in super.clone() via getClass().newInstance()


Constructor Summary
VoidAttachmentVersioningStore.VoidAttachmentArchive()
          Default constructor.
VoidAttachmentVersioningStore.VoidAttachmentArchive(XWikiAttachment attachment)
          Helper constructor.
 
Method Summary
 Object clone()
          
 byte[] getArchive(XWikiContext context)
          Get the archive, loading it from the database if necessary.
 XWikiAttachment getRevision(XWikiAttachment attachment, String rev, XWikiContext context)
          Get an old revision of the attachment which this is an archive of.
 org.suigeneris.jrcs.rcs.Version[] getVersions()
          
 void setArchive(byte[] data)
          Set the archive from a byte array representation of a JRCS archive.
 void setRCSArchive(org.suigeneris.jrcs.rcs.Archive archive)
          
 void updateArchive(byte[] data, XWikiContext context)
          Update the archive.
 
Methods inherited from class com.xpn.xwiki.doc.XWikiAttachmentArchive
getArchive, getAttachment, getId, getRCSArchive, setAttachment, setId
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VoidAttachmentVersioningStore.VoidAttachmentArchive

public VoidAttachmentVersioningStore.VoidAttachmentArchive()
Default constructor. Used in super.clone().


VoidAttachmentVersioningStore.VoidAttachmentArchive

public VoidAttachmentVersioningStore.VoidAttachmentArchive(XWikiAttachment attachment)
Helper constructor.

Parameters:
attachment - attachment of this archive
Method Detail

updateArchive

public void updateArchive(byte[] data,
                          XWikiContext context)
                   throws XWikiException
Update the archive.

Overrides:
updateArchive in class XWikiAttachmentArchive
Parameters:
data - not used for anything, the data is loaded from the attachment included with this archive.
context - the XWikiContext for the request used to load the correct attachment content from the database.
Throws:
XWikiException - if anything goes wrong.

setArchive

public void setArchive(byte[] data)
                throws XWikiException
Set the archive from a byte array representation of a JRCS archive.

Overrides:
setArchive in class XWikiAttachmentArchive
Parameters:
data - a byte array representation of a JRCS archive.
Throws:
XWikiException - if anything goes wrong.

getArchive

public byte[] getArchive(XWikiContext context)
                  throws XWikiException
Get the archive, loading it from the database if necessary.

Overrides:
getArchive in class XWikiAttachmentArchive
Parameters:
context - the XWikiContext for the request used to load the correct attachment archive from the database.
Returns:
a byte array representation of a JRCS archive.
Throws:
XWikiException - if anything goes wrong.

setRCSArchive

public void setRCSArchive(org.suigeneris.jrcs.rcs.Archive archive)

Overrides:
setRCSArchive in class XWikiAttachmentArchive
Parameters:
archive - a JRCS archive.

getVersions

public org.suigeneris.jrcs.rcs.Version[] getVersions()

Overrides:
getVersions in class XWikiAttachmentArchive
Returns:
an array of versions which are available for this attachment, ordered by version number descending.

getRevision

public XWikiAttachment getRevision(XWikiAttachment attachment,
                                   String rev,
                                   XWikiContext context)
                            throws XWikiException
Get an old revision of the attachment which this is an archive of.

Overrides:
getRevision in class XWikiAttachmentArchive
Parameters:
attachment - This attachment will be used to get the document to associate the attachment revision with.
rev - a String representation of the version to load.
context - the context for the request which needed this revision.
Returns:
an XWikiAttachment for the given revision.
Throws:
XWikiException - if any Exception is thrown while getting the revision.

clone

public Object clone()

Overrides:
clone in class XWikiAttachmentArchive


Copyright © 2004–2014 XWiki. All rights reserved.