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. Use create(String, Item, String) to create an instance and then getLinkedItem(DbControl, BasicItem).
Since:
3.6
Author:
Nicklas
  • Field Details

  • 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

      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 interface DataLoader<BasicItem>
      exportedProperty - The property to get the value for
      item - The item that holds the value
    • getLinkedItem

      public BasicItem getLinkedItem(DbControl dc, BasicItem item)
      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