Class TransformContext

java.lang.Object
net.sf.basedb.util.listable.TransformContext

public class TransformContext extends Object
Transformation context that can be used to keep track of vital information when doing multi-step transformations.
Since:
3.5
Author:
Nicklas
  • Field Details

    • dc

      private final DbControl dc
    • include

      private Collection<Include> include
    • collecting

      private boolean collecting
    • avoiding

      private boolean avoiding
    • collectedByItemType

      private Map<Item,Set<Integer>> collectedByItemType
  • Constructor Details

    • TransformContext

      public TransformContext(DbControl dc)
      Creates a new transformation context that will use the given DbControl for database access.
  • Method Details

    • getDbControl

      public DbControl getDbControl()
      Get the DbControl to use in this transformation context.
    • getInclude

      public Collection<Include> getInclude()
      Include options when executing queries to find parent/child items. Default is Include.ALL.
    • setInclude

      public void setInclude(Collection<Include> include)
    • getCache

      public TransformCache getCache()
      Get a cache that can be used for storing transformation results for some time. The cache is stored in the current session and is lost if the user logs out.
      Since:
      3.16
    • setCollecting

      public void setCollecting(boolean collecting)
      Enable/disable collecting of all source items that the transformers in this context are using.
      Since:
      3.19.5
    • setCollecting

      public void setCollecting()
      Shortcut for enabling 'collecting' and disabling 'avoiding'.
      Since:
      3.19.5
    • isCollecting

      public boolean isCollecting()
    • setAvoiding

      public void setAvoiding(boolean avoiding)
      Enable/disable avoiding of returning any source items that has been previously collected.
      Since:
      3.19.5
    • setAvoiding

      public void setAvoiding()
      Shortcut for enabling 'avoiding' and disabling 'collecting'.
      Since:
      3.19.5
    • isAvoiding

      public boolean isAvoiding()
    • resetCollected

      public void resetCollected()
      Clear all collected items and disable both 'collecting' and 'avoiding'.
      Since:
      3.19.5
    • collect

      public Set<Integer> collect(Item itemType, Set<Integer> source)
      Store collected items for later use if collecting has been enabled.
      Returns:
      The source items
    • avoid

      public Set<Integer> avoid(Item itemType, Set<Integer> source)
      Avoid collected items by removing them from the source set. Note that this method modified the source set directly.
      Returns:
      The source set