public override ServiceResult Validate(FilterContext context, int index)
{
m_validated = false;
// verify attribute id.
if (!Attributes.IsValid(m_attributeId))
{
return ServiceResult.Create(
StatusCodes.BadAttributeIdInvalid,
"SimpleAttributeOperand does not specify a valid AttributeId ({0}).",
m_attributeId);
}
// initialize as empty.
m_parsedIndexRange = NumericRange.Empty;
// parse the index range.
if (!String.IsNullOrEmpty(m_indexRange))
{
try
{
m_parsedIndexRange = NumericRange.Parse(m_indexRange);
}
catch (Exception e)
{
return ServiceResult.Create(
e,
StatusCodes.BadIndexRangeInvalid,
"SimpleAttributeOperand does not specify a valid BrowsePath ({0}).",
m_indexRange);
}
if (m_attributeId != Attributes.Value)
{
return ServiceResult.Create(
StatusCodes.BadIndexRangeInvalid,
"SimpleAttributeOperand specifies an IndexRange for an Attribute other than Value ({0}).",
m_attributeId);
}
}
m_validated = true;
return ServiceResult.Good;
}