Package io.jmix.data.impl
Class BaseAttributeChangesProvider
java.lang.Object
io.jmix.data.impl.BaseAttributeChangesProvider
- All Implemented Interfaces:
AttributeChangesProvider
- Direct Known Subclasses:
EclipselinkAttributeChangesProvider
public abstract class BaseAttributeChangesProvider
extends Object
implements AttributeChangesProvider
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected EntityStatesprotected Metadataprotected MetadataTools -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidbuildChangesByImplementation(AttributeChanges.Builder builder, Object entity, BiFunction<Object, MetaProperty, Object> transformer) protected voidbuildExtraChanges(AttributeChanges.Builder builder, Object entity) protected voidcheckEntityState(Object entity) protected ObjectconvertValueIfNeeded(Object value, MetaProperty metaProperty) getAttributeChanges(Object entity) Returns an object describing changes in entity attributes.getChangedAttributeNames(Object entity) Returns the set of dirty attributes (changed since the last load from the database).getOldValue(Object entity, String attribute) Returns an old value of an attribute changed in the current transaction.protected abstract ObjectgetOldValueByImplementation(Object entity, String attribute) booleanReturns true if the given entity has dirty attributes (changed since the last load from the database).booleanReturns true if at least one of the given attributes is dirty (i.e.protected abstract booleanprotected Collection<Object>newCollectionForProperty(MetaProperty metaProperty) voidsetEntityStates(EntityStates entityStates) voidsetMetadata(Metadata metadata) voidsetMetadataTools(MetadataTools metadataTools)
-
Field Details
-
entityStates
-
metadata
-
metadataTools
-
-
Constructor Details
-
BaseAttributeChangesProvider
public BaseAttributeChangesProvider()
-
-
Method Details
-
setEntityStates
-
setMetadata
-
setMetadataTools
-
getAttributeChanges
Description copied from interface:AttributeChangesProviderReturns an object describing changes in entity attributes.- Specified by:
getAttributeChangesin interfaceAttributeChangesProvider- Parameters:
entity- entity instance- Returns:
- dirty attribute names
-
buildChangesByImplementation
protected abstract void buildChangesByImplementation(AttributeChanges.Builder builder, Object entity, BiFunction<Object, MetaProperty, Object> transformer) -
getChangedAttributeNames
Description copied from interface:AttributeChangesProviderReturns the set of dirty attributes (changed since the last load from the database).If the entity is new, returns all its attributes.
If the entity is not persistent or not in the Managed state, returns empty set.
- Specified by:
getChangedAttributeNamesin interfaceAttributeChangesProvider- Parameters:
entity- entity instance- Returns:
- dirty attribute names
- See Also:
-
getChangedAttributeNamesByImplementation
-
isChanged
Description copied from interface:AttributeChangesProviderReturns true if the given entity has dirty attributes (changed since the last load from the database).
If the entity is new, returns true.
If the entity is not persistent or not in the Managed state, returns false.- Specified by:
isChangedin interfaceAttributeChangesProvider- Parameters:
entity- entity instance- See Also:
-
isChanged
Description copied from interface:AttributeChangesProviderReturns true if at least one of the given attributes is dirty (i.e. changed since the last load from the database).If the entity is new, always returns true.
If the entity is not persistent or not in the Managed state, always returns false.
- Specified by:
isChangedin interfaceAttributeChangesProvider- Parameters:
entity- entity instanceattributes- attributes to check- See Also:
-
getOldValue
Description copied from interface:AttributeChangesProviderReturns an old value of an attribute changed in the current transaction. The entity must be in the Managed state. For enum attributes returns enum value.
You can check if the value has been changed usingAttributeChangesProvider.isChanged(Object, String...)method.- Specified by:
getOldValuein interfaceAttributeChangesProvider- Parameters:
entity- entity instanceattribute- attribute name- Returns:
- an old value stored in the database. For a new entity returns null.
- See Also:
-
getOldValueByImplementation
-
convertValueIfNeeded
-
isSoftDeletionEnabled
protected abstract boolean isSoftDeletionEnabled() -
buildExtraChanges
-
newCollectionForProperty
-
checkEntityState
-