Beispiel #1
0
 /// <summary>
 /// Constructs a SifException for delivery to the ZIS
 /// </summary>
 /// <param name="category">A <c>SifErrorCategoryCode.</c> error category</param>
 /// <param name="code">A <c>SifErrorCodes</c> error code</param>
 /// <param name="desc">The error description</param>
 /// <param name="extDesc">An option extended error description</param>
 /// <param name="zone">The zone on which the error occurred</param>
 /// <remarks>
 ///  The Adk will include
 /// the error information provided by the exception when it sends a SIF_Ack
 /// in response to the message being processed. This form of constructor is
 /// typically called by the Adk, but may also be called by agent code if an
 /// exception occurs in a <c>IPublisher</c>, <c>ISubscriber</c>, or <c>IQueryResults</c>
 /// message handler implementation.
 /// </remarks>
 public SifException(
     SifErrorCategoryCode category,
     int code,
     string desc,
     string extDesc,
     IZone zone)
     : base(desc, zone)
 {
     fAck   = null;
     fError = new SIF_Error
              (
         (int)category,
         code,
         desc == null ? "" : desc);
     if (extDesc != null)
     {
         fError.SIF_ExtendedDesc = extDesc;
     }
 }
 /// <summary>  Create an error SIF_Ack for this message.</summary>
 /// <param name="category">The value of the SIF_Error/SIF_Category element
 /// </param>
 /// <param name="code">The value of the SIF_Error/SIF_Code element
 /// </param>
 /// <param name="desc">The value of the SIF_Error/SIF_Desc element
 /// </param>
 /// <returns> A new SIF_Ack instance with a SIF_Error element and SIF_Ack
 /// header values derived from this message's header values
 /// </returns>
 public virtual SIF_Ack AckError(SifErrorCategoryCode category,
                                 int code,
                                 string desc)
 {
     return(AckError(category, code, desc, null));
 }
        /// <summary>  Create an error SIF_Ack for this message.</summary>
        /// <param name="category">The value of the SIF_Error/SIF_Category element
        /// </param>
        /// <param name="code">The value of the SIF_Error/SIF_Code element
        /// </param>
        /// <param name="desc">The value of the SIF_Error/SIF_Desc element
        /// </param>
        /// <param name="extDesc">The value of the SIF_Error/SIF_ExtendedDesc element
        /// </param>
        /// <returns> A new SIF_Ack instance with a SIF_Error element and SIF_Ack
        /// header values derived from this message's header values
        /// </returns>
        public virtual SIF_Ack AckError(SifErrorCategoryCode category,
                                         int code,
                                         string desc,
                                         string extDesc)
        {
            SIF_Ack ack = new SIF_Ack();
            ack.SIF_OriginalMsgId = this.MsgId;
            ack.SIF_OriginalSourceId = this.SourceId;
            SIF_Error error = new SIF_Error
                (
                (int)category,
                code,
                desc ?? "");

            if (extDesc != null)
            {
                error.SIF_ExtendedDesc = extDesc;
            }
            ack.SIF_Error = error;

            //  Ack using the same version of SIF as this message
            ack.SifVersion = SifVersion;

            return ack;
        }
 /// <summary>  Create an error SIF_Ack for this message.</summary>
 /// <param name="category">The value of the SIF_Error/SIF_Category element
 /// </param>
 /// <param name="code">The value of the SIF_Error/SIF_Code element
 /// </param>
 /// <param name="desc">The value of the SIF_Error/SIF_Desc element
 /// </param>
 /// <returns> A new SIF_Ack instance with a SIF_Error element and SIF_Ack
 /// header values derived from this message's header values
 /// </returns>
 public virtual SIF_Ack AckError(SifErrorCategoryCode category,
                                  int code,
                                  string desc)
 {
     return AckError(category, code, desc, null);
 }
        private bool _recurseError( AdkException parent,
                                    SifErrorCategoryCode category )
        {
            if ( parent.fChildren != null ) {
                Exception ch = null;

                for ( int i = 0; i < fChildren.Count; i++ ) {
                    ch = (Exception) fChildren[i];

                    if ( ch is SifException ) {
                        if ( ((SifException) ch).HasErrorCategory( category ) ) {
                            return true;
                        }
                    }
                    else if ( ch is AdkException ) {
                        if ( _recurseError( (AdkException) ch, category ) ) {
                            return true;
                        }
                    }
                }
            }

            return false;
        }
        /// <summary>  Determines if this exception contains at least one nested SifException
        /// with the specified error category and code.
        /// </summary>
        /// <param name="category">The error category to search for
        /// </param>
        /// <param name="code">The error code to search for
        /// </param>
        /// <returns> true if this exception has nested SIFExceptions and at least one
        /// of those has the specified error category and code
        /// </returns>
        public virtual bool HasSifError( SifErrorCategoryCode category,
                                         int code )
        {
            if ( this is SifException ) {
                return ((SifException) this).HasError( category, code );
            }

            return _recurseError( this, category, code );
        }
        /// <summary>  Determines if this SifException has an error with the specified category.
        /// In some versions of SIF, a SifException may describe more than
        /// one error. This method searches through all of the wrapped errors and
        /// returns <c>true</c> if any match the category.
        /// 
        /// </summary>
        /// <param name="category">The SIF error category to search for
        /// 
        /// </param>
        /// <returns> <c>true</c> if any errors wrapped by this exception match
        /// the category
        /// </returns>
        public virtual bool HasErrorCategory( SifErrorCategoryCode category )
        {
            if ( fError != null && fError.SIF_Category == (int) category ) {
                return true;
            }

            return false;
        }
        /// <summary>  Determines if this SifException has an error with the specified category
        /// and code. In some versions of SIF, a SifException may describe more than
        /// one error. This method searches through all of the wrapped errors and
        /// returns <c>true</c> if any match the category and code.
        /// 
        /// </summary>
        /// <param name="category">The SIF error category to search for
        /// </param>
        /// <param name="code">The SIF error code to search for
        /// 
        /// </param>
        /// <returns> <c>true</c> if any errors wrapped by this exception match
        /// the category and code
        /// </returns>
        public virtual bool HasError( SifErrorCategoryCode category,
                                      int code )
        {
            if ( fError != null ) {
                if ( fError.SIF_Category == (int) category && fError.SIF_Code == code ) {
                    return true;
                }
            }

            return false;
        }
 /// <summary>
 /// Constructs a SifException for delivery to the ZIS
 /// </summary>
 /// <param name="category">A <c>SifErrorCategoryCode.</c> error category</param>
 /// <param name="code">A <c>SifErrorCodes</c> error code</param>
 /// <param name="desc">The error description</param>
 /// <param name="extDesc">An option extended error description</param>
 /// <param name="zone">The zone on which the error occurred</param>
 /// <param name="innerException">The internal error that was thrown by the agent</param>
 /// <remarks>
 ///  The Adk will include
 /// the error information provided by the exception when it sends a SIF_Ack
 /// in response to the message being processed. This form of constructor is
 /// typically called by the Adk, but may also be called by agent code if an
 /// exception occurs in a <c>IPublisher</c>, <c>ISubscriber</c>, or <c>IQueryResults</c>
 /// message handler implementation.
 /// </remarks>
 public SifException( SifErrorCategoryCode category,
                      int code,
                      string desc,
                      string extDesc,
                      IZone zone,
                      Exception innerException )
     : base(desc, zone, innerException)
 {
     fAck = null;
     fError = new SIF_Error( (int) category, code, desc == null ? "" : desc );
     if ( extDesc != null ) {
         fError.SIF_ExtendedDesc = extDesc;
     }
 }
