Start page / Template development / Template syntax / Data types / TargetReference

Data type TargetReferenceAvailable from FirstSpirit Version 4.2

Value range of the data type DatasetContainer

FirstSpirit provides the data type TargetReference for processing values which represent a reference to a FirstSpirit object.

The data type TargetReference returns a reference to any FirstSpirit object. The type of the referenced object is not determined: references can be selected to media (pictures and files), to document groups, folders, pages (Page Store), page references (Site Store) and Content2 objects (Content Store) as well as to any other Store.

For further information about the data type TargetReference see API documentation:

de.espirit.firstspirit.access.editor.value.TargetReference

Definition using the standard input components

The input component FS_REFERENCE can be used for including references to FirstSpirit objects (page references, pages from the Page Store, media etc.).

This input component returns the data type TargetReference when accessing the stored value by means of a $CMS_VALUE(...)$ instruction.

Methods on TargetReference objects

The table below lists all methods which can be invoked on objects of data type TargetReference:

The object is generated by the following form objects:
FS_REFERENCE
Method name Return type Brief description Available since
equals(Object) boolean
get IDProvider Get the reference of the element currently set in this TargetReference. 4.2
getClass Class Class of the invoking object
getContent Content2 Returns a Content2 reference or null if reference is not a type of Content2. 4.2
getDocumentGroup DocumentGroup Returns a DocumentGroup reference or null if the referenced instance is not a DocumentGroup. 4.2.17
getLanguage Language Get the language of the selected reference. 4.2
getMedia Media Returns a set medium if any or null if reference is not a type of Media. 4.2
getPage Page Returns a set page or null if referenced element is not type of Page. 4.2
getPageRef PageRef Returns a set page reference or null if referenced element is not type of PageRef. 4.2
getRemoteSymName String Return the symbolic remote project name set in the local remote project configuration. 4.2
getSection Section Get the referenced section. 4.2
getSectionName String Return the name of the Section if the referenced element is of type Section. 4.2
getStoreType Store$Type Get the kind of Store.Type for the selected item. 4.2
getUid String Retrieve the referenced element's unique id. 4.2
getUidType IDProvider$UidType Get the IDProvider.UidType of the given element. 4.2
isCase(Object) boolean
isEmpty boolean Checks whether an expression is empty 4.2
isNull boolean Checks whether an expression is null (zero)
loadSection(Page, String) Section Load a section of the given referenced page identified by its section name. 4.2
print void
resetTo(IDProvider, String) void Reset the reference and the remote information and infer settings for UID and UidType. 4.2.202
set(IDProvider) void Set a new element reference of type IDProvider and infer settings for UID and UidType. 4.2
set(String, Object) Object
setRemoteSymName(String) void If the set element is a remote project reference, this method set the symbolic remote project name definied in the local project configuration. 4.2
setSection(Section) void Set the section to be referenced. 4.2
setSectionName(String) void Use this to set the section. 4.2
setUid(String) void Set the Uid of the referenced element. 4.2
setUidType(IDProvider$UidType) void Set the IDProvider.UidType of the referenced element. 4.2
toJSON String Convert to a JSON-compatible string representation including necessary quotes and escaping for immediate use. Handles Maps, Collections, Arrays, Numbers, Strings, Boolean, Date, and JsonElement. A date instance will be converted to an ISO-8601 formatted date string. Any object other than above will be converted using its 'toString()' value. 5.2.11
toString String
type String

equals(Object)

Method name Return type Available since
equals(Object) boolean

get

Get the reference of the element currently set in this TargetReference.
Method name Return type Available since
get IDProvider 4.2

getClass

The .getClass() (in Bean syntax: .class) method returns the class of the invoking object (cf. java.lang.Class).

Invocation:

$CMS_VALUE(myString.class)$
$CMS_VALUE(myString.getClass())$

Output:

java.lang.String
Method name Return type Available since
getClass Class

getContent

Returns a Content2 reference or null if reference is not a type of Content2.
Method name Return type Available since
getContent Content2 4.2

getDocumentGroup

Returns a DocumentGroup reference or null if the referenced instance is not a DocumentGroup.
Method name Return type Available since
getDocumentGroup DocumentGroup 4.2.17

getLanguage

