コード例 #1
0
 public override NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo CreateCopy
     (System.Collections.Generic.IDictionary <NeoDatis.Odb.OID, NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
                                              > cache, bool onlyData)
 {
     System.Collections.ICollection c = (System.Collections.ICollection)theObject;
     System.Collections.Generic.ICollection <NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
                                             > newCollection = new NeoDatis.Tool.Wrappers.List.OdbArrayList <NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
                                                                                                             >();
     // To keep track of non native objects
     NeoDatis.Tool.Wrappers.List.IOdbList <NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
                                           > nonNatives = new NeoDatis.Tool.Wrappers.List.OdbArrayList <NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
                                                                                                        >();
     System.Collections.IEnumerator iterator = c.GetEnumerator();
     while (iterator.MoveNext())
     {
         NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo aoi = (NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
                                                                        )iterator.Current;
         // create copy
         aoi = aoi.CreateCopy(cache, onlyData);
         newCollection.Add(aoi);
         if (aoi.IsNonNativeObject())
         {
             nonNatives.Add((NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo)aoi);
         }
     }
     NeoDatis.Odb.Core.Layers.Layer2.Meta.CollectionObjectInfo coi = new NeoDatis.Odb.Core.Layers.Layer2.Meta.CollectionObjectInfo
                                                                         (newCollection, odbType, nonNatives);
     coi.SetRealCollectionClassName(realCollectionClassName);
     return(coi);
 }
コード例 #2
0
 private bool CheckIfCollectionContainsValue(System.Collections.ICollection c)
 {
     NeoDatis.Odb.Core.Layers.Layer3.IStorageEngine engine = GetQuery().GetStorageEngine
                                                                 ();
     if (engine == null)
     {
         throw new NeoDatis.Odb.ODBRuntimeException(NeoDatis.Odb.Core.NeoDatisError.QueryEngineNotSet
                                                    );
     }
     NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo aoi = null;
     System.Collections.IEnumerator iterator = c.GetEnumerator();
     // If the object to compared is native
     if (objectIsNative)
     {
         while (iterator.MoveNext())
         {
             aoi = (NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo)iterator.Current;
             if (aoi == null && criterionValue == null)
             {
                 return(true);
             }
             if (aoi != null && criterionValue == null)
             {
                 return(false);
             }
             if (criterionValue.Equals(aoi.GetObject()))
             {
                 return(true);
             }
         }
         return(false);
     }
     // Object is not native
     while (iterator.MoveNext())
     {
         aoi = (NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo)iterator.Current;
         if (aoi.IsNull() && criterionValue == null && oid == null)
         {
             return(true);
         }
         if (aoi != null & oid != null)
         {
             if (aoi.IsNonNativeObject())
             {
                 NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo nnoi1 = (NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
                                                                                   )aoi;
                 bool isEqual = nnoi1.GetOid() != null && oid != null && nnoi1.GetOid().Equals(oid
                                                                                               );
                 if (isEqual)
                 {
                     return(true);
                 }
             }
         }
     }
     return(false);
 }
コード例 #3
0
 public static NeoDatis.Tool.Wrappers.OdbComparable BuildIndexKey(string indexName
                                                                  , NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo oi, int[] fieldIds)
 {
     NeoDatis.Tool.Wrappers.OdbComparable[] keys = new NeoDatis.Tool.Wrappers.OdbComparable
                                                   [fieldIds.Length];
     NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo aoi = null;
     System.IComparable o = null;
     for (int i = 0; i < fieldIds.Length; i++)
     {
         // Todo : can we assume that the object is a Comparable
         try
         {
             aoi = (NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo)oi.GetAttributeValueFromId
                       (fieldIds[i]);
             o = (System.IComparable)aoi.GetObject();
             // JDK1.4 restriction: Boolean is not Comparable in jdk1.4
             if (aoi.GetOdbType().IsBoolean())
             {
                 bool b = (bool)o;
                 if (b)
                 {
                     o = (byte)1;
                 }
                 else
                 {
                     o = (byte)0;
                 }
             }
             // If the index is on NonNativeObjectInfo, then the key is the oid
             // of the object
             if (aoi.IsNonNativeObject())
             {
                 NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo nnoi = (NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
                                                                                  )aoi;
                 o = nnoi.GetOid();
             }
             keys[i] = new NeoDatis.Odb.Core.Query.SimpleCompareKey(o);
         }
         catch (System.Exception)
         {
             throw new NeoDatis.Odb.ODBRuntimeException(NeoDatis.Odb.Core.NeoDatisError.IndexKeysMustImplementComparable
                                                        .AddParameter(fieldIds[i]).AddParameter(oi.GetAttributeValueFromId(fieldIds[i]).
                                                                                                GetType().FullName));
         }
     }
     if (keys.Length == 1)
     {
         return(keys[0]);
     }
     return(new NeoDatis.Odb.Core.Query.ComposedCompareKey(keys));
 }