public SettingDefaultsOnMandatory()
 {
     Name        = "USE_DEFAULTS_ON_MANDATORY";
     Description = "Set the behaviour for mandatory attributes.";
     Type        = DBBoolean.UUID;
     Default     = new DBBoolean(false);
     this._Value = Default.Clone();
 }
 public SettingShowLASTACCESSTIME()
 {
     Name = "LASTACCESSTIME";
     Description = "Show the last accesstime of an object.";
     Type = DBBoolean.UUID;
     Default = new DBBoolean(false);
     Value = new DBBoolean(false);
 }
Beispiel #3
0
 public SettingShowREVISION()
 {
     Name            = "REVISION";
     Description     = "Show the revision of an object.";
     Type            = DBBoolean.UUID;
     Default         = new DBBoolean(false);
     Value           = new DBBoolean(false);
 }
 public SettingShowDELETIONTIME()
 {
     Name = "DELETIONTIME";
     Description = "Show the deletion time of an object.";
     Type = DBBoolean.UUID;
     Default = new DBBoolean(false);
     Value = new DBBoolean(false);
 }
Beispiel #5
0
 public SettingShowEDITIONS()
 {
     Name = "EDITIONS";
     Description = "Show the editions of an object.";
     Type = DBBoolean.UUID;
     Default = new DBBoolean(false);
     Value = new DBBoolean(false);
 }
 public SettingShowLASTMODIFICATIONTIME()
 {
     Name = "LASTMODIFICATIONTIME";
     Description = "Show the last modification time of an object.";
     Type = DBBoolean.UUID;
     Default = new DBBoolean(false);
     Value = new DBBoolean(false);
 }
Beispiel #7
0
 public SettingReadonly()
 {
     Name            = "SETREADONLY";
     Description     = "Decides whether the database is readonly or writeable.";
     Type            = DBBoolean.UUID;
     Default         = new DBBoolean(false);
     Value           = new DBBoolean(false);
 }
