コード例 #1
0
ファイル: Argument.cs プロジェクト: rinavin/RCJS
        /// <summary>
        ///   CTOR that creates a "Value" type argument from a given Expression Value
        /// </summary>
        /// <param name = "expVal">the source expression value</param>
        protected internal Argument(GuiExpressionEvaluator.ExpVal expVal)
        {
            _type = ConstInterface.ARG_TYPE_VALUE;
            _fld  = null;
            _exp  = null;
            _skip = false;

            if (expVal.IsNull)
            {
                _val = null;
            }
            else
            {
                _val = expVal.ToMgVal();
                if (expVal.Attr == StorageAttribute.DOTNET &&
                    (String.IsNullOrEmpty(_val) || !BlobType.isValidDotNetBlob(_val)))
                {
                    _dnObjectCollectionKey = DNManager.getInstance().DNObjectsCollection.CreateEntry(null);
                    _val = BlobType.createDotNetBlobPrefix(_dnObjectCollectionKey);

                    if (expVal.DnMemberInfo != null)
                    {
                        DNManager.getInstance().DNObjectsCollection.Update(_dnObjectCollectionKey,
                                                                           expVal.DnMemberInfo.value);
                    }

                    // add this key into 'tempDNObjectsCollectionKeys', so that it can be freed later.
                    ClientManager.Instance.getTempDNObjectCollectionKeys().Add(_dnObjectCollectionKey);
                }
            }

            _valueIsNull = (_val == null);
            _valueAttr   = expVal.Attr;
        }
コード例 #2
0
ファイル: ReflectionServices.cs プロジェクト: rinavin/RCJS
        /// <summary></summary>
        /// <param name="dnMemberInfo"></param>
        /// <returns></returns>
        public static Type GetType(DNMemberInfo dnMemberInfo)
        {
            Type type = null;

            if (dnMemberInfo == null)
            {
                return(null);
            }

            if (dnMemberInfo.memberInfo != null)
            {
                type = GetType(dnMemberInfo.memberInfo);
            }
            else
            {
                if (dnMemberInfo.indexes != null && dnMemberInfo.parent != null) // for array elem
                {
                    type = dnMemberInfo.parent.value.GetType().GetElementType();
                }
                else if (dnMemberInfo.dnObjectCollectionIsn != -1)
                {
                    type = DNManager.getInstance().DNObjectsCollection.GetDNType(dnMemberInfo.dnObjectCollectionIsn);
                }
                else if (dnMemberInfo.value != null)
                {
                    type = dnMemberInfo.value.GetType();
                }
            }

            return(type);
        }
コード例 #3
0
ファイル: DotNetHandler.cs プロジェクト: rinavin/RCJS
        /// <summary>this is an entry point for all objects handlers</summary>
        /// <param name="objectHashCode"> hash code of the object</param>
        /// <param name="eventName"> event name</param>
        /// <param name="parameters">event parameters</param>
        /// <returns></returns>
        public static void handleDotNetEvent(int objectHashCode, String eventName, Object[] parameters)
        {
            Object       invokedObject     = DNManager.getInstance().DNObjectEventsCollection.getObject(objectHashCode);
            GuiMgControl mgControl         = null;
            bool         raiseRuntimeEvent = true;

            Manager.ContextIDGuard contextIDGuard = null;

            // If Object is a control and it is 'our' control (not created dynamically, decided by .Tag)
            if (invokedObject is Control && ((Control)invokedObject).Tag != null)
            {
                ControlsMap controlsMap = ControlsMap.getInstance();
                MapData     mapData     = controlsMap.getControlMapData((Control)invokedObject);
                if (mapData == null)
                {
                    return;
                }

                mgControl = mapData.getControl();

                contextIDGuard = new Manager.ContextIDGuard(Manager.GetContextID(mgControl));
                //first execute default magic handling of event
                EventType type = DNControlEvents.getStandardEvent(eventName);
                if (type != EventType.NONE && parameters.Length == 2)
                {
                    DefaultHandler.getInstance().handleEvent(type, invokedObject, (EventArgs)parameters[1]);
                }

                if (eventName == "KeyDown") //QCR #736734 KeyDown is handled from Filter.cs on WM_KEYDOWN - do not duplicate the event
                {
                    raiseRuntimeEvent = false;
                }
                else if (eventName == "Disposed")
                {
                    // a Disposed event for a control can't be handled as a runtime-event after the task/form are closed
                    raiseRuntimeEvent = false;
                }
                else
                {
                    // raise .NET runtime event only if hooked from the application (i.e. have a handler in the task)
                    List <String> applicationHookedDNeventsNames = ((TagData)((Control)invokedObject).Tag).ApplicationHookedDNeventsNames;
                    if (applicationHookedDNeventsNames == null || !applicationHookedDNeventsNames.Contains(eventName))
                    {
                        raiseRuntimeEvent = false;
                    }
                }
            }

            // raise .NET event
            if (raiseRuntimeEvent)
            {
                Events.OnDotNetEvent(invokedObject, mgControl, eventName, parameters);
            }

            if (contextIDGuard != null)
            {
                contextIDGuard.Dispose();
            }
        }
