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

Entity data typeAvailable from FirstSpirit Version 4.0

Value range of the Entity data type

Datasets can be maintained in the tables of the Content Store. These datasets can be output and further processed in FirstSpirit. In addition, there are several input components in which one or several datasets can be selected.

A dataset is represented by the Entity data type. On the one hand the dataset includes the individual columns with their values and on the other meta information, e.g. the last editor.

For further information on the Entity data type, see API documentation: de.espirit.firstspirit.access.or.schema.Entity

Methods on Entity objects

The table below lists all methods which can be invoked on objects of data type Entity.

Method name Return type Brief description Available since
clear void
compute(Object, BiFunction) Object
computeIfAbsent(Object, Function) Object
computeIfPresent(Object, BiFunction) Object
containsKey(Object) boolean
containsValue(Object) boolean
copy Entity Copies this entity. 4.0.55
copyFrom(Entity) void Copy the values of the given entity to this entity. 4.0.17
copyOf(Map) Map
entry(Object, Object) Map$Entry
entrySet Set
equals(Object) boolean
forEach(BiConsumer) void
get(Set) Set
get(Collection) List
get(String) Object Value of a key
get(Object) Object
get(String, String) Object
getAttributeNames Collection Return a collection of the attributes declared for this entity. 4.0.17
getClass Class Class of the invoking object
getDataset(TableTemplate) Dataset Dataset erhalten
getDataset(String) Dataset
getEditor User The last user of the content store data
getEntityType EntityType Return the type of this entity. 4.0.17
getGid UUID Returns the gid of this entity, if the session supports gids and the gid is already created, else null. 5.0.100
getId Object
getIdentifier Identifier Return the identifier of this entity. 4.0.17
getKeyValue KeyValue Return the business key of this entity or null if this entity is in state NEW. 4.0.17
getLastChange Date
getList(String) List Return the value of the specified list attribute ("to N relation"). 4.0.55
getOrDefault(Object, Object) Object
getReleasedBy User
getSession Session Returns the session which was used to create or retrieve this entity. 4.0.17
getState Entity$PersistentState Return the state of this entity. 4.0.17
getValue(String) Object Return the value of the attribute specified by the given name. 4.0.17
getValue(Attribute) Object Return the value of the given attribute or null. 4.0.17
isCase(Object) boolean 4.2.14
isEmpty boolean Checks whether an expression is empty
isNull boolean Checks whether an expression is null (zero)
isReleased boolean Return true if this entity is released else false. 4.0.17
isValid boolean Return true if this entity is valid else false. 4.0.17
keySet Set
merge(Object, Object, BiFunction) Object
of Map
of(Object, Object) Map
of(Object, Object, Object, Object) Map
of(Object, Object, Object, Object, Object, Object) Map
of(Object, Object, Object, Object, Object, Object, Object, Object) Map
of(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object) Map
of(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object) Map
of(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object) Map
of(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object) Map
of(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object) Map
of(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object) Map
ofEntries(Map$Entry[]) Map
print void
put(Object, Object) Object
putAll(Map) void
putIfAbsent(Object, Object) Object
refresh void Refresh the content of this entity with the one stored in the database. 4.0.24
remove(Object) Object
remove(Object, Object) boolean
replace(Object, Object) Object
replace(Object, Object, Object) boolean
replaceAll(BiFunction) void
rollback void Revert all attribute changes. 4.0.17
rollbackWithRelations void Reset all changes, including relations (i.e. this may rollback delete operations of entities which has been set in relation to this entity). 4.0.416
set(String, Object) Object
set(Object, Object) Map
setValue(String, Object) void Set the value of the attribute with name to the given value. 4.0.17
setValue(Attribute, Object) void Set the value of the attribute attribute to value. 4.0.17
size int Number of the key/value pairs
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
values Collection

clear

Method name Return type Available since
clear void

compute(Object, BiFunction)

Method name Return type Available since
compute(Object, BiFunction) Object

computeIfAbsent(Object, Function)

Method name Return type Available since
computeIfAbsent(Object, Function) Object

computeIfPresent(Object, BiFunction)

Method name Return type Available since
computeIfPresent(Object, BiFunction) Object

containsKey(Object)

Method name Return type Available since
containsKey(Object) boolean

containsValue(Object)

Method name Return type Available since
containsValue(Object) boolean

copy

Copies this entity.
Method name Return type Available since
copy Entity 4.0.55

copyFrom(Entity)

Copy the values of the given entity to this entity.
Method name Return type Available since
copyFrom(Entity) void 4.0.17

copyOf(Map)

Method name Return type Available since
copyOf(Map) Map

entry(Object, Object)

Method name Return type Available since
entry(Object, Object) Map$Entry

entrySet

Method name Return type Available since
entrySet Set

equals(Object)

Method name Return type Available since
equals(Object) boolean

forEach(BiConsumer)

Method name Return type Available since
forEach(BiConsumer) void

get(Set)

Method name Return type Available since
get(Set) Set

get(Collection)

Method name Return type Available since
get(Collection) List

get(String)

A map contains key/value pairs. The .get(String) method can be used to determine the value of the transferred key.

If a map contains the following key/value pairs:

1st pair: key="Max", value="Mustermann"
2nd pair: key="Franz", value="Meier"
3rd pair: key="Peter", value="Müller"

results in the invocation

MAP.get("Franz")

for return of a character string (cf. java.lang.String ) with the content

Meier
Method name Return type Available since
get(String) Object

get(Object)

Method name Return type Available since
get(Object) Object

get(String, String)

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

getAttributeNames

Return a collection of the attributes declared for this entity.
Method name Return type Available since
getAttributeNames Collection 4.0.17

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

getDataset(TableTemplate)

