1 19 package org.apache.cayenne.access; 20 21 import org.apache.cayenne.Persistent; 22 import org.apache.cayenne.reflect.ArcProperty; 23 import org.apache.cayenne.util.ObjectContextGraphAction; 24 25 34 class DataContextGraphAction extends ObjectContextGraphAction { 35 36 DataContextGraphAction(DataContext context) { 37 super(context); 38 } 39 40 protected void handleSimplePropertyChange( 41 Persistent object, 42 String propertyName, 43 Object oldValue, 44 Object newValue) { 45 46 if (markAsDirty(object)) { 49 context.getGraphManager().nodePropertyChanged( 50 object.getObjectId(), 51 propertyName, 52 oldValue, 53 newValue); 54 } 55 } 56 57 protected void handleArcPropertyChange( 58 Persistent object, 59 ArcProperty property, 60 Object oldValue, 61 Object newValue) { 62 63 if (oldValue != newValue) { 64 markAsDirty(object); 65 66 if (oldValue instanceof Persistent) { 67 context.getGraphManager().arcDeleted( 68 object.getObjectId(), 69 ((Persistent) oldValue).getObjectId(), 70 property.getName()); 71 } 72 73 if (newValue instanceof Persistent) { 74 context.getGraphManager().arcCreated( 75 object.getObjectId(), 76 ((Persistent) newValue).getObjectId(), 77 property.getName()); 78 } 79 } 80 } 81 } 82 | Popular Tags |