Beispiel #8
0
        private static Boolean ConvertToBestMatchingTypeReverse(ref ADBBaseObject myDBBaseObjectB, ref ADBBaseObject myDBBaseObjectA)
        {
            #region Both are not unknown

            if ((myDBBaseObjectA.Type != BasicType.Unknown) && (myDBBaseObjectB.Type != BasicType.Unknown))
            {

                #region Types matching, we can leave

                if (myDBBaseObjectA.Type == myDBBaseObjectB.Type)
                {
                    return true;
                }

                #endregion

                #region DBList and DBReference are not matchable with other types

                else if (myDBBaseObjectA is DBEdge || myDBBaseObjectA is DBReference || myDBBaseObjectB is DBEdge || myDBBaseObjectB is DBReference)
                {
                    return false;
                }

                #endregion

                #region The types does not match - so try to convert the right-handed to the left handed type

                else if (myDBBaseObjectA is DBUInt64)
                {
                    //
                    if (DBUInt64.IsValid(myDBBaseObjectB.Value))
                    {
                        myDBBaseObjectB = myDBBaseObjectA.Clone(myDBBaseObjectB.Value);
                        return true;
                    }
                    return false;
                }

                else if (myDBBaseObjectA is DBInt64)
                {
                    //
                    if (DBInt64.IsValid(myDBBaseObjectB.Value))
                    {
                        myDBBaseObjectB = myDBBaseObjectA.Clone(myDBBaseObjectB.Value);
                        return true;
                    }
                    // do not change to ConvertToBestMatchingType(ref myDBBaseObjectB, ref myDBBaseObjectA)
                    return false;
                }

                else if (myDBBaseObjectA is DBDouble)
                {
                    //
                    if (DBDouble.IsValid(myDBBaseObjectB.Value))
                    {
                        myDBBaseObjectB = myDBBaseObjectA.Clone(myDBBaseObjectB.Value);
                        return true;
                    }
                    return false;
                }

                else if (myDBBaseObjectA is DBDateTime)
                {
                    //
                    if (DBDateTime.IsValid(myDBBaseObjectB.Value))
                    {
                        myDBBaseObjectB = myDBBaseObjectA.Clone(myDBBaseObjectB.Value);
                        return true;
                    }
                    return false;
                }

                else if (myDBBaseObjectA is DBBoolean)
                {
                    //
                    if (DBDouble.IsValid(myDBBaseObjectB.Value))
                    {
                        myDBBaseObjectB = myDBBaseObjectA.Clone(myDBBaseObjectB.Value);
                        return true;
                    }
                    return false;
                }

                else if (myDBBaseObjectA is DBString)
                {
                    //
                    if (DBString.IsValid(myDBBaseObjectB.Value))
                    {
                        myDBBaseObjectB = myDBBaseObjectA.Clone(myDBBaseObjectB.Value);
                        return true;
                    }
                    return false;
                }

                #endregion

                // we couldnt find a matching type for both are not unknown
                return false;

            }

            #endregion

            #region Both are strings - thats fine

            else if (myDBBaseObjectA is DBString && myDBBaseObjectB is DBString)
            {
                return true;
            }

            #endregion

            #region only one is unknown

            else if (!(myDBBaseObjectA.Type == BasicType.Unknown && myDBBaseObjectB.Type == BasicType.Unknown))
            {

                #region myDBBaseObjectA is unknown - try to use the type of myDBBaseObjectB

                if (myDBBaseObjectA.Type == BasicType.Unknown)
                {

                    try
                    {
                        // avaoid changing a Double to Int64
                        if (myDBBaseObjectA is DBNumber
                            && (myDBBaseObjectB.Type == BasicType.Int64 || myDBBaseObjectB.Type == BasicType.UInt64))
                        {
                            if (myDBBaseObjectA.Value is Double && DBDouble.IsValid(myDBBaseObjectB.Value))
                            {
                                myDBBaseObjectA = new DBDouble(myDBBaseObjectA.Value);
                                myDBBaseObjectB = new DBDouble(myDBBaseObjectB.Value);
                                return true;
                            }
                        }

                        myDBBaseObjectA = myDBBaseObjectB.Clone(myDBBaseObjectA.Value);

                    }

                    catch
                    {
                        return false;
                    }

                }

                #endregion

                #region myDBBaseObjectB is unknown - try to use the type of myDBBaseObjectA

                else if (myDBBaseObjectB.Type == BasicType.Unknown)
                {
                    try
                    {
                        myDBBaseObjectB = myDBBaseObjectA.Clone(myDBBaseObjectB.Value);
                    }
                    catch
                    {
                        return false;
                    }
                }

                else
                {
                    return false;
                }

                #endregion

            }

            #endregion

            #region both are unknown

            #region One of them is expected as a Number - so try to parse both as a number

            else if (myDBBaseObjectA is DBNumber || myDBBaseObjectB is DBNumber)
            {

                if (DBInt64.IsValid(myDBBaseObjectA.Value) && DBInt64.IsValid(myDBBaseObjectB.Value))
                {
                    myDBBaseObjectA = new DBInt64(myDBBaseObjectA.Value);
                    myDBBaseObjectB = new DBInt64(myDBBaseObjectB.Value);
                }

                else if (DBUInt64.IsValid(myDBBaseObjectA.Value) && DBUInt64.IsValid(myDBBaseObjectB.Value))
                {
                    myDBBaseObjectA = new DBUInt64(myDBBaseObjectA.Value);
                    myDBBaseObjectB = new DBUInt64(myDBBaseObjectB.Value);
                }

                else if (DBDouble.IsValid(myDBBaseObjectA.Value) && DBDouble.IsValid(myDBBaseObjectB.Value))
                {
                    myDBBaseObjectA = new DBDouble(myDBBaseObjectA.Value);
                    myDBBaseObjectB = new DBDouble(myDBBaseObjectB.Value);
                }

                else
                {
                    return false;
                }

            }

            #endregion

            #region Try all other dataTypes

            else
            {

                // check all types beginning with the hardest and ending with string (matches all)
                if (DBDateTime.IsValid(myDBBaseObjectA.Value) && DBDateTime.IsValid(myDBBaseObjectB.Value))
                {
                    myDBBaseObjectA = new DBDateTime(myDBBaseObjectA.Value);
                    myDBBaseObjectB = new DBDateTime(myDBBaseObjectB.Value);
                }

                else if (DBBoolean.IsValid(myDBBaseObjectA.Value) && DBBoolean.IsValid(myDBBaseObjectB.Value))
                {
                    myDBBaseObjectA = new DBBoolean(myDBBaseObjectA.Value);
                    myDBBaseObjectB = new DBBoolean(myDBBaseObjectB.Value);
                }

                else if (DBEdge.IsValid(myDBBaseObjectA.Value) && DBEdge.IsValid(myDBBaseObjectB.Value))
                {
                    myDBBaseObjectA = new DBEdge(myDBBaseObjectA.Value);
                    myDBBaseObjectB = new DBEdge(myDBBaseObjectB.Value);
                }

                else if (DBReference.IsValid(myDBBaseObjectA.Value) && DBReference.IsValid(myDBBaseObjectB.Value))
                {
                    myDBBaseObjectA = new DBReference(myDBBaseObjectA.Value);
                    myDBBaseObjectB = new DBReference(myDBBaseObjectB.Value);
                }

                else if (DBString.IsValid(myDBBaseObjectA.Value) && DBString.IsValid(myDBBaseObjectB.Value))
                {
                    myDBBaseObjectA = new DBString(myDBBaseObjectA.Value);
                    myDBBaseObjectB = new DBString(myDBBaseObjectB.Value);
                }

                else
                {
                    return false;
                }

            }

            #endregion

            #endregion

            return true;
        }
