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

Data type CatalogAccessorAvailable from FirstSpirit Version 5.2R4

Value range of the data type CatalogAccessor

The input component FS_CATALOG allows section or link lists to be created and maintained.
If accessed via the API, it returns a Catalog object; in template set and snippet definitions for templates, on the other hand, a CatalogAccessor object type is returned.
The data type CatalogAccessor uses the same methods as the data type Catalog and also provides the method getSnippets, which can be used to access snippets of entries in an FS_CATALOG component.

For further information on the data type CatalogAccessor, see the API documentation:

de.espirit.firstspirit.client.access.editor.lists.CatalogAccessor

Methods for CatalogAccessor objects

The table below lists all the methods that can be called for objects of the CatalogAccessor data type:

Method name Return type Brief description Available since
add(Object) boolean
addAll(Collection) boolean
clear void
contains(Object) boolean checks if the provided element is contained 4.0.0
containsAll(Collection) boolean checks if all elements of the provided element are contained 4.0.0
copy Collection make a (shallow) copy 4.0.0
create(Template, FormData) Catalog$Card Factory method to create a new card based on the given template and form data. 5.2.6
distinct(Lambda) Collection Output of a list of unique elements 4.1
equals(Object) boolean
filter(String) Object delivers a filtered collection, the last parameter converted to a lambda expression 4.0.0
filter(Lambda) Object Filtering of list elements 4.0.0
find(UUID) Optional Identifying a "Card" by means of the UUID 5.2.181202
find(String) Optional Identifying a "Card" by means of the UUID (convenience) 5.2.181202
fold(Lambda, Map) Object Summarizing values 4.0.0
forEach(Consumer) void
getClass Class Class of the invoking object
getItems List Conversion into a list of FormData 5.2.415
getSnippets List Provides snippets of entries in an FS_CATALOG component 5.2.416
isCase(Object) boolean
isEmpty boolean Checks whether an expression is empty 4.0.0
isNull boolean Checks whether an expression is null (zero)
iterator Iterator
length int
map(String) Object delivers a mapped collection, the last parameter converted to a lambda expression 4.0.0
map(Lambda) Object Output of list elements as collection 4.0.0
max Object delivers the maximum element (only applicable if elements are compareable) 4.0.0
max(Comparator) Object delivers the maximum element concerning to the given comparator 4.0.0
max(Lambda) Object Filtering by the highest value 4.0.0
min Object delivers the minimum element (only applicable if elements are compareable) 4.0.0
min(Comparator) Object delivers the minimum element concerning to the given comparator 4.0.0
min(Lambda) Object Filtering by the lowest value 4.0.0
plus(Collection) Collection appends all elements to this collection (called for operator '+') 4.0.0
print void
print(Object) void
remove(Object) boolean
removeAll(Collection) boolean
removeIf(Predicate) boolean
retainAll(Collection) boolean
set(String, Object) Object
size int the number of contained elements 4.0.0
spliterator Spliterator
toArray Object[]
toArray(Object[]) Object[]
toArray(IntFunction) Object[]
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
toList List Converts a collection to a list. 5.2.416
toString String
toString(String) String Output of elements separated by delimiters as a string 4.0.0
toString(String, String) String Short form for collection.map(attribute).toString(delimiter) 4.0.0
type String

add(Object)

Method name Return type Available since
add(Object) boolean

addAll(Collection)

Method name Return type Available since
addAll(Collection) boolean

clear

Method name Return type Available since
clear void

contains(Object)

checks if the provided element is contained
Method name Return type Available since
contains(Object) boolean 4.0.0

containsAll(Collection)

checks if all elements of the provided element are contained
Method name Return type Available since
containsAll(Collection) boolean 4.0.0

copy

make a (shallow) copy
Method name Return type Available since
copy Collection 4.0.0

create(Template, FormData)

Factory method to create a new card based on the given template and form data.
Method name Return type Available since
create(Template, FormData) Catalog$Card 5.2.6

distinct(Lambda)

This method filters a collection and returns only the first occurrence relating to a lambda expression.

It can be used to eliminate or ignore duplicates of a list according to a given condition. For this reason, it can be used for glossaries or summaries, which can then serve linked, for example, as navigational element.

See page Mapping expressions (lambda).

Method name Return type Available since
distinct(Lambda) Collection 4.1

equals(Object)

Method name Return type Available since
equals(Object) boolean

filter(String)

delivers a filtered collection, the last parameter converted to a lambda expression
Method name Return type Available since
filter(String) Object 4.0.0

filter(Lambda)

If lists have several attributes per element (comparable with a dataset with several columns), the elements can be filtered by the individual attributes using the method .filter(Lambda).

See page Mapping expressions (lambda).

Method name Return type Available since
filter(Lambda) Object 4.0.0

find(UUID)

This method can be used to identify a "Card" by means of its UUID (java.util.UUID).

The UUID of an FS_CATALOG entry can be determined using the getId() method.

Method name Return type Available since
find(UUID) Optional 5.2.181202

find(String)

This method can be used to identify a "Card". It returns java.util.Optional<Card>, which contains the "Card" object (if available).

The text (content of the st_text input component) of a particular entry (in this case the FS_CATALOG entry with the ID 7644cfe2-b117-4ec7-bc94-bb8f255d1f59) can be output with the following example syntax:

$CMS_VALUE(st_catalog.find("7644cfe2-b117-4ec7-bc94-bb8f255d1f59").get().item.st_text)$

The UUID of an FS_CATALOG entry can be determined using the getId() method.

