예제 #1
0
        /// <summary>
        /// Write a SIFDataObject to the output stream
        /// </summary>
        /// <param name="sdo"></param>
        public void Write(SifDataObject sdo)

        {
            _checkOpen();

            fOut.Write(sdo);
        }
예제 #2
0
        public virtual void Write(SifDataObject o)
        {
            SetSifVersion(o.SifVersion);

            if (o is SifDataObjectXml)
            {
                fWriter.WriteRaw(o.ToXml());
            }
            else
            {
                WriteElement(o);
            }
        }
예제 #3
0
 /// <summary>
 /// Evaluate the given the SIFDataObject against the conditions provided in the
 /// Query. All conditions are evaluated using the provided comparer
 /// </summary>
 /// <param name="obj"> The SIFDataObject to evalaute against this query</param>
 /// <param name="culture">The culture info used to do string comparisons</param>
 /// <returns></returns>
 /// <exception cref="OpenADK.Library.AdkSchemaException">If the condition contains references to invalid elements</exception>
 public bool Evaluate(SifDataObject obj,
                      CultureInfo culture)
 {
     if (!(obj.ElementDef == fObjType))
     {
         return(false);
     }
     if (fRoot != null)
     {
         SifXPathContext context = SifXPathContext.NewSIFContext(obj, EffectiveVersion);
         return(EvaluateConditionGroup(context, fRoot, culture));
     }
     return(true);
 }
예제 #4
0
        /// <summary>
        /// If SIFElement restrictions are placed on this query, this method
        /// will take the SIFDataObject and call setChanged(false). It will then
        /// go through each of the SIFElement restrictions, resolve them, and
        /// call setChanged(true) on those elements only. This will cause the
        /// object to be rendered properly using SIFWriter.
        /// </summary>
        /// <param name="sdo"></param>
        public void SetRenderingRestrictionsTo(SifDataObject sdo)
        {
            if (sdo == null || fFieldRestrictions == null)
            {
                return;
            }

            sdo.SetChanged(false);

            // Go through and only set the filtered items to true
            SifXPathContext context = SifXPathContext.NewSIFContext(sdo);

            foreach (ElementRef elementRef in fFieldRestrictions)
            {
                String  xPath = elementRef.XPath;
                Element e     = context.GetElementOrAttribute(xPath);
                if (e != null)
                {
                    e.SetChanged();
                }
            }
            sdo.EnsureRootElementRendered();
        }
예제 #5
0
 /// <summary>
 /// Evaluate the given the SIFDataObject against the conditions provided in the
 /// Query. All conditions are evaluated using standard string comparisons using
 /// the Invariant Culture
 /// </summary>
 /// <param name="obj"></param>
 /// <returns></returns>
 /// <exception cref="OpenADK.Library.AdkSchemaException">If the condition contains references to invalid elements</exception>
 public bool Evaluate(SifDataObject obj)
 {
     return(Evaluate(obj, CultureInfo.InvariantCulture));
 }
예제 #6
0
        /// <summary>  Constructs an Event object to encapsulate
        /// an outbound SIF Event, which describes
        /// one or more SifDataObjects that have been added, changed,
        /// or deleted by the local application. This form of the constructor is called
        /// by agents when reporting a SIF_Event message to a zone
        /// </summary>
        /// <param name="data">An array of SIFDataObjects, all of which must be of the same class
        /// </param>
        /// <param name="action">Describes how the data has changed: in SIF, this string
        /// must be "Add", "Change", or "Delete"
        /// </param>
        /// <remarks>
        /// <seealso cref="OpenADK.Library.IZone.ReportEvent"/>
        /// </remarks>
        public Event(SifDataObject[] data,
                    string action)
        {
            try
             {
            fData = DataObjectInputStreamImpl.newInstance();
            if (data != null)
            {
               ((DataObjectInputStreamImpl)fData).Data = data;
            }
             }
             catch (AdkException adke)
             {
            throw new SystemException(adke.ToString());
             }

             fObjType = data != null && data.Length > 0 && data[0] != null
                        ? data[0].ElementDef
                        : null;

             SetAction(action);
        }
예제 #7
0
 /// <summary>Detach a SifMessagePayload from this EventObject.<p></summary>
 public virtual void Detach( SifDataObject payload )
 {
     RemoveChild( payload );
 }