コード例 #4
0
 /// <summary>
 ///   remove DNObjectsCollection entries made by dot net parameters for the event
 /// </summary>
 internal void removeDotNetArgs()
 {
     // free the object table entry
     for (int i = 0; i < _argList.getSize(); i++)
     {
         string val = _argList.getArg(i).getValue(StorageAttribute.DOTNET, 0);
         DNManager.getInstance().DNObjectsCollection.Remove(BlobType.getKey(val));
     }
 }
コード例 #5
0
ファイル: ReflectionServices.cs プロジェクト: rinavin/RCJS
        /// <summary> Add the ValueChangedHandler. </summary>
        /// <param name="control"></param>
        internal static void AddDNControlValueChangedHandler(Control control)
        {
            Debug.Assert(Misc.IsGuiThread());

            DNObjectEventsCollection.ObjectEvents objectEvents = DNManager.getInstance().DNObjectEventsCollection.getObjectEvents(control);

            Debug.Assert(objectEvents != null);

            if (!String.IsNullOrEmpty(objectEvents.DNControlValueChangedEventName))
            {
                AddDNControlValueChangedHandler(control, objectEvents.DNControlValueChangedEventName);
            }
        }
コード例 #6
0
        /// <summary>
        ///   update the result into expression DNObjectsCollection Entry and modifies Expval to contain the blob prefix
        /// </summary>
        /// <param name = "expVal"></param>
        private void ConvertExpValForDotNet(ExpressionEvaluator.ExpVal expVal)
        {
            if (expVal.Attr == StorageAttribute.DOTNET)
            {
                // update the value at DNObjectsCollection Key. This is updated into Expression DNObjectsCollection key, so no need to Cast.
                DNManager.getInstance().DNObjectsCollection.Update(_dnObjectCollectionKey, expVal.DnMemberInfo.value);

                bool isNull = (expVal.DnMemberInfo.value == null);

                expVal.Nullify();
                expVal.Init(StorageAttribute.DOTNET, isNull, BlobType.createDotNetBlobPrefix(_dnObjectCollectionKey));
            }
        }
コード例 #7
0
        /// <summary>
        ///   parse the expression XML tag
        /// </summary>
        /// <param name = "tokensVector">the vector of attributes and their values
        /// </param>
        // TODO: NEW JDK - tokensVector - use ArrayList instead of Vector
        private void initElements(List <String> tokensVector)
        {
            String expStr;
            String attribute, valueStr;

            for (int j = 0;
                 j < tokensVector.Count;
                 j += 2)
            {
                attribute = (tokensVector[j]);
                valueStr  = (tokensVector[j + 1]);

                switch (attribute)
                {
                case XMLConstants.MG_ATTR_VALUE:
                    //if we work in hex
                    if (ClientManager.Instance.getEnvironment().GetDebugLevel() > 1)
                    {
                        expStr = valueStr;
                        buildByteArray(expStr);
                    }
                    else
                    {
                        _expBytes = Misc.ToSByteArray(Base64.decodeToByte(valueStr));
                    }
                    break;

                case XMLConstants.MG_ATTR_ID:
                    _id = XmlParser.getInt(valueStr);
                    break;

                case ConstInterface.MG_ATTR_COMPUTE_BY:
                    _computeBy = valueStr[0];
                    break;

                default:
                    Logger.Instance.WriteExceptionToLog(
                        "There is no such tag in Expression.initElements class. Insert case to Expression.initElements for " +
                        attribute);
                    break;
                }
            }
            if (!computedByClient())
            {
                _cmdsToServer = _task.getMGData().CmdsToServer;
            }

            // add an entry into DNObjectsCollection and store the key reference in �DNObjectsCollectionKey�E
            _dnObjectCollectionKey = DNManager.getInstance().DNObjectsCollection.CreateEntry(null);
        }
