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 { } }
.getProperty(relationshipQuery.getRelationshipName()); if (!property.isFault(object)) {
/** * Checks if an object has its to-one relationship target modified in memory. */ static boolean isToOneTargetModified( ArcProperty property, Persistent object, ObjectDiff diff) { if (object.getPersistenceState() != PersistenceState.MODIFIED || diff == null) { return false; } if (property.isFault(object)) { return false; } Persistent toOneTarget = (Persistent) property.readPropertyDirectly(object); ObjectId currentId = (toOneTarget != null) ? toOneTarget.getObjectId() : null; // if ObjectId is temporary, target is definitely modified... // this would cover NEW objects (what are the other cases of temp id??) if (currentId != null && currentId.isTemporary()) { return true; } if (!diff.containsArcSnapshot(property.getName())) { return false; } ObjectId targetId = diff.getArcSnapshotValue(property.getName()); return !Util.nullSafeEquals(currentId, targetId); }