public virtual object GetCurrentInstance(NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo nnoi) { //FIXME no need if (nnoi.GetObject() != null) { return(nnoi.GetObject()); } return(instanceBuilder.BuildOneInstance(nnoi)); }
public override object GetObjectFromOid(NeoDatis.Odb.OID oid) { if (oid == null) { throw new NeoDatis.Odb.ODBRuntimeException(NeoDatis.Odb.Core.NeoDatisError.CanNotGetObjectFromNullOid ); } NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo nnoi = GetObjectReader() .ReadNonNativeObjectInfoFromOid(null, oid, true, true); if (nnoi.IsDeletedObject()) { throw new NeoDatis.Odb.ODBRuntimeException(NeoDatis.Odb.Core.NeoDatisError.ObjectIsMarkedAsDeletedForOid .AddParameter(oid)); } object o = nnoi.GetObject(); if (o == null) { o = GetObjectReader().GetInstanceBuilder().BuildOneInstance(nnoi); } NeoDatis.Odb.Core.Transaction.ISession lsession = GetSession(true); // Here oid can be different from nnoi.getOid(). This is the case when // the oid is an external oid. That`s why we use // nnoi.getOid() to put in the cache lsession.GetCache().AddObject(nnoi.GetOid(), o, nnoi.GetHeader()); lsession.GetTmpCache().ClearObjectInfos(); return(o); }
private void StoreChangedObject(NonNativeObjectInfo aoi1, NonNativeObjectInfo aoi2, int fieldId , AbstractObjectInfo oldValue, AbstractObjectInfo newValue, string message, int objectRecursionLevel) { if (aoi1 != null && aoi2 != null) { if (aoi1.GetOid() != null && aoi1.GetOid().Equals(aoi2.GetOid())) { changedObjectMetaRepresentations.Add(aoi2); changes.Add(new ChangedObjectInfo(aoi1 .GetClassInfo(), aoi2.GetClassInfo(), fieldId, oldValue, newValue, message, objectRecursionLevel )); // also the max recursion level if (objectRecursionLevel > maxObjectRecursionLevel) { maxObjectRecursionLevel = objectRecursionLevel; } nbChanges++; } else { newObjects.Add(aoi2.GetObject()); string fieldName = aoi1.GetClassInfo().GetAttributeInfoFromId(fieldId).GetName(); // keep track of the position where the reference must be // updated - use aoi1 to get position, because aoi2 do not have position defined yet long positionToUpdateReference = aoi1.GetAttributeDefinitionPosition(fieldId); StoreNewObjectReference(positionToUpdateReference, aoi2, objectRecursionLevel, fieldName ); } } else { //newObjectMetaRepresentations.add(aoi2); NeoDatis.Tool.DLogger.Info("Non native object with null object"); } }