public void nodeRemoved(Object nodeId) { Object object = context.internalGraphManager().getNode(nodeId); if (object != null) { context.deleteObject((Persistent) object); } }
public void nodeIdChanged(Object nodeId, Object newId) { // do not unregister the node just yet... only put replaced id in deadIds to // remove it later. Otherwise stored operations will not work Object node = context.internalGraphManager().getNode(nodeId); if (node != null) { context.internalGraphManager().deadIds().add(nodeId); context.internalGraphManager().registerNode(newId, node); if (node instanceof Persistent) { // inject new id ((Persistent) node).setObjectId((ObjectId) newId); } } }
public void arcDeleted(Object nodeId, Object targetNodeId, Object arcId) { // null source or target likely means the object is not faulted yet... Faults // shouldn't get disturbed by adding/removing arcs Object source = context.internalGraphManager().getNode(nodeId); if (source == null) { // no need to disconnect non-existent object return; } // (see "TODO" in 'arcCreated') ArcProperty p = (ArcProperty) propertyForId(nodeId, arcId.toString()); if (p.isFault(source)) { return; } Object target = context.internalGraphManager().getNode(targetNodeId); if (target == null) { target = context.createFault((ObjectId) targetNodeId); } try { if (p instanceof ToManyProperty) { ((ToManyProperty) p).removeTargetDirectly(source, target); } else { p.writePropertyDirectly(source, target, null); } } finally { } }
public void arcCreated(Object nodeId, Object targetNodeId, Object arcId) { // null source or target likely means the object is not faulted yet... Faults // shouldn't get disturbed by adding/removing arcs Object source = context.internalGraphManager().getNode(nodeId); if (source == null) { // no need to connect non-existent object return; } // TODO (Andrus, 10/17/2005) - check for local modifications to avoid // overwriting... ArcProperty p = (ArcProperty) propertyForId(nodeId, arcId.toString()); if (p.isFault(source)) { return; } Object target = context.internalGraphManager().getNode(targetNodeId); if (target == null) { target = context.createFault((ObjectId) targetNodeId); } try { if (p instanceof ToManyProperty) { ((ToManyProperty) p).addTargetDirectly(source, target); } else { p.writePropertyDirectly(source, null, target); } } finally { } }
public void nodeIdChanged(Object nodeId, Object newId) { // do not unregister the node just yet... only put replaced id in deadIds to // remove it later. Otherwise stored operations will not work Object node = context.internalGraphManager().getNode(nodeId); if (node != null) { context.internalGraphManager().deadIds().add(nodeId); context.internalGraphManager().registerNode(newId, node); if (node instanceof Persistent) { // inject new id ((Persistent) node).setObjectId((ObjectId) newId); } } }
/** * Remaps keys in to-many map relationships that contain dirty objects with * potentially modified properties. */ private void remapTargets() { Iterator<Object> it = stateLog.dirtyIds().iterator(); EntityResolver resolver = context.getEntityResolver(); while (it.hasNext()) { ObjectId id = (ObjectId) it.next(); ClassDescriptor descriptor = resolver.getClassDescriptor(id.getEntityName()); Collection<ArcProperty> mapArcProperties = descriptor.getMapArcProperties(); if (!mapArcProperties.isEmpty()) { Object object = getNode(id); for (ArcProperty arc : mapArcProperties) { ToManyMapProperty reverseArc = (ToManyMapProperty) arc .getComplimentaryReverseArc(); Object source = arc.readPropertyDirectly(object); if (source != null && !reverseArc.isFault(source)) { remapTarget(reverseArc, source, object); } } } } }
public void nodePropertyChanged( Object nodeId, String property, Object oldValue, Object newValue) { Object object = context.internalGraphManager().getNode(nodeId); if (object != null) { // do not override local changes.... PropertyDescriptor p = propertyForId(nodeId, property); if (Util.nullSafeEquals(p.readPropertyDirectly(object), oldValue)) { p.writePropertyDirectly(object, oldValue, newValue); } } }
public void arcCreated(Object nodeId, Object targetNodeId, Object arcId) { // null source or target likely means the object is not faulted yet... Faults // shouldn't get disturbed by adding/removing arcs Object source = context.internalGraphManager().getNode(nodeId); if (source == null) { source = context.createFault((ObjectId) nodeId); } Object target = context.internalGraphManager().getNode(targetNodeId); if (target == null) { target = context.createFault((ObjectId) targetNodeId); } // TODO (Andrus, 10/17/2005) - check for local modifications to avoid // overwriting... ArcProperty p = (ArcProperty) propertyForId(nodeId, arcId.toString()); try { context.internalGraphAction().handleArcPropertyChange( (Persistent) source, p, null, target); } finally { context.internalGraphAction().setArcChangeInProcess(false); } }
public void arcDeleted(Object nodeId, Object targetNodeId, Object arcId) { // null source or target likely means the object is not faulted yet... Faults // shouldn't get disturbed by adding/removing arcs Object source = context.internalGraphManager().getNode(nodeId); if (source == null) { source = context.createFault((ObjectId) nodeId); } Object target = context.internalGraphManager().getNode(targetNodeId); if (target == null) { target = context.createFault((ObjectId) targetNodeId); } // (see "TODO" in 'arcCreated') ArcProperty p = (ArcProperty) propertyForId(nodeId, arcId.toString()); p.writePropertyDirectly(source, target, null); try { context.internalGraphAction().handleArcPropertyChange( (Persistent) source, p, target, null); } finally { context.internalGraphAction().setArcChangeInProcess(false); } }
public void nodePropertyChanged( Object nodeId, String property, Object oldValue, Object newValue) { Object object = context.internalGraphManager().getNode(nodeId); if (object != null) { // do not override local changes.... Property p = propertyForId(nodeId, property); if (Util.nullSafeEquals(p.readPropertyDirectly(object), oldValue)) { p.writePropertyDirectly(object, oldValue, newValue); context.internalGraphAction().handleSimplePropertyChange( (Persistent) object, property, oldValue, newValue); } } }