public final class EntityBeanIntercept extends Object implements Serializable
This provides the mechanisms to support deferred fetching of reference beans and oldValues generation for concurrency checking.
Constructor and Description |
---|
EntityBeanIntercept(Object ownerBean)
Create a intercept with a given entity.
|
Modifier and Type | Method and Description |
---|---|
int |
addDirtyPropertyHash(int hash)
Add and return a dirty property hash recursing into embedded beans.
|
void |
addDirtyPropertyNames(Set<String> props,
String prefix)
Recursively add dirty properties.
|
void |
addDirtyPropertyValues(Map<String,ValuePair> dirtyValues,
String prefix)
Recursively add dirty properties.
|
void |
addPropertyChangeListener(PropertyChangeListener listener)
Add a property change listener for this entity bean.
|
void |
addPropertyChangeListener(String propertyName,
PropertyChangeListener listener)
Add a property change listener for this entity bean for a specific
property.
|
protected boolean |
areEqual(Object obj1,
Object obj2)
Helper method to check if two objects are equal.
|
int |
findProperty(String propertyName)
Finds the index position of a given property.
|
boolean[] |
getChanged()
Return the set of property names for changed properties.
|
boolean[] |
getDirtyProperties()
Return the array of flags indicating the dirty properties.
|
int |
getDirtyPropertyHash()
Return a dirty property hash taking into account embedded beans.
|
Set<String> |
getDirtyPropertyNames()
Return the set of dirty properties.
|
Map<String,ValuePair> |
getDirtyValues()
Return a map of dirty properties with their new and old values.
|
Object |
getEmbeddedOwner()
Return the owning bean for an embedded bean.
|
int |
getEmbeddedOwnerIndex()
Return the property index (for the parent) of this embedded bean.
|
String |
getLazyLoadProperty()
Return the property that triggered the lazy load.
|
int |
getLazyLoadPropertyIndex()
Return the index of the property that triggered the lazy load.
|
boolean[] |
getLoaded() |
int |
getLoadedPropertyHash()
Return a loaded property hash.
|
Set<String> |
getLoadedPropertyNames()
Return the set of property names for a partially loaded bean.
|
Object |
getOrigValue(int propertyIndex)
Return the original value that was changed via an update.
|
EntityBean |
getOwner()
Return the 'owning' entity bean.
|
PersistenceContext |
getPersistenceContext()
Return the persistenceContext.
|
String |
getProperty(int propertyIndex)
Return the property name for the given property.
|
int |
getPropertyLength()
Return the number of properties.s
|
boolean |
hasDirtyProperty(Set<String> propertyNames)
Return true if any of the given property names are dirty.
|
boolean |
hasIdOnly(int idIndex)
Return true if only the Id property has been loaded.
|
void |
initialisedMany(int propertyIndex)
Called when a BeanCollection is initialised automatically.
|
boolean |
isChangedProperty(int propertyIndex)
Return true if the property is considered changed.
|
boolean |
isDirty()
Return true if this bean has been directly modified (it has oldValues) or
if any embedded beans are either new or dirty (and hence need saving).
|
boolean |
isDirtyProperty(int propertyIndex)
Return true if the property was changed or if it is embedded and one of its
embedded properties is dirty.
|
boolean |
isDisableLazyLoad()
Return true if lazy loading is disabled.
|
boolean |
isEmbeddedNewOrDirty(Object embeddedBean)
Return true if the embedded bean is new or dirty and hence needs saving.
|
boolean |
isFullyLoadedBean() |
boolean |
isLazyLoadFailure()
Return true if the bean is marked as having failed lazy loading.
|
boolean |
isLoaded()
Return true if the entity has been loaded.
|
boolean |
isLoadedProperty(int propertyIndex)
Return true if the property is loaded.
|
boolean |
isNew()
Return true if this entity bean is new and not yet saved.
|
boolean |
isNewOrDirty()
Return true if the entity bean is new or dirty (and should be saved).
|
boolean |
isPartial()
Check each property to see if the bean is partially loaded.
|
boolean |
isReadOnly()
Return true if the bean should be treated as readOnly.
|
boolean |
isReference()
Return true if the entity is a reference.
|
protected void |
loadBean(int loadProperty)
Load the bean when it is a reference.
|
void |
markPropertyAsChanged(int propertyIndex)
Explicitly mark a property as having been changed.
|
void |
postSetter(PropertyChangeEvent event)
Called for "enhancement" postSetter processing.
|
void |
postSetter(PropertyChangeEvent event,
Object newValue)
Called for "subclassed" postSetter processing.
|
void |
preGetter(int propertyIndex)
Method that is called prior to a getter method on the actual entity.
|
PropertyChangeEvent |
preSetter(boolean intercept,
int propertyIndex,
boolean oldValue,
boolean newValue)
Check for primitive boolean.
|
PropertyChangeEvent |
preSetter(boolean intercept,
int propertyIndex,
byte[] oldValue,
byte[] newValue)
byte[].
|
PropertyChangeEvent |
preSetter(boolean intercept,
int propertyIndex,
byte oldValue,
byte newValue)
byte.
|
PropertyChangeEvent |
preSetter(boolean intercept,
int propertyIndex,
char[] oldValue,
char[] newValue)
char[].
|
PropertyChangeEvent |
preSetter(boolean intercept,
int propertyIndex,
char oldValue,
char newValue)
char.
|
PropertyChangeEvent |
preSetter(boolean intercept,
int propertyIndex,
double oldValue,
double newValue)
double.
|
PropertyChangeEvent |
preSetter(boolean intercept,
int propertyIndex,
float oldValue,
float newValue)
float.
|
PropertyChangeEvent |
preSetter(boolean intercept,
int propertyIndex,
int oldValue,
int newValue)
Check for primitive int.
|
PropertyChangeEvent |
preSetter(boolean intercept,
int propertyIndex,
long oldValue,
long newValue)
long.
|
PropertyChangeEvent |
preSetter(boolean intercept,
int propertyIndex,
Object oldValue,
Object newValue)
Check to see if the values are not equal.
|
PropertyChangeEvent |
preSetter(boolean intercept,
int propertyIndex,
short oldValue,
short newValue)
short.
|
PropertyChangeEvent |
preSetterMany(boolean interceptField,
int propertyIndex,
Object oldValue,
Object newValue)
OneToMany and ManyToMany don't have any interception so just check for
PropertyChangeSupport.
|
void |
removePropertyChangeListener(PropertyChangeListener listener)
Remove a property change listener for this entity bean.
|
void |
removePropertyChangeListener(String propertyName,
PropertyChangeListener listener)
Remove a property change listener for this entity bean for a specific
property.
|
void |
setBeanLoader(BeanLoader beanLoader)
Set the BeanLoader.
|
void |
setBeanLoader(BeanLoader beanLoader,
PersistenceContext ctx)
Set the BeanLoader with PersistenceContext.
|
void |
setChangedProperty(int propertyIndex) |
void |
setDirty(boolean dirty) |
void |
setDisableLazyLoad(boolean disableLazyLoad)
Set true to turn off lazy loading.
|
void |
setEmbeddedDirty(int embeddedProperty)
Called by an embedded bean onto its owner.
|
void |
setEmbeddedLoaded(Object embeddedBean)
Set the loaded status for the embedded bean.
|
void |
setEmbeddedOwner(EntityBean parentBean,
int embeddedOwnerIndex)
Set the embedded beans owning bean.
|
void |
setFullyLoadedBean(boolean fullyLoadedBean) |
void |
setLazyLoadFailure(Object ownerId)
Set lazy load failure flag.
|
void |
setLoaded()
Set the loaded state to true.
|
void |
setLoadedLazy()
When finished loading for lazy or refresh on an already partially populated
bean.
|
void |
setLoadedProperty(int propertyIndex)
Set the property to be loaded.
|
void |
setNewBeanForUpdate()
For forced update on a 'New' bean set all the loaded properties to changed.
|
void |
setNodeUsageCollector(NodeUsageCollector usageCollector)
Turn on profile collection.
|
void |
setPersistenceContext(PersistenceContext persistenceContext)
Set the persistenceContext.
|
void |
setPropertyLoaded(String propertyName,
boolean loaded)
Set the loaded state of the property given it's name.
|
void |
setPropertyUnloaded(int propertyIndex)
Set the property to be treated as unloaded.
|
void |
setReadOnly(boolean readOnly)
Set the readOnly status.
|
void |
setReference(int idPos)
Set this as a reference object.
|
public EntityBeanIntercept(Object ownerBean)
Refer to agent ProxyConstructor.
public EntityBean getOwner()
public PersistenceContext getPersistenceContext()
public void setPersistenceContext(PersistenceContext persistenceContext)
public void addPropertyChangeListener(PropertyChangeListener listener)
public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
public void removePropertyChangeListener(PropertyChangeListener listener)
public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
public void setNodeUsageCollector(NodeUsageCollector usageCollector)
public Object getEmbeddedOwner()
public int getEmbeddedOwnerIndex()
public void setEmbeddedOwner(EntityBean parentBean, int embeddedOwnerIndex)
public void setBeanLoader(BeanLoader beanLoader, PersistenceContext ctx)
public void setBeanLoader(BeanLoader beanLoader)
public boolean isFullyLoadedBean()
public void setFullyLoadedBean(boolean fullyLoadedBean)
public boolean isPartial()
public boolean isDirty()
public void setEmbeddedDirty(int embeddedProperty)
public void setDirty(boolean dirty)
public boolean isNew()
public boolean isNewOrDirty()
public boolean hasIdOnly(int idIndex)
public boolean isReference()
public void setReference(int idPos)
public boolean isReadOnly()
public void setReadOnly(boolean readOnly)
public boolean isLoaded()
public void setLoaded()
Calls to setter methods after the bean is loaded can result in 'Old Values' being created to support ConcurrencyMode.ALL
Worth noting that this is also set after a insert/update. By doing so it 'resets' the bean for making further changes and saving again.
public void setLoadedLazy()
public void setLazyLoadFailure(Object ownerId)
public boolean isLazyLoadFailure()
public boolean isDisableLazyLoad()
public void setDisableLazyLoad(boolean disableLazyLoad)
Typically used to disable lazy loading on SQL based report beans.
public void setEmbeddedLoaded(Object embeddedBean)
public boolean isEmbeddedNewOrDirty(Object embeddedBean)
public Object getOrigValue(int propertyIndex)
public int findProperty(String propertyName)
public String getProperty(int propertyIndex)
public int getPropertyLength()
public void setPropertyLoaded(String propertyName, boolean loaded)
public void setPropertyUnloaded(int propertyIndex)
public void setLoadedProperty(int propertyIndex)
public boolean isLoadedProperty(int propertyIndex)
public boolean isChangedProperty(int propertyIndex)
public boolean isDirtyProperty(int propertyIndex)
public void markPropertyAsChanged(int propertyIndex)
public void setChangedProperty(int propertyIndex)
public void setNewBeanForUpdate()
public Set<String> getLoadedPropertyNames()
public boolean[] getDirtyProperties()
public Set<String> getDirtyPropertyNames()
public void addDirtyPropertyNames(Set<String> props, String prefix)
public boolean hasDirtyProperty(Set<String> propertyNames)
public Map<String,ValuePair> getDirtyValues()
public void addDirtyPropertyValues(Map<String,ValuePair> dirtyValues, String prefix)
public int getDirtyPropertyHash()
public int addDirtyPropertyHash(int hash)
public int getLoadedPropertyHash()
public boolean[] getChanged()
public boolean[] getLoaded()
public int getLazyLoadPropertyIndex()
public String getLazyLoadProperty()
protected void loadBean(int loadProperty)
protected boolean areEqual(Object obj1, Object obj2)
public void initialisedMany(int propertyIndex)
public void preGetter(int propertyIndex)
public void postSetter(PropertyChangeEvent event)
public void postSetter(PropertyChangeEvent event, Object newValue)
public PropertyChangeEvent preSetterMany(boolean interceptField, int propertyIndex, Object oldValue, Object newValue)
public PropertyChangeEvent preSetter(boolean intercept, int propertyIndex, Object oldValue, Object newValue)
public PropertyChangeEvent preSetter(boolean intercept, int propertyIndex, boolean oldValue, boolean newValue)
public PropertyChangeEvent preSetter(boolean intercept, int propertyIndex, int oldValue, int newValue)
public PropertyChangeEvent preSetter(boolean intercept, int propertyIndex, long oldValue, long newValue)
public PropertyChangeEvent preSetter(boolean intercept, int propertyIndex, double oldValue, double newValue)
public PropertyChangeEvent preSetter(boolean intercept, int propertyIndex, float oldValue, float newValue)
public PropertyChangeEvent preSetter(boolean intercept, int propertyIndex, short oldValue, short newValue)
public PropertyChangeEvent preSetter(boolean intercept, int propertyIndex, char oldValue, char newValue)
public PropertyChangeEvent preSetter(boolean intercept, int propertyIndex, byte oldValue, byte newValue)
public PropertyChangeEvent preSetter(boolean intercept, int propertyIndex, char[] oldValue, char[] newValue)
public PropertyChangeEvent preSetter(boolean intercept, int propertyIndex, byte[] oldValue, byte[] newValue)
Copyright © 2016. All rights reserved.