Deleting a document involves several steps before the full document is actually deleted from the database and disk. These steps are described below.
Only users with "Edit" or "Manage everything" permissions can delete documents from a space.
To delete one or several documents, select them from the Content tab of the workspace, click on Delete and confirm. The documents are moved to the Trash tab of the workspace (available to users with management rights only) and do not appear in the workspace's content list anymore. They are now flagged as trashed (
ecm:isTrashed = 1).
You can also delete documents using right-click on the document's icon from the Content tab of the workspace.
Users with "Manage everything" permissions can access the workspace's Trash and perform one of the following actions:
- Restore documents by selecting them and clicking the Restore button.
Documents are moved back to the Content tab of the workspace and available to users. They get the "project" lifecycle state, even if their lifecycle state before deletion was "approved".
- Erase documents by selecting them and clicking the Permanent delete button.
Documents are permanently erased from the application. They cannot be restored. The relations to the deleted documents are deleted.
- Empty the trash by clicking the corresponding button.
All deleted documents are permanently erased from the application. They cannot be restored. The relations to the deleted documents are deleted.
Putting a document in the trash is done by calling
TrashService corresponding API. The service will move the corresponding documents (to avoid collision with future document) and change its internal property:
When the trash is purged, all its documents are permanently deleted.
Besides the standard user interface, a document is put in the trash when using WebDAV, Nuxeo Drive, or using the TrashService APIs.
If soft-delete is enabled (this is not the case by default), then the document is marked as deleted in the database (using a simple boolean flag) but no rows are actually removed. A search will not be able to find any document marked deleted in this way. From the application's point of view, the document is already fully deleted.
A scheduled periodic process will then hard-delete the documents marked as deleted at a later time, for asynchronous cleanup in fixed-sized batches.
Soft-delete is available for VCS only.
Soft-delete can be enabled to relieve the database of expected heavy loads if many documents are deleted at the same time.
When Nuxeo has to hard-delete lots of documents, many rows in many tables, themselves related by foreign key constraints, have to be removed. On some databases this can use many resources (like undo segments for Oracle) and take a lot of time, so soft-delete is designed to spread these costly operations over time.
To activate soft-delete, you should change the repository configuration to add
<softDelete enabled="true" /> . See Configuration Templates for more about updating the
Please consult NXP-11335 for more details about soft-delete and the configuration of the periodic cleanup.
If soft-delete is not enabled, or when the periodic cleanup process for soft-delete happens, the document's data is actually physically deleted from the database by using
DELETE SQL statements (or equivalent calls for non-VCS storages).