Recycle bin module

User perspective overview

The Recycle bin module has the following advantages:

  • Users are able to revert an unintended deletion of items.
  • Web administrators are able to archive or recycle pages that are currently not in use but may be needed in the future.
  • Developers and designers are able to archive deprecated sections of the site without deleting them..

Development overview

The Recycle bin functionality is built on the concept that the consumers of the data providers can distinguish data items that are marked as deleted. In other words, when an item is sent to the Recycle bin, no data is actually deleted from the data storage, but the item is flagged as deleted and all data consumers can filter the deleted items.

This approach has the advantage of keeping the items that were sent to the Recycle bin with the correct schema. This is quite significant since all types in Sitefinity CMS are dynamically extendable, meaning that you are able to augment existing types during runtime. Another important factor is that data item types in Sitefinity CMS have a predefined lifecycle, meaning that the existing consumers of these items can distinguish data items that are in status live, instead of master or temp, which makes the addition of the deleted lifecycle status backward compatible.

When an item supports the Sitefinity CMS lifecycle, you do not have the deleted state of the data item in a single database column, but in multiple database columns that must be considered.

All data items, like NewsItem, that support recycling must implement the IRecyclableDataItem interface and, therefore, the property IsDeleted. For items that are also ILifecycleDataItem the implementation maps the IsDeleted property to the ContentLifecycleStatus persistent property, which has a deleted status. For non-lifecycle types, like PageNode, the IsDeleted property is persisted by directly mapping its value to a database column.

The entry point for the Recycle bin functionality is the manager of the corresponding data item. The newsManager.RecycleBin property returns an instance of IRecycleBinStrategy, which is a component responsible for handling the transition of a specific data between non deleted and deleted states.

Another important aspect is that there is a centralized storage of IRecycleBinDataItems. The storage stores information about items that are in the Recycle bin (marked as deleted) and is automatically synchronized with the state of the deleted data items through the DataEvents API.

Supported types

For detailed information, see Reference: Content types supported by Recycle bin.

Creation of Recycle bin items

Sitefinity CMS uses the functionality of the Recycle bin module to query and visualize all items that are marked as deleted and therefore can be restored. The Recycle bin defines the data manager provider and the required services to accomplish this.

Sitefinity CMS creates a Recycle bin item when a data item is moved to the Recycle bin. The data manager responsible for marking an item as deleted raises an IRecyclableDataEvent. The Recycle bin module is subscribed to the event by using an IRecycleBinDataEventInterceptor. The interceptor is responsible for creating or deleting IRecycleBinDataItems using the IRecycleBinService, which can be acquired from the Telerik.Sitefinity.Services.ServiceBus.

Want to learn more?

Sign up for our free beginner training. Boost your credentials through advanced courses and certification.
Register for Sitefinity training and certification.

Was this article helpful?