コード例 #8
0
        /// <summary>
        /// This will be invoked on Column value change.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void ColumnChangedHandler(object sender, DataColumnChangeEventArgs e)
        {
            //Save updated value ( e.ProposedValue) in DNObjectsCollection
            DNObjectsCollection dnObjectsCollection = DNManager.getInstance().DNObjectsCollection;
            Type type  = (e.ProposedValue != null) ? e.ProposedValue.GetType() : typeof(DBNull);
            int  dnKey = dnObjectsCollection.CreateEntry(type);

            dnObjectsCollection.Update(dnKey, e.ProposedValue);

            //invoke event which will update variable at core and will cause recompute & variable change handler
            int columnID = e.Column.Ordinal;

            Events.OnDVControlColumnValueChangedEvent(sender, columnID, dnKey);
        }
コード例 #9
0
ファイル: DotNetHandler.cs プロジェクト: rinavin/RCJS
        /// <summary>
        /// This function handles DN control value changed event.
        /// </summary>
        /// <param name="objectHashCode">object hash code.</param>
        public static void HandleDNControlValueChanged(int objectHashCode)
        {
            Object invokedObject = DNManager.getInstance().DNObjectEventsCollection.getObject(objectHashCode);

            // Get the gui control from the control's map.
            if (invokedObject is Control && ((Control)invokedObject).Tag != null)
            {
                ControlsMap controlsMap = ControlsMap.getInstance();
                MapData     mapData     = controlsMap.getControlMapData((Control)invokedObject);
                if (mapData != null)
                {
                    //Raise the event.
                    Events.OnDNControlValueChanged(mapData.getControl(), mapData.getIdx());
                }
            }
        }
コード例 #10
0
        /// <summary>
        ///   set dot net parameters as arguments for the event
        /// </summary>
        /// <param name = "parameters"></param>
        internal void setDotNetArgs(object[] parameters)
        {
            ExpressionEvaluator.ExpVal[] argsList = new ExpressionEvaluator.ExpVal[parameters.Length];
            for (int i = 0; i < parameters.Length; i++)
            {
                int    key        = DNManager.getInstance().DNObjectsCollection.CreateEntry(null);
                String blobString = BlobType.createDotNetBlobPrefix(key);
                DNManager.getInstance().DNObjectsCollection.Update(key, parameters[i]);
                argsList[i] = new ExpressionEvaluator.ExpVal(StorageAttribute.DOTNET,
                                                             parameters[i] == null, blobString);
            }
            //create the string for the blob
            ArgumentsList args = new ArgumentsList(argsList);

            setArgList(args);
        }
コード例 #11
0
ファイル: DotNetHandler.cs プロジェクト: rinavin/RCJS
        /// <summary> adds events for control</summary>
        /// <param name="control"></param>
        /// <param name="dnEventsNames">comma-delimited string of events that should be raised for the object</param>
        internal void addHandler(Control control, List <String> dnEventsNames)
        {
            DNObjectEventsCollection.ObjectEvents objectEvents = DNManager.getInstance().DNObjectEventsCollection.checkAndCreateObjectEvents(control);

            foreach (string item in dnEventsNames)
            {
                ReflectionServices.addHandler(item, control, objectEvents, true);
            }

            ICollection <String> standartEvents = DNControlEvents.getStandardEventsNames();

            foreach (string item in standartEvents)
            {
                if (!dnEventsNames.Contains(item))
                {
                    ReflectionServices.addHandler(item, control, objectEvents, false);
                }
            }
        }
