use of org.apache.cayenne.reflect.PropertyDescriptor in project cayenne by apache.
the class DataContextMergeHandler method arcChanged.
// works the same for add and remove as long as we don't get too smart per TODO below.
private void arcChanged(Object nodeId, Object targetNodeId, Object arcId) {
final Persistent source = (Persistent) context.getGraphManager().getNode(nodeId);
if (source != null && source.getPersistenceState() != PersistenceState.HOLLOW) {
final int state = source.getPersistenceState();
PropertyDescriptor p = propertyForId(nodeId, arcId.toString());
p.visit(new PropertyVisitor() {
public boolean visitAttribute(AttributeProperty property) {
return false;
}
public boolean visitToMany(ToManyProperty property) {
if (state == PersistenceState.COMMITTED) {
property.invalidate(source);
}
return false;
}
public boolean visitToOne(ToOneProperty property) {
if (state == PersistenceState.COMMITTED) {
property.invalidate(source);
}
// of dirty objects. See DataRowUtils for details.
return false;
}
});
}
}
Aggregations