E
- of Entity type
public class EntityBabyPersistTransformer<E> extends EntityPersistTransformer<E>
RelatedEntityPersistTransformer
: This variant is more apt for Updates or simpler cases of updates.EntityPersistTransformer
,
RelatedEntityPersistTransformer
em, exceptions, failFast, messages, tm
Constructor and Description |
---|
EntityBabyPersistTransformer() |
Modifier and Type | Method and Description |
---|---|
Object |
getFieldAccessor()
The field name or accessor, can be a String or a
TwoWayTransformer .If a Transformer then it will apply it over the input to derive the object to persist if its a new born. |
EntityFieldSetter<E,Object> |
getFieldPersist()
Once the new born object is persisted the resultant entity is put back into the parent.
|
org.apache.commons.collections.Predicate |
getPersistCritera()
Checks the field specified by
fieldAccessor if this needs to be persisted or not. |
boolean |
isPersist()
If true will
EntityManager.persist(Object) else will use EntityManager.merge(Object) |
void |
setFieldAccessor(Object fieldAccessor)
The field name or accessor, can be a String or a
TwoWayTransformer .If a Transformer then it will apply it over the input to derive the object to persist if its a new born. |
void |
setFieldPersist(EntityFieldSetter<E,Object> fieldPersist)
Once the new born object is persisted the resultant entity is put back into the parent.
|
void |
setPersist(boolean persist)
If true will
EntityManager.persist(Object) else will use EntityManager.merge(Object) |
void |
setPersistCritera(org.apache.commons.collections.Predicate persistCritera)
Checks the field specified by
fieldAccessor if this needs to be persisted or not. |
E |
write(E record)
Write a record
|
protected void |
write(E record,
Object child)
Write child to parent record
|
close, getExceptions, getMessages, getTransactionDef, handleException, init, isExecuteUnderTransaction, isFailFast, isInitialized, setExceptions, setExecuteUnderTransaction, setFailFast, setMessages, setTransactionDef, transform, write
protected void write(E record, Object child)
record
- as Echild
- as Objectpublic E write(E record)
RealTimeWriter
write
in interface RealTimeWriter<E>
write
in class EntityPersistTransformer<E>
public Object getFieldAccessor()
TwoWayTransformer
.Transformer
then it will apply it over the input to derive the object to persist if its a new born.
If fieldPersist
is not null, and this is not a String, then fieldAccessor
will be used as a TwoWayTransformer.from(Object)
to take the parent object and derive the field name in that
represents the child entitypublic void setFieldAccessor(Object fieldAccessor)
TwoWayTransformer
.Transformer
then it will apply it over the input to derive the object to persist if its a new born.
If fieldPersist
is not null, and this is not a String, then fieldAccessor
will be used as a TwoWayTransformer.from(Object)
to take the parent object and derive the field name in that
represents the child entitypublic EntityFieldSetter<E,Object> getFieldPersist()
public void setFieldPersist(EntityFieldSetter<E,Object> fieldPersist)
public boolean isPersist()
EntityManager.persist(Object)
else will use EntityManager.merge(Object)
public void setPersist(boolean persist)
EntityManager.persist(Object)
else will use EntityManager.merge(Object)
public org.apache.commons.collections.Predicate getPersistCritera()
fieldAccessor
if this needs to be persisted or not.
Predicate.evaluate(Object)
= true implies it will be persistedwrite(Object, Object)
will always be called.public void setPersistCritera(org.apache.commons.collections.Predicate persistCritera)
fieldAccessor
if this needs to be persisted or not.
Predicate.evaluate(Object)
= true implies it will be persistedwrite(Object, Object)
will always be called.Copyright © 2018. All rights reserved.