You can use this method to determine in a template a Dataset from an Entity (which, for example, is generated by the contentSelect function.
This method expects the input of a reference name of the respective table template in quotation marks.

Example:

$CMS_FOR(_entity, cs_press_releases)$
$CMS_SET(_dataset, _entity.getDataset("products.product"))$
$-- ... --$
$CMS_END_FOR$

Here cs_press_releases is the variable / identifier of the contentSelect function, products.product is the reference name of the table template.

Alternatively, the following notation can be used. In this case, the conversion already takes place when the FOR loop is called.

$CMS_FOR(_dataset, cs_press_releases.map(entity->entity.getDataset("products.product")))$
$-- ... --$
$CMS_END_FOR$

If the Dataset cannot be determined, null is returned.

Method name Return type Available since
getDataset(TableTemplate) Dataset

getDataset(String)

Method name Return type Available since
getDataset(String) Dataset

getEditor

The .getEditor() returns the last user of the content store data. The returned User object can be used to output information about the user, e.g. abbreviation, name, etc.

Method name Return type Available since
getEditor User

getEntityType

Return the type of this entity.
Method name Return type Available since
getEntityType EntityType 4.0.17

getGid

Returns the gid of this entity, if the session supports gids and the gid is already created, else null.
Method name Return type Available since
getGid UUID 5.0.100

getId

Method name Return type Available since
getId Object

getIdentifier

Return the identifier of this entity.
Method name Return type Available since
getIdentifier Identifier 4.0.17

getKeyValue

Return the business key of this entity or null if this entity is in state NEW.
Method name Return type Available since
getKeyValue KeyValue 4.0.17

getLastChange

Method name Return type Available since
getLastChange Date

getList(String)

Return the value of the specified list attribute ("to N relation").
Method name Return type Available since
getList(String) List 4.0.55

getOrDefault(Object, Object)

Method name Return type Available since
getOrDefault(Object, Object) Object

getReleasedBy

Method name Return type Available since
getReleasedBy User

getSession

Returns the session which was used to create or retrieve this entity.
Method name Return type Available since
getSession Session 4.0.17

getState

Return the state of this entity.
Method name Return type Available since
getState Entity$PersistentState 4.0.17

getValue(String)

Return the value of the attribute specified by the given name.
Method name Return type Available since
getValue(String) Object 4.0.17

getValue(Attribute)

Return the value of the given attribute or null.
Method name Return type Available since
getValue(Attribute) Object 4.0.17

isCase(Object)

Method name Return type Available since
isCase(Object) boolean 4.2.14

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 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

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

isReleased

Return true if this entity is released else false.
Method name Return type Available since
isReleased boolean 4.0.17

isValid

Return true if this entity is valid else false.
Method name Return type Available since
isValid boolean 4.0.17

keySet

Method name Return type Available since
keySet Set

merge(Object, Object, BiFunction)

Method name Return type Available since
merge(Object, Object, BiFunction) Object

of

Method name Return type Available since
of Map

of(Object, Object)

Method name Return type Available since
of(Object, Object) Map

of(Object, Object, Object, Object)

Method name Return type Available since
of(Object, Object, Object, Object) Map

of(Object, Object, Object, Object, Object, Object)

Method name Return type Available since
of(Object, Object, Object, Object, Object, Object) Map

of(Object, Object, Object, Object, Object, Object, Object, Object)

Method name Return type Available since
of(Object, Object, Object, Object, Object, Object, Object, Object) Map

of(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object)

Method name Return type Available since
of(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object) Map

of(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object)

Method name Return type Available since
of(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object) Map

of(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object)

Method name Return type Available since
of(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object) Map

of(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object)

Method name Return type Available since
of(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object) Map

of(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object)

Method name Return type Available since
of(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object) Map

of(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object)

Method name Return type Available since
of(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object) Map

ofEntries(Map$Entry[])

Method name Return type Available since
ofEntries(Map$Entry[]) Map

print

Method name Return type Available since
print void

put(Object, Object)

Method name Return type Available since
put(Object, Object) Object

putAll(Map)

Method name Return type Available since
putAll(Map) void

putIfAbsent(Object, Object)

Method name Return type Available since
putIfAbsent(Object, Object) Object

refresh

Refresh the content of this entity with the one stored in the database.
Method name Return type Available since
refresh void 4.0.24

remove(Object)

Method name Return type Available since
remove(Object) Object

remove(Object, Object)

Method name Return type Available since
remove(Object, Object) boolean

replace(Object, Object)

Method name Return type Available since
replace(Object, Object) Object

replace(Object, Object, Object)

Method name Return type Available since
replace(Object, Object, Object) boolean

replaceAll(BiFunction)

Method name Return type Available since
replaceAll(BiFunction) void

rollback

Revert all attribute changes.
Method name Return type Available since
rollback void 4.0.17

rollbackWithRelations

Reset all changes, including relations (i.e. this may rollback delete operations of entities which has been set in relation to this entity).
Method name Return type Available since
rollbackWithRelations void 4.0.416

set(String, Object)

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

set(Object, Object)

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

setValue(String, Object)

Set the value of the attribute with name to the given value.
Method name Return type Available since
setValue(String, Object) void 4.0.17

setValue(Attribute, Object)

Set the value of the attribute attribute to value.
Method name Return type Available since
setValue(Attribute, Object) void 4.0.17

size

The .size() (in Bean syntax: .size) method returns the number of the key/value pairs in a map.

The returned object is an integer (see java.lang.Integer).

Method name Return type Available since
size int

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

values

Method name Return type Available since
values Collection

© 2005 - 2024 Crownpeak Technology GmbH | All rights reserved. | FirstSpirit 2024.4 | Data privacy