Package nl.gx.webmanager.cms.core
Interface ContentItem<T extends ContentItemVersion<?>>
-
@Indexable public interface ContentItem<T extends ContentItemVersion<?>>
Definition of a content item.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description T
getCurrent()
Returns the current version of this content item.T
getCurrent(Language language)
Returns the current version of this content item in the specified language.T
getEditVersion()
The version used to display version and/or language specific properties (like the title) of the content item in the Edit Environment.T
getEditVersionInLanguage(Language language)
Same as getEditVersion().ContentItemId
getIdentifier()
Returns the content item identifier of this content item.Link
getInternalLink()
Returns the internal link to this content item.Link
getLink()
Returns the link to this content item or null if no current of the (context) language is available.T
getMostRelevantVersion(Language language)
Deprecated.String
getOriginId()
Get the Origin ID.T
getPlanned()
Returns the planned version of this content item.T
getPlanned(Language language)
Returns the planned version of this content item.T
getVersion(Boolean matchActiveOnly, Language matchLanguage, boolean enforceLanguage, Date matchDate, boolean inContextFirst)
Returns the version with the latest publication date/time of all versions of this content item that match the input parameters.T[]
getVersions()
Returns allContentItemVersion
s this content item has.T[]
getVersions(Language language)
Returns all content items versions within the given language.Website
getWebsite()
Returns the website that owns this content item.
-
-
-
Method Detail
-
getIdentifier
ContentItemId getIdentifier()
Returns the content item identifier of this content item.- Returns:
- The content item identifier of this content item
- Since:
- 10.34.0
- See Also:
ContentItemId
-
getVersions
T[] getVersions()
Returns allContentItemVersion
s this content item has. AContentItem
must have at least oneContentItemVersion
.In exceptional cases like these, the method returns an empty array:
- The
ContentItem
and therefore its last version has just been deleted within the current session. - The
Content Type
is inactive.
- Returns:
- all versions, in exceptional cases only an empty array, never
null
- The
-
getVersions
T[] getVersions(Language language)
Returns all content items versions within the given language. Fallback languages are ignored here, even if fallback languages are enabled. So returned versions are guaranteed to have the specified language.
A content item can have zero or more content item versions within a language, but there exists one language for which a version is available.- Parameters:
language
- the language of the versions to be returned.- Returns:
- all versions, or an empty array if there are no versions for the given language. Never returns
null
.
-
getVersion
T getVersion(Boolean matchActiveOnly, Language matchLanguage, boolean enforceLanguage, Date matchDate, boolean inContextFirst)
Returns the version with the latest publication date/time of all versions of this content item that match the input parameters.- Parameters:
matchActiveOnly
-- If true, only versions match that have an active state.
- If false, all versions match, no matter their state (active or inactive).
- If null, a default is used instead. For frontend requests, the default is true. For backend requests, the default is true when the in context view mode is set to Active only and false otherwise.
matchLanguage
-- If not null, only versions match that are in this language, or in its fallback language if fallback languages are enabled.
- If null and the current editing language is not null, only versions match that are in the current editing language, or in its fallback language if fallback languages are enabled.
- If null and the current editing language is null, only versions match that are in the default content language, or in its fallback language if fallback languages are enabled. NB: the default content language cannot be null.
enforceLanguage
-- If true and matchLanguage is not null, only versions will be matched that exactly match the language as specified in matchLanguage. Fallback languages are ignored, even if fallback languages are enabled.
- If false, fallback languages are taken into account while matching versions (if enabled)
- NB: if enforceLanguage is true, matchLanguage should not be null. If enforceLanguage is true and matchLanguage is null, this method always returns null.
matchDate
-- If not null, only versions match that have an active state at this provided date/time, considering its publication and expiration date.
- If null, all versions match no matter their publication or expiration date.
inContextFirst
-- If true, this method gives precedence to content item versions that are set
on the presentation context (either
PresentationContext.getMediaItemVersion()
orPresentationContext.getPageVersion()
) and returns this version, if is is not null. - If false, versions set on the
PresentationContext
do not effect the version returned by this method.
- If true, this method gives precedence to content item versions that are set
on the presentation context (either
- Returns:
- The version with the latest publication date/time in case more then 1 version matches all input arguments. Returns null if no versions match all input arguments.
- Since:
- 10.32.0
-
getCurrent
T getCurrent()
Returns the current version of this content item. Returns the exact same result asgetCurrent(null)
.- Returns:
- the current version, or
null
if there is no current version - See Also:
getCurrent(Language)
-
getCurrent
T getCurrent(Language language)
Returns the current version of this content item in the specified language. This method returns the exact same result asgetVersion(null, language, false, showDate)
, where showDate equals the in context date/time if specified (can only be the case for in context requests) or the current date/time otherwise.- Returns:
- the current version for this language, or
null
if there is no current version - See Also:
#getVersion(Boolean, Language, boolean, Date)
-
getPlanned
T getPlanned()
Returns the planned version of this content item. Returns the exact same result asgetPlanned(null)
.- Returns:
- the planned version, or
null
if there is no planned version - See Also:
getPlanned(Language)
-
getPlanned
T getPlanned(Language language)
Returns the planned version of this content item. The planned version is defined as;- null if
getCurrent(language)
returns not null - Otherwise,
getVersion(false, null, false, null)
if it is not null - Otherwise, the version of the first language returned by
Website.getLanguages()
for whichgetVersion(false, lang, false, null)
is not null
- Returns:
- the planned version for this language, or
null
if there is no planned version - See Also:
#getVersion(Boolean, Language, boolean, Date)
- null if
-
getMostRelevantVersion
@Deprecated T getMostRelevantVersion(Language language)
Deprecated.This method is deprecated. Please usegetVersion(false, language, new Date())
instead.
-
getWebsite
@ReferDocument Website getWebsite()
Returns the website that owns this content item.- Returns:
- website Owner website of the content item.
-
getLink
Link getLink()
Returns the link to this content item or null if no current of the (context) language is available.- Returns:
- link to this content item or null if no current of the (context) language is available
-
getInternalLink
Link getInternalLink()
Returns the internal link to this content item.- Returns:
- internal link to this content item
-
getOriginId
String getOriginId()
Get the Origin ID. This identifier is set on creation and will thereafter never change. AContentItem
can be looked up using its Origin ID. An exported item will keep its Origin ID when imported on another environment and can therefore be used for recognizing corresponding items. The Origin ID is always unique within aWebsite
, but not always on an installation, after exports/imports within the installation.- Returns:
- the Origin ID of this
ContentItem
- See Also:
PageManagementService.getFromOriginId(Website, String)
,MediaRepositoryManagementService.getFromOriginId(Website, String)
-
getEditVersion
T getEditVersion()
The version used to display version and/or language specific properties (like the title) of the content item in the Edit Environment. For example, if the edit environment needs to display a content item reference, it can use getEditVersion().getTitle() as name of that reference since the content item itself has no title.- Returns:
- the version used to display version and/or language specific properties
- Since:
- 10.31.0
-
getEditVersionInLanguage
T getEditVersionInLanguage(Language language)
Same as getEditVersion(). However, versions in the specified language have precedence over all other versions. So whenever a version exists in the specified language of this content item, a version in the specified language is guaranteed to be returned. Like getEditVersion, this method also gives precedence to active versions over inactive versions.- Parameters:
language
- The language of the version to return. If a version is returned and at least 1 version in that language exists, the returned version is guaranteed to be in this language. Hence, language must not be null.- Returns:
- the version used to display version and/or language specific properties
- Since:
- 10.32.0
-
-