git-svn-id: https://svn.coded.pt/svn/SIPRP@1081 bb69d46d-e84e-40c8-a05a-06db0d633741

0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
Tiago Simão 16 years ago
parent a6ba5582cc
commit 20cfed1e99

@ -27,6 +27,8 @@ import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreePath; import javax.swing.tree.TreePath;
import javax.swing.tree.TreeSelectionModel; import javax.swing.tree.TreeSelectionModel;
import org.apache.cayenne.PersistenceState;
import leaf.ui.LeafButton; import leaf.ui.LeafButton;
import leaf.ui.LeafDialog; import leaf.ui.LeafDialog;
import leaf.ui.LeafIconButton; import leaf.ui.LeafIconButton;

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

Loading…
Cancel
Save