コード例 #12
0
        /// <summary>
        ///   serialize an item (field/global param/...) to an XML format (applicable to be passed to the server).
        /// </summary>
        /// <param name = "itemVal">item's value</param>
        /// <param name = "itemAttr">item's attribute</param>
        /// <param name = "cellAttr">cell's attribute - relevant only if 'itemAttr' is vector</param>
        /// <param name = "toBase64">decide Base64 encoding is to be done</param>
        /// <returns>serialized buffer</returns>
        public static String serializeItemVal(String itemVal, StorageAttribute itemAttr, StorageAttribute cellAttr, bool toBase64)
        {
            Debug.Assert(itemVal != null);

            int significantNumSize = Manager.Environment.GetSignificantNumSize() * 2;

            String valueSize;
            int    j;
            var    tmpBuf = new StringBuilder();

            // for alpha type add the length of the value as hex number of 4 digits
            switch (itemAttr)
            {
            case StorageAttribute.NUMERIC:
            case StorageAttribute.DATE:
            case StorageAttribute.TIME:
                itemVal = !toBase64
                            ? itemVal.Substring(0, significantNumSize)
                            : Base64.encode(byteStreamToString(itemVal.Substring(0, significantNumSize)), Manager.Environment.GetEncoding());

                break;

            case StorageAttribute.ALPHA:
            case StorageAttribute.UNICODE:
                itemVal = StrUtil.rtrim(itemVal);
                int pos       = 0;
                int fldValLen = itemVal.Length;

                do
                {
                    int nullChrPos = itemVal.IndexOf((Char)0, pos);
                    if (nullChrPos == -1)
                    {
                        valueSize = (Convert.ToString(fldValLen - pos, 16)).ToUpper();
                        // add leading zeros (if needed)
                        for (j = 0; j < 4 - valueSize.Length; j++)
                        {
                            tmpBuf.Append('0');
                        }
                        tmpBuf.Append(valueSize);

                        if (pos > 0)
                        {
                            itemVal = itemVal.Substring(pos, (fldValLen) - (pos));
                        }

                        pos = fldValLen;
                    }
                    else
                    {
                        // If NULL chars exist in the middle of the value - create a spanned record
                        // Turn on the high most bit in the length (to indicate a segment)
                        valueSize = (Convert.ToString(nullChrPos - pos + 0x8000, 16)).ToUpper();
                        tmpBuf.Append(valueSize);
                        tmpBuf.Append(itemVal.Substring(pos, (nullChrPos) - (pos)));

                        // Count number of consecutive NULL chars, and add their count to XML
                        for (j = 1; j < fldValLen - nullChrPos && itemVal[nullChrPos + j] == 0; j++)
                        {
                        }
                        // add leading zeros (if needed)
                        valueSize = "0000" + (Convert.ToString(j, 16)).ToUpper();
                        tmpBuf.Append(valueSize.Substring(valueSize.Length - 4));

                        // Append a hex dump of special chars
                        for (pos = nullChrPos; j > 0; j--, pos++)
                        {
                            string tmpStr = "0" + (Convert.ToString(itemVal[nullChrPos], 16));
                            tmpBuf.Append(tmpStr.Substring(tmpStr.Length - 2));
                        }

                        // If special chars were last, add the length of the last segment (zero)
                        if (pos >= fldValLen)
                        {
                            tmpBuf.Append("0000");
                            itemVal = "";
                            break;
                        }
                    }
                } while (pos < fldValLen);
                break;


            case StorageAttribute.BLOB:
            case StorageAttribute.BLOB_VECTOR:
            case StorageAttribute.DOTNET:
                pos = 0;

                // convert dotnet object into magic equivalent and append as data into blob suffix.
                if (itemAttr == StorageAttribute.DOTNET)
                {
                    Object itmObj      = null;
                    int    key         = BlobType.getKey(itemVal);
                    String itmMagicVal = "";

                    if (key != 0)
                    {
                        itmObj = DNManager.getInstance().DNObjectsCollection.GetDNObj(key);
                    }

                    // convert dotnet object into magic type
                    if (itmObj != null)
                    {
                        StorageAttribute magicType = DNConvert.getDefaultMagicTypeForDotNetType(itmObj.GetType());
                        itmMagicVal = DNConvert.convertDotNetToMagic(itmObj, magicType);

                        // append to dotnet blob as data
                        if (itmMagicVal.Length > 0)
                        {
                            itemVal = BlobType.addDataToDotNetBlob(itemVal, itmMagicVal, magicType);
                        }
                    }
                }

                fldValLen = itemVal.Length;

                if (UtilStrByteMode.isLocaleDefLangDBCS() && itemAttr == StorageAttribute.BLOB_VECTOR)
                {
                    if (cellAttr == StorageAttribute.ALPHA || cellAttr == StorageAttribute.MEMO)
                    {
                        itemVal = VectorType.adjustAlphaStringsInFlatData(itemVal);

                        // The flat data will be divided by 0x3FFF characters.
                        // Each segment will be size in 0x3FFF ~ 0x7FFF bytes.
                        // The size depends on the number of DBCS characters, not fixed in 0x7FFF.
                        do
                        {
                            if (itemVal.Length < pos + 0x3FFF)
                            //(0x8000 - 1) / 2 = 0x3FFF
                            {
                                if (pos > 0)
                                {
                                    itemVal = itemVal.Substring(pos);
                                }

                                valueSize = (Convert.ToString(UtilStrByteMode.lenB(itemVal), 16)).ToUpper();
                                // add leading zeros (if needed)
                                for (j = 0; j < 4 - valueSize.Length; j++)
                                {
                                    tmpBuf.Append('0');
                                }
                                tmpBuf.Append(valueSize);

                                //hex encoding
                                itemVal = !toBase64
                                        ? StrUtil.stringToHexaDump(itemVal, 4)
                                        : Base64.encode(itemVal, true, Manager.Environment.GetEncoding());

                                pos = fldValLen;
                            }
                            else
                            {
                                String strSub = itemVal.Substring(pos, 0x3FFF);
                                // + 0x8000 ... to indicate not the last segment
                                valueSize = (Convert.ToString(UtilStrByteMode.lenB(strSub) + 0x8000, 16)).ToUpper();
                                tmpBuf.Append(valueSize);

                                //hex or base64 encoding
                                tmpBuf.Append(!toBase64
                                            ? StrUtil.stringToHexaDump(strSub, 4)
                                            : Base64.encode(strSub, true, Manager.Environment.GetEncoding()));

                                tmpBuf.Append("0000");
                                pos += 0x3FFF;
                            }
                        } while (pos < fldValLen);

                        break;
                    }
                }

                do
                {
                    if (fldValLen < pos + 0x7FFF)
                    //0x8000 -1 = 0x7FFF
                    {
                        valueSize = (Convert.ToString(fldValLen - pos, 16)).ToUpper();
                        // add leading zeros (if needed)
                        for (j = 0; j < 4 - valueSize.Length; j++)
                        {
                            tmpBuf.Append('0');
                        }
                        tmpBuf.Append(valueSize);

                        if (pos > 0)
                        {
                            itemVal = itemVal.Substring(pos, (fldValLen) - (pos));
                        }

                        //hex encoding
                        itemVal = !toBase64
                                  ? StrUtil.stringToHexaDump(itemVal, 4)
                                  : Base64.encode(itemVal, Manager.Environment.GetEncoding());

                        pos = fldValLen;
                    }
                    else
                    {
                        //to indicate the full segment
                        valueSize = "FFFF"; //(Integer.toHexString (0xFFFF)).toUpperCase()
                        tmpBuf.Append(valueSize);

                        //hex or base64 encoding
                        if (!toBase64)
                        {
                            tmpBuf.Append(StrUtil.stringToHexaDump(itemVal.Substring(pos, 0x7FFF), 4));
                        }
                        else
                        {
                            tmpBuf.Append(Base64.encode(itemVal.Substring(pos, 0x7FFF), Manager.Environment.GetEncoding()));
                        }

                        tmpBuf.Append("0000");
                        pos += 0x7FFF;
                    }
                } while (pos < fldValLen);

                break;
            } //end of the type case block

            tmpBuf.Append(itemVal);
            return(tmpBuf.ToString());
        }
