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 |
Defines parameters which may be used to filter the output of a data stream object. | List<Parameter<?>> getDefinedParameters()
These parameter objects may be configured and obtained using a parameter factory of type Parameter.Factory. | |
void setFilter(ParameterMap) | ||
Allows updates to filter parameters based upon various events. | List<Parameter<?>> updateParameters( | |
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< | |
void setAssociation(A) | ||
Note: The page Data Association provides details about this aspect as well as the data association handler class. | ||