Class PersistTasks
java.lang.Object
ch.tocco.nice2.persist.core.api.exec.tasks.PersistTasks
Deprecated.
this (huge) class is now deprecated in favor for the api in exec package or classes in task2 package.
many convenience methods are not necessary anymore, because combination should now be much less noisy
-
Method Summary
Modifier and TypeMethodDescriptionstatic PersistTaskBase
<Relation, Entity> addRelation
(Entity entity) Deprecated.Task that adds an entity to a relation.static PersistTaskBase
<String, Entity> Deprecated.Task that creates a new entity using the entity model given as argument.static PersistTaskBase
<Void, Entity> createEntity
(String modelName) Deprecated.Task that creates a new entity using the given entity model.static <A,
B> PersistListTask <Iterable<A>, Optional<B>> expandTask
(PersistTask<A, B> task) Deprecated.please use api in exec packagestatic <A,
B> PersistListTask <Iterable<A>, Optional<B>> expandTask
(PersistTask<A, B> task, boolean collectResults) Deprecated.please use api in exec packagestatic <A,
B> PersistListTask <Iterable<A>, B> expandTaskFlat
(PersistTask<A, B> task, boolean collectResults) Deprecated.please use api in exec packagestatic <A> PersistTask
<Optional<A>, A> Deprecated.static <A,
B, C> PersistListTask <A, C> flatMap
(PersistTask<A, ? extends Iterable<B>> listTask, PersistTask<B, C> singleTask) Deprecated.Same asmap(PersistTask, PersistTask)
but discards anynull
elements in the final result list.static <A,
T> PersistListTask <A, T> flatMapEntity
(PersistTask<A, ? extends Iterable<Entity>> listTask, PersistTask<Entity, T> entityTask) Deprecated.Same asmapEntity(PersistTask, PersistTask)
but discards anynull
elements, thus the elements of the resulting list are not wrapped in anOptional
since they're always not null.static PersistTaskBase
<PrimaryKey, Entity> Deprecated.static PersistTaskBase
<String, Entity> getByPkString
(String entityModel, boolean required) Deprecated.static PersistTaskBase
<String, Entity> getByUniqueId
(String entityModel, boolean required) Deprecated.static PersistTaskBase
<String, EntityManager> Deprecated.A simple task that gets theEntityManager
to an entity model name.static PersistTaskBase
<String, EntityModel> Deprecated.static <V> PersistTaskBase
<Entity, V> getFieldValue
(String fieldName, Class<V> type) Deprecated.Creates a task that reads the value of a field.static PersistTaskBase
<Iterable<Entity>, Entity> getFirst()
Deprecated.Returns the first entity of the entity list ornull
.static PersistTaskBase
<Entity, Entity> getRelatedEntity
(String relationName, boolean required) Deprecated.Resolves the related entitystatic PersistTaskBase
<Iterable<Entity>, Entity> Deprecated.Returns the first entity of the entity list ornull
if no element is available.static <A> PersistTaskBase
<A, A> identity()
Deprecated.static <X> EntityListTask
<X> lift
(EntityList list) Deprecated.Lifts the given value into anEntityListTask
that will simply return it, regardless of its argument.static <X,
A> PersistListTask <X, A> Deprecated.Lifts the given iterable into aPersistListTask
that will simply return it on each invocation, regardless of its argument.static <A,
B, C> PersistListTask <A, Optional<C>> map
(PersistTask<A, ? extends Iterable<B>> listTask, PersistTask<B, C> singleTask) Deprecated.Creates a new task that will execute the first task and then applying the second task to each element of the result of the first task.static <A,
T> PersistListTask <A, Optional<T>> mapEntity
(PersistTask<A, ? extends Iterable<Entity>> listTask, PersistTask<Entity, T> entityTask) Deprecated.Creates a composed task which applies the second task to each element of the result of the first task.static OptionalTask
<QueryBuilder, Query> Deprecated.static EntityListTask
<QueryBuilder> Deprecated.static PersistTaskBase
<Entity, Relation> Deprecated.Task that resolves a relation.static PersistTaskBase
<Entity, Entity> setFieldValue
(String fieldName, Object value) Deprecated.static PersistTaskBase
<Relation, Entity> setRelation
(Entity entity) Deprecated.Task that sets an entity to a relation.static PersistTaskBase
<Entity, Entity> setRelation
(String relationName, boolean required, Entity entity) Deprecated.Task that sets an entity to a relation.static <A,
L extends Iterable<Entity>>
EntityListTask<A> toEntityListTask
(PersistTask<A, L> task) Deprecated.Enriches a simplePersistTask
that producesEntityList
s with acompose
andmap
method by wrapping it in anEntityListTaskWrapper
.static <A,
T> PersistListTask <A, T> toPersistListTask
(PersistTask<A, ? extends Iterable<T>> task) Deprecated.Wraps the given task into a wrapper that defines methods specific for the return type of list.static PersistTaskBase
<Entity, Entity> Deprecated.
-
Method Details
-
filterOptionals
Deprecated. -
lift
Deprecated.Lifts the given iterable into aPersistListTask
that will simply return it on each invocation, regardless of its argument. -
lift
Deprecated.Lifts the given value into anEntityListTask
that will simply return it, regardless of its argument. -
unwrapEntityHolder
Deprecated. -
getEntityManager
Deprecated.A simple task that gets theEntityManager
to an entity model name. -
getEntityModel
Deprecated.Simple task that returns theEntityModel
to an model name. -
identity
Deprecated. -
queryBuilder
Deprecated.A task that creates aQuery
out of aQueryBuilder
. -
queryBuilderQuery
Deprecated.A task that executes a query obtained from aQueryBuilder
. -
mapEntity
public static <A,T> PersistListTask<A,Optional<T>> mapEntity(PersistTask<A, ? extends Iterable<Entity>> listTask, PersistTask<Entity, T> entityTask) Deprecated.Creates a composed task which applies the second task to each element of the result of the first task. All results are collected in a list.null
values are also collected and therefore elements are wrapped in anOptional
.The returned task will never return
null
. If thelistTask
did not return a value or the entity list is empty an emptyList<Optional<T>>
is returned. -
flatMapEntity
public static <A,T> PersistListTask<A,T> flatMapEntity(PersistTask<A, ? extends Iterable<Entity>> listTask, PersistTask<Entity, T> entityTask) Deprecated.Same asmapEntity(PersistTask, PersistTask)
but discards anynull
elements, thus the elements of the resulting list are not wrapped in anOptional
since they're always not null. -
map
public static <A,B, PersistListTask<A,C> Optional<C>> map(PersistTask<A, ? extends Iterable<B>> listTask, PersistTask<B, C> singleTask) Deprecated.Creates a new task that will execute the first task and then applying the second task to each element of the result of the first task. The second task is therefore executed for each element in the result list of the first task. All final results are collected in a list. Sincenull
values are possible, the elements are wrapped in anOptional
.- Parameters:
listTask
- the first task, creating a result listsingleTask
- the task that is applied to each element of the result list- See Also:
-
flatMap
public static <A,B, PersistListTask<A,C> C> flatMap(PersistTask<A, ? extends Iterable<B>> listTask, PersistTask<B, C> singleTask) Deprecated.Same asmap(PersistTask, PersistTask)
but discards anynull
elements in the final result list. Thus the elements are not wrapped in anOptional
. -
toEntityListTask
public static <A,L extends Iterable<Entity>> EntityListTask<A> toEntityListTask(PersistTask<A, L> task) Deprecated.Enriches a simplePersistTask
that producesEntityList
s with acompose
andmap
method by wrapping it in anEntityListTaskWrapper
. -
toPersistListTask
public static <A,T> PersistListTask<A,T> toPersistListTask(PersistTask<A, ? extends Iterable<T>> task) Deprecated.Wraps the given task into a wrapper that defines methods specific for the return type of list. -
getFirst
Deprecated.Returns the first entity of the entity list ornull
. -
getSingle
Deprecated.Returns the first entity of the entity list ornull
if no element is available. If more than one element is found, an exception is thrown. -
getRelatedEntity
public static PersistTaskBase<Entity,Entity> getRelatedEntity(String relationName, boolean required) Deprecated.Resolves the related entity- Parameters:
relationName
- the relation to resolverequired
- controls whether the relation model must exist or not
-
getFieldValue
Deprecated.Creates a task that reads the value of a field. -
setFieldValue
Deprecated. -
resolve
Deprecated.Task that resolves a relation. Therequired
argument controls whether the relation model must exist or not. -
setRelation
Deprecated.Task that sets an entity to a relation.- Parameters:
entity
- the entity to be set on the relation- Returns:
- the entity where the relation was resolved and set (source)
-
addRelation
Deprecated.Task that adds an entity to a relation.- Parameters:
entity
- the entity to be set on the relation- Returns:
- the entity where the relation was resolved and set (source)
-
setRelation
public static PersistTaskBase<Entity,Entity> setRelation(String relationName, boolean required, Entity entity) Deprecated.Task that sets an entity to a relation. Therequired
argument controls whether the relation model must exist or not.- Parameters:
relationName
- a relation namerequired
- controls whether the relation model must exist or notentity
- the entity to be set on the relation- Returns:
- the entity where the relation was resolved and set (source)
-
createEntity
Deprecated.Task that creates a new entity using the entity model given as argument. -
createEntity
Deprecated.Task that creates a new entity using the given entity model. -
getByUniqueId
@Deprecated public static PersistTaskBase<String,Entity> getByUniqueId(String entityModel, boolean required) Deprecated.Task that looks up an entity by the given unqiue id. Therequired
argument controls whether the entity must exist or not. -
getByPk
@Deprecated public static PersistTaskBase<PrimaryKey,Entity> getByPk(String entityModel, boolean required) Deprecated.Task that looks up an entity by its primary key. Therequired
argument controls whether the entity must exist or not. -
getByPkString
@Deprecated public static PersistTaskBase<String,Entity> getByPkString(String entityModel, boolean required) Deprecated.Task that looks up an entity by its primary key. Therequired
parameter controls whether the entity must exists or not. -
expandTask
@Deprecated public static <A,B> PersistListTask<Iterable<A>,Optional<B>> expandTask(PersistTask<A, B> task, boolean collectResults) Deprecated.please use api in exec packageReturns a new task that accepts a list of arguments and applies each of it to the given task. IfcollectResults
istrue
, the results are collected and returned as a list. Otherwise the returned list is empty. -
expandTaskFlat
@Deprecated public static <A,B> PersistListTask<Iterable<A>,B> expandTaskFlat(PersistTask<A, B> task, boolean collectResults) Deprecated.please use api in exec packageReturns a new task that accepts a list of arguments and applies each of it to the given task. IfcollectResults
istrue
, the results are collected and returned as a list. Otherwise the returned list is empty. -
expandTask
@Deprecated public static <A,B> PersistListTask<Iterable<A>,Optional<B>> expandTask(PersistTask<A, B> task) Deprecated.please use api in exec packageReturns a new task that accepts a list of arguments and applies each of it to the given task. The results are collected and returned as a list. Same asexpandTask(task, true)
-