Class PersistTasks

java.lang.Object
ch.tocco.nice2.persist.core.api.exec.tasks.PersistTasks

@Deprecated public final class PersistTasks extends Object
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 Details

    • filterOptionals

      public static <A> PersistTask<Optional<A>,A> filterOptionals()
      Deprecated.
    • lift

      public static <X, A> PersistListTask<X,A> lift(Iterable<A> result)
      Deprecated.
      Lifts the given iterable into a PersistListTask that will simply return it on each invocation, regardless of its argument.
    • lift

      public static <X> EntityListTask<X> lift(EntityList list)
      Deprecated.
      Lifts the given value into an EntityListTask that will simply return it, regardless of its argument.
    • unwrapEntityHolder

      @Deprecated public static PersistTaskBase<Entity,Entity> unwrapEntityHolder()
      Deprecated.
    • getEntityManager

      public static PersistTaskBase<String,EntityManager> getEntityManager()
      Deprecated.
      A simple task that gets the EntityManager to an entity model name.
    • getEntityModel

      @Deprecated public static PersistTaskBase<String,EntityModel> getEntityModel()
      Deprecated.
      Simple task that returns the EntityModel to an model name.
    • identity

      public static <A> PersistTaskBase<A,A> identity()
      Deprecated.
    • queryBuilder

      @Deprecated public static OptionalTask<QueryBuilder,Query> queryBuilder()
      Deprecated.
      A task that creates a Query out of a QueryBuilder.
    • queryBuilderQuery

      @Deprecated public static EntityListTask<QueryBuilder> queryBuilderQuery()
      Deprecated.
      A task that executes a query obtained from a QueryBuilder.
    • 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 an Optional.

      The returned task will never return null. If the listTask did not return a value or the entity list is empty an empty List<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 as mapEntity(PersistTask, PersistTask) but discards any null elements, thus the elements of the resulting list are not wrapped in an Optional since they're always not null.
    • map

      public 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. 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. Since null values are possible, the elements are wrapped in an Optional.

      Parameters:
      listTask - the first task, creating a result list
      singleTask - the task that is applied to each element of the result list
      See Also:
    • flatMap

      public static <A, B, C> PersistListTask<A,C> flatMap(PersistTask<A,? extends Iterable<B>> listTask, PersistTask<B,C> singleTask)
      Deprecated.
      Same as map(PersistTask, PersistTask) but discards any null elements in the final result list. Thus the elements are not wrapped in an Optional.
    • toEntityListTask

      public static <A, L extends Iterable<Entity>> EntityListTask<A> toEntityListTask(PersistTask<A,L> task)
      Deprecated.
      Enriches a simple PersistTask that produces EntityLists with a compose and map method by wrapping it in an EntityListTaskWrapper.
    • 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

      public static PersistTaskBase<Iterable<Entity>,Entity> getFirst()
      Deprecated.
      Returns the first entity of the entity list or null.
    • getSingle

      public static PersistTaskBase<Iterable<Entity>,Entity> getSingle()
      Deprecated.
      Returns the first entity of the entity list or null 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 resolve
      required - controls whether the relation model must exist or not
    • getFieldValue

      public static <V> PersistTaskBase<Entity,V> getFieldValue(String fieldName, Class<V> type)
      Deprecated.
      Creates a task that reads the value of a field.
    • setFieldValue

      public static PersistTaskBase<Entity,Entity> setFieldValue(String fieldName, Object value)
      Deprecated.
    • resolve

      public static PersistTaskBase<Entity,Relation> resolve(String relationName, boolean required)
      Deprecated.
      Task that resolves a relation. The required argument controls whether the relation model must exist or not.
    • setRelation

      public static PersistTaskBase<Relation,Entity> setRelation(Entity entity)
      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

      public static PersistTaskBase<Relation,Entity> addRelation(Entity entity)
      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. The required argument controls whether the relation model must exist or not.
      Parameters:
      relationName - a relation name
      required - controls whether the relation model must exist or not
      entity - the entity to be set on the relation
      Returns:
      the entity where the relation was resolved and set (source)
    • createEntity

      public static PersistTaskBase<String,Entity> createEntity()
      Deprecated.
      Task that creates a new entity using the entity model given as argument.
    • createEntity

      public static PersistTaskBase<Void,Entity> createEntity(String modelName)
      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. The required 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. The required 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. The required 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 package
      Returns a new task that accepts a list of arguments and applies each of it to the given task. If collectResults is true, 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 package
      Returns a new task that accepts a list of arguments and applies each of it to the given task. If collectResults is true, 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 package
      Returns 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 as expandTask(task, true)