Data Access Plug-In
FirstSpirit Developer API Interface: de.espirit.firstspirit.client.plugin.dataaccess.DataAccessPlugin
Developer API documentation: DataAccessPlugin<D>
The data access plug-in class defines a data access plug-in for use in FirstSpirit. It advertises foundational information such as label and icon, creates a session builder which connects the plug-in to its core data access functionality, and optionally provides aspects which mark the data access plug-in usable within the report UIs provided by SiteArchitect and ContentCreator.
Code Example
public class MyDataAccessPlugin implements DataAccessPlugin<MyDataObject> {
private final DataAccessAspectMap _aspects;
private BaseContext _context;
public MyDataAccessPlugin() {
_aspects = new DataAccessAspectMap();
}
@Override
public void setUp(@NotNull final BaseContext context) {
_context = context;
_aspects.put(Reporting.TYPE, new MyReportingAspect(_context));
}
@Nullable
@Override
public <A> A getAspect(@NotNull final DataAccessAspectType<A> type) {
return _aspects.get(type);
}
@NotNull
@Override
public String getLabel() {
return "My Data Access Plug-In";
}
@Nullable
@Override
public Image<?> getIcon() {
if (_context != null) {
final ImageAgent imageAgent = _context.requireSpecialist(ImageAgent.TYPE);
if (_context.is(BaseContext.Env.WEBEDIT)) {
return imageAgent.getImageFromUrl("path/to/myDataAccessPlugin.png");
} else {
return imageAgent.getImageFromIcon(new ImageIcon(getClass().getResource("myDataAccessPlugin.png")));
}
}
return null;
}
@NotNull
@Override
public DataAccessSessionBuilder<MyDataObject> createSessionBuilder() {
return new MyDataAccessSessionBuilder();
}
@Override
public void tearDown() {
}
public static class MyReportingAspect implements Reporting {
private final BaseContext _context;
public MyReportingAspect(@NotNull final BaseContext context) {
_context = context;
}
@Nullable
@Override
public Image<?> getReportIcon(final boolean active) {
final String activityFlag = active ? "active" : "inactive";
final ImageAgent imageAgent = _context.requireSpecialist(ImageAgent.TYPE);
if (_context.is(BaseContext.Env.WEBEDIT)) {
return imageAgent.getImageFromUrl("path/to/myDataAccessPluginReport_" + activityFlag + ".png");
} else {
return imageAgent.getImageFromIcon(
new ImageIcon(getClass().getResource("myDataAccessPluginReport" + activityFlag + ".png"))
);
}
}
}
}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 access plug-in class supports the requested aspect, the method should return an object which implements that aspect; otherwise, it should return null.
Data Access Plug-In Aspects | ||
|---|---|---|
Reporting | ||
Aspect | Description | Methods / Notes |
Specifies that the data access plug-in should be shown as a report in SiteArchitect and ContentCreator and provides a fitting icon. | Image<?> getReportIcon(boolean) | |
Provides interactive items which operate on individual report entries. | ReportItem<D> getClickItem()
| |
Provides interactive items which operate within the context of the entire report (i.e. without association with individual report entries). | Collection<? extends Item<BaseContext>> getStaticItems()
| |
Provides access control for data displayed by a data access plugin. | void verifyAccess() throws AccessDeniedException
Several other environments are available as well but are not listed as they are not relevant to this data access plugin aspect. See Information About the Execution Environment (ODFS) and BaseContext (FirstSpirit API Documentation) for more information. | |
Aspect providing means to determine and report references via the “DataAccess-Plugin”. There are two categories of references which both require a distinct method. | The interface also serves as an adapter, so only the (empty) method required by the “DataAccess-Plugin” needs to be implemented. There are two methods available:
| |