コード例 #13
0
ファイル: ReflectionServices.cs プロジェクト: rinavin/RCJS
        /// <summary>
        //This function registers "HandleDNControlValueChanged" to the event
        //specified by the user for DN control property change.
        /// </summary>
        /// <param name="eventName">Event to be registered</param>
        /// <param name="obj">object on which, event will be registered</param>
        internal static void AddDNControlValueChangedHandler(object objectToHook, String eventName)
        {
            Control ctrl = (Control)objectToHook;

            DNObjectEventsCollection.ObjectEvents objectEvents = DNManager.getInstance().DNObjectEventsCollection.checkAndCreateObjectEvents(ctrl);

            //DNControlValueChangedDelegate and DNControlValueChangedEventName should be initialized only once. If initialized second time, assert.
            //Debug.Assert(objectEvents.DNControlValueChangedDelegate == null && objectEvents.DNControlValueChangedEventName == null);

            Type type = ctrl.GetType();

            //Get an EventInfo representing the  event, and get the type of delegate that handles the event.
            EventInfo eventInfo = type.GetEvent(eventName);

            if (eventInfo != null)
            {
                // Get the "add" accessor of the event and invoke it late-bound, passing in the delegate instance.
                // This is equivalent to using the += operator in C#, or AddHandler in Visual Basic.
                // The instance on which the "add" accessor is invoked is the form;
                // the arguments must be passed as an array.
                MethodInfo addHandler = eventInfo.GetAddMethod();

                Delegate eventHandler = null;

                try
                {
                    if (objectEvents.DNControlValueChangedDelegate != null)
                    {
                        Debug.Assert(objectEvents.DNControlValueChangedEventName == eventName);
                        eventHandler = objectEvents.DNControlValueChangedDelegate;
                    }
                    else
                    {
                        eventHandler = createDynamicDelegateForDNCtrlValueChangedEvent(ctrl.GetHashCode(), eventInfo);

                        //Add delegate(event handler) to object events.
                        objectEvents.DNControlValueChangedDelegate = eventHandler;
                        //Add event name to object events.
                        objectEvents.DNControlValueChangedEventName = eventName;
                    }

                    try
                    {
                        addHandler.Invoke(objectToHook, new Object[] { eventHandler });
                    }
                    catch (Exception e)
                    {
                        if (e is TargetInvocationException && e.InnerException != null)
                        {
                            throw e.InnerException;
                        }
                        else
                        {
                            throw e;
                        }
                    }
                }
                catch (Exception exception)
                {
                    DNException dnException = Manager.GetCurrentRuntimeContext().DNException;
                    dnException.set(exception);
                }
            }
            else
            {
                Events.WriteExceptionToLog(String.Format("Event type \"{0}\" not supported", eventName));
            }
        }
