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
Modifier and TypeFieldDescriptionprotected EntityStates
protected Metadata
protected MetadataTools
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
buildChangesByImplementation
(AttributeChanges.Builder builder, Object entity, BiFunction<Object, MetaProperty, Object> transformer) protected void
buildExtraChanges
(AttributeChanges.Builder builder, Object entity) protected void
checkEntityState
(Object entity) protected Object
convertValueIfNeeded
(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 Object
getOldValueByImplementation
(Object entity, String attribute) boolean
Returns true if the given entity has dirty attributes (changed since the last load from the database).boolean
Returns true if at least one of the given attributes is dirty (i.e.protected abstract boolean
protected Collection<Object>
newCollectionForProperty
(MetaProperty metaProperty) void
setEntityStates
(EntityStates entityStates) void
setMetadata
(Metadata metadata) void
setMetadataTools
(MetadataTools metadataTools)
-
Field Details
-
entityStates
-
metadata
-
metadataTools
-
-
Constructor Details
-
BaseAttributeChangesProvider
public BaseAttributeChangesProvider()
-
-
Method Details
-
setEntityStates
-
setMetadata
-
setMetadataTools
-
getAttributeChanges
Description copied from interface:AttributeChangesProvider
Returns an object describing changes in entity attributes.- Specified by:
getAttributeChanges
in 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:AttributeChangesProvider
Returns 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:
getChangedAttributeNames
in interfaceAttributeChangesProvider
- Parameters:
entity
- entity instance- Returns:
- dirty attribute names
- See Also:
-
getChangedAttributeNamesByImplementation
-
isChanged
Description copied from interface:AttributeChangesProvider
Returns 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:
isChanged
in interfaceAttributeChangesProvider
- Parameters:
entity
- entity instance- See Also:
-
isChanged
Description copied from interface:AttributeChangesProvider
Returns 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:
isChanged
in interfaceAttributeChangesProvider
- Parameters:
entity
- entity instanceattributes
- attributes to check- See Also:
-
getOldValue
Description copied from interface:AttributeChangesProvider
Returns 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:
getOldValue
in 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
-