예제 #8
0
 private void Track(SifDataObject o)
 {
     try
     {
         if (fRefIdTracker.Contains(o.RefId))
         {
             using (
                 Stream outStream =
                     File.OpenWrite
                         ("Duplicate " + o.RefId + "-" + o.ElementDef.Name + "-" +
                           DateTime.Now.ToFileTime().ToString() + ".xml"))
             {
                 using (TextWriter wr = new StreamWriter(outStream))
                 {
                     wr.WriteLine
                         (String.Format("Duplicate Object with Refid: {0}", o.RefId));
                     wr.WriteLine
                         ("Original:" + ((SifDataObject)fRefIdTracker[o.RefId]).ToXml());
                     wr.WriteLine("New:" + o.ToXml());
                 }
             }
         }
         else
         {
             fRefIdTracker.Add(o.RefId, o);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         Adk.Log.Warn(ex.Message, ex);
     }
 }
예제 #9
0
 // BEGIN EXTRA METHODS (C:/GitHub/rafidzal/OpenADK-java/adk-generator/../adk-generator/datadef/core/sif20/SIF_EventObject.txt.cs)
 /// <summary>Attach a SifMessagePayload to this EventObject.<p></summary>
 public virtual void Attach( SifDataObject payload )
 {
     AddChild( payload );
 }
예제 #10
0
        public virtual void Write( SifDataObject o )
        {
            SetSifVersion( o.SifVersion );

            if ( o is SifDataObjectXml )
            {
                fWriter.WriteRaw( o.ToXml() );
            }
            else
            {
                WriteElement( o );
            }
        }
예제 #11
0
        /// <summary>
        /// Write a SIFDataObject to the output stream
        /// </summary>
        /// <param name="sdo"></param>
        public void Write( SifDataObject sdo )
        {
            _checkOpen();

            fOut.Write( sdo );
        }
예제 #12
0
        /// <summary>
        /// If SIFElement restrictions are placed on this query, this method
        /// will take the SIFDataObject and call setChanged(false). It will then 
        /// go through each of the SIFElement restrictions, resolve them, and 
        /// call setChanged(true) on those elements only. This will cause the
        /// object to be rendered properly using SIFWriter.
        /// </summary>
        /// <param name="sdo"></param>
        public void SetRenderingRestrictionsTo(SifDataObject sdo)
        {
            if (sdo == null || fFieldRestrictions == null)
            {
                return;
            }

            sdo.SetChanged(false);

            // Go through and only set the filtered items to true
            SifXPathContext context = SifXPathContext.NewSIFContext(sdo);
            foreach (ElementRef elementRef in fFieldRestrictions)
            {
                String xPath = elementRef.XPath;
                Element e = context.GetElementOrAttribute(xPath);
                if (e != null)
                {
                    e.SetChanged();
                }
            }
            sdo.EnsureRootElementRendered();
        }
예제 #13
0
 /// <summary>
 /// Evaluate the given the SIFDataObject against the conditions provided in the
 /// Query. All conditions are evaluated using the provided comparer
 /// </summary>
 /// <param name="obj"> The SIFDataObject to evalaute against this query</param>
 /// <param name="culture">The culture info used to do string comparisons</param>
 /// <returns></returns>
 /// <exception cref="OpenADK.Library.AdkSchemaException">If the condition contains references to invalid elements</exception>
 public bool Evaluate(SifDataObject obj,
                       CultureInfo culture)
 {
     if (!(obj.ElementDef == fObjType))
     {
         return false;
     }
     if (fRoot != null)
     {
         SifXPathContext context = SifXPathContext.NewSIFContext(obj, EffectiveVersion);
         return EvaluateConditionGroup(context, fRoot, culture);
     }
     return true;
 }
예제 #14
0
 /// <summary>
 /// Evaluate the given the SIFDataObject against the conditions provided in the
 /// Query. All conditions are evaluated using standard string comparisons using
 /// the Invariant Culture
 /// </summary>
 /// <param name="obj"></param>
 /// <returns></returns>
 /// <exception cref="OpenADK.Library.AdkSchemaException">If the condition contains references to invalid elements</exception>
 public bool Evaluate(SifDataObject obj)
 {
     return Evaluate(obj, CultureInfo.InvariantCulture);
 }