Method name Return type Available since
find(String) Optional 5.2.181202

fold(Lambda, Map)

This method folds the collection with the given lambda expression and start value.

See page Mapping expressions (lambda).

Method name Return type Available since
fold(Lambda, Map) Object 4.0.0

forEach(Consumer)

Method name Return type Available since
forEach(Consumer) void

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

getItems

The getItems method (in Bean syntax: .items) can be used to access Card data directly and work with this data. It returns a list of FormData objects:

IDENTIFIER.items

Here, IDENTIFIER is the variable name for the respective FS_CATALOG input component.

In order to be able to identify and output the value of a certain input component ("FormField") in this list for a snippet definition both the identifier of the required input component and its position in the list must be specified:

st_catalog.items[0].st_text

In this example, the value of "st_text" of the first entry in the FS_CATALOG component is identified with the "st_catalog" identifier.

Method name Return type Available since
getItems List 5.2.415

getSnippets

Using this method (in Bean syntax: .snippets), the snippets of the entries in an FS_CATALOG component can be accessed, e.g.

FS_CATALOG.snippets

The method returns a list. The required element in the list can be returned by indicating the position number (in square brackets; counting starts at 0).
To access the values of the snippets for the various entries in an FS_CATALOG component, the following syntax can be used:

FS_CATALOG_VAR.snippets[0].thumbnail
FS_CATALOG_VAR.snippets[0].header
FS_CATALOG_VAR.snippets[0].extract

In this case

  • thumbnail outputs the value of the Thumbnail field
  • header outputs the value of the Label field
  • extract outputs the value of the Extract field

The snippet definition of, in this case, the first entry in the FS_CATALOG component.
See also Interface DataSnippet (Package de.espirit.firstspirit.agency).

The image is output (field Thumbnail view) using the following example syntax:

<img src="$CMS_REF(FS_CATALOG_VAR.snippets[0].thumbnail.source)$"/>

Using $CMS_SWITCH(...)$ enables the output to be dependent on the type of image object, e.g.

$CMS_SWITCH(FS_CATALOG_VAR.snippets[0].thumbnail.source)$ 
$CMS_CASE(class("de.espirit.firstspirit.access.store.mediastore.Media"))$
thumbnail: <img src="$CMS_REF(FS_CATALOG_VAR.snippets[0].thumbnail.source)$"/>

$CMS_CASE(class("java.lang.String"))$
thumbnail: $CMS_VALUE(FS_CATALOG_VAR.snippets[0].thumbnail.source)$
$CMS_END_SWITCH$

In this example, the output depends on whether the object is a media object (class de.espirit.firstspirit.access.store.mediastore.Media) or a string object (class java.lang.String).

Method name Return type Available since
getSnippets List 5.2.416

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

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

iterator

Method name Return type Available since
iterator Iterator

length

Method name Return type Available since
length int

map(String)

delivers a mapped collection, the last parameter converted to a lambda expression
Method name Return type Available since
map(String) Object 4.0.0

map(Lambda)

See page Mapping expressions (lambda).

Method name Return type Available since
map(Lambda) Object 4.0.0

max

delivers the maximum element (only applicable if elements are compareable)
Method name Return type Available since
max Object 4.0.0

max(Comparator)

delivers the maximum element concerning to the given comparator
Method name Return type Available since
max(Comparator) Object 4.0.0

max(Lambda)

This method delivers the maximum element concerning to the given comparator.

See page Mapping expressions (lambda).

Method name Return type Available since
max(Lambda) Object 4.0.0

min

delivers the minimum element (only applicable if elements are compareable)
Method name Return type Available since
min Object 4.0.0

min(Comparator)

delivers the minimum element concerning to the given comparator
Method name Return type Available since
min(Comparator) Object 4.0.0

min(Lambda)

This method delivers the minimum element concerning to the given comparator.

See page Mapping expressions (lambda).

Method name Return type Available since
min(Lambda) Object 4.0.0

plus(Collection)

appends all elements to this collection (called for operator '+')
Method name Return type Available since
plus(Collection) Collection 4.0.0

print

Method name Return type Available since
print void

print(Object)

Method name Return type Available since
print(Object) void

remove(Object)

Method name Return type Available since
remove(Object) boolean

removeAll(Collection)

Method name Return type Available since
removeAll(Collection) boolean

removeIf(Predicate)

Method name Return type Available since
removeIf(Predicate) boolean

retainAll(Collection)

Method name Return type Available since
retainAll(Collection) boolean

set(String, Object)

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

size

the number of contained elements
Method name Return type Available since
size int 4.0.0

spliterator

Method name Return type Available since
spliterator Spliterator

toArray

Method name Return type Available since
toArray Object[]

toArray(Object[])

Method name Return type Available since
toArray(Object[]) Object[]

toArray(IntFunction)

Method name Return type Available since
toArray(IntFunction) Object[]

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

toList

Converts a collection to a list.
Method name Return type Available since
toList List 5.2.416

toString

Method name Return type Available since
toString String

toString(String)

The individual elements, e.g. of a list, can be output as string, separated by a delimiter which can be chosen freely.

Example:

$CMS_SET(myList, ["House","Key","Window"])$
$CMS_VALUE(myList.toString("; "))$

The elements of the list myList are output, separated each by semicolon and a space character:

House; Key; Window
Method name Return type Available since
toString(String) String 4.0.0

toString(String, String)

Short form for collection.map(attribute).toString(delimiter)
Method name Return type Available since
toString(String, String) String 4.0.0

type

Method name Return type Available since
type String

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