Class GroupbyTask
java.lang.Object
ch.tocco.nice2.persist.core.api.exec.tasks2.GroupbyTask
- All Implemented Interfaces:
OptionalTask<EntityList,
,com.google.common.collect.ImmutableMultimap<GroupbyTask.Key, Entity>> PersistTask<EntityList,
com.google.common.collect.ImmutableMultimap<GroupbyTask.Key, Entity>>
public final class GroupbyTask
extends Object
implements OptionalTask<EntityList,com.google.common.collect.ImmutableMultimap<GroupbyTask.Key,Entity>>
This task partitions a given entity list according to the result of resolving
a path against each entity in the list. A path can "end in" an relation, like
`relA.relB`, or in a field like `relA.unique_id` (a single field name is the
simplest form).
It returns a multi map where the key corresponds to the result of resolving
the path against an entity in the list. Thus it is either an entity or the
value of some field. The
GroupbyTask.Key
represents this: either one
of GroupbyTask.Key.getEntity()
or GroupbyTask.Key.getField()
will be present. If the result is `null` then the special key
GroupbyTask.Key.NULL
is used.-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncom.google.common.collect.ImmutableMultimap
<GroupbyTask.Key, Entity> doRun
(EntityList entityHolders, CommandContext ctx) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface ch.tocco.nice2.persist.core.api.exec.OptionalTask
run
Methods inherited from interface ch.tocco.nice2.persist.core.api.exec.PersistTask
andThenDo, compose, compose2, composeWhen, discardResult, expand, expand, getDescription, ifElse, logTime, orWhen, orWhenNot, passWhen, passWhenNot, skipErrors, unwrap
-
Constructor Details
-
GroupbyTask
-
GroupbyTask
-
-
Method Details
-
doRun
public com.google.common.collect.ImmutableMultimap<GroupbyTask.Key,Entity> doRun(EntityList entityHolders, CommandContext ctx) throws Exception - Specified by:
doRun
in interfaceOptionalTask<EntityList,
com.google.common.collect.ImmutableMultimap<GroupbyTask.Key, Entity>> - Throws:
Exception
-