Start page
Start page

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

Data type DatasetContainerAvailable from FirstSpirit Version 4.2

Value range of the data type DatasetContainer

FirstSpirit provides the data type DatasetContainer for the processing of values which represent structured data from the Content Store of FirstSpirit. The data type DatasetContainer represents a logical grouping of an entity (Entity data type) from a database and the relating table template of a FirstSpirit project.

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

de.espirit.firstspirit.access.editor.value.DatasetContainer

Definition using the standard input components

Using the input component FS_DATASET a dataset is referenced from the Content Store (analogous to the zur input component CMS_INPUT_OBJECTCHOOSER). This input component returns the data type DatasetContainer by means of a $CMS_VALUE(...)$ instruction when accessing the stored value.

Creating DatasetContainer programmatically

If you want to create new DatasetContainer object, which contains a specific entity, programmatically, you can use the methods of the sub-object Factory. This new DatasetContainer can then be assigned as value to a FS_DATASET component.

The methods of the Factory object are specified in the API documentation: de.espirit.firstspirit.access.editor.value.DatasetContainer.Factory

For creating a DatasetContainer a new object of the type DatasetContainer.Factory must be instantiated first. By means of the methods create(...) of this object a data record or an entity, a table template and a project language can be used to create a new DatasetContainer object, configured with these elements. This object will then be assigned to the form of a FS_DATASET input component:

//!Beanshell

import de.espirit.firstspirit.access.store.Store;
import de.espirit.firstspirit.access.editor.value.DatasetContainer;
import de.espirit.firstspirit.access.editor.value.DatasetContainer.Factory;

// Setup
element = context.getElement();
userService = context.getUserService();
projectLanguage = context.getProject().getMasterLanguage();

// Obtain an entity from the Content Store
contentStoreRoot = userService.getStore(Store.Type.CONTENTSTORE);
dataSource = contentStoreRoot.getContent2ByName("myDataSourceUID");
tableTemplate = dataSource.getTemplate();
entity = dataSource.getData().get(0);

//
// Create new DatasetContainer object and assign it to an FS_DATASET input component
//

// Prepare the store element for editing and obtain form data
element.setLock(true, false);
formData = element.getFormData();
fsDatasetField = formData.get(projectLanguage, "fsDatasetComponentLabel");

// Use DatasetContainer.Factory to create a new DatasetContainer with the entity we've obtained earlier
DatasetContainer.Factory datasetContainerFactory = new DatasetContainer.Factory();
DatasetContainer newDatasetContainer = datasetContainerFactory.create(entity, tableTemplate, projectLanguage);

// Assign the new DatasetContainer to the FS_DATASET field and save the store element
fsDatasetField.set(newDatasetContainer);
element.setFormData(formData);
element.save();
element.setLock(false);
element.refresh();

Methods on DatasetContainer objects

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

The object is generated by the following form objects:
FS_DATASET
Method name Return type Brief description Available since
compareTo(Comparable) int
equals(Object) boolean
getClass Class Class of the invoking object
getDataset Dataset
getGid UUID
getKey KeyValue
getLanguage Language
getTemplateUid String
isCase(Object) boolean
isEmpty boolean
isNull boolean Checks whether an expression is null (zero)
print void
set(String, Object) Object
toJson String Convert to JSON string representtion (only handles Maps, Collections, Arrays, Numbers, and Strings) 4.2.14
toString String
type String

compareTo(Comparable)

Method name Return type Available since
compareTo(Comparable) int

equals(Object)

Method name Return type Available since
equals(Object) boolean

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

Method name Return type Available since
getDataset Dataset

getGid

Method name Return type Available since
getGid UUID

getKey

Method name Return type Available since
getKey KeyValue

getLanguage

Method name Return type Available since
getLanguage Language

getTemplateUid

Method name Return type Available since
getTemplateUid String

isCase(Object)

Method name Return type Available since
isCase(Object) boolean

isEmpty

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

print

Method name Return type Available since
print void

set(String, Object)

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

toJson

Convert to JSON string representtion (only handles Maps, Collections, Arrays, Numbers, and Strings)
Method name Return type Available since
toJson String 4.2.14

toString

Method name Return type Available since
toString String

type

Method name Return type Available since
type String

© 2005 - 2015 e-Spirit AG | All rights reserved. | Last change: 2014-03-18