public abstract class ExternalRecordEntityAdapter extends RecordEntityAdapter
ExternalRecordEntity
based adapters.Constructor and Description |
---|
ExternalRecordEntityAdapter(Object entity,
ExternalValue externalValue,
RecordType type,
ModelInstance modelInstance,
ModelProvider modelProvider)
Creates new instance.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addToNonSharedAssociationCache(RecordProperty property,
Object runtimeValue)
Adds value to internal values association cache.
|
protected boolean |
canRemoveThisFromReverseAssociation(RecordHolder removed,
RecordAssociation reverseAssociation)
Returns true if this entity/holder can be removed from reverse association.
|
protected boolean |
canSetProperty(String name)
Returns true if a property can be updated.
|
void |
cleanAndRenewVersion() |
protected abstract void |
clearEntity()
Clears reference to the entity.
|
protected abstract Object |
convertToRuntime(RecordProperty property,
Object rawValue)
Converts raw value to runtime value.
|
protected String |
createEntityIdentificationString(Object entity)
Creates entity identification string.
|
protected Object |
createEntityJavaIdentification()
Creates java identification object.
|
void |
fireNewEntityChange()
Fire change for created entity.
|
protected void |
firePropertyChange(String name,
Object value)
Fire property change event.
|
protected Long |
getAuditRevisionId()
Returns audit revision id
|
Object |
getEntity()
Returns the adapted entity.
|
String |
getEntityIdentificationString()
Returns the unique string for this record (primary key and if needed version)
private String entityIdentificationString;
|
protected Object |
getEntityInternal()
Returns entity.
|
Object |
getEntityNotNull()
This method should be called instead of
getEntity() when entity
is expected to be not null. |
ExternalRecordType |
getExternalRecordType()
Returns external record type.
|
ExternalValue |
getExternalValue()
finds an existing external value for entity hold by this adapter.
|
protected Field |
getField(Class<?> cls,
String name)
returns field from class or super-classes.
|
protected abstract Object |
getFromEntity(Object entity,
RecordProperty property) |
protected Object |
getFromEntity(RecordProperty property)
Returns value of property from entity.
|
ExternalRecordHolder |
getHolder()
Returns holder for the underlying entity.
|
Object |
getJavaIdentification()
Returns the unique object for this record (primary key).
|
protected ModelInstance |
getModelInstance()
Returns model instance.
|
protected ModelProvider |
getModelProvider()
Returns model provider
|
Object |
getProperty(RecordProperty property)
Returns value of the property.
|
protected Object |
getPropertyInternal(RecordProperty property)
Gets property internal.
|
protected abstract Object |
getRawFromEntity(Object entity,
RecordProperty property)
Returns unmodified value from entity.
|
protected Object |
getRawFromEntity(RecordProperty property) |
RecordType |
getType()
Returns record type.
|
Long |
getVersion()
Returns string representation of the entity version, used for multi-transactional optimistic locking.
|
protected void |
initEntityIdentificationString() |
protected boolean |
isExternalValueCreated()
Returns true if external value is created.
|
protected abstract boolean |
isInitialized(Object object) |
boolean |
needsToBeReloaded()
Returns true if entity needs to be reloaded from database.
|
protected void |
postSetAssociation(RecordAssociation assoc,
Object value)
Executes after association is set.
|
protected abstract void |
refresh() |
protected abstract void |
reloadIfNeeded()
Reloads entity.
|
protected abstract void |
removeEntity(Object entity)
Removes entity.
|
protected abstract void |
removeFromAllAssociations(Set<ExternalRecordAssociation> ignoreAssociations)
Removes this entity from all association.
|
void |
removeThis()
Removes the adapted entity.
|
protected void |
setEntityInternal(Object entity)
Sets entity.
|
protected void |
setPropertyInternal(RecordProperty property,
Object value,
boolean ignoreCompositions)
Sets property.
|
void |
updateVersion()
Updates version string.
|
getConverter, getEvaluationConverter, getHolderFactory, getHolderInternal, getJavaObject, remove, removeAddedFromOldParents, removeNullObjects, setAssociation, setField, setHolderInternal, setProperty, setThisSideOfAssociation
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isUpdateNecessary
public ExternalRecordEntityAdapter(Object entity, ExternalValue externalValue, RecordType type, ModelInstance modelInstance, ModelProvider modelProvider)
entity
- externalValue
- type
- modelInstance
- modelProvider
- protected ModelInstance getModelInstance()
RecordEntityAdapter
getModelInstance
in class RecordEntityAdapter
protected ModelProvider getModelProvider()
RecordEntityAdapter
getModelProvider
in class RecordEntityAdapter
public RecordType getType()
RecordEntityAdapter
getType
in class RecordEntityAdapter
protected void initEntityIdentificationString()
protected Object getEntityInternal()
protected void setEntityInternal(Object entity)
entity
- public boolean needsToBeReloaded()
public Object getEntity()
public Object getEntityNotNull()
getEntity()
when entity
is expected to be not null.protected abstract void reloadIfNeeded()
public ExternalRecordType getExternalRecordType()
protected boolean isExternalValueCreated()
public ExternalRecordHolder getHolder()
getHolder
in class RecordEntityAdapter
public ExternalValue getExternalValue()
protected Long getAuditRevisionId()
public String getEntityIdentificationString()
protected String createEntityIdentificationString(Object entity)
entity
- public Object getJavaIdentification()
protected Object createEntityJavaIdentification()
public void updateVersion()
public Long getVersion()
public Object getProperty(RecordProperty property)
getProperty
in class RecordEntityAdapter
property
- protected Object getPropertyInternal(RecordProperty property)
property
- protected void setPropertyInternal(RecordProperty property, Object value, boolean ignoreCompositions)
RecordEntityAdapter
setPropertyInternal
in class RecordEntityAdapter
protected abstract Object getRawFromEntity(Object entity, RecordProperty property)
entity
- property
- protected Object getRawFromEntity(RecordProperty property)
protected abstract Object getFromEntity(Object entity, RecordProperty property)
protected Object getFromEntity(RecordProperty property)
property
- protected abstract Object convertToRuntime(RecordProperty property, Object rawValue)
property
- rawValue
- protected void addToNonSharedAssociationCache(RecordProperty property, Object runtimeValue)
property
- runtimeValue
- protected boolean canSetProperty(String name)
RecordEntityAdapter
canSetProperty
in class RecordEntityAdapter
protected void firePropertyChange(String name, Object value)
RecordEntityAdapter
firePropertyChange
in class RecordEntityAdapter
public void fireNewEntityChange()
protected boolean canRemoveThisFromReverseAssociation(RecordHolder removed, RecordAssociation reverseAssociation)
RecordEntityAdapter
canRemoveThisFromReverseAssociation
in class RecordEntityAdapter
protected void postSetAssociation(RecordAssociation assoc, Object value)
RecordEntityAdapter
postSetAssociation
in class RecordEntityAdapter
public void removeThis()
removeThis
in class RecordEntityAdapter
protected abstract boolean isInitialized(Object object)
protected abstract void removeFromAllAssociations(Set<ExternalRecordAssociation> ignoreAssociations)
ignoreAssociations
- protected abstract void removeEntity(Object entity)
entity
- protected abstract void clearEntity()
protected Field getField(Class<?> cls, String name) throws SecurityException, NoSuchFieldException
cls
- name
- SecurityException
NoSuchFieldException
protected abstract void refresh()
public void cleanAndRenewVersion()
Copyright © 2007-2020 Whitestein Technologies. All Rights Reserved.