Lifespan management

From Sense/Net Wiki
Jump to: navigation, search
  •  
  •  
  •  
  •  
  • 99%
  • 6.0
  • Enterprise
  • Community
  • Planned

What it is

Lifespan management is a feature which allows arbitrary content items in a Sense/Net repository to be shown only in a pre-defined period of time. These content items can appear at a specified date and can disappear at another specified date. It is also possible to make a content item appear at a given time and have it stay there indefinitely or to make it disappear at a specified time.

Overview

Lifespan management in Sense/Net is intended to be both user-friendly and performant. This means that lifespan management can be enabled individually for any content and can be enabled for queries and portlets, but is by default disabled.

The feature needs to be enabled on the Content Type for which lifespan management is desired by allowing the necessary fields to be shown on the user interface. If this is done, users who create items of that content can enable it on content items individually.

In order for lifespan management to be taken into account, it needs to be explicitly enabled on queries that want to support it and in portlets where it's desired to display only the items that are valid at the time of viewing.


Enabling lifespan management means adding extra options to queries which can lead to some loss of performance. Please only enable this feature in places where it is needed.


Using lifespan management (for end users / portal builders)

You need to enable lifespan management for each portlet individually when you would like to display content items whose lifespan is valid when someone looks at the portlet.

To enable lifespan on a content item, do the following:

  • Set the value "EnableLifespan" field to true. This means you need to check the checkbox that enables it.
  • The "ValidFrom" field tells when the content item will appear. If it's left blank, it will appear immediately.
  • The "ValidTill" field tells when the content item will disappear. If it's left blank, it will never disappear.

To enable lifespan on a portlet:

  • Some portlets directly support this feature and only require you to set the "Lifespan" setting to "Enabled".
  • For portlets that do not have such a setting, you need to edit the query filter manually and add .LIFESPAN:ON to the query. See this page for details.


Note that some features which allow users to specify custom queries also have lifespan management settings. (For example the Smart Folder also has its own lifespan setting.)


Enabling lifespan management (for developers)

Every actual Content Type has the necessary fields that enable this feature (they are inherited from the GenericContent type), but those fields are hidden by default. You need to edit the CTD of the content type and edit the Field configurations to show these fields on the user interface.

The Query API also supports this feature. In a content query, you can enable the lifespan filters by adding .LIFESPAN:ON to the query or by setting the appropriate values in the QuerySettings object.

Example for a query with lifespan:

Type:Article .LIFESPAN:ON


Passing a QuerySettings object to a content query will always override the .LIFESPAN clause in the query text.