Get the language of the selected reference.
Method name Return type Available since
getLanguage Language 4.2

getMedia

Returns a set medium if any or null if reference is not a type of Media.
Method name Return type Available since
getMedia Media 4.2

getPage

Returns a set page or null if referenced element is not type of Page.
Method name Return type Available since
getPage Page 4.2

getPageRef

Returns a set page reference or null if referenced element is not type of PageRef.
Method name Return type Available since
getPageRef PageRef 4.2

getRemoteSymName

Return the symbolic remote project name set in the local remote project configuration.
Method name Return type Available since
getRemoteSymName String 4.2

getSection

Get the referenced section.
Method name Return type Available since
getSection Section 4.2

getSectionName

Return the name of the Section if the referenced element is of type Section.
Method name Return type Available since
getSectionName String 4.2

getStoreType

Get the kind of Store.Type for the selected item.
Method name Return type Available since
getStoreType Store$Type 4.2

getUid

Retrieve the referenced element's unique id.
Method name Return type Available since
getUid String 4.2

getUidType

Get the IDProvider.UidType of the given element.
Method name Return type Available since
getUidType IDProvider$UidType 4.2

isCase(Object)

Method name Return type Available since
isCase(Object) boolean

isEmpty

The .isEmpty() (in Bean syntax: .isEmpty) method checks whether an expression or object is empty, e.g. storeElement.isEmpty(). The result of the semantic check depends on the expression or object, e.g. a character string is empty if it does not contain any characters. In the case of objects with complex values or objects, the object decides when it is empty. The data type DomElement for example always contains an empty document, thus it is never null. For this reason, checking an empty DOM editor input component by using the method .isNull() returns the value false, whereas checking the component with .isEmpty() would return the value true.

The method .isEmpty() returns a Boolean value as the check result. true is the check result if the expression or object is empty and false if not.

Method name Return type Available since
isEmpty boolean 4.2

isNull

The .isNull() (in Bean syntax: .isNull) method checks whether an expression or object is null , e.g. storeElement.isNull(). In the case of objects with complex values or objects, the object decides when it is null. The data type DomElement for example always contains an empty document, thus it is never null. For this reason, checking an empty DOM editor input component by using the method .isNull() returns the value false, whereas checking the component with .isEmpty() would return the value true.

The method .isNull() returns a Boolean value as the check result. true is the check result if the expression or object is null and false if not.

Method name Return type Available since
isNull boolean

loadSection(Page, String)

Load a section of the given referenced page identified by its section name.
Method name Return type Available since
loadSection(Page, String) Section 4.2

print

Method name Return type Available since
print void

resetTo(IDProvider, String)

Reset the reference and the remote information and infer settings for UID and UidType.
Method name Return type Available since
resetTo(IDProvider, String) void 4.2.202

set(IDProvider)

Set a new element reference of type IDProvider and infer settings for UID and UidType.
Method name Return type Available since
set(IDProvider) void 4.2

set(String, Object)

Method name Return type Available since
set(String, Object) Object

setRemoteSymName(String)

If the set element is a remote project reference, this method set the symbolic remote project name definied in the local project configuration.
Method name Return type Available since
setRemoteSymName(String) void 4.2

setSection(Section)

Set the section to be referenced.
Method name Return type Available since
setSection(Section) void 4.2

setSectionName(String)

Use this to set the section.
Method name Return type Available since
setSectionName(String) void 4.2

setUid(String)

Set the Uid of the referenced element.
Method name Return type Available since
setUid(String) void 4.2

setUidType(IDProvider$UidType)

Set the IDProvider.UidType of the referenced element.
Method name Return type Available since
setUidType(IDProvider$UidType) void 4.2

toJSON

Convert to a JSON-compatible string representation including necessary quotes and escaping for immediate use. Handles Maps, Collections, Arrays, Numbers, Strings, Boolean, Date, and JsonElement. A date instance will be converted to an ISO-8601 formatted date string. Any object other than above will be converted using its 'toString()' value.
Method name Return type Available since
toJSON String 5.2.11

toString

Method name Return type Available since
toString String

type

Method name Return type Available since
type String

© 2005 - 2023 Crownpeak Technology GmbH | All rights reserved. | FirstSpirit 2023.2 | Data privacy