private void clearNullRelationships(List<Persistent> parentObjects) { for (Persistent object : parentObjects) { if (incoming.readPropertyDirectly(object) instanceof Fault) { incoming.writePropertyDirectly(object, null, null); } } }
/** * Creates a temporary association between child and parent objects. Permanent * relationship is set using the information created here, by calling * 'connectToParents'. */ void linkToParent(Persistent object, Persistent parent) { if (parent != null && parent.getPersistenceState() != PersistenceState.HOLLOW) { // if a relationship is to-one (i.e. flattened to-one), can connect right // away.... write directly to prevent changing persistence state. if (incoming instanceof ToOneProperty) { incoming.writePropertyDirectly(parent, null, object); } else { List<Persistent> peers = partitionByParent.get(parent); // wrap in a list even if relationship is to-one... will unwrap at the end // of the processing cycle. if (peers == null) { peers = new ArrayList<>(); partitionByParent.put(parent, peers); } else if (peers.contains(object)) { // checking for duplicates is needed in case of nested joint prefetches // when there is more than one row with the same combination of adjacent // parent and child... return; } peers.add(object); } } }
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 { } }