Start page / Plug-In Development / Universal Extensions / Data Access / Data Stream / Builder

Data Stream Builder

FirstSpirit Developer API Interface: de.espirit.firstspirit.client.plugin.dataaccess.DataStreamBuilder
Developer API documentation: DataStreamBuilder<D>

This class is tasked with creating a data stream object.

In order to react to configuration needs when used with FS_INDEX input components, a stream builder class may provide several aspects which can be used to configure the data stream object, e.g. to limit the set of data objects returned by the data stream in some way.

public class MyDataStreamBuilder implements DataStreamBuilder<MyDataObject> {

private final StreamBuilderAspectMap _aspects;

public MyDataStreamBuilder() {
_aspects = new StreamBuilderAspectMap();

_aspects.put(Filterable.TYPE, new MyFilterableAspect());
}

@Nullable
@Override
public <A> A getAspect(@NotNull final StreamBuilderAspectType<A> type) {
return _aspects.get(type);
}

/**
* Create a data stream object. In this case, we're calling a constructor which takes an
* object of type MyFilterableAspect so that the stream object can access the current
* filter settings.
*/
@NotNull
@Override
public DataStream<MyDataObject> createDataStream() {
return new MyDataStream(_aspects.get(Filterable.TYPE));
}

/**
* This implementation of Filterable defines one boolean parameter and otherwise
* receives and provides a ParameterMap with filter settings.
*/
public class MyFilterableAspect implements Filterable {

private ParameterMap _filter;

@NotNull
@Override
public List<Parameter<?>> getDefinedParameters() {
final ParameterBoolean germanText = Parameter.Factory.createBoolean("germanText", "Use German text", false);
return Collections.singletonList(germanText);
}

@Override
public void setFilter(@NotNull final ParameterMap filter) {
_filter = filter;
}

@Nullable
public ParameterMap getFilter() {
return _filter;
}
}
}

Providing Aspects

FirstSpirit occasionally calls the method getAspect(...) with various aspect types as a parameter to identify which input components support a given aspect. If the data stream builder class supports the requested aspect, the method should return an object which implements that aspect; otherwise, it should return null.

Data Stream Builder Aspects

Filter

Aspect

Description

Methods / Notes

Filterable

Defines parameters which may be used to filter the output of a data stream object.

See aspect Updating (below) for a means to dynamically update filter parameters as filter values are changed.

List<Parameter<?>> getDefinedParameters()
provides parameters which will be shown in the filter UI associated with list representations of the data access plug-in.

Parameter objects may be of the following types:

These parameter objects may be configured and obtained using a parameter factory of type Parameter.Factory.

Note: Each filter included in the List returned by getDefinedParameters() should use a unique name (within the domain of the data access plug-in). If two or more filters are provided which use the same name, only the first filter encountered in the list will be rendered and made available for programmatic access; all other filters identified by that name will be silently ignored.

void setFilter(ParameterMap)
sets the currently applied filter settings. The ParameterMap object maps the defined parameters to their specific, current values.

Updating

Allows updates to filter parameters based upon various events.

This aspect may be used for scenarios in which the current value of one filter parameter should influence the set of values available in another filter parameter. E.g., if the user selects the value “Books” in the dropdown filter “Media type”, another dropdown filter “Media” should be updated to offer individual books for selection.

Requires use of the aspect Filterable (see above).

List<Parameter<?>> updateParameters(
@Nullable final ParameterMap,
final List<Parameter<?>>
)

The client program calls this method whenever the values of filter parameters defined for the data access plugin are changed by the user, either in a report or in the selection dialog of an FS_INDEX input component. It will also be called if the report associated with the data access plugin is closed and reopened by the user. The first parameter of this method, a ParameterMap object, provides the values of the filter parameters at the time this update request was triggered. The second parameter, a List of Parameter objects, provides the complete filter parameter definitions as they were at the time this update request was triggered.

Note: The return value only needs to include filter parameters whose definitions have been changed due to the update request.

DataAssociating<T, A>

Specifies that a report based on the data access plug-in (see Data Access Plug-In aspect "Reporting") supports visualization of report entries in the ContentCreator preview.

DataAssociationHandler.Type<
? extends DataAssociationHandler<T, A>
> getAssociationType()

provides the type of a data association handler which is to be used with this report.

void setAssociation(A)
sets an association with the given object, which can be used to configure the data stream object created by the builder object.

Note: The page Data Association provides details about this aspect as well as the data association handler class.

   

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