From: Richard B. <rb...@us...> - 2004-11-05 01:39:35
|
Update of /cvsroot/jcframework/dotnet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7037 Modified Files: CInjectedObject.vb CPersistenceBroker.vb CPersistentObject.vb IPersistentObject.vb Log Message: Fix for retrieveAssociations. Preexisting objects were not being correctly retrieved Index: CPersistenceBroker.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/CPersistenceBroker.vb,v retrieving revision 1.77 retrieving revision 1.78 diff -u -d -r1.77 -r1.78 --- CPersistenceBroker.vb 2 Nov 2004 05:36:13 -0000 1.77 +++ CPersistenceBroker.vb 5 Nov 2004 01:39:17 -0000 1.78 @@ -630,18 +630,16 @@ gotValue = False If Not Value Is Nothing Then 'Need to know if returned object is persistent and has a legitimate key - 'If Value.hasValidKey Then + If Value.HasValidKey Then anObjPers = m_cache.Item(Value) - If anObjPers Is Nothing Then - retrieveObject(Value, False, False) - Else + If Not anObjPers Is Nothing Then Value = anObjPers - End If Value.IsDirty = False Value.OriginalCacheKey = New CCacheKey(Value) obj.SetAttributeValue(udaMap.Target, Value.GetSourceObject) gotValue = True - 'End If + End If + End If End If If Not gotValue Then 'Object doesn't exist - let's create it Index: IPersistentObject.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/IPersistentObject.vb,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- IPersistentObject.vb 1 Nov 2004 21:28:03 -0000 1.6 +++ IPersistentObject.vb 5 Nov 2004 01:39:17 -0000 1.7 @@ -31,6 +31,7 @@ Sub ResetOriginalDates() Function GetObjectByClassMap(ByVal classMap As CClassMap) As IPersistableObject Function GetSourceObject() As Object + Function HasValidKey() As Boolean End Interface Public Interface IPersistentObject Index: CInjectedObject.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/CInjectedObject.vb,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- CInjectedObject.vb 27 Oct 2004 07:38:48 -0000 1.6 +++ CInjectedObject.vb 5 Nov 2004 01:39:17 -0000 1.7 @@ -627,5 +627,18 @@ Public Function GetSourceObject() As Object Implements IPersistableObject.GetSourceObject Return m_object End Function + + Public Overridable Function hasValidKey() As Boolean Implements IPersistableObject.HasValidKey + 'Check for any non-null key attributes + Dim am As CAttributeMap + Dim cm As CClassMap + cm = Me.getClassMap + For Each am In cm.KeyAttributeMaps + If Not IsNullAlias(Me.GetSourceObject.getValueByAttribute(am.Name)) Then + Return True + End If + Next + Return False + End Function End Class Index: CPersistentObject.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/CPersistentObject.vb,v retrieving revision 1.49 retrieving revision 1.50 diff -u -d -r1.49 -r1.50 --- CPersistentObject.vb 1 Nov 2004 21:28:03 -0000 1.49 +++ CPersistentObject.vb 5 Nov 2004 01:39:17 -0000 1.50 @@ -632,11 +632,17 @@ ''' </history> '''----------------------------------------------------------------------------- <EditorBrowsable(EditorBrowsableState.Advanced)> _ - Public Overridable Function hasValidKey() As Boolean - If m_oid Is Nothing Then + Public Overridable Function hasValidKey() As Boolean Implements IPersistableObject.HasValidKey + 'Check for any non-null key attributes + Dim am As CAttributeMap + Dim cm As CClassMap + cm = Me.getClassMap + For Each am In cm.KeyAttributeMaps + If Not IsNullAlias(Me.getValueByAttribute(am.Name)) Then + Return True + End If + Next Return False - End If - Return OIDValue.Length > 0 End Function '''----------------------------------------------------------------------------- |