Package com.xpn.xwiki.api
Class DeletedDocument
- java.lang.Object
-
- com.xpn.xwiki.api.Api
-
- com.xpn.xwiki.api.DeletedDocument
-
public class DeletedDocument extends Api
Information about a deleted document in the recycle bin.- Version:
- $Id: 6249b94b8d332dd2cf48c65e3c83176eb5aade44 $
-
-
Constructor Summary
Constructors Constructor Description DeletedDocument(XWikiDeletedDocument deletedDoc, XWikiContext context)
Simple constructor, initializes a new API object with the currentcontext
and the specified protecteddeleted document
object.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
canDelete()
boolean
canUndelete()
Check if the current user has the right to restore the document.boolean
canView()
Check if the current user has the right to view the deleted document.String
getBatchId()
Date
getDate()
XWikiDeletedDocument
getDeletedDocument()
String
getDeleter()
DocumentReference
getDeleterReference()
Document
getDocument()
DocumentReference
getDocumentReference()
String
getFullName()
long
getId()
String
getLanguage()
Deprecated.since 8.0M1, usegetLocale()
insteadLocale
getLocale()
-
Methods inherited from class com.xpn.xwiki.api.Api
convert, convert, convert, convertAttachments, getAuthorizationManager, getContextualAuthorizationManager, getXWikiContext, hasAccess, hasAccessLevel, hasAdminRights, hasProgrammingRights, hasWikiAdminRights
-
-
-
-
Constructor Detail
-
DeletedDocument
public DeletedDocument(XWikiDeletedDocument deletedDoc, XWikiContext context)
Simple constructor, initializes a new API object with the currentcontext
and the specified protecteddeleted document
object.- Parameters:
deletedDoc
- the internal object wrapped by this APIcontext
- the current request context
-
-
Method Detail
-
getFullName
public String getFullName()
- Returns:
- full name of document (ie: Main.WebHome)
-
getLanguage
@Deprecated public String getLanguage()
Deprecated.since 8.0M1, usegetLocale()
instead- Returns:
- locale of document
-
getLocale
public Locale getLocale()
- Returns:
- locale of document
- Since:
- 8.0M1
-
getDate
public Date getDate()
- Returns:
- date of delete action
-
getDeleter
public String getDeleter()
- Returns:
- user which delete document
-
getDeleterReference
public DocumentReference getDeleterReference()
- Returns:
- the reference of the user who deleted this document
- Since:
- 11.5RC1
-
getId
public long getId()
- Returns:
- id of deleted document. id is unique only for this document.
-
getBatchId
public String getBatchId()
- Returns:
- the id of the operation that deleted multiple documents at the same time, including this one
- Since:
- 9.4RC1
-
canUndelete
public boolean canUndelete()
Check if the current user has the right to restore the document.- Returns:
true
if the current user can restore this document,false
otherwise
-
canView
@Unstable public boolean canView()
Check if the current user has the right to view the deleted document. This is allowed either if the user has admin right on the original reference of the doc, or if they were the original user who deleted it.- Returns:
- {code true} if the current user is allowed to view the deleted document.
- Since:
- 14.10, 14.4.7, 13.10.11
-
canDelete
public boolean canDelete()
- Returns:
true
if the current user can permanently delete this document,false
otherwise- xwiki.cfg configuration:
- xwiki.store.recyclebin.adminWaitDays How many days should an administrator wait before being able to permanently delete this document from the recycle bin. 0 by default., xwiki.store.recyclebin.waitDays How many days should a normal user with "delete" right wait before being able to permanently delete this document from the recycle bin. 7 by default.
-
getDeletedDocument
@Programming public XWikiDeletedDocument getDeletedDocument()
- Returns:
- original deleted document if user has programming rights, else
null
.
-
getDocument
public Document getDocument()
- Returns:
- the document as it is in the recycle bin if the user is allowed to restore it,
null
otherwise
-
getDocumentReference
public DocumentReference getDocumentReference()
- Returns:
- the document reference for the deleted document, including any locale information
- Since:
- 9.4RC1
-
-