Package com.xpn.xwiki.doc
Class DeletedAttachment
- java.lang.Object
-
- com.xpn.xwiki.util.AbstractSimpleClass
-
- com.xpn.xwiki.doc.DeletedAttachment
-
public class DeletedAttachment extends AbstractSimpleClass
Archive of deleted attachment, stored inAttachmentRecycleBinStore
. Immutable, because deleted attachments should not be modified.- Since:
- 1.4M1
- Version:
- $Id: c6098193e08b8722504f07926fa10c10f2c5c71f $
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
DeletedAttachment()
Default constructor.DeletedAttachment(long docId, String docName, String filename, String storeType, String deleter, Date deleteDate, DeletedAttachmentContent content)
DeletedAttachment(long docId, String docName, String filename, String storeType, String deleter, Date deleteDate, DeletedAttachmentContent content, long id)
DeletedAttachment(XWikiAttachment attachment, String deleter, Date deleteDate, XWikiContext context)
A constructor with all the information about the deleted attachment.
-
Method Summary
-
Methods inherited from class com.xpn.xwiki.util.AbstractSimpleClass
equals, hashCode, toString
-
-
-
-
Constructor Detail
-
DeletedAttachment
protected DeletedAttachment()
Default constructor. Used only by hibernate when restoring objects from the database.
-
DeletedAttachment
public DeletedAttachment(XWikiAttachment attachment, String deleter, Date deleteDate, XWikiContext context) throws XWikiException
A constructor with all the information about the deleted attachment.- Parameters:
attachment
- Deleted attachment.deleter
- User which deleted the attachment.deleteDate
- Date of delete action.context
- The current context. Used for determining the encoding.- Throws:
XWikiException
- If the attachment cannot be exported to XML.
-
DeletedAttachment
public DeletedAttachment(long docId, String docName, String filename, String storeType, String deleter, Date deleteDate, DeletedAttachmentContent content)
- Parameters:
docId
- the ID of the document this attachment belonged todocName
- the reference of the document this attachment belonged tofilename
- the name of the attachmentstoreType
- the way to store the documentdeleter
- the user who delete documentdeleteDate
- date of delete actioncontent
- the stored deleted document- Since:
- 9.10RC1
-
DeletedAttachment
public DeletedAttachment(long docId, String docName, String filename, String storeType, String deleter, Date deleteDate, DeletedAttachmentContent content, long id)
- Parameters:
docId
- the ID of the document this attachment belonged todocName
- the reference of the document this attachment belonged tofilename
- the name of the attachmentstoreType
- the way to store the documentdeleter
- the user who delete documentdeleteDate
- date of delete actioncontent
- the stored deleted documentid
- the synthetic id of this deleted attachment. Uniquely identifies an entry in the recycle bin.- Since:
- 9.10RC1
-
-
Method Detail
-
getId
public long getId()
Getter forid
.- Returns:
- The synthetic id of this deleted attachment. Uniquely identifies an entry in the recycle bin.
-
setId
protected void setId(long id)
Setter forid
.- Parameters:
id
- The synthetic id to set. Used only by hibernate.
-
getDocId
public long getDocId()
Getter fordocId
.- Returns:
- The id of the document this attachment belonged to.
-
setDocId
protected void setDocId(long docId)
Setter fordocId
.- Parameters:
docId
- The id of the document to set. Used only by hibernate.
-
getDocName
public String getDocName()
Getter fordocName
.- Returns:
- The name of the document this attachment belonged to.
-
setDocName
protected void setDocName(String docName)
Setter fordocName
.- Parameters:
docName
- The document name to set. Used only by hibernate.
-
setFilename
protected void setFilename(String filename)
Setter forfilename
.- Parameters:
filename
- The attachment filename to set. Used only by hibernate.
-
getAttachmentReference
public AttachmentReference getAttachmentReference()
- Returns:
- the attachment reference for the deleted attachment
- Since:
- 9.9RCA
-
setDate
protected void setDate(Date date)
Setter fordate
.- Parameters:
date
- The date of the delete action to set. Used only by Hibernate.
-
getDeleter
public String getDeleter()
Getter fordeleter
.- Returns:
- the user who deleted the attachment, as its document name (e.g.
XWiki.Admin
)
-
setDeleter
protected void setDeleter(String deleter)
Setter fordeleter
.- Parameters:
deleter
- The user which has removed the document to set. Used only by Hibernate.
-
getContentStore
public String getContentStore()
- Returns:
- the type of the store used for the content
- Since:
- 9.10RC1
-
setContentStore
public void setContentStore(String xmlStore)
- Parameters:
xmlStore
- the type of store (supported values are null/"hibernate" and "file")- Since:
- 9.10RC1
-
getXml
public String getXml()
Getter forcontent
.- Returns:
- XML serialization of
XWikiAttachment
-
setXml
protected void setXml(String xml)
Setter forcontent
.- Parameters:
xml
- XML serialization ofXWikiAttachment
. Used only by Hibernate.
-
setAttachment
@Deprecated protected void setAttachment(XWikiAttachment attachment, XWikiContext context) throws XWikiException
Deprecated.since 9.9RC1, useDeletedAttachment(long, String, String, String, String, Date, DeletedAttachmentContent)
insteadExportXWikiAttachment
toDeletedAttachment
.- Parameters:
attachment
- the deleted attachmentcontext
- the current context, used in the XML export- Throws:
XWikiException
- if an exception occurs during the XML export
-
restoreAttachment
@Deprecated public XWikiAttachment restoreAttachment(XWikiAttachment attachment, XWikiContext context) throws XWikiException
Deprecated.since 9.9RC1, userestoreAttachment(XWikiAttachment)
insteadRestore aXWikiAttachment
from aDeletedAttachment
. Note that this method does not actually restore the attachment to its owner document, it simply re-composes anXWikiAttachment
object from the saved data.- Parameters:
attachment
- optional object where to put the attachment data, if notnull
context
- the currentcontext
- Returns:
- restored attachment
- Throws:
XWikiException
- If an exception occurs while the Attachment is restored from the XML. SeeXWikiAttachment.fromXML(String)
.
-
restoreAttachment
public XWikiAttachment restoreAttachment(XWikiAttachment attachment) throws XWikiException
Restore aXWikiAttachment
from aDeletedAttachment
. Note that this method does not actually restore the attachment to its owner document, it simply re-composes anXWikiAttachment
object from the saved data.- Parameters:
attachment
- optional object where to put the attachment data, if notnull
- Returns:
- restored attachment
- Throws:
XWikiException
- If an exception occurs while the Attachment is restored from the XML. SeeXWikiAttachment.fromXML(String)
.
-
restoreAttachment
public XWikiAttachment restoreAttachment() throws XWikiException
- Returns:
- restored attachment
- Throws:
XWikiException
- if error inXWikiDocument.fromXML(String)
- Since:
- 9.10RC1
-
-