|
|
|
|
@ -131,11 +131,6 @@ public class BaseObject extends CayenneDataObject implements Comparable<BaseObje
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Object readProperty(String propertyName) {
|
|
|
|
|
return (propertyName != null && propertyName.endsWith("Array") ) ? getReferringObjects(propertyName) : super.readProperty(propertyName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private <OBJ_CLASS extends BaseObject > boolean isRelational( OBJ_CLASS object )
|
|
|
|
|
{
|
|
|
|
|
boolean result = false;
|
|
|
|
|
@ -178,25 +173,32 @@ public class BaseObject extends CayenneDataObject implements Comparable<BaseObje
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Object readProperty(String propertyName) {
|
|
|
|
|
return (propertyName != null && propertyName.endsWith("Array") ) ? getReferringObjects(propertyName) : super.readProperty(propertyName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
|
|
private <OBJ_CLASS extends BaseObject> List<OBJ_CLASS> getReferringObjects( String arrayProperty )
|
|
|
|
|
{
|
|
|
|
|
List<OBJ_CLASS> result = new LinkedList<OBJ_CLASS>();
|
|
|
|
|
List<OBJ_CLASS> result = (List<OBJ_CLASS>) super.readProperty(arrayProperty);
|
|
|
|
|
List<OBJ_CLASS> toDelete = new LinkedList<OBJ_CLASS>();
|
|
|
|
|
Boolean isRel = null;
|
|
|
|
|
for( OBJ_CLASS o : (List<OBJ_CLASS>) super.readProperty(arrayProperty) )
|
|
|
|
|
for( OBJ_CLASS o : result )
|
|
|
|
|
{
|
|
|
|
|
if( isRel == null )
|
|
|
|
|
{
|
|
|
|
|
isRel = isRelational( o );
|
|
|
|
|
}
|
|
|
|
|
if( null == o.readProperty( "deletedDate" ) )
|
|
|
|
|
if( null != o.readProperty( "deletedDate" ) || isRel && isRelDeleted(o) )
|
|
|
|
|
{
|
|
|
|
|
if( !isRel || !isRelDeleted( o ) )
|
|
|
|
|
{
|
|
|
|
|
result.add(o);
|
|
|
|
|
}
|
|
|
|
|
toDelete.add(o);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for( OBJ_CLASS o : toDelete )
|
|
|
|
|
{
|
|
|
|
|
result.remove(o);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|