/// <summary> /// Gets the index of the given IExpression in the collection /// </summary> /// <param name="expression"></param> /// <returns></returns> public int GetIndex(inf.IExpression expression) { for (int i = 0; i < this.Count; i++) { if (this.List[i] == expression) { return(i); } } return(-1); }
/// <summary> /// Creates a new RuleCombinerParameter using the XmlReader instance provided. /// </summary> /// <param name="reader">The XmlReader instance positioned at the CombinerParameterElement node.</param> /// <param name="schemaVersion">The version of the schema that was used to validate.</param> public VariableDefinitionElement(XmlReader reader, XacmlVersion schemaVersion) : base(XacmlSchema.Policy, schemaVersion) { if (reader.LocalName == PolicySchema2.VariableDefinitionElement.VariableDefinition && ValidateSchema(reader, schemaVersion)) { // Read the attributes if (reader.HasAttributes) { // Load all the attributes while (reader.MoveToNextAttribute()) { if (reader.LocalName == PolicySchema2.VariableDefinitionElement.VariableId) { _id = reader.GetAttribute(PolicySchema2.VariableDefinitionElement.VariableId); } } reader.MoveToElement(); } // Read the rule contents. while (reader.Read()) { switch (reader.LocalName) { case PolicySchema1.AttributeSelectorElement.AttributeSelector: _expression = new AttributeSelectorElement(reader, schemaVersion); break; case PolicySchema1.SubjectAttributeDesignatorElement.SubjectAttributeDesignator: _expression = new SubjectAttributeDesignatorElement(reader, schemaVersion); break; case PolicySchema1.ActionAttributeDesignatorElement.ActionAttributeDesignator: _expression = new ActionAttributeDesignatorElement(reader, schemaVersion); break; case PolicySchema1.ResourceAttributeDesignatorElement.ResourceAttributeDesignator: _expression = new ResourceAttributeDesignatorElement(reader, schemaVersion); break; case PolicySchema1.EnvironmentAttributeDesignatorElement.EnvironmentAttributeDesignator: _expression = new EnvironmentAttributeDesignatorElement(reader, schemaVersion); break; case PolicySchema1.AttributeValueElement.AttributeValue: _expression = new AttributeValueElementReadWrite(reader, schemaVersion); break; case PolicySchema1.FunctionElement.Function: _expression = new FunctionElementReadWrite(reader, schemaVersion); break; case PolicySchema1.ApplyElement.Apply: _expression = new ApplyElement(reader, schemaVersion); break; case PolicySchema2.VariableReferenceElement.VariableReference: _expression = new VariableReferenceElement(reader, schemaVersion); break; } if (reader.LocalName == PolicySchema2.VariableDefinitionElement.VariableDefinition && reader.NodeType == XmlNodeType.EndElement) { break; } } } else { throw new Exception(Resource.ResourceManager[Resource.MessageKey.exc_invalid_node_name, reader.LocalName]); } }
/// <summary> /// Creates a new RuleCombinerParameter using the provided argument values. /// </summary> /// <param name="id">The variable id.</param> /// <param name="expression">The expression for the variable definition.</param> /// <param name="schemaVersion">The version of the schema that was used to validate.</param> public VariableDefinitionElement(string id, inf.IExpression expression, XacmlVersion schemaVersion) : base(XacmlSchema.Policy, schemaVersion) { _id = id; _expression = expression; }
/// <summary> /// Creates a new RuleCombinerParameter using the XmlReader instance provided. /// </summary> /// <param name="reader">The XmlReader instance positioned at the CombinerParameterElement node.</param> /// <param name="schemaVersion">The version of the schema that was used to validate.</param> public VariableDefinitionElement( XmlReader reader, XacmlVersion schemaVersion ) : base( XacmlSchema.Policy, schemaVersion ) { if( reader.LocalName == PolicySchema2.VariableDefinitionElement.VariableDefinition && ValidateSchema( reader, schemaVersion ) ) { // Read the attributes if( reader.HasAttributes ) { // Load all the attributes while( reader.MoveToNextAttribute() ) { if( reader.LocalName == PolicySchema2.VariableDefinitionElement.VariableId ) { _id = reader.GetAttribute( PolicySchema2.VariableDefinitionElement.VariableId ); } } reader.MoveToElement(); } // Read the rule contents. while( reader.Read() ) { switch( reader.LocalName ) { case PolicySchema1.AttributeSelectorElement.AttributeSelector: _expression = new AttributeSelectorElement( reader, schemaVersion ); break; case PolicySchema1.SubjectAttributeDesignatorElement.SubjectAttributeDesignator: _expression = new SubjectAttributeDesignatorElement( reader, schemaVersion ); break; case PolicySchema1.ActionAttributeDesignatorElement.ActionAttributeDesignator: _expression = new ActionAttributeDesignatorElement( reader, schemaVersion ); break; case PolicySchema1.ResourceAttributeDesignatorElement.ResourceAttributeDesignator: _expression = new ResourceAttributeDesignatorElement( reader, schemaVersion ); break; case PolicySchema1.EnvironmentAttributeDesignatorElement.EnvironmentAttributeDesignator: _expression = new EnvironmentAttributeDesignatorElement( reader, schemaVersion ); break; case PolicySchema1.AttributeValueElement.AttributeValue: _expression = new AttributeValueElementReadWrite( reader, schemaVersion ); break; case PolicySchema1.FunctionElement.Function: _expression = new FunctionElementReadWrite( reader, schemaVersion ); break; case PolicySchema1.ApplyElement.Apply: _expression = new ApplyElement( reader, schemaVersion ); break; case PolicySchema2.VariableReferenceElement.VariableReference: _expression = new VariableReferenceElement( reader, schemaVersion ); break; } if( reader.LocalName == PolicySchema2.VariableDefinitionElement.VariableDefinition && reader.NodeType == XmlNodeType.EndElement ) { break; } } } else { throw new Exception( Resource.ResourceManager[ Resource.MessageKey.exc_invalid_node_name, reader.LocalName ] ); } }
/// <summary> /// Creates a new RuleCombinerParameter using the provided argument values. /// </summary> /// <param name="id">The variable id.</param> /// <param name="expression">The expression for the variable definition.</param> /// <param name="schemaVersion">The version of the schema that was used to validate.</param> public VariableDefinitionElement( string id, inf.IExpression expression, XacmlVersion schemaVersion ) : base( XacmlSchema.Policy, schemaVersion ) { _id = id; _expression = expression; }
/// <summary> /// Adds an object to the end of the CollectionBase. /// </summary> /// <param name="value">The Object to be added to the end of the CollectionBase. </param> /// <returns>The CollectionBase index at which the value has been added.</returns> public virtual int Add(inf.IExpression value) { return(List.Add(value)); }