Beispiel #10
0
 /// <summary>  Constructs a SifException for delivery to the ZIS.</summary>
 /// <param name="category">A <c>SifErrorCategoryCode.</c> error category
 /// </param>
 /// <param name="code">A <c>SifErrorCodes</c> error code
 /// </param>
 /// <param name="desc">The error description
 /// </param>
 /// <param name="zone">The zone on which the error occurred
 /// </param>
 /// <param name="innerException">The exception that is being handled by the agent</param>
 /// <remarks> The Adk will include
 /// the error information provided by the exception when it sends a SIF_Ack
 /// in response to the message being processed. This form of constructor is
 /// typically called by the Adk, but may also be called by agent code if an
 /// exception occurs in a <i>Publisher</i>, <i>Subscriber</i>, or <i>QueryResults</i>
 /// message handler implementation.</remarks>
 public SifException( SifErrorCategoryCode category,
                      int code,
                      string desc,
                      IZone zone,
                      Exception innerException )
     : this(category, code, desc, null, zone, innerException)
 {
 }
Beispiel #11
0
 // BEGIN EXTRA METHODS (C:/dev/OpenADK-java/adk-generator/datadef/core/sif20/SIF_Error.txt.cs)
 public SIF_Error(SifErrorCategoryCode category, int sifCode, string sifDesc, string sifExtDesc)
     : this((int)category, sifCode, sifDesc)
 {
     this.SIF_ExtendedDesc = sifExtDesc;
 }
Beispiel #12
0
// BEGIN EXTRA METHODS (C:/GitHub/rafidzal/OpenADK-java/adk-generator/../adk-generator/datadef/core/sif20/SIF_Error.txt.cs)

        public SIF_Error(SifErrorCategoryCode category, int sifCode, string sifDesc, string sifExtDesc)
            : this((int)category, sifCode, sifDesc)
        {
            this.SIF_ExtendedDesc = sifExtDesc;
        }