loading table of contents...

5.4.2. Content

The package com.coremedia.cap.content of CoreMedia Studio provides classes for accessing content. A Content object represents a document or folder in the CoreMedia system. It can be obtained through the methods getChild(...) or getContent(String) of the content repository. Note that unlike in Unified API, the String parameter to the latter method is not an ID, but a URI path. You can get the URI path of a Content with the Content#getUriPath() method (inherited from com.coremedia.ui.data.RemoteBean).

You can also initiate a search request using the search service returned by getSearchService() or by navigating to a content from the root folder returned by getRoot().

Using getProperties(), it is possible to navigate to a secondary bean of type com.coremedia.cap.content.ContentProperties that contains all schema-defined properties of a content item. When updating properties, use the inherited, generic set(property, value) method of com.coremedia.ui.data.Bean with Calendar, String, or Number objects or arrays of Content objects as appropriate for the individual properties. Refrain from setting blob-valued and XML-valued properties at this time. As for all remote beans, the method flush(callback) can be called to force properties to be written to the server immediately.

The Content object itself is only responsible for the meta properties that are the same for all contents, for example the name property. The class ContentPropertyNames lists all these property names for your reference. As usual, these are also the property names for the events that are sent when a content changes.

The property lifecycleStatus is a special property that does not correspond to any Unified API feature. It indicates the simplified way in which Studio represents the approval, deletion, and publication flags to the user. The class LifecycleStatus contains constants for the supported states.

Following the Unified API, every content object is associated to a ContentType object by means of the getType() method. You can also retrieve types by name from the content repository. Given a type, you can create new instances of the type by means of the create(Content, String, Function) method.

The move() and rename() methods are shortcuts for setting the parent and name properties. As such, a callback provided with these calls receives a FlushResult as its single argument. The methods copy(), checkIn(), checkOut(), revert(), and doDelete() correspond to the equivalent Unified API methods. (The unusual name of the doDelete() method is caused by delete being a reserved word in ActionScript.)

All operations receive result objects indicating whether the operation was successful. The result of a delete operation is recorded in a DeleteResult, with result codes being documented in DeleteResultCodes. Similarly, there are CopyResult and CheckInResult objects. Please see the ASDoc for details.

Through the method getIssues(), a Content object provides access to issues detected by the server-side validators. See Section 5.3.3, “Issues” for details about the issue API.