Пример #1
0
        /// <summary>
        /// Creates a new OlapXmlResponse instance for a certain response document.
        /// Every response document will bec checked for a global error element
        /// immediately.
        /// </summary>
        /// <param name="response">Response document to be evaluated.</param>
        public OlapXmlResponse(string response)
        {
            _errors           = new List <string>();
            _document         = XDocument.Parse(response);
            _namespaceManager = new XmlNamespaceManager(new NameTable());
            _namespaceManager.AddNamespace("Alea", RequestBase.OlapNamespace.NamespaceName);
            XElement error = _document.XPathSelectElement("/Alea:Document/Alea:Request/Alea:Error", _namespaceManager);

            if (error != null)
            {
                string errorId = "unknown";
                if (error.Attribute(ErrorIdAttribute) != null)
                {
                    errorId = error.Attribute(ErrorIdAttribute).Value;
                    _errors.Add(errorId);
                }
                NativeOlapApi.LogError(LogEvent.ErrorInXmlResponse, "Olap server returned the following error: " + errorId);
            }
        }
Пример #2
0
        /// <summary>
        /// Checks for errors that are specific to the RenameDimensionElement request.
        /// </summary>
        /// <param name="dimension">Dimension to rename element for.</param>
        /// <param name="element">The element to be renamed.</param>
        /// <param name="newName">The element's new name.</param>
        /// <returns>True, if the response document contains any errors. False, otherwise.</returns>
        public bool CheckForErrorsInRenameDimensionElement(string dimension, string element, string newName)
        {
            bool     hasErrors    = false;
            XElement errorElement = _document.XPathSelectElement("/Alea:Document/Alea:Request/Alea:Return/Alea:Dimension/Alea:Error", _namespaceManager);

            if (errorElement != null)
            {
                hasErrors = true;
                string     errorID   = "unknown";
                XAttribute errorAttr = errorElement.Attribute("ErrorID");
                if (errorAttr.Value != null)
                {
                    errorID = errorAttr.Value;
                }
                // TODO 10.5: localize error messages
                string message = "The element " + element + " could not be renamed to '" + newName + "' in dimension " + dimension + ". The error code from the server was: " + errorID;
                NativeOlapApi.LogError(LogEvent.ErrorInXmlResponse, message);
            }
            return(hasErrors);
        }
Пример #3
0
        /// <summary>
        /// Checks for errors that are specific to the CreateDimensionElement request.
        /// </summary>
        /// <param name="dimension">Dimension to create element for.</param>
        /// <param name="element">The element to be created.</param>
        /// <returns>True, if the response document contains any errors. False, otherwise.</returns>
        public bool CheckForErrorsInCreateDimensionElement(string dimension, string element)
        {
            bool     hasErrors    = false;
            XElement errorElement = _document.XPathSelectElement("/Alea:Document/Alea:Request/Alea:Return/Alea:Dimension/Alea:Elements", _namespaceManager);

            if (errorElement != null)
            {
                string[] returnValues = errorElement.Value.Split('\t');
                string   olapError    = string.Empty;
                if (returnValues != null && returnValues.Length > 0)
                {
                    olapError = returnValues[0];
                    _errors.Add(olapError);
                    hasErrors = true;
                }
                // TODO 10.5: localize error messages
                string message = "The element " + element + " could not be created in dimension " + dimension + ". The error code from the server was: " + olapError;
                NativeOlapApi.LogError(LogEvent.ErrorInXmlResponse, message);
            }
            return(hasErrors);
        }
Пример #4
0
 private void AddError(LogEvent eventId, string message)
 {
     _errors.Add(message);
     NativeOlapApi.LogError(eventId, message);
 }