Beispiel #1
0
        public static void Validate(Message message, DataDictionary sessionDataDict, DataDictionary appDataDict, string beginString, string msgType)
        {
            bool bodyOnly = (null == sessionDataDict);

            if ((null != sessionDataDict) && (null != sessionDataDict.Version))
            {
                if (!sessionDataDict.Version.Equals(beginString))
                {
                    throw new UnsupportedVersion(beginString);
                }
            }

            if (((null != sessionDataDict) && sessionDataDict.CheckFieldsOutOfOrder) || ((null != appDataDict) && appDataDict.CheckFieldsOutOfOrder))
            {
                int field;
                if (!message.HasValidStructure(out field))
                {
                    throw new TagOutOfOrder(field);
                }
            }

            if ((null != appDataDict) && (null != appDataDict.Version))
            {
                appDataDict.CheckMsgType(msgType);
                appDataDict.CheckHasRequired(message, msgType);
            }

            if (!bodyOnly)
            {
                sessionDataDict.Iterate(message.Header, msgType);
                sessionDataDict.Iterate(message.Trailer, msgType);
            }

            appDataDict.Iterate(message, msgType);
        }
Beispiel #2
0
        /// <summary>
        /// Overloaded Validate() method written specifically for Iress' LSEHub to enable/disable validation for Header, Body and Trailer components independently.
        /// A.Chisholm - 25/05/2017
        /// </summary>
        /// <param name="message"></param>
        /// <param name="beginString"></param>
        /// <param name="msgType"></param>
        /// <param name="validateBody"></param>
        /// <param name="validateHeader"></param>
        /// <param name="validateTrailer"></param>
        public void Validate(Message message, string beginString, string msgType, bool validateBody, bool validateHeader, bool validateTrailer)
        {
            DataDictionary sessionDataDict = this;

            if ((null != sessionDataDict) && (null != sessionDataDict.Version))
            {
                if (!sessionDataDict.Version.Equals(beginString))
                {
                    throw new UnsupportedVersion();
                }
            }

            if (null != sessionDataDict && sessionDataDict.CheckFieldsOutOfOrder)
            {
                int field;
                if (!message.HasValidStructure(out field))
                {
                    throw new TagOutOfOrder(field);
                }
            }

            if ((null != sessionDataDict) && (null != sessionDataDict.Version))
            {
                sessionDataDict.CheckMsgType(msgType);
                sessionDataDict.CheckHasRequired(message, msgType, validateHeader, validateBody, validateTrailer);
            }

            if (validateBody)
            {
                sessionDataDict.Iterate(message, msgType);
            }

            if (validateHeader)
            {
                sessionDataDict.Iterate(message.Header, msgType);
            }

            if (validateTrailer)
            {
                sessionDataDict.Iterate(message.Trailer, msgType);
            }
        }
        public static void Validate(Message message, DataDictionary sessionDataDict, DataDictionary appDataDict, string beginString, string msgType)
        {
            bool bodyOnly = (null == sessionDataDict);

            if ((null != sessionDataDict) && (null != sessionDataDict.Version))
                if (!sessionDataDict.Version.Equals(beginString))
                    throw new UnsupportedVersion();

            if (((null != sessionDataDict) && sessionDataDict.CheckFieldsOutOfOrder) || ((null != appDataDict) && appDataDict.CheckFieldsOutOfOrder))
            {
                int field;
                if (!message.HasValidStructure(out field))
                    throw new TagOutOfOrder(field);
            }

            if ((null != appDataDict) && (null != appDataDict.Version))
            {
                appDataDict.CheckMsgType(msgType);
                appDataDict.CheckHasRequired(message, msgType);
            }

            if (!bodyOnly)
            {
                sessionDataDict.Iterate(message.Header, msgType);
                sessionDataDict.Iterate(message.Trailer, msgType);
            }

            appDataDict.Iterate(message, msgType);
        }