Immutable objects are those objects, which cannot be changed. That means (most of the) properties or contents of these objects cannot be edited. I had discussed few points about immutability on my notes about Virtual Documents. Lets see some other aspects of Immutability here.
Now lets see how can we make an object immutable and what are the exception to it
- Versioning an Object (Sys object or any sub type of Sys object)
When an Object is versioned (made a new version by check in) the old version of the versioned object becomes immutable
- Branching an Object
When you branch an Object the parent of the new Branched object becomes Immutable.In both the cases mentioned above Immutability of an object is controlled by an attribute with Boolean value called r_immutable_flag, which is part of dm_sysobject . Content server sets the r_immutable_flag to true on the old version of the object in both these cases.
- Retention Policy
If the Object is governed by a retention policy that makes its immutable then also the r_immutable_flag to true making the Object immutable.
- Freezing a Document by calling freeze()
Freeze method is used to explicitly set a object as immutable. When you call freeze method it sets r_immutable_flag to true and also sets r_frozen_flag to true.
Setting r_frozen_flag to true indicates that freeze method is called on that object. In other words r_frozen_flag is set to true only if freeze method is called on that object, not by versioning branching etc.
Unfreezing a Document
Unfreeze method sets the value of r_frozen_flag to false and also r_immutable_flag to false and hence makes that object mutable again
Freezing and Unfreezing a Virtual Document
If you chose to freeze an associated snapshot in a Virtual Document, the r_has_frzn_assembly attribute is also set to TRUE on that Virtual Document object.
When you freeze a snapshot r_immutable_flag attributes for each component in the snapshot is set to true and also value of r_frzn_assembly_cnt is incremented. The r_frzn_assembly count attribute contains a count of the number of frozen snapshots that contain this component.
If value of r_frzn_assembly_cnt is greater than zero, you cannot delete or modify the object.
Calling a Freeze method to freeze a snapshot automatically freezes the document with which the snapshot is associated. To freeze only the snapshot and not the document, first execute a Freeze method and include the argument to freeze the snapshot then execute an Unfreeze method to unfreeze only the document.
Even though if an Objects is set to immutable there are some attributes of that object that can be changed, lets see what all are those attributes are
These are the attributes that content server can change on a immutable Objects
There are few attributes that an application or a DQL can change on a Frozen Object
- Version label (r_version_label) Symbolic labels only
Changing i_folder_id means you can link or unlink a Frozen document with any folders or cabinets)