Exemplo n.º 1
0
        /// <summary>
        /// Reads the Xml of a logical OR.
        /// </summary>
        /// <param name="reader">An XmlReader for a logical OR.</param>
        public override void ReadXml(XmlReader reader)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }

            reader.MoveToRequiredStartElement(AuthorizationConstants.Elements.LogicalOr);

            string evaluates = reader.GetOptionalAttribute(AuthorizationConstants.Attributes.Evaluates);
            string termId    = reader.GetOptionalAttribute(AuthorizationConstants.Attributes.TermId);

            if (!string.IsNullOrEmpty(termId))
            {
                this.TermId = new Uri(termId);
            }

            if (!string.IsNullOrEmpty(evaluates))
            {
                this.Evaluates = XmlConvert.ToBoolean(evaluates);
            }

            while (reader.Read())
            {
                if (reader.IsRequiredStartElement(AuthorizationConstants.Elements.LogicalAnd))
                {
                    this.Add(LogicalAndCollection.Load(reader));
                }

                if (reader.IsRequiredStartElement(AuthorizationConstants.Elements.LogicalOr))
                {
                    this.Add(LogicalOrCollection.Load(reader));
                }

                if (reader.IsRequiredStartElement(AuthorizationConstants.Elements.Rule))
                {
                    this.Add(Rule.Load(reader));
                }

                if (reader.IsRequiredEndElement(AuthorizationConstants.Elements.LogicalOr))
                {
                    return;
                    //break;
                }
            }

            reader.Read();
        }
Exemplo n.º 2
0
        public static new LogicalConnectiveCollection Load(XmlReader reader)
        {
            LogicalAndCollection lac = new LogicalAndCollection();

            lac.ReadXml(reader);

            return(lac);

            //Adds an object to the end of the Capl.Authorization.LogicalAndCollection
            //Removes all element from the Capl.Authorization.LogicalAndCollection
            //Determines whether an element in the Capl.Authorization.LogicalAndCollection
            //Copies the entire Capl.Authorization.LogicalAndCollection to a compatible one-dimensional array System.Array, starting at the specified index of the target array.
            //Gets the number of element actually contained in the Capl.Authorization.LogicalAndCollection
            //Returns an enumerator that iterates through the Capl.Authorization.LogicalAndCollection
            // Inserts an elmenent into the Capl.Authorization.LogicalAndCollection at the specified location.
            //Remmoves the first occurrence of a specifed object from the Capl.Authorization.LogicalAndCollection
            //Removes the element at a specified index from the Capl.Authorization.LogicalAndCollection
        }
Exemplo n.º 3
0
        public static Term Load(XmlReader reader)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }

            Term evalExp = null;

            reader.MoveToStartElement();

            if (reader.IsRequiredStartElement(AuthorizationConstants.Elements.Rule))
            {
                Rule rule = new Rule();
                rule.ReadXml(reader);
                evalExp = rule;
            }

            if (reader.IsRequiredStartElement(AuthorizationConstants.Elements.LogicalAnd))
            {
                LogicalAndCollection logicalAnd = new LogicalAndCollection();
                logicalAnd.ReadXml(reader);
                evalExp = logicalAnd;
            }


            if (reader.IsRequiredStartElement(AuthorizationConstants.Elements.LogicalOr))
            {
                LogicalOrCollection logicalOr = new LogicalOrCollection();
                logicalOr.ReadXml(reader);
                evalExp = logicalOr;
            }

            if (evalExp != null)
            {
                return(evalExp);
            }
            else
            {
                throw new SerializationException("Invalid evaluation expression element.");
            }
        }