예제 #1
0
        /// <summary>
        /// Sends a GetPartsMetadataResponse message to a customer.
        /// </summary>
        /// <param name="correlatedHeader">The message header that the messages to send are correlated with.</param>
        /// <param name="metadata">The parts metadata.</param>
        /// <param name="isFinalPart">Whether or not this is the final part of a multi-part message.</param>
        /// <param name="extension">The message header extension.</param>
        /// <returns>The sent message on success; <c>null</c> otherwise.</returns>
        public virtual EtpMessage <GetPartsMetadataResponse> GetPartsMetadataResponse(IMessageHeader correlatedHeader, IDictionary <string, PartsMetadataInfo> metadata, bool isFinalPart = true, IMessageHeaderExtension extension = null)
        {
            var body = new GetPartsMetadataResponse
            {
                Metadata = metadata ?? new Dictionary <string, PartsMetadataInfo>(),
            };

            return(SendResponse(body, correlatedHeader, extension: extension, isMultiPart: true, isFinalPart: isFinalPart));
        }
        /// <summary>
        /// Handles the GetPartsMetadataResponse message from a store.
        /// </summary>
        /// <param name="header">The message header.</param>
        /// <param name="message">The GetPartsMetadataResponse message.</param>
        protected virtual void HandleGetPartsMetadataResponse(IMessageHeader header, GetPartsMetadataResponse message)
        {
            foreach (var metadata in message.Metadata)
            {
                Metadata.Add(metadata);
            }

            foreach (var error in message.Errors)
            {
                Errors.Add(error);
            }

            Notify(OnGetPartsMetadataResponse, header, message);
        }
예제 #3
0
        /// <summary>
        /// Sends the metadata describing the list items in the requested growing objects.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <param name="metadata">The parts metadata.</param>
        /// <param name="errors">The errors.</param>
        /// <returns>The message identifier.</returns>
        public long GetPartsMetadataResponse(IMessageHeader request, IList <PartsMetadataInfo> metadata, IList <ErrorInfo> errors)
        {
            var header = CreateMessageHeader(Protocols.GrowingObject, MessageTypes.GrowingObject.GetPartsMetadataResponse, request.MessageId);

            if (metadata != null)
            {
                foreach (var info in metadata)
                {
                    if (info.CustomData == null)
                    {
                        info.CustomData = new Dictionary <string, DataValue>();
                    }
                }
            }

            var message = new GetPartsMetadataResponse
            {
                Metadata = metadata ?? new List <PartsMetadataInfo>(),
                Errors   = errors ?? new List <ErrorInfo>()
            };

            return(Session.SendMessage(header, message));
        }