mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Refactor rename getters to accessors for BeanCollection, EntityBeanIntercept etc
This commit is contained in:
@@ -77,12 +77,12 @@ public interface BeanCollection<E> extends Serializable, ToStringAware {
|
||||
/**
|
||||
* Return the bean that owns this collection.
|
||||
*/
|
||||
EntityBean getOwnerBean();
|
||||
EntityBean owner();
|
||||
|
||||
/**
|
||||
* Return the bean property name this collection represents.
|
||||
*/
|
||||
String getPropertyName();
|
||||
String propertyName();
|
||||
|
||||
/**
|
||||
* Check after the lazy load that the underlying collection is not null
|
||||
@@ -99,7 +99,7 @@ public interface BeanCollection<E> extends Serializable, ToStringAware {
|
||||
* This is so that the filter can be applied on refresh.
|
||||
* </p>
|
||||
*/
|
||||
ExpressionList<?> getFilterMany();
|
||||
ExpressionList<?> filterMany();
|
||||
|
||||
/**
|
||||
* Set the filter that was used in building this collection.
|
||||
@@ -154,7 +154,7 @@ public interface BeanCollection<E> extends Serializable, ToStringAware {
|
||||
/**
|
||||
* Returns the underlying collection of beans from the Set, Map or List.
|
||||
*/
|
||||
Collection<E> getActualDetails();
|
||||
Collection<E> actualDetails();
|
||||
|
||||
/**
|
||||
* Returns the underlying entries so for Maps this is a collection of
|
||||
@@ -162,7 +162,7 @@ public interface BeanCollection<E> extends Serializable, ToStringAware {
|
||||
* <p>
|
||||
* For maps this returns the entrySet as we need the keys of the map.
|
||||
*/
|
||||
Collection<?> getActualEntries();
|
||||
Collection<?> actualEntries();
|
||||
|
||||
/**
|
||||
* return true if there are real rows held. Return false is this is using
|
||||
@@ -195,7 +195,7 @@ public interface BeanCollection<E> extends Serializable, ToStringAware {
|
||||
/**
|
||||
* Return the current modify listening mode. Can be null for on newly created beans.
|
||||
*/
|
||||
ModifyListenMode getModifyListening();
|
||||
ModifyListenMode modifyListening();
|
||||
|
||||
/**
|
||||
* Add an object to the additions list.
|
||||
@@ -217,13 +217,13 @@ public interface BeanCollection<E> extends Serializable, ToStringAware {
|
||||
* Return the list of objects added to the list set or map. These will used to
|
||||
* insert rows into the intersection table of a ManyToMany.
|
||||
*/
|
||||
Set<E> getModifyAdditions();
|
||||
Set<E> modifyAdditions();
|
||||
|
||||
/**
|
||||
* Return the list of objects removed from the list set or map. These will
|
||||
* used to delete rows from the intersection table of a ManyToMany.
|
||||
*/
|
||||
Set<E> getModifyRemovals();
|
||||
Set<E> modifyRemovals();
|
||||
|
||||
/**
|
||||
* Reset the set of additions and deletions. This is called after the
|
||||
@@ -239,5 +239,5 @@ public interface BeanCollection<E> extends Serializable, ToStringAware {
|
||||
/**
|
||||
* Return a shallow copy of this collection that is modifiable.
|
||||
*/
|
||||
BeanCollection<E> getShallowCopy();
|
||||
BeanCollection<E> shallowCopy();
|
||||
}
|
||||
|
||||
@@ -17,12 +17,12 @@ public interface EntityBeanIntercept extends Serializable {
|
||||
/**
|
||||
* Return the 'owning' entity bean.
|
||||
*/
|
||||
EntityBean getOwner();
|
||||
EntityBean owner();
|
||||
|
||||
/**
|
||||
* Return the persistenceContext.
|
||||
*/
|
||||
PersistenceContext getPersistenceContext();
|
||||
PersistenceContext persistenceContext();
|
||||
|
||||
/**
|
||||
* Set the persistenceContext.
|
||||
@@ -37,7 +37,7 @@ public interface EntityBeanIntercept extends Serializable {
|
||||
/**
|
||||
* Return the ownerId (IdClass).
|
||||
*/
|
||||
Object getOwnerId();
|
||||
Object ownerId();
|
||||
|
||||
/**
|
||||
* Set the ownerId (IdClass).
|
||||
@@ -47,12 +47,12 @@ public interface EntityBeanIntercept extends Serializable {
|
||||
/**
|
||||
* Return the owning bean for an embedded bean.
|
||||
*/
|
||||
Object getEmbeddedOwner();
|
||||
Object embeddedOwner();
|
||||
|
||||
/**
|
||||
* Return the property index (for the parent) of this embedded bean.
|
||||
*/
|
||||
int getEmbeddedOwnerIndex();
|
||||
int embeddedOwnerIndex();
|
||||
|
||||
/**
|
||||
* Clear the getter callback.
|
||||
@@ -229,7 +229,7 @@ public interface EntityBeanIntercept extends Serializable {
|
||||
/**
|
||||
* Return the original value that was changed via an update.
|
||||
*/
|
||||
Object getOrigValue(int propertyIndex);
|
||||
Object origValue(int propertyIndex);
|
||||
|
||||
/**
|
||||
* Finds the index position of a given property. Returns -1 if the
|
||||
@@ -240,12 +240,12 @@ public interface EntityBeanIntercept extends Serializable {
|
||||
/**
|
||||
* Return the property name for the given property.
|
||||
*/
|
||||
String getProperty(int propertyIndex);
|
||||
String property(int propertyIndex);
|
||||
|
||||
/**
|
||||
* Return the number of properties.
|
||||
*/
|
||||
int getPropertyLength();
|
||||
int propertyLength();
|
||||
|
||||
/**
|
||||
* Set the loaded state of the property given it's name.
|
||||
@@ -321,17 +321,17 @@ public interface EntityBeanIntercept extends Serializable {
|
||||
/**
|
||||
* Return the set of property names for a partially loaded bean.
|
||||
*/
|
||||
Set<String> getLoadedPropertyNames();
|
||||
Set<String> loadedPropertyNames();
|
||||
|
||||
/**
|
||||
* Return the array of flags indicating the dirty properties.
|
||||
*/
|
||||
boolean[] getDirtyProperties();
|
||||
boolean[] dirtyProperties();
|
||||
|
||||
/**
|
||||
* Return the set of dirty properties.
|
||||
*/
|
||||
Set<String> getDirtyPropertyNames();
|
||||
Set<String> dirtyPropertyNames();
|
||||
|
||||
/**
|
||||
* Recursively add dirty properties.
|
||||
@@ -346,7 +346,7 @@ public interface EntityBeanIntercept extends Serializable {
|
||||
/**
|
||||
* Return a map of dirty properties with their new and old values.
|
||||
*/
|
||||
Map<String, ValuePair> getDirtyValues();
|
||||
Map<String, ValuePair> dirtyValues();
|
||||
|
||||
/**
|
||||
* Recursively add dirty properties.
|
||||
@@ -361,7 +361,7 @@ public interface EntityBeanIntercept extends Serializable {
|
||||
/**
|
||||
* Return a dirty property hash taking into account embedded beans.
|
||||
*/
|
||||
StringBuilder getDirtyPropertyKey();
|
||||
StringBuilder dirtyPropertyKey();
|
||||
|
||||
/**
|
||||
* Add and return a dirty property hash.
|
||||
@@ -371,22 +371,22 @@ public interface EntityBeanIntercept extends Serializable {
|
||||
/**
|
||||
* Return a loaded property hash.
|
||||
*/
|
||||
StringBuilder getLoadedPropertyKey();
|
||||
StringBuilder loadedPropertyKey();
|
||||
|
||||
/**
|
||||
* Return the loaded state for all the properties.
|
||||
*/
|
||||
boolean[] getLoaded();
|
||||
boolean[] loaded();
|
||||
|
||||
/**
|
||||
* Return the index of the property that triggered the lazy load.
|
||||
*/
|
||||
int getLazyLoadPropertyIndex();
|
||||
int lazyLoadPropertyIndex();
|
||||
|
||||
/**
|
||||
* Return the property that triggered the lazy load.
|
||||
*/
|
||||
String getLazyLoadProperty();
|
||||
String lazyLoadProperty();
|
||||
|
||||
/**
|
||||
* Load the bean when it is a reference.
|
||||
@@ -497,7 +497,7 @@ public interface EntityBeanIntercept extends Serializable {
|
||||
/**
|
||||
* Return the sort order value for an order column.
|
||||
*/
|
||||
int getSortOrder();
|
||||
int sortOrder();
|
||||
|
||||
/**
|
||||
* Set the sort order value for an order column.
|
||||
@@ -522,7 +522,7 @@ public interface EntityBeanIntercept extends Serializable {
|
||||
/**
|
||||
* Returns the loadErrors.
|
||||
*/
|
||||
Map<String, Exception> getLoadErrors();
|
||||
Map<String, Exception> loadErrors();
|
||||
|
||||
/**
|
||||
* Return true if the property has its changed state set.
|
||||
|
||||
@@ -30,12 +30,12 @@ public class InterceptReadOnly implements EntityBeanIntercept {
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityBean getOwner() {
|
||||
public EntityBean owner() {
|
||||
return owner;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PersistenceContext getPersistenceContext() {
|
||||
public PersistenceContext persistenceContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public class InterceptReadOnly implements EntityBeanIntercept {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOwnerId() {
|
||||
public Object ownerId() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -60,12 +60,12 @@ public class InterceptReadOnly implements EntityBeanIntercept {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getEmbeddedOwner() {
|
||||
public Object embeddedOwner() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEmbeddedOwnerIndex() {
|
||||
public int embeddedOwnerIndex() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -230,7 +230,7 @@ public class InterceptReadOnly implements EntityBeanIntercept {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOrigValue(int propertyIndex) {
|
||||
public Object origValue(int propertyIndex) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -240,12 +240,12 @@ public class InterceptReadOnly implements EntityBeanIntercept {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProperty(int propertyIndex) {
|
||||
public String property(int propertyIndex) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPropertyLength() {
|
||||
public int propertyLength() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -320,17 +320,17 @@ public class InterceptReadOnly implements EntityBeanIntercept {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getLoadedPropertyNames() {
|
||||
public Set<String> loadedPropertyNames() {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean[] getDirtyProperties() {
|
||||
public boolean[] dirtyProperties() {
|
||||
return new boolean[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getDirtyPropertyNames() {
|
||||
public Set<String> dirtyPropertyNames() {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
@@ -345,7 +345,7 @@ public class InterceptReadOnly implements EntityBeanIntercept {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, ValuePair> getDirtyValues() {
|
||||
public Map<String, ValuePair> dirtyValues() {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
|
||||
@@ -360,7 +360,7 @@ public class InterceptReadOnly implements EntityBeanIntercept {
|
||||
}
|
||||
|
||||
@Override
|
||||
public StringBuilder getDirtyPropertyKey() {
|
||||
public StringBuilder dirtyPropertyKey() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -370,22 +370,22 @@ public class InterceptReadOnly implements EntityBeanIntercept {
|
||||
}
|
||||
|
||||
@Override
|
||||
public StringBuilder getLoadedPropertyKey() {
|
||||
public StringBuilder loadedPropertyKey() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean[] getLoaded() {
|
||||
public boolean[] loaded() {
|
||||
return new boolean[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLazyLoadPropertyIndex() {
|
||||
public int lazyLoadPropertyIndex() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLazyLoadProperty() {
|
||||
public String lazyLoadProperty() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -495,7 +495,7 @@ public class InterceptReadOnly implements EntityBeanIntercept {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSortOrder() {
|
||||
public int sortOrder() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -520,7 +520,7 @@ public class InterceptReadOnly implements EntityBeanIntercept {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Exception> getLoadErrors() {
|
||||
public Map<String, Exception> loadErrors() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -133,12 +133,12 @@ public final class InterceptReadWrite implements EntityBeanIntercept {
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityBean getOwner() {
|
||||
public EntityBean owner() {
|
||||
return owner;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PersistenceContext getPersistenceContext() {
|
||||
public PersistenceContext persistenceContext() {
|
||||
return persistenceContext;
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ public final class InterceptReadWrite implements EntityBeanIntercept {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOwnerId() {
|
||||
public Object ownerId() {
|
||||
return ownerId;
|
||||
}
|
||||
|
||||
@@ -163,12 +163,12 @@ public final class InterceptReadWrite implements EntityBeanIntercept {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getEmbeddedOwner() {
|
||||
public Object embeddedOwner() {
|
||||
return embeddedOwner;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEmbeddedOwnerIndex() {
|
||||
public int embeddedOwnerIndex() {
|
||||
return embeddedOwnerIndex;
|
||||
}
|
||||
|
||||
@@ -381,8 +381,7 @@ public final class InterceptReadWrite implements EntityBeanIntercept {
|
||||
@Override
|
||||
public void setEmbeddedLoaded(Object embeddedBean) {
|
||||
if (embeddedBean instanceof EntityBean) {
|
||||
EntityBean eb = (EntityBean) embeddedBean;
|
||||
eb._ebean_getIntercept().setLoaded();
|
||||
((EntityBean) embeddedBean)._ebean_getIntercept().setLoaded();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -402,7 +401,7 @@ public final class InterceptReadWrite implements EntityBeanIntercept {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOrigValue(int propertyIndex) {
|
||||
public Object origValue(int propertyIndex) {
|
||||
if ((flags[propertyIndex] & (FLAG_ORIG_VALUE_SET | FLAG_MUTABLE_HASH_SET)) == FLAG_MUTABLE_HASH_SET) {
|
||||
// mutable hash set, but not ORIG_VALUE
|
||||
setOriginalValue(propertyIndex, mutableInfo[propertyIndex].get());
|
||||
@@ -415,7 +414,7 @@ public final class InterceptReadWrite implements EntityBeanIntercept {
|
||||
|
||||
@Override
|
||||
public int findProperty(String propertyName) {
|
||||
String[] names = owner._ebean_getPropertyNames();
|
||||
final String[] names = owner._ebean_getPropertyNames();
|
||||
for (int i = 0; i < names.length; i++) {
|
||||
if (names[i].equals(propertyName)) {
|
||||
return i;
|
||||
@@ -425,7 +424,7 @@ public final class InterceptReadWrite implements EntityBeanIntercept {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProperty(int propertyIndex) {
|
||||
public String property(int propertyIndex) {
|
||||
if (propertyIndex == -1) {
|
||||
return null;
|
||||
}
|
||||
@@ -433,13 +432,13 @@ public final class InterceptReadWrite implements EntityBeanIntercept {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPropertyLength() {
|
||||
public int propertyLength() {
|
||||
return flags.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPropertyLoaded(String propertyName, boolean loaded) {
|
||||
int position = findProperty(propertyName);
|
||||
final int position = findProperty(propertyName);
|
||||
if (position == -1) {
|
||||
throw new IllegalArgumentException("Property " + propertyName + " not found");
|
||||
}
|
||||
@@ -533,23 +532,23 @@ public final class InterceptReadWrite implements EntityBeanIntercept {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getLoadedPropertyNames() {
|
||||
public Set<String> loadedPropertyNames() {
|
||||
if (fullyLoadedBean) {
|
||||
return null;
|
||||
}
|
||||
Set<String> props = new LinkedHashSet<>();
|
||||
final Set<String> props = new LinkedHashSet<>();
|
||||
for (int i = 0; i < flags.length; i++) {
|
||||
if ((flags[i] & FLAG_LOADED_PROP) != 0) {
|
||||
props.add(getProperty(i));
|
||||
props.add(property(i));
|
||||
}
|
||||
}
|
||||
return props;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean[] getDirtyProperties() {
|
||||
int len = getPropertyLength();
|
||||
boolean[] dirties = new boolean[len];
|
||||
public boolean[] dirtyProperties() {
|
||||
final int len = propertyLength();
|
||||
final boolean[] dirties = new boolean[len];
|
||||
for (int i = 0; i < len; i++) {
|
||||
// this, or an embedded property has been changed - recurse
|
||||
dirties[i] = (flags[i] & (FLAG_CHANGED_PROP + FLAG_EMBEDDED_DIRTY)) != 0;
|
||||
@@ -558,31 +557,31 @@ public final class InterceptReadWrite implements EntityBeanIntercept {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getDirtyPropertyNames() {
|
||||
Set<String> props = new LinkedHashSet<>();
|
||||
public Set<String> dirtyPropertyNames() {
|
||||
final Set<String> props = new LinkedHashSet<>();
|
||||
addDirtyPropertyNames(props, null);
|
||||
return props;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDirtyPropertyNames(Set<String> props, String prefix) {
|
||||
int len = getPropertyLength();
|
||||
final int len = propertyLength();
|
||||
for (int i = 0; i < len; i++) {
|
||||
if (isChangedProp(i)) {
|
||||
// the property has been changed on this bean
|
||||
props.add((prefix == null ? getProperty(i) : prefix + getProperty(i)));
|
||||
props.add((prefix == null ? property(i) : prefix + property(i)));
|
||||
} else if ((flags[i] & FLAG_EMBEDDED_DIRTY) != 0) {
|
||||
// an embedded property has been changed - recurse
|
||||
EntityBean embeddedBean = (EntityBean) owner._ebean_getField(i);
|
||||
embeddedBean._ebean_getIntercept().addDirtyPropertyNames(props, getProperty(i) + ".");
|
||||
final EntityBean embeddedBean = (EntityBean) owner._ebean_getField(i);
|
||||
embeddedBean._ebean_getIntercept().addDirtyPropertyNames(props, property(i) + ".");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasDirtyProperty(Set<String> propertyNames) {
|
||||
String[] names = owner._ebean_getPropertyNames();
|
||||
int len = getPropertyLength();
|
||||
final String[] names = owner._ebean_getPropertyNames();
|
||||
final int len = propertyLength();
|
||||
for (int i = 0; i < len; i++) {
|
||||
if (isChangedProp(i)) {
|
||||
if (propertyNames.contains(names[i])) {
|
||||
@@ -598,46 +597,46 @@ public final class InterceptReadWrite implements EntityBeanIntercept {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, ValuePair> getDirtyValues() {
|
||||
Map<String, ValuePair> dirtyValues = new LinkedHashMap<>();
|
||||
public Map<String, ValuePair> dirtyValues() {
|
||||
final Map<String, ValuePair> dirtyValues = new LinkedHashMap<>();
|
||||
addDirtyPropertyValues(dirtyValues, null);
|
||||
return dirtyValues;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDirtyPropertyValues(Map<String, ValuePair> dirtyValues, String prefix) {
|
||||
int len = getPropertyLength();
|
||||
final int len = propertyLength();
|
||||
for (int i = 0; i < len; i++) {
|
||||
if (isChangedProp(i)) {
|
||||
// the property has been changed on this bean
|
||||
String propName = (prefix == null ? getProperty(i) : prefix + getProperty(i));
|
||||
Object newVal = owner._ebean_getField(i);
|
||||
Object oldVal = getOrigValue(i);
|
||||
final String propName = (prefix == null ? property(i) : prefix + property(i));
|
||||
final Object newVal = owner._ebean_getField(i);
|
||||
final Object oldVal = origValue(i);
|
||||
if (notEqual(oldVal, newVal)) {
|
||||
dirtyValues.put(propName, new ValuePair(newVal, oldVal));
|
||||
}
|
||||
} else if ((flags[i] & FLAG_EMBEDDED_DIRTY) != 0) {
|
||||
// an embedded property has been changed - recurse
|
||||
EntityBean embeddedBean = (EntityBean) owner._ebean_getField(i);
|
||||
embeddedBean._ebean_getIntercept().addDirtyPropertyValues(dirtyValues, getProperty(i) + ".");
|
||||
final EntityBean embeddedBean = (EntityBean) owner._ebean_getField(i);
|
||||
embeddedBean._ebean_getIntercept().addDirtyPropertyValues(dirtyValues, property(i) + ".");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDirtyPropertyValues(BeanDiffVisitor visitor) {
|
||||
int len = getPropertyLength();
|
||||
final int len = propertyLength();
|
||||
for (int i = 0; i < len; i++) {
|
||||
if (isChangedProp(i)) {
|
||||
// the property has been changed on this bean
|
||||
Object newVal = owner._ebean_getField(i);
|
||||
Object oldVal = getOrigValue(i);
|
||||
final Object newVal = owner._ebean_getField(i);
|
||||
final Object oldVal = origValue(i);
|
||||
if (notEqual(oldVal, newVal)) {
|
||||
visitor.visit(i, newVal, oldVal);
|
||||
}
|
||||
} else if ((flags[i] & FLAG_EMBEDDED_DIRTY) != 0) {
|
||||
// an embedded property has been changed - recurse
|
||||
EntityBean embeddedBean = (EntityBean) owner._ebean_getField(i);
|
||||
final EntityBean embeddedBean = (EntityBean) owner._ebean_getField(i);
|
||||
visitor.visitPush(i);
|
||||
embeddedBean._ebean_getIntercept().addDirtyPropertyValues(visitor);
|
||||
visitor.visitPop();
|
||||
@@ -646,8 +645,8 @@ public final class InterceptReadWrite implements EntityBeanIntercept {
|
||||
}
|
||||
|
||||
@Override
|
||||
public StringBuilder getDirtyPropertyKey() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
public StringBuilder dirtyPropertyKey() {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
addDirtyPropertyKey(sb);
|
||||
return sb;
|
||||
}
|
||||
@@ -657,24 +656,23 @@ public final class InterceptReadWrite implements EntityBeanIntercept {
|
||||
if (sortOrder > 0) {
|
||||
sb.append("s,");
|
||||
}
|
||||
int len = getPropertyLength();
|
||||
final int len = propertyLength();
|
||||
for (int i = 0; i < len; i++) {
|
||||
if ((flags[i] & FLAG_CHANGED_PROP) != 0) { // we do not check against mutablecontent here.
|
||||
sb.append(i).append(',');
|
||||
} else if ((flags[i] & FLAG_EMBEDDED_DIRTY) != 0) {
|
||||
// an embedded property has been changed - recurse
|
||||
EntityBean embeddedBean = (EntityBean) owner._ebean_getField(i);
|
||||
sb.append(i).append('[');
|
||||
embeddedBean._ebean_getIntercept().addDirtyPropertyKey(sb);
|
||||
((EntityBean) owner._ebean_getField(i))._ebean_getIntercept().addDirtyPropertyKey(sb);
|
||||
sb.append(']');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public StringBuilder getLoadedPropertyKey() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
int len = getPropertyLength();
|
||||
public StringBuilder loadedPropertyKey() {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
final int len = propertyLength();
|
||||
for (int i = 0; i < len; i++) {
|
||||
if (isLoadedProperty(i)) {
|
||||
sb.append(i).append(',');
|
||||
@@ -684,8 +682,8 @@ public final class InterceptReadWrite implements EntityBeanIntercept {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean[] getLoaded() {
|
||||
boolean[] ret = new boolean[flags.length];
|
||||
public boolean[] loaded() {
|
||||
final boolean[] ret = new boolean[flags.length];
|
||||
for (int i = 0; i < ret.length; i++) {
|
||||
ret[i] = (flags[i] & FLAG_LOADED_PROP) != 0;
|
||||
}
|
||||
@@ -693,13 +691,13 @@ public final class InterceptReadWrite implements EntityBeanIntercept {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLazyLoadPropertyIndex() {
|
||||
public int lazyLoadPropertyIndex() {
|
||||
return lazyLoadProperty;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLazyLoadProperty() {
|
||||
return getProperty(lazyLoadProperty);
|
||||
public String lazyLoadProperty() {
|
||||
return property(lazyLoadProperty);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -839,7 +837,7 @@ public final class InterceptReadWrite implements EntityBeanIntercept {
|
||||
loadBean(propertyIndex);
|
||||
}
|
||||
if (nodeUsageCollector != null) {
|
||||
nodeUsageCollector.addUsed(getProperty(propertyIndex));
|
||||
nodeUsageCollector.addUsed(property(propertyIndex));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -988,7 +986,7 @@ public final class InterceptReadWrite implements EntityBeanIntercept {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSortOrder() {
|
||||
public int sortOrder() {
|
||||
return sortOrder;
|
||||
}
|
||||
|
||||
@@ -1017,19 +1015,19 @@ public final class InterceptReadWrite implements EntityBeanIntercept {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Exception> getLoadErrors() {
|
||||
public Map<String, Exception> loadErrors() {
|
||||
if (loadErrors == null) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
Map<String, Exception> ret = null;
|
||||
int len = getPropertyLength();
|
||||
int len = propertyLength();
|
||||
for (int i = 0; i < len; i++) {
|
||||
Exception loadError = loadErrors[i];
|
||||
final Exception loadError = loadErrors[i];
|
||||
if (loadError != null) {
|
||||
if (ret == null) {
|
||||
ret = new LinkedHashMap<>();
|
||||
}
|
||||
ret.put(getProperty(i), loadError);
|
||||
ret.put(property(i), loadError);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
|
||||
@@ -59,17 +59,17 @@ abstract class AbstractBeanCollection<E> implements BeanCollection<E> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityBean getOwnerBean() {
|
||||
public EntityBean owner() {
|
||||
return ownerBean;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPropertyName() {
|
||||
public String propertyName() {
|
||||
return propertyName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExpressionList<?> getFilterMany() {
|
||||
public ExpressionList<?> filterMany() {
|
||||
return filterMany;
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ abstract class AbstractBeanCollection<E> implements BeanCollection<E> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModifyListenMode getModifyListening() {
|
||||
public ModifyListenMode modifyListening() {
|
||||
return modifyListenMode;
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ abstract class AbstractBeanCollection<E> implements BeanCollection<E> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<E> getModifyAdditions() {
|
||||
public Set<E> modifyAdditions() {
|
||||
if (modifyHolder == null) {
|
||||
return null;
|
||||
} else {
|
||||
@@ -191,7 +191,7 @@ abstract class AbstractBeanCollection<E> implements BeanCollection<E> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<E> getModifyRemovals() {
|
||||
public Set<E> modifyRemovals() {
|
||||
if (modifyHolder == null) {
|
||||
return null;
|
||||
} else {
|
||||
@@ -213,7 +213,7 @@ abstract class AbstractBeanCollection<E> implements BeanCollection<E> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies all relevant properties for a clone. See {@link #getShallowCopy()}
|
||||
* Copies all relevant properties for a clone. See {@link #shallowCopy()}
|
||||
*/
|
||||
protected void setFromOriginal(AbstractBeanCollection<E> other) {
|
||||
this.disableLazyLoad = other.disableLazyLoad;
|
||||
|
||||
@@ -3,12 +3,7 @@ package io.ebean.common;
|
||||
import io.ebean.bean.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* List capable of lazy loading and modification awareness.
|
||||
@@ -73,7 +68,7 @@ public final class BeanList<E> extends AbstractBeanCollection<E> implements List
|
||||
if (list == null) {
|
||||
list = new ArrayList<>();
|
||||
}
|
||||
list.addAll((Collection<? extends E>) other.getActualDetails());
|
||||
list.addAll((Collection<? extends E>) other.actualDetails());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -159,17 +154,17 @@ public final class BeanList<E> extends AbstractBeanCollection<E> implements List
|
||||
/**
|
||||
* Return the actual underlying list.
|
||||
*/
|
||||
public List<E> getActualList() {
|
||||
public List<E> actualList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<E> getActualDetails() {
|
||||
public Collection<E> actualDetails() {
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<?> getActualEntries() {
|
||||
public Collection<?> actualEntries() {
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -538,7 +533,7 @@ public final class BeanList<E> extends AbstractBeanCollection<E> implements List
|
||||
}
|
||||
|
||||
@Override
|
||||
public BeanCollection<E> getShallowCopy() {
|
||||
public BeanCollection<E> shallowCopy() {
|
||||
BeanList<E> copy = new BeanList<>(new CopyOnFirstWriteList<>(list));
|
||||
copy.setFromOriginal(this);
|
||||
return copy;
|
||||
|
||||
@@ -5,11 +5,7 @@ import io.ebean.bean.BeanCollectionLoader;
|
||||
import io.ebean.bean.EntityBean;
|
||||
import io.ebean.bean.ToStringBuilder;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Map capable of lazy loading and modification aware.
|
||||
@@ -71,7 +67,7 @@ public final class BeanMap<K, E> extends AbstractBeanCollection<E> implements Ma
|
||||
public void loadFrom(BeanCollection<?> other) {
|
||||
BeanMap<K, E> otherMap = (BeanMap<K, E>) other;
|
||||
internalPutNull();
|
||||
map.putAll(otherMap.getActualMap());
|
||||
map.putAll(otherMap.actualMap());
|
||||
}
|
||||
|
||||
public void internalPutNull() {
|
||||
@@ -175,7 +171,7 @@ public final class BeanMap<K, E> extends AbstractBeanCollection<E> implements Ma
|
||||
/**
|
||||
* Return the actual underlying map.
|
||||
*/
|
||||
public Map<K, E> getActualMap() {
|
||||
public Map<K, E> actualMap() {
|
||||
return map;
|
||||
}
|
||||
|
||||
@@ -183,7 +179,7 @@ public final class BeanMap<K, E> extends AbstractBeanCollection<E> implements Ma
|
||||
* Returns the collection of beans (map values).
|
||||
*/
|
||||
@Override
|
||||
public Collection<E> getActualDetails() {
|
||||
public Collection<E> actualDetails() {
|
||||
return map.values();
|
||||
}
|
||||
|
||||
@@ -191,7 +187,7 @@ public final class BeanMap<K, E> extends AbstractBeanCollection<E> implements Ma
|
||||
* Returns the map entrySet.
|
||||
*/
|
||||
@Override
|
||||
public Collection<?> getActualEntries() {
|
||||
public Collection<?> actualEntries() {
|
||||
return map.entrySet();
|
||||
}
|
||||
|
||||
@@ -346,7 +342,7 @@ public final class BeanMap<K, E> extends AbstractBeanCollection<E> implements Ma
|
||||
}
|
||||
|
||||
@Override
|
||||
public BeanCollection<E> getShallowCopy() {
|
||||
public BeanCollection<E> shallowCopy() {
|
||||
BeanMap<K, E> copy = new BeanMap<>(new LinkedHashMap<>(map));
|
||||
copy.setFromOriginal(this);
|
||||
return copy;
|
||||
|
||||
@@ -67,7 +67,7 @@ public final class BeanSet<E> extends AbstractBeanCollection<E> implements Set<E
|
||||
if (set == null) {
|
||||
set = new LinkedHashSet<>();
|
||||
}
|
||||
set.addAll((Collection<? extends E>) other.getActualDetails());
|
||||
set.addAll((Collection<? extends E>) other.actualDetails());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -155,17 +155,17 @@ public final class BeanSet<E> extends AbstractBeanCollection<E> implements Set<E
|
||||
/**
|
||||
* Return the actual underlying set.
|
||||
*/
|
||||
public Set<E> getActualSet() {
|
||||
public Set<E> actualSet() {
|
||||
return set;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<E> getActualDetails() {
|
||||
public Collection<E> actualDetails() {
|
||||
return set;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<?> getActualEntries() {
|
||||
public Collection<?> actualEntries() {
|
||||
return set;
|
||||
}
|
||||
|
||||
@@ -382,7 +382,7 @@ public final class BeanSet<E> extends AbstractBeanCollection<E> implements Set<E
|
||||
}
|
||||
|
||||
@Override
|
||||
public BeanCollection<E> getShallowCopy() {
|
||||
public BeanCollection<E> shallowCopy() {
|
||||
BeanSet<E> copy = new BeanSet<>(new LinkedHashSet<>(set));
|
||||
copy.setFromOriginal(this);
|
||||
return copy;
|
||||
|
||||
@@ -23,7 +23,7 @@ public final class LoadBeanRequest extends LoadRequest {
|
||||
* Construct for lazy load request.
|
||||
*/
|
||||
public LoadBeanRequest(LoadBeanBuffer loadBuffer, EntityBeanIntercept ebi, boolean loadCache) {
|
||||
this(loadBuffer, null, true, ebi.getLazyLoadProperty(), ebi.isLoaded(), loadCache || ebi.isLoadedFromCache());
|
||||
this(loadBuffer, null, true, ebi.lazyLoadProperty(), ebi.isLoaded(), loadCache || ebi.isLoadedFromCache());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -66,7 +66,7 @@ public final class LoadBeanRequest extends LoadRequest {
|
||||
final List<Object> idList = new ArrayList<>(batch.size());
|
||||
final BeanDescriptor<?> desc = loadBuffer.descriptor();
|
||||
for (EntityBeanIntercept ebi : batch) {
|
||||
idList.add(desc.getId(ebi.getOwner()));
|
||||
idList.add(desc.getId(ebi.owner()));
|
||||
}
|
||||
return idList;
|
||||
}
|
||||
@@ -116,10 +116,10 @@ public final class LoadBeanRequest extends LoadRequest {
|
||||
for (EntityBeanIntercept ebi : batch) {
|
||||
// check if the underlying row in DB was deleted. Mark the bean as 'failed' if
|
||||
// necessary but allow processing to continue until it is accessed by client code
|
||||
Object id = desc.getId(ebi.getOwner());
|
||||
Object id = desc.getId(ebi.owner());
|
||||
if (!loadedIds.contains(id)) {
|
||||
// assume this is logically deleted (hence not found)
|
||||
desc.markAsDeleted(ebi.getOwner());
|
||||
desc.markAsDeleted(ebi.owner());
|
||||
missedIds.add(id);
|
||||
missed.add(ebi);
|
||||
}
|
||||
|
||||
@@ -66,13 +66,13 @@ public final class LoadManyRequest extends LoadRequest {
|
||||
if (lazy && !originIncluded && bc == originCollection) {
|
||||
originIncluded = true;
|
||||
}
|
||||
idList.add(many.parentId(bc.getOwnerBean()));
|
||||
idList.add(many.parentId(bc.owner()));
|
||||
bc.setLoader(server); // don't use the load buffer again
|
||||
}
|
||||
}
|
||||
if (originCollection != null && !originIncluded) {
|
||||
CoreLog.log.log(INFO, "Batch lazy loading including origin collection - size:{0}", idList.size());
|
||||
idList.add(many.parentId(originCollection.getOwnerBean()));
|
||||
idList.add(many.parentId(originCollection.owner()));
|
||||
originCollection.setLoader(server); // don't use the load buffer again
|
||||
}
|
||||
if (many.targetDescriptor().isPadInExpression()) {
|
||||
@@ -129,12 +129,12 @@ public final class LoadManyRequest extends LoadRequest {
|
||||
if (bc != null) {
|
||||
if (bc.checkEmptyLazyLoad()) {
|
||||
if (log.isLoggable(DEBUG)) {
|
||||
EntityBean ownerBean = bc.getOwnerBean();
|
||||
EntityBean ownerBean = bc.owner();
|
||||
Object parentId = desc.getId(ownerBean);
|
||||
log.log(DEBUG, "BeanCollection after lazy load was empty. type:{0} id:{1} owner:{2}", ownerBean.getClass().getName(), parentId, ownerBean);
|
||||
}
|
||||
} else if (loadCache && many.isUseCache()) {
|
||||
desc.cacheManyPropPut(many, bc, desc.cacheKeyForBean(bc.getOwnerBean()));
|
||||
desc.cacheManyPropPut(many, bc, desc.cacheKeyForBean(bc.owner()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ final class DefaultBeanLoader {
|
||||
}
|
||||
|
||||
void loadMany(BeanCollection<?> bc, boolean onlyIds) {
|
||||
loadManyInternal(bc.getOwnerBean(), bc.getPropertyName(), false, onlyIds);
|
||||
loadManyInternal(bc.owner(), bc.propertyName(), false, onlyIds);
|
||||
}
|
||||
|
||||
void refreshMany(EntityBean parentBean, String propertyName) {
|
||||
@@ -51,7 +51,7 @@ final class DefaultBeanLoader {
|
||||
|
||||
private void loadManyInternal(EntityBean parentBean, String propertyName, boolean refresh, boolean onlyIds) {
|
||||
EntityBeanIntercept ebi = parentBean._ebean_getIntercept();
|
||||
PersistenceContext pc = ebi.getPersistenceContext();
|
||||
PersistenceContext pc = ebi.persistenceContext();
|
||||
BeanDescriptor<?> parentDesc = server.descriptor(parentBean.getClass());
|
||||
BeanPropertyAssocMany<?> many = (BeanPropertyAssocMany<?>) parentDesc.beanProperty(propertyName);
|
||||
BeanCollection<?> beanCollection = null;
|
||||
@@ -60,7 +60,7 @@ final class DefaultBeanLoader {
|
||||
Object currentValue = many.getValue(parentBean);
|
||||
if (currentValue instanceof BeanCollection<?>) {
|
||||
beanCollection = (BeanCollection<?>) currentValue;
|
||||
filterMany = beanCollection.getFilterMany();
|
||||
filterMany = beanCollection.filterMany();
|
||||
}
|
||||
|
||||
Object parentId = parentDesc.getId(parentBean);
|
||||
@@ -113,7 +113,7 @@ final class DefaultBeanLoader {
|
||||
if (beanCollection != null) {
|
||||
if (beanCollection.checkEmptyLazyLoad()) {
|
||||
if (log.isLoggable(DEBUG)) {
|
||||
log.log(DEBUG, "BeanCollection after load was empty. Owner:{0}", beanCollection.getOwnerBean());
|
||||
log.log(DEBUG, "BeanCollection after load was empty. Owner:{0}", beanCollection.owner());
|
||||
}
|
||||
} else if (useManyIdCache) {
|
||||
final String parentKey = parentDesc.cacheKey(parentId);
|
||||
@@ -172,12 +172,12 @@ final class DefaultBeanLoader {
|
||||
}
|
||||
|
||||
void loadBean(EntityBeanIntercept ebi) {
|
||||
refreshBeanInternal(ebi.getOwner(), SpiQuery.Mode.LAZYLOAD_BEAN, -1);
|
||||
refreshBeanInternal(ebi.owner(), SpiQuery.Mode.LAZYLOAD_BEAN, -1);
|
||||
}
|
||||
|
||||
private void refreshBeanInternal(EntityBean bean, SpiQuery.Mode mode, int embeddedOwnerIndex) {
|
||||
EntityBeanIntercept ebi = bean._ebean_getIntercept();
|
||||
PersistenceContext pc = ebi.getPersistenceContext();
|
||||
PersistenceContext pc = ebi.persistenceContext();
|
||||
if (Mode.REFRESH_BEAN == mode) {
|
||||
// need a new PersistenceContext for REFRESH
|
||||
pc = null;
|
||||
@@ -185,8 +185,8 @@ final class DefaultBeanLoader {
|
||||
BeanDescriptor<?> desc = server.descriptor(bean.getClass());
|
||||
if (EntityType.EMBEDDED == desc.entityType()) {
|
||||
// lazy loading on an embedded bean property
|
||||
EntityBean embeddedOwner = (EntityBean) ebi.getEmbeddedOwner();
|
||||
refreshBeanInternal(embeddedOwner, mode, ebi.getEmbeddedOwnerIndex());
|
||||
EntityBean embeddedOwner = (EntityBean) ebi.embeddedOwner();
|
||||
refreshBeanInternal(embeddedOwner, mode, ebi.embeddedOwnerIndex());
|
||||
}
|
||||
Object id = desc.getId(bean);
|
||||
if (pc == null) {
|
||||
@@ -208,14 +208,14 @@ final class DefaultBeanLoader {
|
||||
}
|
||||
}
|
||||
SpiQuery<?> query = server.createQuery(desc.type());
|
||||
query.setLazyLoadProperty(ebi.getLazyLoadProperty());
|
||||
query.setLazyLoadProperty(ebi.lazyLoadProperty());
|
||||
if (draft) {
|
||||
query.asDraft();
|
||||
} else if (mode == SpiQuery.Mode.LAZYLOAD_BEAN && desc.isSoftDelete()) {
|
||||
query.setIncludeSoftDeletes();
|
||||
}
|
||||
if (embeddedOwnerIndex > -1) {
|
||||
query.select(ebi.getProperty(embeddedOwnerIndex));
|
||||
query.select(ebi.property(embeddedOwnerIndex));
|
||||
}
|
||||
// don't collect AutoTune usage profiling information
|
||||
// as we just copy the data out of these fetched beans
|
||||
|
||||
@@ -46,17 +46,17 @@ public final class DefaultBeanState implements BeanState {
|
||||
|
||||
@Override
|
||||
public Set<String> loadedProps() {
|
||||
return intercept.getLoadedPropertyNames();
|
||||
return intercept.loadedPropertyNames();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> changedProps() {
|
||||
return intercept.getDirtyPropertyNames();
|
||||
return intercept.dirtyPropertyNames();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, ValuePair> dirtyValues() {
|
||||
return intercept.getDirtyValues();
|
||||
return intercept.dirtyValues();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -91,11 +91,11 @@ public final class DefaultBeanState implements BeanState {
|
||||
|
||||
@Override
|
||||
public Map<String, Exception> loadErrors() {
|
||||
return intercept.getLoadErrors();
|
||||
return intercept.loadErrors();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int sortOrder() {
|
||||
return intercept.getSortOrder();
|
||||
return intercept.sortOrder();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public final class DiffHelp {
|
||||
}
|
||||
}
|
||||
if (oldBean == null) {
|
||||
return ((EntityBean) newBean)._ebean_getIntercept().getDirtyValues();
|
||||
return ((EntityBean) newBean)._ebean_getIntercept().dirtyValues();
|
||||
}
|
||||
return desc.diff((EntityBean) newBean, (EntityBean) oldBean);
|
||||
}
|
||||
|
||||
@@ -529,7 +529,7 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
|
||||
OrderBy<T> orderBy = query.getOrderBy();
|
||||
if (orderBy != null && !orderBy.isEmpty()) {
|
||||
// in memory sort after merging the cache hits with the DB hits
|
||||
beanDescriptor.sort(((BeanList<T>) result).getActualList(), orderBy.toStringFormat());
|
||||
beanDescriptor.sort(((BeanList<T>) result).actualList(), orderBy.toStringFormat());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -646,7 +646,7 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
|
||||
if (cached != null && isAuditReads() && readAuditQueryType()) {
|
||||
if (cached instanceof BeanCollection) {
|
||||
// raw sql can't use L2 cache so normal queries only in here
|
||||
Collection<T> actualDetails = ((BeanCollection<T>) cached).getActualDetails();
|
||||
Collection<T> actualDetails = ((BeanCollection<T>) cached).actualDetails();
|
||||
List<Object> ids = new ArrayList<>(actualDetails.size());
|
||||
for (T bean : actualDetails) {
|
||||
ids.add(beanDescriptor.idForJson(bean));
|
||||
@@ -657,7 +657,7 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
|
||||
if (Boolean.FALSE.equals(query.isReadOnly())) {
|
||||
// return shallow copies if readonly is explicitly set to false
|
||||
if (cached instanceof BeanCollection) {
|
||||
cached = ((BeanCollection<?>) cached).getShallowCopy();
|
||||
cached = ((BeanCollection<?>) cached).shallowCopy();
|
||||
} else if (cached instanceof List) {
|
||||
cached = new CopyOnFirstWriteList<>((List<?>) cached);
|
||||
} else if (cached instanceof Set) {
|
||||
|
||||
@@ -281,7 +281,7 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
|
||||
|
||||
private void onFailedUpdateUndoGeneratedProperties() {
|
||||
for (BeanProperty prop : beanDescriptor.propertiesGenUpdate()) {
|
||||
Object oldVal = intercept.getOrigValue(prop.propertyIndex());
|
||||
Object oldVal = intercept.origValue(prop.propertyIndex());
|
||||
prop.setValue(entityBean, oldVal);
|
||||
}
|
||||
}
|
||||
@@ -372,12 +372,12 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
|
||||
|
||||
@Override
|
||||
public Set<String> loadedProperties() {
|
||||
return intercept.getLoadedPropertyNames();
|
||||
return intercept.loadedPropertyNames();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> updatedProperties() {
|
||||
return intercept.getDirtyPropertyNames();
|
||||
return intercept.dirtyPropertyNames();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -410,7 +410,7 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
|
||||
|
||||
@Override
|
||||
public Map<String, ValuePair> updatedValues() {
|
||||
return intercept.getDirtyValues();
|
||||
return intercept.dirtyValues();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -713,7 +713,7 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
|
||||
* Return the original / old value for the given property.
|
||||
*/
|
||||
public Object getOrigValue(BeanProperty prop) {
|
||||
return intercept.getOrigValue(prop.propertyIndex());
|
||||
return intercept.origValue(prop.propertyIndex());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -867,7 +867,7 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
|
||||
boolean isChangeLog = beanDescriptor.isChangeLog();
|
||||
if (type == Type.UPDATE && (isChangeLog || notifyCache || docStoreMode == DocStoreMode.UPDATE)) {
|
||||
// get the dirty properties for update notification to the doc store
|
||||
dirtyProperties = intercept.getDirtyProperties();
|
||||
dirtyProperties = intercept.dirtyProperties();
|
||||
}
|
||||
if (isChangeLog) {
|
||||
changeLog();
|
||||
@@ -1142,9 +1142,9 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
|
||||
public String updatePlanHash() {
|
||||
StringBuilder key;
|
||||
if (determineUpdateAllLoadedProperties()) {
|
||||
key = intercept.getLoadedPropertyKey();
|
||||
key = intercept.loadedPropertyKey();
|
||||
} else {
|
||||
key = intercept.getDirtyPropertyKey();
|
||||
key = intercept.dirtyPropertyKey();
|
||||
}
|
||||
BeanProperty versionProperty = beanDescriptor.versionProperty();
|
||||
if (versionProperty != null) {
|
||||
@@ -1237,7 +1237,7 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
|
||||
public void docStorePersist() {
|
||||
idValue = beanDescriptor.getId(entityBean);
|
||||
if (type == Type.UPDATE) {
|
||||
dirtyProperties = intercept.getDirtyProperties();
|
||||
dirtyProperties = intercept.dirtyProperties();
|
||||
}
|
||||
// processing now so set IGNORE (unlike DB + DocStore processing with post-commit)
|
||||
docStoreMode = DocStoreMode.IGNORE;
|
||||
|
||||
@@ -45,7 +45,7 @@ abstract class BaseCollectionHelp<T> implements BeanCollectionHelp<T> {
|
||||
@Override
|
||||
public final Collection underlying(Object value) {
|
||||
if (value instanceof BeanCollection) {
|
||||
return ((BeanCollection)value).getActualDetails();
|
||||
return ((BeanCollection)value).actualDetails();
|
||||
} else {
|
||||
return (Collection)value;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public final class BeanCollectionUtil {
|
||||
}
|
||||
// For maps this is a collection of Map.Entry, otherwise it
|
||||
// returns a collection of beans
|
||||
return bc.getActualEntries();
|
||||
return bc.actualEntries();
|
||||
}
|
||||
if (o instanceof Collection<?>) {
|
||||
return ((Collection<?>) o);
|
||||
@@ -61,7 +61,7 @@ public final class BeanCollectionUtil {
|
||||
}
|
||||
// For maps this is a collection of Map.Entry, otherwise it
|
||||
// returns a collection of beans
|
||||
return bc.getActualDetails();
|
||||
return bc.actualDetails();
|
||||
}
|
||||
if (o instanceof Map<?, ?>) {
|
||||
// yes, we want the entrySet (to set the keys)
|
||||
|
||||
@@ -29,6 +29,7 @@ import io.ebeaninternal.api.*;
|
||||
import io.ebeaninternal.api.TransactionEventTable.TableIUD;
|
||||
import io.ebeaninternal.api.json.SpiJsonReader;
|
||||
import io.ebeaninternal.api.json.SpiJsonWriter;
|
||||
import io.ebeaninternal.server.bind.DataBind;
|
||||
import io.ebeaninternal.server.cache.CacheChangeSet;
|
||||
import io.ebeaninternal.server.cache.CachedBeanData;
|
||||
import io.ebeaninternal.server.cache.CachedManyIds;
|
||||
@@ -45,7 +46,6 @@ import io.ebeaninternal.server.querydefn.DefaultOrmQuery;
|
||||
import io.ebeaninternal.server.querydefn.OrmQueryDetail;
|
||||
import io.ebeaninternal.server.querydefn.OrmQueryProperties;
|
||||
import io.ebeaninternal.server.rawsql.SpiRawSql;
|
||||
import io.ebeaninternal.server.bind.DataBind;
|
||||
import io.ebeaninternal.util.SortByClause;
|
||||
import io.ebeaninternal.util.SortByClauseParser;
|
||||
import io.ebeanservice.docstore.api.DocStoreBeanAdapter;
|
||||
@@ -350,9 +350,9 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
this.idPropertyIndex = (idProperty == null) ? -1 : ebi.findProperty(idProperty.name());
|
||||
this.versionPropertyIndex = (versionProperty == null) ? -1 : ebi.findProperty(versionProperty.name());
|
||||
this.unloadProperties = derivePropertiesToUnload(prototypeEntityBean);
|
||||
this.propertiesIndex = new BeanProperty[ebi.getPropertyLength()];
|
||||
this.propertiesIndex = new BeanProperty[ebi.propertyLength()];
|
||||
for (int i = 0; i < propertiesIndex.length; i++) {
|
||||
propertiesIndex[i] = propMap.get(ebi.getProperty(i));
|
||||
propertiesIndex[i] = propMap.get(ebi.property(i));
|
||||
}
|
||||
}
|
||||
idSelect = initIdSelect();
|
||||
@@ -400,7 +400,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
* These properties need to be unloaded when populating beans for queries.
|
||||
*/
|
||||
private int[] derivePropertiesToUnload(EntityBean prototypeEntityBean) {
|
||||
boolean[] loaded = prototypeEntityBean._ebean_getIntercept().getLoaded();
|
||||
boolean[] loaded = prototypeEntityBean._ebean_getIntercept().loaded();
|
||||
int[] props = new int[loaded.length];
|
||||
int pos = 0;
|
||||
// collect the positions of the properties initialised in the default constructor.
|
||||
@@ -711,7 +711,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
public void merge(EntityBean bean, EntityBean existing) {
|
||||
EntityBeanIntercept fromEbi = bean._ebean_getIntercept();
|
||||
EntityBeanIntercept toEbi = existing._ebean_getIntercept();
|
||||
int propertyLength = toEbi.getPropertyLength();
|
||||
int propertyLength = toEbi.propertyLength();
|
||||
String[] names = properties();
|
||||
for (int i = 0; i < propertyLength; i++) {
|
||||
if (fromEbi.isLoadedProperty(i)) {
|
||||
@@ -2217,12 +2217,12 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
}
|
||||
|
||||
public boolean lazyLoadMany(EntityBeanIntercept ebi, LoadBeanContext parent) {
|
||||
int lazyLoadProperty = ebi.getLazyLoadPropertyIndex();
|
||||
int lazyLoadProperty = ebi.lazyLoadPropertyIndex();
|
||||
if (lazyLoadProperty == -1) {
|
||||
return false;
|
||||
}
|
||||
if (inheritInfo != null) {
|
||||
return descOf(ebi.getOwner().getClass()).lazyLoadMany(ebi, lazyLoadProperty, parent);
|
||||
return descOf(ebi.owner().getClass()).lazyLoadMany(ebi, lazyLoadProperty, parent);
|
||||
}
|
||||
return lazyLoadMany(ebi, lazyLoadProperty, parent);
|
||||
}
|
||||
@@ -2241,7 +2241,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
BeanProperty lazyLoadBeanProp = propertiesIndex[lazyLoadProperty];
|
||||
if (lazyLoadBeanProp instanceof BeanPropertyAssocMany<?>) {
|
||||
BeanPropertyAssocMany<?> manyProp = (BeanPropertyAssocMany<?>) lazyLoadBeanProp;
|
||||
final BeanCollection<?> collection = manyProp.createReference(ebi.getOwner());
|
||||
final BeanCollection<?> collection = manyProp.createReference(ebi.owner());
|
||||
ebi.setLoadedLazy();
|
||||
if (loadBeanContext != null) {
|
||||
loadBeanContext.register(manyProp, collection);
|
||||
@@ -3076,7 +3076,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
// not using Id generator so just base on isLoaded()
|
||||
return !ebi.isLoaded();
|
||||
}
|
||||
if (!hasIdValue(ebi.getOwner())) {
|
||||
if (!hasIdValue(ebi.owner())) {
|
||||
// No Id property means it must be an insert
|
||||
return true;
|
||||
}
|
||||
@@ -3139,7 +3139,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
for (BeanProperty beanProperty : propertiesMutable) {
|
||||
int propertyIndex = beanProperty.propertyIndex();
|
||||
if (ebi.isLoadedProperty(propertyIndex)) {
|
||||
Object value = beanProperty.getValue(ebi.getOwner());
|
||||
Object value = beanProperty.getValue(ebi.owner());
|
||||
if (beanProperty.checkMutable(value, ebi.isDirtyProperty(propertyIndex), ebi)) {
|
||||
// mutable scalar value which is considered dirty so mark
|
||||
// it as such so that it is included in an update
|
||||
@@ -3156,7 +3156,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
for (BeanProperty beanProperty : propertiesMutable) {
|
||||
int propertyIndex = beanProperty.propertyIndex();
|
||||
if (ebi.isLoadedProperty(propertyIndex)) {
|
||||
Object value = beanProperty.getValue(ebi.getOwner());
|
||||
Object value = beanProperty.getValue(ebi.owner());
|
||||
if (beanProperty.checkMutable(value, ebi.isDirtyProperty(propertyIndex), ebi)) {
|
||||
ebi.markPropertyAsChanged(propertyIndex);
|
||||
return;
|
||||
|
||||
+7
-7
@@ -271,9 +271,9 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
// not in cache so return unsuccessful
|
||||
return false;
|
||||
}
|
||||
EntityBean ownerBean = bc.getOwnerBean();
|
||||
EntityBean ownerBean = bc.owner();
|
||||
EntityBeanIntercept ebi = ownerBean._ebean_getIntercept();
|
||||
PersistenceContext persistenceContext = ebi.getPersistenceContext();
|
||||
PersistenceContext persistenceContext = ebi.persistenceContext();
|
||||
BeanDescriptor<?> targetDescriptor = many.targetDescriptor();
|
||||
|
||||
List<Object> idList = entry.getIdList();
|
||||
@@ -696,7 +696,7 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
Set<EntityBeanIntercept> beanCacheLoadAll(Set<EntityBeanIntercept> batch, PersistenceContext context, int lazyLoadProperty, String propertyName) {
|
||||
Map<Object, EntityBeanIntercept> ebis = new HashMap<>();
|
||||
for (EntityBeanIntercept ebi : batch) {
|
||||
ebis.put(desc.cacheKeyForBean(ebi.getOwner()), ebi);
|
||||
ebis.put(desc.cacheKeyForBean(ebi.owner()), ebi);
|
||||
}
|
||||
|
||||
Map<Object, Object> hits = getBeanCache().getAll(ebis.keySet());
|
||||
@@ -715,7 +715,7 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
beanLog.log(TRACE, " load {0}({1}) - cache miss on property({2})", cacheName, key, propertyName);
|
||||
}
|
||||
} else {
|
||||
CachedBeanDataToBean.load(desc, ebi.getOwner(), cacheData, context);
|
||||
CachedBeanDataToBean.load(desc, ebi.owner(), cacheData, context);
|
||||
loaded.add(ebi);
|
||||
if (beanLog.isLoggable(DEBUG)) {
|
||||
beanLog.log(DEBUG, " load {0}({1}) - hit", cacheName, key);
|
||||
@@ -739,10 +739,10 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
int lazyLoadProperty = ebi.getLazyLoadPropertyIndex();
|
||||
if (lazyLoadProperty > -1 && !cacheData.isLoaded(ebi.getLazyLoadProperty())) {
|
||||
int lazyLoadProperty = ebi.lazyLoadPropertyIndex();
|
||||
if (lazyLoadProperty > -1 && !cacheData.isLoaded(ebi.lazyLoadProperty())) {
|
||||
if (beanLog.isLoggable(TRACE)) {
|
||||
beanLog.log(TRACE, " LOAD {0}({1}) - cache miss on property({2})", cacheName, key, ebi.getLazyLoadProperty());
|
||||
beanLog.log(TRACE, " LOAD {0}({1}) - cache miss on property({2})", cacheName, key, ebi.lazyLoadProperty());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ public class BeanListHelp<T> extends BaseCollectionHelp<T> {
|
||||
public final BeanCollectionAdd getBeanCollectionAdd(Object bc, String mapKey) {
|
||||
if (bc instanceof BeanList<?>) {
|
||||
BeanList<?> bl = (BeanList<?>) bc;
|
||||
if (bl.getActualList() == null) {
|
||||
if (bl.actualList() == null) {
|
||||
bl.setActualList(new ArrayList<>());
|
||||
}
|
||||
return bl;
|
||||
@@ -85,7 +85,7 @@ public class BeanListHelp<T> extends BaseCollectionHelp<T> {
|
||||
} else if (currentList instanceof BeanList<?>) {
|
||||
// normally this case, replace just the underlying list
|
||||
BeanList<?> currentBeanList = (BeanList<?>) currentList;
|
||||
currentBeanList.setActualList(newBeanList.getActualList());
|
||||
currentBeanList.setActualList(newBeanList.actualList());
|
||||
currentBeanList.setModifyListening(many.modifyListenMode());
|
||||
|
||||
} else {
|
||||
@@ -108,7 +108,7 @@ public class BeanListHelp<T> extends BaseCollectionHelp<T> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
list = beanList.getActualList();
|
||||
list = beanList.actualList();
|
||||
} else {
|
||||
list = (List<?>) collection;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public class BeanMapHelp<T> extends BaseCollectionHelp<T> {
|
||||
BeanProperty beanProp = targetDescriptor.beanProperty(mapKey);
|
||||
if (bc instanceof BeanMap<?, ?>) {
|
||||
BeanMap<Object, Object> bm = (BeanMap<Object, Object>) bc;
|
||||
Map<Object, Object> actualMap = bm.getActualMap();
|
||||
Map<Object, Object> actualMap = bm.actualMap();
|
||||
if (actualMap == null) {
|
||||
actualMap = new LinkedHashMap<>();
|
||||
bm.setActualMap(actualMap);
|
||||
@@ -132,7 +132,7 @@ public class BeanMapHelp<T> extends BaseCollectionHelp<T> {
|
||||
} else if (current instanceof BeanMap<?, ?>) {
|
||||
// normally this case, replace just the underlying list
|
||||
BeanMap<?, ?> currentBeanMap = (BeanMap<?, ?>) current;
|
||||
currentBeanMap.setActualMap(newBeanMap.getActualMap());
|
||||
currentBeanMap.setActualMap(newBeanMap.actualMap());
|
||||
currentBeanMap.setModifyListening(many.modifyListenMode());
|
||||
|
||||
} else {
|
||||
@@ -155,7 +155,7 @@ public class BeanMapHelp<T> extends BaseCollectionHelp<T> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
map = bc.getActualMap();
|
||||
map = bc.actualMap();
|
||||
} else {
|
||||
map = (Map<?, ?>) collection;
|
||||
}
|
||||
|
||||
@@ -700,7 +700,7 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
|
||||
* Return the bean cache value for this property using original values.
|
||||
*/
|
||||
public Object getCacheDataValueOrig(EntityBeanIntercept ebi) {
|
||||
return cacheDataConvert(ebi.getOrigValue(propertyIndex));
|
||||
return cacheDataConvert(ebi.origValue(propertyIndex));
|
||||
}
|
||||
|
||||
private Object cacheDataConvert(Object value) {
|
||||
|
||||
@@ -875,7 +875,7 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
|
||||
|
||||
// publish from each draft to live bean creating new live beans as required
|
||||
draftVal.size();
|
||||
Collection<T> actualDetails = draftVal.getActualDetails();
|
||||
Collection<T> actualDetails = draftVal.actualDetails();
|
||||
for (T bean : actualDetails) {
|
||||
Object id = targetDescriptor.id(bean);
|
||||
T liveBean = liveBeansAsMap.remove(id);
|
||||
@@ -904,7 +904,7 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
|
||||
@SuppressWarnings("unchecked")
|
||||
private Map<Object, T> liveBeansAsMap(BeanCollection<?> liveVal) {
|
||||
liveVal.size();
|
||||
Collection<?> liveBeans = liveVal.getActualDetails();
|
||||
Collection<?> liveBeans = liveVal.actualDetails();
|
||||
Map<Object, T> liveMap = new LinkedHashMap<>();
|
||||
for (Object liveBean : liveBeans) {
|
||||
Object id = targetDescriptor.id(liveBean);
|
||||
|
||||
@@ -408,7 +408,7 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> implements STr
|
||||
*/
|
||||
@Override
|
||||
public Object getCacheDataValueOrig(EntityBeanIntercept ebi) {
|
||||
return cacheDataConvert(ebi.getOrigValue(propertyIndex));
|
||||
return cacheDataConvert(ebi.origValue(propertyIndex));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -25,12 +25,12 @@ public final class BeanPropertyIdClass extends BeanPropertyAssocOne {
|
||||
|
||||
@Override
|
||||
public Object getValue(EntityBean bean) {
|
||||
return bean._ebean_getIntercept().getOwnerId();
|
||||
return bean._ebean_getIntercept().ownerId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValueIntercept(EntityBean bean) {
|
||||
return bean._ebean_getIntercept().getOwnerId();
|
||||
return bean._ebean_getIntercept().ownerId();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -16,12 +16,12 @@ public final class BeanPropertyOrderColumn extends BeanProperty {
|
||||
|
||||
@Override
|
||||
public Object getValue(EntityBean bean) {
|
||||
return bean._ebean_getIntercept().getSortOrder();
|
||||
return bean._ebean_getIntercept().sortOrder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValueIntercept(EntityBean bean) {
|
||||
return bean._ebean_getIntercept().getSortOrder();
|
||||
return bean._ebean_getIntercept().sortOrder();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -37,7 +37,7 @@ public class BeanSetHelp<T> extends BaseCollectionHelp<T> {
|
||||
public final BeanCollectionAdd getBeanCollectionAdd(Object bc, String mapKey) {
|
||||
if (bc instanceof BeanSet<?>) {
|
||||
BeanSet<?> beanSet = (BeanSet<?>) bc;
|
||||
if (beanSet.getActualSet() == null) {
|
||||
if (beanSet.actualSet() == null) {
|
||||
beanSet.setActualSet(new LinkedHashSet<>());
|
||||
}
|
||||
return beanSet;
|
||||
@@ -90,7 +90,7 @@ public class BeanSetHelp<T> extends BaseCollectionHelp<T> {
|
||||
} else if (current instanceof BeanSet<?>) {
|
||||
// normally this case, replace just the underlying list
|
||||
BeanSet<?> currentBeanSet = (BeanSet<?>) current;
|
||||
currentBeanSet.setActualSet(newBeanSet.getActualSet());
|
||||
currentBeanSet.setActualSet(newBeanSet.actualSet());
|
||||
currentBeanSet.setModifyListening(many.modifyListenMode());
|
||||
|
||||
} else {
|
||||
@@ -113,7 +113,7 @@ public class BeanSetHelp<T> extends BaseCollectionHelp<T> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
set = bc.getActualSet();
|
||||
set = bc.actualSet();
|
||||
} else {
|
||||
set = (Set<?>) collection;
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ final class DLoadBeanContext extends DLoadBaseContext implements LoadBeanContext
|
||||
public void add(EntityBeanIntercept ebi) {
|
||||
if (persistenceContext == null) {
|
||||
// get persistenceContext from first loaded bean into the buffer
|
||||
persistenceContext = ebi.getPersistenceContext();
|
||||
persistenceContext = ebi.persistenceContext();
|
||||
}
|
||||
batch.add(ebi);
|
||||
}
|
||||
@@ -200,7 +200,7 @@ final class DLoadBeanContext extends DLoadBaseContext implements LoadBeanContext
|
||||
// re-add to the batch and lazy load from DB skipping l2 cache
|
||||
batch.add(ebi);
|
||||
} else if (context.hitCache) {
|
||||
Set<EntityBeanIntercept> hits = context.desc.cacheBeanLoadAll(batch, persistenceContext, ebi.getLazyLoadPropertyIndex(), ebi.getLazyLoadProperty());
|
||||
Set<EntityBeanIntercept> hits = context.desc.cacheBeanLoadAll(batch, persistenceContext, ebi.lazyLoadPropertyIndex(), ebi.lazyLoadProperty());
|
||||
batch.removeAll(hits);
|
||||
if (batch.isEmpty() || hits.contains(ebi)) {
|
||||
// successfully hit the L2 cache so don't invoke DB lazy loading
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
package io.ebeaninternal.server.loadcontext;
|
||||
|
||||
import io.ebean.bean.BeanCollection;
|
||||
import io.ebean.bean.BeanCollectionLoader;
|
||||
import io.ebean.bean.EntityBean;
|
||||
import io.ebean.bean.ObjectGraphNode;
|
||||
import io.ebean.bean.PersistenceContext;
|
||||
import io.ebean.bean.*;
|
||||
import io.ebeaninternal.api.LoadManyBuffer;
|
||||
import io.ebeaninternal.api.LoadManyContext;
|
||||
import io.ebeaninternal.api.LoadManyRequest;
|
||||
@@ -198,7 +194,7 @@ final class DLoadManyContext extends DLoadBaseContext implements LoadManyContext
|
||||
try {
|
||||
boolean useCache = !onlyIds && context.hitCache && context.property.isUseCache();
|
||||
if (useCache) {
|
||||
EntityBean ownerBean = bc.getOwnerBean();
|
||||
EntityBean ownerBean = bc.owner();
|
||||
BeanDescriptor<?> parentDesc = context.desc.descriptor(ownerBean.getClass());
|
||||
Object parentId = parentDesc.getId(ownerBean);
|
||||
final String parentKey = parentDesc.cacheKey(parentId);
|
||||
|
||||
@@ -972,7 +972,7 @@ public final class DefaultPersister implements Persister {
|
||||
if (deleteMode.isHard() || many.isTargetSoftDelete()) {
|
||||
Object details = many.getValue(parentBean);
|
||||
if (details instanceof BeanCollection<?>) {
|
||||
Set<?> modifyRemovals = ((BeanCollection<?>) details).getModifyRemovals();
|
||||
Set<?> modifyRemovals = ((BeanCollection<?>) details).modifyRemovals();
|
||||
if (modifyRemovals != null && !modifyRemovals.isEmpty()) {
|
||||
// delete the orphans that have been removed from the collection
|
||||
for (Object detail : modifyRemovals) {
|
||||
|
||||
@@ -6,18 +6,10 @@ import io.ebean.bean.EntityBeanIntercept;
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
import io.ebeaninternal.api.SpiSqlUpdate;
|
||||
import io.ebeaninternal.server.core.PersistRequestBean;
|
||||
import io.ebeaninternal.server.deploy.BeanCollectionUtil;
|
||||
import io.ebeaninternal.server.deploy.BeanDescriptor;
|
||||
import io.ebeaninternal.server.deploy.BeanProperty;
|
||||
import io.ebeaninternal.server.deploy.BeanPropertyAssocMany;
|
||||
import io.ebeaninternal.server.deploy.IntersectionRow;
|
||||
import io.ebeaninternal.server.deploy.*;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
import static io.ebeaninternal.server.persist.DmlUtil.isNullOrZero;
|
||||
import static java.lang.System.Logger.Level.WARNING;
|
||||
@@ -165,7 +157,7 @@ final class SaveManyBeans extends SaveManyBase {
|
||||
} else {
|
||||
int originalOrder = 0;
|
||||
if (orderColumn != null) {
|
||||
originalOrder = detail._ebean_getIntercept().getSortOrder();
|
||||
originalOrder = detail._ebean_getIntercept().sortOrder();
|
||||
if (sortOrder != originalOrder) {
|
||||
detail._ebean_intercept().setSortOrder(sortOrder);
|
||||
ebi.setDirty(true);
|
||||
@@ -285,10 +277,10 @@ final class SaveManyBeans extends SaveManyBase {
|
||||
// BeanCollection so get the additions/deletions
|
||||
BeanCollection<?> manyValue = (BeanCollection<?>) value;
|
||||
if (setListenMode(manyValue, many)) {
|
||||
additions = manyValue.getActualDetails();
|
||||
additions = manyValue.actualDetails();
|
||||
} else {
|
||||
additions = manyValue.getModifyAdditions();
|
||||
deletions = manyValue.getModifyRemovals();
|
||||
additions = manyValue.modifyAdditions();
|
||||
deletions = manyValue.modifyRemovals();
|
||||
}
|
||||
// reset so the changes are only processed once
|
||||
manyValue.modifyReset();
|
||||
@@ -343,7 +335,7 @@ final class SaveManyBeans extends SaveManyBase {
|
||||
forceOrphanRemoval = !insertedParent && isChangedProperty();
|
||||
} else {
|
||||
BeanCollection<?> c = (BeanCollection<?>) value;
|
||||
Set<?> modifyRemovals = c.getModifyRemovals();
|
||||
Set<?> modifyRemovals = c.modifyRemovals();
|
||||
if (insertedParent) {
|
||||
// after insert set the modify listening mode for private owned etc
|
||||
c.setModifyListening(many.modifyListenMode());
|
||||
@@ -372,7 +364,7 @@ final class SaveManyBeans extends SaveManyBase {
|
||||
* Check if we need to set the listen mode (on new collections persisted for the first time).
|
||||
*/
|
||||
private boolean setListenMode(BeanCollection<?> manyValue, BeanPropertyAssocMany<?> prop) {
|
||||
BeanCollection.ModifyListenMode mode = manyValue.getModifyListening();
|
||||
BeanCollection.ModifyListenMode mode = manyValue.modifyListening();
|
||||
if (mode == null) {
|
||||
// new collection persisted for the first time
|
||||
manyValue.setModifyListening(prop.modifyListenMode());
|
||||
|
||||
+2
-2
@@ -18,7 +18,7 @@ public final class BindableOrderColumn extends BindableProperty {
|
||||
|
||||
@Override
|
||||
public void addToUpdate(PersistRequestBean<?> request, List<Bindable> list) {
|
||||
int sortOrder = request.intercept().getSortOrder();
|
||||
int sortOrder = request.intercept().sortOrder();
|
||||
if (sortOrder > 0) {
|
||||
list.add(this);
|
||||
}
|
||||
@@ -29,7 +29,7 @@ public final class BindableOrderColumn extends BindableProperty {
|
||||
*/
|
||||
@Override
|
||||
public void dmlBind(BindableRequest request, EntityBean bean) throws SQLException {
|
||||
int sortOrder = bean._ebean_getIntercept().getSortOrder();
|
||||
int sortOrder = bean._ebean_getIntercept().sortOrder();
|
||||
request.bind(sortOrder, prop);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ final class BindablePropertyVersion implements Bindable {
|
||||
public void dmlBind(BindableRequest request, EntityBean bean) throws SQLException {
|
||||
|
||||
// get prior version value from 'old values'
|
||||
Object value = bean._ebean_getIntercept().getOrigValue(prop.propertyIndex());
|
||||
Object value = bean._ebean_getIntercept().origValue(prop.propertyIndex());
|
||||
request.bind(value, prop);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ import io.ebeaninternal.api.SpiTransaction;
|
||||
import io.ebeaninternal.server.core.OrmQueryEngine;
|
||||
import io.ebeaninternal.server.core.OrmQueryRequest;
|
||||
import io.ebeaninternal.server.core.SpiResultSet;
|
||||
import io.ebeaninternal.server.deploy.BeanDescriptor;
|
||||
import io.ebeaninternal.server.persist.Binder;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
@@ -129,9 +128,7 @@ public final class DefaultOrmQueryEngine implements OrmQueryEngine {
|
||||
SpiQuery<T> query = request.query();
|
||||
if (result != null && request.isBeanCachePutMany()) {
|
||||
// load the individual beans into the bean cache
|
||||
BeanDescriptor<T> descriptor = request.descriptor();
|
||||
Collection<T> c = result.getActualDetails();
|
||||
descriptor.cacheBeanPutAll(c);
|
||||
request.descriptor().cacheBeanPutAll(result.actualDetails());
|
||||
}
|
||||
|
||||
request.mergeCacheHits(result);
|
||||
@@ -140,7 +137,7 @@ public final class DefaultOrmQueryEngine implements OrmQueryEngine {
|
||||
result.setReadOnly(true);
|
||||
request.putToQueryCache(result);
|
||||
if (Boolean.FALSE.equals(query.isReadOnly())) {
|
||||
result = result.getShallowCopy();
|
||||
result = result.shallowCopy();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package io.ebean.xtest.bean;
|
||||
|
||||
import io.ebean.xtest.BaseTestCase;
|
||||
import io.ebean.DB;
|
||||
import io.ebean.bean.EntityBean;
|
||||
import io.ebean.bean.EntityBeanIntercept;
|
||||
import io.ebean.xtest.BaseTestCase;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.tests.compositekeys.db.AuditInfo;
|
||||
import org.tests.model.basic.Customer;
|
||||
@@ -120,7 +120,7 @@ public class EntityBeanInterceptTest extends BaseTestCase {
|
||||
}
|
||||
|
||||
private int findProperty(String name, EntityBeanIntercept eb) {
|
||||
final String[] names = eb.getOwner()._ebean_getPropertyNames();
|
||||
final String[] names = eb.owner()._ebean_getPropertyNames();
|
||||
for (int i = 0; i < names.length; i++) {
|
||||
if (names[i].equals(name)) {
|
||||
return i;
|
||||
|
||||
@@ -41,7 +41,7 @@ public class BeanListTest {
|
||||
// act
|
||||
list.addAll(all());
|
||||
|
||||
assertThat(list.getModifyAdditions()).isNull();
|
||||
assertThat(list.modifyAdditions()).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -53,7 +53,7 @@ public class BeanListTest {
|
||||
// act
|
||||
list.addAll(all());
|
||||
|
||||
assertThat(list.getModifyAdditions()).isNull();
|
||||
assertThat(list.modifyAdditions()).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -63,18 +63,18 @@ public class BeanListTest {
|
||||
list.setModifyListening(BeanCollection.ModifyListenMode.ALL);
|
||||
list.add(object1);
|
||||
|
||||
assertThat(list.getModifyAdditions()).containsOnly(object1);
|
||||
assertThat(list.getModifyRemovals()).isEmpty();
|
||||
assertThat(list.modifyAdditions()).containsOnly(object1);
|
||||
assertThat(list.modifyRemovals()).isEmpty();
|
||||
|
||||
list.add(object1);
|
||||
assertThat(list.getModifyAdditions()).containsOnly(object1);
|
||||
assertThat(list.modifyAdditions()).containsOnly(object1);
|
||||
|
||||
list.add(object2);
|
||||
assertThat(list.getModifyAdditions()).containsOnly(object1, object2);
|
||||
assertThat(list.modifyAdditions()).containsOnly(object1, object2);
|
||||
|
||||
list.remove(object1);
|
||||
assertThat(list.getModifyAdditions()).containsOnly(object2);
|
||||
assertThat(list.getModifyRemovals()).isEmpty();
|
||||
assertThat(list.modifyAdditions()).containsOnly(object2);
|
||||
assertThat(list.modifyRemovals()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -86,8 +86,8 @@ public class BeanListTest {
|
||||
// act
|
||||
list.addAll(all());
|
||||
|
||||
assertThat(list.getModifyAdditions()).containsOnly(object1, object2, object3);
|
||||
assertThat(list.getModifyRemovals()).isEmpty();
|
||||
assertThat(list.modifyAdditions()).containsOnly(object1, object2, object3);
|
||||
assertThat(list.modifyRemovals()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -98,11 +98,11 @@ public class BeanListTest {
|
||||
|
||||
// act
|
||||
list.remove(object2);
|
||||
assertThat(list.getModifyRemovals()).isNotEmpty();
|
||||
assertThat(list.modifyRemovals()).isNotEmpty();
|
||||
list.add(object2);
|
||||
|
||||
assertThat(list.getModifyRemovals()).isEmpty();
|
||||
assertThat(list.getModifyAdditions()).isEmpty();
|
||||
assertThat(list.modifyRemovals()).isEmpty();
|
||||
assertThat(list.modifyAdditions()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -114,8 +114,8 @@ public class BeanListTest {
|
||||
// act
|
||||
list.sort(Comparator.comparingInt(Object::hashCode));
|
||||
|
||||
assertThat(list.getModifyRemovals()).isEmpty();
|
||||
assertThat(list.getModifyAdditions()).isEmpty();
|
||||
assertThat(list.modifyRemovals()).isEmpty();
|
||||
assertThat(list.modifyAdditions()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -127,8 +127,8 @@ public class BeanListTest {
|
||||
// act
|
||||
list.sort(Comparator.comparingInt(Object::hashCode));
|
||||
|
||||
assertThat(list.getModifyRemovals()).isEmpty();
|
||||
assertThat(list.getModifyAdditions()).isEmpty();
|
||||
assertThat(list.modifyRemovals()).isEmpty();
|
||||
assertThat(list.modifyAdditions()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -143,8 +143,8 @@ public class BeanListTest {
|
||||
assertThat(list.contains(object2)).isTrue();
|
||||
list.add(object2); // object2 added as List allows duplicates
|
||||
|
||||
assertThat(list.getModifyAdditions()).containsOnly(object1, object2);
|
||||
assertThat(list.getModifyRemovals()).isEmpty();
|
||||
assertThat(list.modifyAdditions()).containsOnly(object1, object2);
|
||||
assertThat(list.modifyRemovals()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -156,8 +156,8 @@ public class BeanListTest {
|
||||
// act
|
||||
list.addAll(all());
|
||||
|
||||
assertThat(list.getModifyAdditions()).containsOnly(object1, object2, object3);
|
||||
assertThat(list.getModifyRemovals()).isEmpty();
|
||||
assertThat(list.modifyAdditions()).containsOnly(object1, object2, object3);
|
||||
assertThat(list.modifyRemovals()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -166,14 +166,14 @@ public class BeanListTest {
|
||||
BeanList<Object> list = new BeanList<>();
|
||||
list.setModifyListening(BeanCollection.ModifyListenMode.ALL);
|
||||
list.addAll(all());
|
||||
assertThat(list.getModifyAdditions()).containsOnly(object1, object2, object3);
|
||||
assertThat(list.modifyAdditions()).containsOnly(object1, object2, object3);
|
||||
|
||||
// act
|
||||
list.remove(object2);
|
||||
list.remove(object3);
|
||||
|
||||
assertThat(list.getModifyAdditions()).containsOnly(object1);
|
||||
assertThat(list.getModifyRemovals()).isEmpty();
|
||||
assertThat(list.modifyAdditions()).containsOnly(object1);
|
||||
assertThat(list.modifyRemovals()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -182,13 +182,13 @@ public class BeanListTest {
|
||||
BeanList<Object> list = new BeanList<>();
|
||||
list.setModifyListening(BeanCollection.ModifyListenMode.ALL);
|
||||
list.addAll(all());
|
||||
assertThat(list.getModifyAdditions()).containsOnly(object1, object2, object3);
|
||||
assertThat(list.modifyAdditions()).containsOnly(object1, object2, object3);
|
||||
|
||||
// act
|
||||
list.removeAll(some());
|
||||
|
||||
assertThat(list.getModifyAdditions()).containsOnly(object1);
|
||||
assertThat(list.getModifyRemovals()).isEmpty();
|
||||
assertThat(list.modifyAdditions()).containsOnly(object1);
|
||||
assertThat(list.modifyRemovals()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -202,8 +202,8 @@ public class BeanListTest {
|
||||
list.remove(object3);
|
||||
|
||||
// assert
|
||||
assertThat(list.getModifyAdditions()).isEmpty();
|
||||
assertThat(list.getModifyRemovals()).containsOnly(object2, object3);
|
||||
assertThat(list.modifyAdditions()).isEmpty();
|
||||
assertThat(list.modifyRemovals()).containsOnly(object2, object3);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -216,8 +216,8 @@ public class BeanListTest {
|
||||
list.removeAll(some());
|
||||
|
||||
// assert
|
||||
assertThat(list.getModifyAdditions()).isEmpty();
|
||||
assertThat(list.getModifyRemovals()).containsOnly(object2, object3);
|
||||
assertThat(list.modifyAdditions()).isEmpty();
|
||||
assertThat(list.modifyRemovals()).containsOnly(object2, object3);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -230,8 +230,8 @@ public class BeanListTest {
|
||||
list.clear();
|
||||
|
||||
//assert
|
||||
assertThat(list.getModifyRemovals()).containsOnly(object1, object2, object3);
|
||||
assertThat(list.getModifyAdditions()).isEmpty();
|
||||
assertThat(list.modifyRemovals()).containsOnly(object1, object2, object3);
|
||||
assertThat(list.modifyAdditions()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -247,8 +247,8 @@ public class BeanListTest {
|
||||
list.clear();
|
||||
|
||||
//assert
|
||||
assertThat(list.getModifyRemovals()).containsOnly(object1);
|
||||
assertThat(list.getModifyAdditions()).isEmpty();
|
||||
assertThat(list.modifyRemovals()).containsOnly(object1);
|
||||
assertThat(list.modifyAdditions()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -257,13 +257,13 @@ public class BeanListTest {
|
||||
BeanList<Object> list = new BeanList<>();
|
||||
list.setModifyListening(BeanCollection.ModifyListenMode.ALL);
|
||||
list.addAll(all());
|
||||
assertThat(list.getModifyAdditions()).containsOnly(object1, object2, object3);
|
||||
assertThat(list.modifyAdditions()).containsOnly(object1, object2, object3);
|
||||
|
||||
// act
|
||||
list.retainAll(some());
|
||||
|
||||
assertThat(list.getModifyAdditions()).containsOnly(object2, object3);
|
||||
assertThat(list.getModifyRemovals()).isEmpty();
|
||||
assertThat(list.modifyAdditions()).containsOnly(object2, object3);
|
||||
assertThat(list.modifyRemovals()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -278,8 +278,8 @@ public class BeanListTest {
|
||||
// act
|
||||
list.retainAll(some());
|
||||
|
||||
assertThat(list.getModifyAdditions()).containsOnly(object3);
|
||||
assertThat(list.getModifyRemovals()).containsOnly(object1);
|
||||
assertThat(list.modifyAdditions()).containsOnly(object3);
|
||||
assertThat(list.modifyRemovals()).containsOnly(object1);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -291,7 +291,7 @@ public class BeanListTest {
|
||||
// act
|
||||
list.retainAll(some());
|
||||
|
||||
assertThat(list.getModifyRemovals()).containsOnly(object1);
|
||||
assertThat(list.modifyRemovals()).containsOnly(object1);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -43,19 +43,19 @@ public class BeanMapTest {
|
||||
map.put("1", object1);
|
||||
map.put("4", null);
|
||||
|
||||
assertThat(map.getModifyAdditions()).containsOnly(object1);
|
||||
assertThat(map.getModifyRemovals()).isEmpty();
|
||||
assertThat(map.modifyAdditions()).containsOnly(object1);
|
||||
assertThat(map.modifyRemovals()).isEmpty();
|
||||
|
||||
map.put("1", object1);
|
||||
map.put("4", null);
|
||||
assertThat(map.getModifyAdditions()).containsOnly(object1);
|
||||
assertThat(map.modifyAdditions()).containsOnly(object1);
|
||||
|
||||
map.put("2", object2);
|
||||
assertThat(map.getModifyAdditions()).containsOnly(object1, object2);
|
||||
assertThat(map.modifyAdditions()).containsOnly(object1, object2);
|
||||
|
||||
map.remove("1");
|
||||
assertThat(map.getModifyAdditions()).containsOnly(object2);
|
||||
assertThat(map.getModifyRemovals()).isEmpty();
|
||||
assertThat(map.modifyAdditions()).containsOnly(object2);
|
||||
assertThat(map.modifyRemovals()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -67,8 +67,8 @@ public class BeanMapTest {
|
||||
// act
|
||||
set.putAll(all());
|
||||
|
||||
assertThat(set.getModifyAdditions()).containsOnly(object1, object2, object3);
|
||||
assertThat(set.getModifyRemovals()).isEmpty();
|
||||
assertThat(set.modifyAdditions()).containsOnly(object1, object2, object3);
|
||||
assertThat(set.modifyRemovals()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -83,8 +83,8 @@ public class BeanMapTest {
|
||||
assertThat(map.containsValue(object2)).isTrue();
|
||||
map.put("2", object2);
|
||||
|
||||
assertThat(map.getModifyAdditions()).containsOnly(object1);
|
||||
assertThat(map.getModifyRemovals()).isEmpty();
|
||||
assertThat(map.modifyAdditions()).containsOnly(object1);
|
||||
assertThat(map.modifyRemovals()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -96,8 +96,8 @@ public class BeanMapTest {
|
||||
// act
|
||||
map.putAll(all());
|
||||
|
||||
assertThat(map.getModifyAdditions()).containsOnly(object1);
|
||||
assertThat(map.getModifyRemovals()).isEmpty();
|
||||
assertThat(map.modifyAdditions()).containsOnly(object1);
|
||||
assertThat(map.modifyRemovals()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -106,14 +106,14 @@ public class BeanMapTest {
|
||||
BeanMap<String, Object> map = new BeanMap<>();
|
||||
map.setModifyListening(BeanCollection.ModifyListenMode.ALL);
|
||||
map.putAll(all());
|
||||
assertThat(map.getModifyAdditions()).containsOnly(object1, object2, object3);
|
||||
assertThat(map.modifyAdditions()).containsOnly(object1, object2, object3);
|
||||
|
||||
// act
|
||||
map.remove("2");
|
||||
map.remove("3");
|
||||
|
||||
assertThat(map.getModifyAdditions()).containsOnly(object1);
|
||||
assertThat(map.getModifyRemovals()).isEmpty();
|
||||
assertThat(map.modifyAdditions()).containsOnly(object1);
|
||||
assertThat(map.modifyRemovals()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -122,14 +122,14 @@ public class BeanMapTest {
|
||||
BeanMap<String, Object> map = new BeanMap<>();
|
||||
map.setModifyListening(BeanCollection.ModifyListenMode.ALL);
|
||||
map.putAll(all());
|
||||
assertThat(map.getModifyAdditions()).containsOnly(object1, object2, object3);
|
||||
assertThat(map.modifyAdditions()).containsOnly(object1, object2, object3);
|
||||
|
||||
// act
|
||||
map.remove("2");
|
||||
map.remove("3");
|
||||
|
||||
assertThat(map.getModifyAdditions()).containsOnly(object1);
|
||||
assertThat(map.getModifyRemovals()).isEmpty();
|
||||
assertThat(map.modifyAdditions()).containsOnly(object1);
|
||||
assertThat(map.modifyRemovals()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -143,8 +143,8 @@ public class BeanMapTest {
|
||||
map.remove("3");
|
||||
|
||||
// assert
|
||||
assertThat(map.getModifyAdditions()).isEmpty();
|
||||
assertThat(map.getModifyRemovals()).containsOnly(object2, object3);
|
||||
assertThat(map.modifyAdditions()).isEmpty();
|
||||
assertThat(map.modifyRemovals()).containsOnly(object2, object3);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -158,8 +158,8 @@ public class BeanMapTest {
|
||||
map.remove("3");
|
||||
|
||||
// assert
|
||||
assertThat(map.getModifyAdditions()).isEmpty();
|
||||
assertThat(map.getModifyRemovals()).containsOnly(object2, object3);
|
||||
assertThat(map.modifyAdditions()).isEmpty();
|
||||
assertThat(map.modifyRemovals()).containsOnly(object2, object3);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -172,8 +172,8 @@ public class BeanMapTest {
|
||||
map.clear();
|
||||
|
||||
//assert
|
||||
assertThat(map.getModifyRemovals()).containsOnly(object1, object2, object3);
|
||||
assertThat(map.getModifyAdditions()).isEmpty();
|
||||
assertThat(map.modifyRemovals()).containsOnly(object1, object2, object3);
|
||||
assertThat(map.modifyAdditions()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -187,8 +187,8 @@ public class BeanMapTest {
|
||||
map.clear();
|
||||
|
||||
//assert
|
||||
assertThat(map.getModifyRemovals()).containsOnly(object1);
|
||||
assertThat(map.getModifyAdditions()).isEmpty();
|
||||
assertThat(map.modifyRemovals()).containsOnly(object1);
|
||||
assertThat(map.modifyAdditions()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -229,7 +229,7 @@ public class BeanMapTest {
|
||||
assertThat(map).doesNotContainKeys("1");
|
||||
assertThat(map.get("1")).isNull();
|
||||
|
||||
assertThat(map.getModifyRemovals()).containsOnly(object1);
|
||||
assertThat(map.modifyRemovals()).containsOnly(object1);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -245,7 +245,7 @@ public class BeanMapTest {
|
||||
assertThat(map).isEmpty();
|
||||
assertThat(keySet).isEmpty();
|
||||
|
||||
assertThat(map.getModifyRemovals()).containsOnly(object1, object2);
|
||||
assertThat(map.modifyRemovals()).containsOnly(object1, object2);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -265,7 +265,7 @@ public class BeanMapTest {
|
||||
assertThat(keySet).containsExactly("1", "3");
|
||||
assertThat(map).containsKeys("1", "3");
|
||||
|
||||
assertThat(map.getModifyRemovals()).containsOnly(object2);
|
||||
assertThat(map.modifyRemovals()).containsOnly(object2);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -288,7 +288,7 @@ public class BeanMapTest {
|
||||
assertThat(keySet).containsExactly("1", "4");
|
||||
assertThat(map).containsKeys("1", "4");
|
||||
|
||||
assertThat(map.getModifyRemovals()).containsOnly(object2, object3, object5);
|
||||
assertThat(map.modifyRemovals()).containsOnly(object2, object3, object5);
|
||||
}
|
||||
|
||||
|
||||
@@ -312,7 +312,7 @@ public class BeanMapTest {
|
||||
assertThat(keySet).containsExactly("2", "3", "5");
|
||||
assertThat(map).containsKeys("2", "3", "5");
|
||||
|
||||
assertThat(map.getModifyRemovals()).containsOnly(object1, object4);
|
||||
assertThat(map.modifyRemovals()).containsOnly(object1, object4);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -343,7 +343,7 @@ public class BeanMapTest {
|
||||
|
||||
assertThat(entries).isEmpty();
|
||||
assertThat(map).isEmpty();
|
||||
assertThat(map.getModifyRemovals()).containsOnly(object1);
|
||||
assertThat(map.modifyRemovals()).containsOnly(object1);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -360,7 +360,7 @@ public class BeanMapTest {
|
||||
assertThat(existed22).isFalse();
|
||||
|
||||
assertThat(map).hasSize(4);
|
||||
assertThat(map.getModifyRemovals()).containsOnly(object1);
|
||||
assertThat(map.modifyRemovals()).containsOnly(object1);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -374,7 +374,7 @@ public class BeanMapTest {
|
||||
assertThat(modified).isFalse();
|
||||
|
||||
assertThat(map).hasSize(5);
|
||||
assertThat(map.getModifyRemovals()).isNull();
|
||||
assertThat(map.modifyRemovals()).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -390,7 +390,7 @@ public class BeanMapTest {
|
||||
}
|
||||
assertThat(map).hasSize(3);
|
||||
assertThat(entries).hasSize(3);
|
||||
assertThat(map.getModifyRemovals()).containsOnly(object2, object5);
|
||||
assertThat(map.modifyRemovals()).containsOnly(object2, object5);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -401,7 +401,7 @@ public class BeanMapTest {
|
||||
entries.removeAll(asList(new AbstractMap.SimpleEntry<>("1", object1), new AbstractMap.SimpleEntry<>("3", object4), new AbstractMap.SimpleEntry<>("4", object4)));
|
||||
assertThat(map).hasSize(3);
|
||||
assertThat(entries).hasSize(3);
|
||||
assertThat(map.getModifyRemovals()).containsOnly(object1, object4);
|
||||
assertThat(map.modifyRemovals()).containsOnly(object1, object4);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -412,7 +412,7 @@ public class BeanMapTest {
|
||||
entries.retainAll(asList(new AbstractMap.SimpleEntry<>("1", object1), new AbstractMap.SimpleEntry<>("3", object4), new AbstractMap.SimpleEntry<>("4", object4)));
|
||||
assertThat(map).hasSize(2);
|
||||
assertThat(entries).hasSize(2);
|
||||
assertThat(map.getModifyRemovals()).containsOnly(object2, object3, object5);
|
||||
assertThat(map.modifyRemovals()).containsOnly(object2, object3, object5);
|
||||
}
|
||||
|
||||
private BeanMap<String, EBasic> newModifyListeningMap() {
|
||||
|
||||
@@ -38,18 +38,18 @@ public class BeanSetTest {
|
||||
set.setModifyListening(BeanCollection.ModifyListenMode.ALL);
|
||||
set.add(object1);
|
||||
|
||||
assertThat(set.getModifyAdditions()).containsOnly(object1);
|
||||
assertThat(set.getModifyRemovals()).isEmpty();
|
||||
assertThat(set.modifyAdditions()).containsOnly(object1);
|
||||
assertThat(set.modifyRemovals()).isEmpty();
|
||||
|
||||
set.add(object1);
|
||||
assertThat(set.getModifyAdditions()).containsOnly(object1);
|
||||
assertThat(set.modifyAdditions()).containsOnly(object1);
|
||||
|
||||
set.add(object2);
|
||||
assertThat(set.getModifyAdditions()).containsOnly(object1, object2);
|
||||
assertThat(set.modifyAdditions()).containsOnly(object1, object2);
|
||||
|
||||
set.remove(object1);
|
||||
assertThat(set.getModifyAdditions()).containsOnly(object2);
|
||||
assertThat(set.getModifyRemovals()).isEmpty();
|
||||
assertThat(set.modifyAdditions()).containsOnly(object2);
|
||||
assertThat(set.modifyRemovals()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -61,8 +61,8 @@ public class BeanSetTest {
|
||||
// act
|
||||
set.addAll(all());
|
||||
|
||||
assertThat(set.getModifyAdditions()).containsOnly(object1, object2, object3);
|
||||
assertThat(set.getModifyRemovals()).isEmpty();
|
||||
assertThat(set.modifyAdditions()).containsOnly(object1, object2, object3);
|
||||
assertThat(set.modifyRemovals()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -77,8 +77,8 @@ public class BeanSetTest {
|
||||
assertThat(set.contains(object2)).isTrue();
|
||||
set.add(object2);
|
||||
|
||||
assertThat(set.getModifyAdditions()).containsOnly(object1);
|
||||
assertThat(set.getModifyRemovals()).isEmpty();
|
||||
assertThat(set.modifyAdditions()).containsOnly(object1);
|
||||
assertThat(set.modifyRemovals()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -90,8 +90,8 @@ public class BeanSetTest {
|
||||
// act
|
||||
set.addAll(all());
|
||||
|
||||
assertThat(set.getModifyAdditions()).containsOnly(object1);
|
||||
assertThat(set.getModifyRemovals()).isEmpty();
|
||||
assertThat(set.modifyAdditions()).containsOnly(object1);
|
||||
assertThat(set.modifyRemovals()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -100,14 +100,14 @@ public class BeanSetTest {
|
||||
BeanSet<Object> set = new BeanSet<>();
|
||||
set.setModifyListening(BeanCollection.ModifyListenMode.ALL);
|
||||
set.addAll(all());
|
||||
assertThat(set.getModifyAdditions()).containsOnly(object1, object2, object3);
|
||||
assertThat(set.modifyAdditions()).containsOnly(object1, object2, object3);
|
||||
|
||||
// act
|
||||
set.remove(object2);
|
||||
set.remove(object3);
|
||||
|
||||
assertThat(set.getModifyAdditions()).containsOnly(object1);
|
||||
assertThat(set.getModifyRemovals()).isEmpty();
|
||||
assertThat(set.modifyAdditions()).containsOnly(object1);
|
||||
assertThat(set.modifyRemovals()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -116,13 +116,13 @@ public class BeanSetTest {
|
||||
BeanSet<Object> set = new BeanSet<>();
|
||||
set.setModifyListening(BeanCollection.ModifyListenMode.ALL);
|
||||
set.addAll(all());
|
||||
assertThat(set.getModifyAdditions()).containsOnly(object1, object2, object3);
|
||||
assertThat(set.modifyAdditions()).containsOnly(object1, object2, object3);
|
||||
|
||||
// act
|
||||
set.removeAll(some());
|
||||
|
||||
assertThat(set.getModifyAdditions()).containsOnly(object1);
|
||||
assertThat(set.getModifyRemovals()).isEmpty();
|
||||
assertThat(set.modifyAdditions()).containsOnly(object1);
|
||||
assertThat(set.modifyRemovals()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -136,8 +136,8 @@ public class BeanSetTest {
|
||||
set.remove(object3);
|
||||
|
||||
// assert
|
||||
assertThat(set.getModifyAdditions()).isEmpty();
|
||||
assertThat(set.getModifyRemovals()).containsOnly(object2, object3);
|
||||
assertThat(set.modifyAdditions()).isEmpty();
|
||||
assertThat(set.modifyRemovals()).containsOnly(object2, object3);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -150,8 +150,8 @@ public class BeanSetTest {
|
||||
set.removeAll(some());
|
||||
|
||||
// assert
|
||||
assertThat(set.getModifyAdditions()).isEmpty();
|
||||
assertThat(set.getModifyRemovals()).containsOnly(object2, object3);
|
||||
assertThat(set.modifyAdditions()).isEmpty();
|
||||
assertThat(set.modifyRemovals()).containsOnly(object2, object3);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -164,8 +164,8 @@ public class BeanSetTest {
|
||||
set.clear();
|
||||
|
||||
//assert
|
||||
assertThat(set.getModifyRemovals()).containsOnly(object1, object2, object3);
|
||||
assertThat(set.getModifyAdditions()).isEmpty();
|
||||
assertThat(set.modifyRemovals()).containsOnly(object1, object2, object3);
|
||||
assertThat(set.modifyAdditions()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -181,8 +181,8 @@ public class BeanSetTest {
|
||||
set.clear();
|
||||
|
||||
//assert
|
||||
assertThat(set.getModifyRemovals()).containsOnly(object1);
|
||||
assertThat(set.getModifyAdditions()).isEmpty();
|
||||
assertThat(set.modifyRemovals()).containsOnly(object1);
|
||||
assertThat(set.modifyAdditions()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -191,13 +191,13 @@ public class BeanSetTest {
|
||||
BeanSet<Object> set = new BeanSet<>();
|
||||
set.setModifyListening(BeanCollection.ModifyListenMode.ALL);
|
||||
set.addAll(all());
|
||||
assertThat(set.getModifyAdditions()).containsOnly(object1, object2, object3);
|
||||
assertThat(set.modifyAdditions()).containsOnly(object1, object2, object3);
|
||||
|
||||
// act
|
||||
set.retainAll(some());
|
||||
|
||||
assertThat(set.getModifyAdditions()).containsOnly(object2, object3);
|
||||
assertThat(set.getModifyRemovals()).isEmpty();
|
||||
assertThat(set.modifyAdditions()).containsOnly(object2, object3);
|
||||
assertThat(set.modifyRemovals()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -212,8 +212,8 @@ public class BeanSetTest {
|
||||
// act
|
||||
set.retainAll(some());
|
||||
|
||||
assertThat(set.getModifyAdditions()).containsOnly(object3);
|
||||
assertThat(set.getModifyRemovals()).containsOnly(object1);
|
||||
assertThat(set.modifyAdditions()).containsOnly(object3);
|
||||
assertThat(set.modifyRemovals()).containsOnly(object1);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -225,7 +225,7 @@ public class BeanSetTest {
|
||||
// act
|
||||
set.retainAll(some());
|
||||
|
||||
assertThat(set.getModifyRemovals()).containsOnly(object1);
|
||||
assertThat(set.modifyRemovals()).containsOnly(object1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ class TestBeanFindController implements BeanFindController {
|
||||
Map<Class<?>, List<Integer>> elementsMap = new HashMap<>();
|
||||
Map<Class<?>, Map<Integer, FindControllerMain>> controllerLookup = new HashMap<>();
|
||||
|
||||
for (Object entry : result.getActualEntries()) {
|
||||
for (Object entry : result.actualEntries()) {
|
||||
FindControllerMain findControllerMain = (FindControllerMain) entry;
|
||||
Class<?> beanType = beanTypeFor(findControllerMain.getTargetTableName(), request);
|
||||
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ public class WriteJsonDirtyTest {
|
||||
customer.setAnniversary(new Date(System.currentTimeMillis()));
|
||||
|
||||
EntityBean entityBean = (EntityBean) customer;
|
||||
boolean[] dirtyProperties = entityBean._ebean_getIntercept().getDirtyProperties();
|
||||
boolean[] dirtyProperties = entityBean._ebean_getIntercept().dirtyProperties();
|
||||
|
||||
StringWriter writer = new StringWriter();
|
||||
JsonFactory jsonFactory = new JsonFactory();
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package org.tests.batchload;
|
||||
|
||||
import io.ebean.xtest.BaseTestCase;
|
||||
import io.ebean.BeanState;
|
||||
import io.ebean.DB;
|
||||
import io.ebean.bean.EntityBean;
|
||||
import io.ebean.bean.EntityBeanIntercept;
|
||||
import io.ebean.xtest.BaseTestCase;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.tests.model.basic.Customer;
|
||||
import org.tests.model.basic.ResetBasicData;
|
||||
@@ -53,10 +53,10 @@ class TestBeanState extends BaseTestCase {
|
||||
assertThat(beanState.changedProps()).containsOnly("name");
|
||||
|
||||
EntityBeanIntercept ebi = ((EntityBean) customer)._ebean_getIntercept();
|
||||
boolean[] dirtyProperties = ebi.getDirtyProperties();
|
||||
boolean[] dirtyProperties = ebi.dirtyProperties();
|
||||
for (int i = 0; i < dirtyProperties.length; i++) {
|
||||
if (dirtyProperties[i]) {
|
||||
String dirtyPropertyName = ebi.getProperty(i);
|
||||
String dirtyPropertyName = ebi.property(i);
|
||||
assertEquals("name", dirtyPropertyName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package org.tests.cascade;
|
||||
|
||||
import io.ebean.xtest.BaseTestCase;
|
||||
import io.ebean.DB;
|
||||
import io.ebean.bean.BeanCollection;
|
||||
import io.ebean.test.LoggedSql;
|
||||
import io.ebean.xtest.BaseTestCase;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.tests.model.basic.TSDetail;
|
||||
import org.tests.model.basic.TSMaster;
|
||||
@@ -34,7 +34,7 @@ public class TestPrivateOwned extends BaseTestCase {
|
||||
TSDetail removedDetail = details.remove(1);
|
||||
|
||||
BeanCollection<?> bc = (BeanCollection<?>) details;
|
||||
Set<?> modifyRemovals = bc.getModifyRemovals();
|
||||
Set<?> modifyRemovals = bc.modifyRemovals();
|
||||
|
||||
assertNotNull(modifyRemovals);
|
||||
assertTrue(modifyRemovals.size() == 1);
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package org.tests.query.other;
|
||||
|
||||
import io.ebean.xtest.BaseTestCase;
|
||||
import io.ebean.DB;
|
||||
import io.ebean.Query;
|
||||
import io.ebean.bean.EntityBean;
|
||||
import io.ebean.bean.EntityBeanIntercept;
|
||||
import io.ebean.xtest.BaseTestCase;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.tests.model.basic.Customer;
|
||||
import org.tests.model.basic.ResetBasicData;
|
||||
@@ -34,7 +34,7 @@ public class TestQueryDistinct extends BaseTestCase {
|
||||
|
||||
EntityBeanIntercept ebi = ((EntityBean) customer)._ebean_getIntercept();
|
||||
assertTrue(ebi.isDisableLazyLoad());
|
||||
assertNull(ebi.getPersistenceContext());
|
||||
assertNull(ebi.persistenceContext());
|
||||
|
||||
// lazy loading disabled
|
||||
assertNull(customer.getId());
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package org.tests.unitinternal;
|
||||
|
||||
import io.ebean.xtest.BaseTestCase;
|
||||
import io.ebean.DB;
|
||||
import io.ebean.bean.BeanCollection;
|
||||
import io.ebean.xtest.BaseTestCase;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.tests.model.basic.ENullCollection;
|
||||
import org.tests.model.basic.ENullCollectionDetail;
|
||||
@@ -30,8 +30,8 @@ public class TestNullCollectionSet extends BaseTestCase {
|
||||
|
||||
BeanCollection<?> bc = (BeanCollection<?>) details;
|
||||
assertFalse(bc.isPopulated());
|
||||
assertNotNull(bc.getOwnerBean());
|
||||
assertNotNull(bc.getPropertyName());
|
||||
assertNotNull(bc.owner());
|
||||
assertNotNull(bc.propertyName());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package org.tests.unitinternal;
|
||||
|
||||
import io.ebean.xtest.BaseTestCase;
|
||||
import io.ebean.DB;
|
||||
import io.ebean.bean.BeanCollection;
|
||||
import io.ebean.xtest.BaseTestCase;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.tests.model.basic.EVanillaCollection;
|
||||
import org.tests.model.basic.EVanillaCollectionDetail;
|
||||
@@ -31,8 +31,8 @@ public class TestVanillaCollectionSet extends BaseTestCase {
|
||||
|
||||
BeanCollection<?> bc = (BeanCollection<?>) details;
|
||||
assertFalse(bc.isPopulated());
|
||||
assertNotNull(bc.getOwnerBean());
|
||||
assertNotNull(bc.getPropertyName());
|
||||
assertNotNull(bc.owner());
|
||||
assertNotNull(bc.propertyName());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user