Class AnyToAnyDataLoader
java.lang.Object
net.sf.basedb.clients.web.plugins.AnyToAnyDataLoader
- All Implemented Interfaces:
DataLoader<BasicItem>
Data loader implementation that load any-to-any links. This
implementation can also be used in standalone mode on list page.
Use
create(String, Item, String)
to create an instance
and then getLinkedItem(DbControl, BasicItem)
.- Since:
- 3.6
- Author:
- Nicklas
-
Field Summary
Modifier and TypeFieldDescriptionprivate final String
private final Item
private final Metadata.PropertyPath<BasicItem,
?> -
Constructor Summary
ConstructorDescriptionAnyToAnyDataLoader
(String linkName, Item linkType, Metadata.PropertyPath<BasicItem, ?> propertyPath) Load links with the specified name and target type. -
Method Summary
Modifier and TypeMethodDescriptionstatic AnyToAnyDataLoader
Create a new data loader that load a value from an any-to-any link.getData
(DbControl dc, ExportedProperty exportedProperty, BasicItem item) Get the value for the specified property.getLinkedItem
(DbControl dc, BasicItem item) Get the item that is linked to by this any-to-any link definition.
-
Field Details
-
linkName
-
linkType
-
propertyPath
-
-
Constructor Details
-
AnyToAnyDataLoader
public AnyToAnyDataLoader(String linkName, Item linkType, Metadata.PropertyPath<BasicItem, ?> propertyPath) Load links with the specified name and target type. If not link type or property path is given, only the ID of the target item is returned.- Parameters:
linkName
- Name of the any-to-any link (required)linkType
- Target item type of the link (optional)propertyPath
- Property of the target item to load (optional)
-
-
Method Details
-
create
Create a new data loader that load a value from an any-to-any link.- Parameters:
linkName
- Name of the any-to-any link (required)linkType
- Target item type of the link (optional)linkProperty
- Property of the target item to load (optional)
-
getData
Description copied from interface:DataLoader
Get the value for the specified property.- Specified by:
getData
in interfaceDataLoader<BasicItem>
exportedProperty
- The property to get the value foritem
- The item that holds the value
-
getLinkedItem
Get the item that is linked to by this any-to-any link definition.- Returns:
- The linked item or null if no item exists or if the item is not of the correct target type
-