What this is about
CDMS deletes hard. The row disappears from the database, and the object is gone for every request: reading returns 404, a search does not find it, references to it are empty. There is no “deleted” field, no recycle bin and no endpoint to restore it. This is called: no soft delete.
What remains is the history, provided the model is audited. Audited means: for every change, CDMS writes a revision, a stored state with a timestamp and an author. See What is audited.
The timeline of an object
flowchart LR
A["ADD<br/>created"] --> M1["MOD<br/>changed"] --> M2["MOD<br/>changed"] --> D["DEL<br/>deleted"]
D -.-> X["Read: 404<br/>Rollback: 404<br/>History: readable"]
Every revision has a type: ADD for creating, MOD for every change, DEL for deleting. The DEL revision tells you who deleted the object and when. Its fields are empty, except for the id. You find the last content before the delete in the revision before it.
The history after the delete
You read the history as for an existing object, with its id:
POST /api/rest/order/7e1…/history
{ "response": ["id", "orderNr", "price"] }{ "data": [
{ "revision": { "id": "7e1…", "orderNr": null, "price": null },
"revisionMeta": { "ref": 57, "username": "ben", … },
"revisionType": "DEL" },
{ "revision": { "id": "7e1…", "orderNr": "A-1000", "price": 120.5 },
"revisionMeta": { "ref": 42, "username": "anna", … },
"revisionType": "MOD" },
{ "revision": { "id": "7e1…", "orderNr": "A-1000", "price": 90.8 },
"revisionMeta": { "ref": 17, "username": "anna", … },
"revisionType": "ADD" }
],
"meta": { … } }For this you need the read role and the history role of the model, and the model must have the history endpoint. See Reading the history.
What remains, what is gone
- the object is gone
- the history remains: all revisions up to the deletion
- who deleted it and when
- dependent children: each with its own history, if their model is audited
- file content and versions are gone
- the object is gone
- nothing of it remains in CDMS
- file content is gone
For files see Deleting file models.
No rollback for deleted objects
A rollback sets an existing object back to the state of an older revision. For a deleted object this does not work:
-
1Client→CDMSsends
POST /order/7e1…/rollback/42 -
2CDMSlooks for the object with the read filters
-
3CDMS→Clientno longer exists → 404
not-found|<Dto>|<id>Result: Nothing is created. The history stays unchanged.
An object keeps its id forever, and a deleted id is not given out again. That is why CDMS cannot bring a deleted object back under its old id. See Rolling back to an old state.
Creating an old state again
If you need a deleted object again, create it anew:
-
1Client→CDMSreads the history and takes the revision before the
DELrevision -
2Client→CDMSsends its fields without
idtoPOST /order/create -
3CDMS→Databasecreates a new objectResult: The new object has a new
id, a new_createdOnand a new history of its own. The old history stays under the oldid. You have to create dependent children and file contents anew as well.
Pitfalls
What comes next
- The steps of a DELETE: How a DELETE runs
- Reading revisions: Reading the history
- What a revision contains: What a revision records