Deactivating Documents in DQL
We received questions from Delilah users who would like to see functionality to be added that allows documents to be deactivated. For deactivation, most people do not want to delete the documents but just move to a special cabinet.
Because deactivation can also be easily accomplished using just DQL, we do not see a need to add this functionality to the Delilah product.
However, we like to share with you how you can deactivate documents.
Preparation
---------------
- Create a Cabinet called Deactivated
- Create an ACL called HIDDEN, where you revoke world read permission
- Mark documents that you want to deactivate by changing the subject of the document to deactivate
Notes:
- If you like to use the queries below, be sure to test them first in a safe environment / test system
- The sample queries will deactivate dm_document type and any subtypes of dm_document!
- Complete version trees will be deactivated
- Only 1 version in the tree needs to have the subject set to deactivate to deactivate the complete tree
- It will only execute on versions that exist outside the /Deactivated cabinet
- In the Step 2 UPDATE statement, modify the SET acl_domain to reflect your docbase name
Step 1: Identify which Versions are going to be deactivated:
SELECT *
FROM dm_document (ALL) doc1
WHERE r_object_id IN
(SELECT r_object_id FROM dm_document (ALL) doc2
WHERE doc2.r_object_id = doc1.r_object_id AND NOT FOLDER ('/Deactivated'))
AND i_chronicle_id IN
(SELECT i_chronicle_id FROM dm_document (ALL) doc2
WHERE doc2.i_chronicle_id = doc1.i_chronicle_id
AND UPPER(subject) LIKE UPPER('deactivate%'))
ORDER BY object_name
Step 2: Deactivate the complete version trees:
UPDATE dm_document (ALL) doc1 OBJECTS
SET r_immutable_flag = FALSE
SET acl_domain = '*YOUR DOCBASE NAME*'
SET acl_name = 'HIDDEN'
MOVE TO '/Deactivated'
WHERE r_object_id IN
(SELECT r_object_id FROM dm_document (ALL) doc2
WHERE doc2.r_object_id = doc1.r_object_id AND NOT FOLDER ('/Deactivated'))
AND i_chronicle_id IN
(SELECT i_chronicle_id FROM dm_document (ALL) doc2
WHERE doc2.i_chronicle_id = doc1.i_chronicle_id
AND UPPER(subject) LIKE UPPER('deactivate%'))
If you have questions or comments, be sure to send an e-mail to This email address is being protected from spambots. You need JavaScript enabled to view it. or post in our forum at http://www.canservices.nl