close

Filter

loading table of contents...

Unified API Developer Manual / Version 2210

Table Of Contents

5.6 Observed Property Service

The ObservedPropertyService allows you to access contents which have a given value in an observed property. A content property is observed when the property in the content type definition is annotated with extensions:observe. See Section 4.3.8.3, “Changing the Observe Attribute of a StringProperty” in Content Server Manual for the configuration of an observed property. Currently only a string property with a maximum length of 256 is supported. For such an observed property and a given non-empty value the Content Server maintains the set of contents whose observed property has the value. The ObservedPropertyService offers methods to retrieve the contents in a cached and dependency-tracked way.

Example: Given is a content type ExternalProduct with an observed string property externalId. Now, the set of external product contents whose external ID is "acme sportswear 123" can be retrieved by observedPropertyService.getContentsWithValue("acme sportswear 123", externalIdDescriptor) whereas externalIdDescriptor is the content property descriptor of the externalId property.

The same could be achieved using the query service. But the result retrieved by the ObservedPropertyService is cached and dependency-tracked, which is more efficient. Additionally, for every change of the set of contents with the observed value the content repository sends a corresponding event.

The ObservedPropertyEvent is thrown when a set of observed contents has changed. See the Javadoc for details.

Caution

Caution

Beware that the ObservedPropertyEvent reveals the value of the observed property to the listener. For example, the external IDs of the ExternalProduct contents maintained in the CMS could be collected without having the proper access rights to the Content Repository.

Search Results

Table Of Contents
warning

Your Internet Explorer is no longer supported.

Please use Mozilla Firefox, Google Chrome, or Microsoft Edge.