Package net.sf.basedb.util.listable
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 Summary
Fields Modifier and Type Field Description private boolean
avoiding
private Map<Item,Set<Integer>>
collectedByItemType
private boolean
collecting
private DbControl
dc
private Collection<Include>
include
-
Constructor Summary
Constructors Constructor Description TransformContext(DbControl dc)
Creates a new transformation context that will use the given DbControl for database access. -
Method Summary
Modifier and Type Method Description Set<Integer>
avoid(Item itemType, Set<Integer> source)
Avoid collected items by removing them from the source set.Set<Integer>
collect(Item itemType, Set<Integer> source)
Store collected items for later use if collecting has been enabled.TransformCache
getCache()
Get a cache that can be used for storing transformation results for some time.DbControl
getDbControl()
Get the DbControl to use in this transformation context.Collection<Include>
getInclude()
Include options when executing queries to find parent/child items.boolean
isAvoiding()
boolean
isCollecting()
void
resetCollected()
Clear all collected items and disable both 'collecting' and 'avoiding'.void
setAvoiding()
Shortcut for enabling 'avoiding' and disabling 'collecting'.void
setAvoiding(boolean avoiding)
Enable/disable avoiding of returning any source items that has been previously collected.void
setCollecting()
Shortcut for enabling 'collecting' and disabling 'avoiding'.void
setCollecting(boolean collecting)
Enable/disable collecting of all source items that the transformers in this context are using.void
setInclude(Collection<Include> include)
-
Field Details
-
dc
-
include
-
collecting
private boolean collecting -
avoiding
private boolean avoiding -
collectedByItemType
-
-
Constructor Details
-
TransformContext
Creates a new transformation context that will use the given DbControl for database access.
-
-
Method Details
-
getDbControl
Get the DbControl to use in this transformation context. -
getInclude
Include options when executing queries to find parent/child items. Default is Include.ALL. -
setInclude
-
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
Store collected items for later use if collecting has been enabled.- Returns:
- The source items
-
avoid
Avoid collected items by removing them from the source set. Note that this method modified the source set directly.- Returns:
- The source set
-