Class EntityTemplateTasks
java.lang.Object
ch.tocco.nice2.persist.entity.spi.template.EntityTemplateTasks
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
A task that executes another task once and caches the result as instance member.static class
A task that expects an entity model name and a template id in form `Tuple.of(baseModel, id)` and will then perform a query to fetch all template entities with those properties and relUser empty or equal to the current User.static class
A task that loads previously saved relation values for a template back into the template entity.static class
Task that creates a new empty template entity (entity of model `Entity_template`).static class
A task that takes a template entity and sets all fields read from a concrete base entity, given by its primary key.static class
A task to create the specialTemplateEntity
from a normalEntity
of model `Entity_template`.static class
A task that expects a template entity (of model Entity_template) or a "normal" entity and creates an URI for it. -
Method Summary
Modifier and TypeMethodDescriptionstatic <A,
B> PersistTask <A, B> cached
(PersistTask<A, B> task) static PersistTask
<Tuple2<EntityModel, String>, TemplateEntity> createEmpty
(TypeManager typeManager, CommandExecutor executor, Set<TemplateEntityFieldHandler> fieldHandlers, TemplateBlacklist templateBlacklist) Creates a new emptyTemplateEntity
.static PersistTask
<String, Void> Returns a task that will delete a template given its id.static PersistTask
<TemplateEntity, TemplateEntity> filler
(Entity entity, TemplateBlacklist templateBlacklist) filler task that does not clear empty relationsstatic PersistTask
<TemplateEntity, TemplateEntity> filler
(Entity entity, TemplateBlacklist templateBlacklist, boolean clearRelations) Returns a task that reads all values from the base entity of the given key and sets them into the template argument.static PersistTask
<Entity, TemplateEntity> mapper
(TypeManager typeManager, CommandExecutor executor, Set<TemplateEntityFieldHandler> fieldHandlers, TemplateBlacklist templateBlacklist) Returns a task that can create aTemplateEntity
based on the given entity of model `Entity_template`.static PersistTask
<Tuple2<String, String>, TemplateEntity> templateLoader
(TypeManager typeManager, CommandExecutor executor, Set<TemplateEntityFieldHandler> fieldHandlers, TemplateBlacklist templateBlacklist) Returns a task that finds the one and only template entity for the given id (consisting of base model name and template id).
-
Method Details
-
deleteTemplate
Returns a task that will delete a template given its id. If the template does not exists, the task will return `None` instead of throwing an exception. -
templateLoader
public static PersistTask<Tuple2<String,String>, templateLoaderTemplateEntity> (TypeManager typeManager, CommandExecutor executor, Set<TemplateEntityFieldHandler> fieldHandlers, TemplateBlacklist templateBlacklist) Returns a task that finds the one and only template entity for the given id (consisting of base model name and template id). It returns `null`, if no such template exists. -
mapper
public static PersistTask<Entity,TemplateEntity> mapper(TypeManager typeManager, CommandExecutor executor, Set<TemplateEntityFieldHandler> fieldHandlers, TemplateBlacklist templateBlacklist) Returns a task that can create aTemplateEntity
based on the given entity of model `Entity_template`. -
createEmpty
public static PersistTask<Tuple2<EntityModel,String>, createEmptyTemplateEntity> (TypeManager typeManager, CommandExecutor executor, Set<TemplateEntityFieldHandler> fieldHandlers, TemplateBlacklist templateBlacklist) Creates a new emptyTemplateEntity
. The required information is the base model and an new template id that must not exists for this base model. -
filler
public static PersistTask<TemplateEntity,TemplateEntity> filler(Entity entity, TemplateBlacklist templateBlacklist) filler task that does not clear empty relations- See Also:
-
filler
public static PersistTask<TemplateEntity,TemplateEntity> filler(Entity entity, TemplateBlacklist templateBlacklist, boolean clearRelations) Returns a task that reads all values from the base entity of the given key and sets them into the template argument. -
cached
-