Beispiel #9
0
        public static Exceptional<Boolean> ConvertToBestMatchingType(ref ADBBaseObject myDBBaseObjectA, ref ADBBaseObject myDBBaseObjectB)
        {
            #region Both are not unknown

            if ((myDBBaseObjectA.Type != BasicType.Unknown) && (myDBBaseObjectB.Type != BasicType.Unknown))
            {

                #region Types matching, we can leave

                if (myDBBaseObjectA.Type == myDBBaseObjectB.Type)
                {
                    return new Exceptional<Boolean>(true);
                }

                #endregion

                #region DBList and DBReference are not matchable with other types

                else if (myDBBaseObjectA is DBEdge || myDBBaseObjectB is DBEdge)
                {
                    return new Exceptional<Boolean>(false);
                }

                #endregion

                #region The types does not match - so try to convert the right-handed to the left handed type

                else if (myDBBaseObjectA is DBUInt64)
                {
                    //
                    if (DBUInt64.IsValid(myDBBaseObjectB.Value))
                    {
                        myDBBaseObjectB = myDBBaseObjectA.Clone(myDBBaseObjectB.Value);
                        return new Exceptional<Boolean>(true);
                    }
                    return new Exceptional<Boolean>(ConvertToBestMatchingTypeReverse(ref myDBBaseObjectA, ref myDBBaseObjectB));
                }

                else if (myDBBaseObjectA is DBInt64)
                {
                    //
                    if (DBInt64.IsValid(myDBBaseObjectB.Value))
                    {
                        myDBBaseObjectB = myDBBaseObjectA.Clone(myDBBaseObjectB.Value);
                        return new Exceptional<Boolean>(true);
                    }
                    return new Exceptional<Boolean>(ConvertToBestMatchingTypeReverse(ref myDBBaseObjectA, ref myDBBaseObjectB));
                }

                else if (myDBBaseObjectA is DBInt32)
                {
                    //
                    if (DBInt32.IsValid(myDBBaseObjectB.Value))
                    {
                        myDBBaseObjectB = myDBBaseObjectA.Clone(myDBBaseObjectB.Value);
                        return new Exceptional<Boolean>(true);
                    }
                    return new Exceptional<Boolean>(ConvertToBestMatchingTypeReverse(ref myDBBaseObjectA, ref myDBBaseObjectB));
                }

                else if (myDBBaseObjectA is DBDouble)
                {
                    //
                    if (DBDouble.IsValid(myDBBaseObjectB.Value))
                    {
                        myDBBaseObjectB = myDBBaseObjectA.Clone(myDBBaseObjectB.Value);
                        return new Exceptional<Boolean>(true);
                    }
                    return new Exceptional<Boolean>(ConvertToBestMatchingTypeReverse(ref myDBBaseObjectA, ref myDBBaseObjectB));
                }

                else if (myDBBaseObjectA is DBDateTime)
                {
                    //
                    if (DBDateTime.IsValid(myDBBaseObjectB.Value))
                    {
                        myDBBaseObjectB = myDBBaseObjectA.Clone(myDBBaseObjectB.Value);
                        return new Exceptional<Boolean>(true);
                    }
                    return new Exceptional<Boolean>(ConvertToBestMatchingTypeReverse(ref myDBBaseObjectA, ref myDBBaseObjectB));
                }

                else if (myDBBaseObjectA is DBBoolean)
                {
                    //
                    if (DBBoolean.IsValid(myDBBaseObjectB.Value))
                    {
                        myDBBaseObjectB = myDBBaseObjectA.Clone(myDBBaseObjectB.Value);
                        return new Exceptional<Boolean>(true);
                    }
                    return new Exceptional<Boolean>(ConvertToBestMatchingTypeReverse(ref myDBBaseObjectA, ref myDBBaseObjectB));
                }

                #endregion

                // we couldnt find a matching type for both are not unknown
                return new Exceptional<bool>(new Error_NotImplemented(new StackTrace(true), String.Format("no type conversion implemented for {0} and {1}", myDBBaseObjectA.GetType(), myDBBaseObjectB.GetType())));

            }

            #endregion

            #region Both are strings - thats fine

            else if (myDBBaseObjectA is DBString && myDBBaseObjectB is DBString)
            {
                return new Exceptional<Boolean>(true);
            }

            #endregion

            #region only one is unknown

            else if (!(myDBBaseObjectA.Type == BasicType.Unknown && myDBBaseObjectB.Type == BasicType.Unknown))
            {

                #region myDBBaseObjectA is unknown - try to use the type of myDBBaseObjectB

                if (myDBBaseObjectA.Type == BasicType.Unknown)
                {

                    // avoid changing a Double to Int64
                    if (myDBBaseObjectA is DBNumber
                        && (myDBBaseObjectB.Type == BasicType.Int64 || myDBBaseObjectB.Type == BasicType.UInt64))
                    {
                        if (myDBBaseObjectA.Value is Double && DBDouble.IsValid(myDBBaseObjectB.Value))
                        {
                            myDBBaseObjectA = new DBDouble(myDBBaseObjectA.Value);
                            myDBBaseObjectB = new DBDouble(myDBBaseObjectB.Value);
                            return new Exceptional<bool>(true);
                        }
                    }

                    try
                    {
                        myDBBaseObjectA = myDBBaseObjectB.Clone(myDBBaseObjectA.Value);
                    }
                    catch
                    {
                        return new Exceptional<bool>(new Error_DataTypeDoesNotMatch(myDBBaseObjectB.GetType().Name, myDBBaseObjectA.Value.GetType().Name));
                    }

                }

                #endregion

                #region myDBBaseObjectB is unknown - try to use the type of myDBBaseObjectA

                else if (myDBBaseObjectB.Type == BasicType.Unknown)
                {

                    // avoid changing a Double to Int64
                    if (myDBBaseObjectB is DBNumber
                        && (myDBBaseObjectA.Type == BasicType.Int64 || myDBBaseObjectA.Type == BasicType.UInt64))
                    {
                        if (myDBBaseObjectB.Value is Double && DBDouble.IsValid(myDBBaseObjectA.Value))
                        {
                            myDBBaseObjectA = new DBDouble(myDBBaseObjectA.Value);
                            myDBBaseObjectB = new DBDouble(myDBBaseObjectB.Value);
                            return new Exceptional<bool>(true);
                        }
                    }

                    try
                    {
                        myDBBaseObjectB = myDBBaseObjectA.Clone(myDBBaseObjectB.Value);
                    }
                    catch
                    {
                        return new Exceptional<bool>(new Error_DataTypeDoesNotMatch(myDBBaseObjectA.Value.GetType().ToString(), myDBBaseObjectB.GetType().ToString()));
                    }

                }

                else
                {
                    return new Exceptional<bool>(false);
                }

                #endregion

            }

            #endregion

            #region both are unknown

            #region One of them is expected as a Number - so try to parse both as a number

            else if (myDBBaseObjectA is DBNumber || myDBBaseObjectB is DBNumber)
            {

                if (DBInt64.IsValid(myDBBaseObjectA.Value) && DBInt64.IsValid(myDBBaseObjectB.Value))
                {
                    myDBBaseObjectA = new DBInt64(myDBBaseObjectA.Value);
                    myDBBaseObjectB = new DBInt64(myDBBaseObjectB.Value);
                }

                else if (DBUInt64.IsValid(myDBBaseObjectA.Value) && DBUInt64.IsValid(myDBBaseObjectB.Value))
                {
                    myDBBaseObjectA = new DBUInt64(myDBBaseObjectA.Value);
                    myDBBaseObjectB = new DBUInt64(myDBBaseObjectB.Value);
                }

                else if (DBDouble.IsValid(myDBBaseObjectA.Value) && DBDouble.IsValid(myDBBaseObjectB.Value))
                {
                    myDBBaseObjectA = new DBDouble(myDBBaseObjectA.Value);
                    myDBBaseObjectB = new DBDouble(myDBBaseObjectB.Value);
                }

                else
                {
                    return new Exceptional<Boolean>(false);
                }

            }

            #endregion

            #region Try all other dataTypes

            else
            {

                // check all types beginning with the hardest and ending with string (matches all)
                if (DBDateTime.IsValid(myDBBaseObjectA.Value) && DBDateTime.IsValid(myDBBaseObjectB.Value))
                {
                    myDBBaseObjectA = new DBDateTime(myDBBaseObjectA.Value);
                    myDBBaseObjectB = new DBDateTime(myDBBaseObjectB.Value);
                }

                else if (DBBoolean.IsValid(myDBBaseObjectA.Value) && DBBoolean.IsValid(myDBBaseObjectB.Value))
                {
                    myDBBaseObjectA = new DBBoolean(myDBBaseObjectA.Value);
                    myDBBaseObjectB = new DBBoolean(myDBBaseObjectB.Value);
                }

                else if (DBEdge.IsValid(myDBBaseObjectA.Value) && DBEdge.IsValid(myDBBaseObjectB.Value))
                {
                    myDBBaseObjectA = new DBEdge(myDBBaseObjectA.Value);
                    myDBBaseObjectB = new DBEdge(myDBBaseObjectB.Value);
                }

                else if (DBReference.IsValid(myDBBaseObjectA.Value) && DBReference.IsValid(myDBBaseObjectB.Value))
                {
                    myDBBaseObjectA = new DBReference(myDBBaseObjectA.Value);
                    myDBBaseObjectB = new DBReference(myDBBaseObjectB.Value);
                }

                else if (DBString.IsValid(myDBBaseObjectA.Value) && DBString.IsValid(myDBBaseObjectB.Value))
                {
                    myDBBaseObjectA = new DBString(myDBBaseObjectA.Value);
                    myDBBaseObjectB = new DBString(myDBBaseObjectB.Value);
                }

                else
                {
                    return new Exceptional<Boolean>(false);
                }

            }

            #endregion

            #endregion

            return new Exceptional<bool>(true);
        }
Beispiel #10
0
 private void Serialize(ref SerializationWriter mySerializationWriter, DBBoolean myValue)
 {
     mySerializationWriter.WriteBoolean((Boolean)myValue.Value);
 }
Beispiel #11
0
 private object Deserialize(ref SerializationReader mySerializationReader, DBBoolean myValue)
 {
     myValue._Value = mySerializationReader.ReadBoolean();
     return myValue;
 }
Beispiel #12
0
 private void CalcEstimatedSize(DBBoolean myTypeAttribute)
 {
     //DateTime + TypeCode + EstimatedSize
     _estimatedSize = EstimatedSizeConstants.Boolean + GetBaseSize();
 }