Class AnyToAnyDataLoader
- java.lang.Object
-
- net.sf.basedb.clients.web.plugins.AnyToAnyDataLoader
-
- All Implemented Interfaces:
DataLoader<BasicItem>
public class AnyToAnyDataLoader extends Object implements DataLoader<BasicItem>
Data loader implementation that load any-to-any links. This implementation can also be used in standalone mode on list page. Usecreate(String, Item, String)
to create an instance and thengetLinkedItem(DbControl, BasicItem)
.- Since:
- 3.6
- Author:
- Nicklas
-
-
Field Summary
Fields Modifier and Type Field Description private String
linkName
private Item
linkType
private Metadata.PropertyPath<BasicItem,?>
propertyPath
-
Constructor Summary
Constructors Constructor Description AnyToAnyDataLoader(String linkName, Item linkType, Metadata.PropertyPath<BasicItem,?> propertyPath)
Load links with the specified name and target type.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static AnyToAnyDataLoader
create(String linkName, Item linkType, String linkProperty)
Create a new data loader that load a value from an any-to-any link.Object
getData(DbControl dc, ExportedProperty exportedProperty, BasicItem item)
Get the value for the specified property.BasicItem
getLinkedItem(DbControl dc, BasicItem item)
Get the item that is linked to by this any-to-any link definition.
-
-
-
Field Detail
-
linkName
private final String linkName
-
linkType
private final Item linkType
-
propertyPath
private final Metadata.PropertyPath<BasicItem,?> propertyPath
-
-
Constructor Detail
-
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 Detail
-
create
public static AnyToAnyDataLoader create(String linkName, Item linkType, String linkProperty)
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
public Object getData(DbControl dc, ExportedProperty exportedProperty, BasicItem item)
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
-
-