コード例 #14
0
ファイル: Argument.cs プロジェクト: rinavin/RCJS
        /// <summary>
        /// converts Alpha/Unicode values to Blob and vice versa.
        /// </summary>
        /// <param name="value"></param>
        /// <param name="srcAttr"></param>
        /// <param name="expectedType"></param>
        /// <returns></returns>
        internal static String convertArgs(String value, StorageAttribute srcAttr, StorageAttribute expectedType)
        {
            int    key;
            object dotNetObj  = null;
            bool   invalidArg = false;

            if (srcAttr != StorageAttribute.DOTNET &&
                expectedType == StorageAttribute.DOTNET)
            {
                //Convert Magic To DotNet
                key       = _tempTableKey;
                dotNetObj = DNConvert.convertMagicToDotNet(value, srcAttr,
                                                           DNConvert.getDefaultDotNetTypeForMagicType(value, srcAttr));

                DNManager.getInstance().DNObjectsCollection.Update(key, dotNetObj);
                value = BlobType.createDotNetBlobPrefix(key);
            }
            else if (srcAttr == StorageAttribute.DOTNET &&
                     expectedType != StorageAttribute.DOTNET &&
                     expectedType != StorageAttribute.NONE)
            {
                //Convert DotNet to Magic
                key = BlobType.getKey(value);

                if (key != 0)
                {
                    dotNetObj = DNManager.getInstance().DNObjectsCollection.GetDNObj(key);
                    value     = DNConvert.convertDotNetToMagic(dotNetObj, expectedType);
                }
            }
            else
            {
                switch (expectedType)
                {
                case StorageAttribute.ALPHA:
                case StorageAttribute.UNICODE:
                    if (srcAttr == StorageAttribute.BLOB)
                    {
                        if (BlobType.isValidBlob(value))
                        {
                            value = BlobType.getString(value);
                        }
                    }
                    else if (!StorageAttributeCheck.IsTypeAlphaOrUnicode(srcAttr))
                    {
                        invalidArg = true;
                    }
                    break;

                case StorageAttribute.NUMERIC:
                case StorageAttribute.DATE:
                case StorageAttribute.TIME:
                    if (!StorageAttributeCheck.isTypeNumeric(srcAttr))
                    {
                        invalidArg = true;
                    }
                    break;

                case StorageAttribute.BLOB:
                    if (StorageAttributeCheck.IsTypeAlphaOrUnicode(srcAttr))
                    {
                        char contentType = srcAttr == StorageAttribute.ALPHA
                                           ? BlobType.CONTENT_TYPE_ANSI
                                           : BlobType.CONTENT_TYPE_UNICODE;
                        value = BlobType.createFromString(value, contentType);
                    }
                    else if (!StorageAttributeCheck.isTypeBlob(srcAttr))
                    {
                        invalidArg = true;
                    }
                    break;
                }

                //If there is mismatch in attribute, take default value of expectd argument.
                if (invalidArg)
                {
                    value = FieldDef.getMagicDefaultValue(expectedType);
                }
            }

            return(value);
        }