LoadPropertyValueFromXml method

  1. @override
Future<void> LoadPropertyValueFromXml(
  1. EwsServiceXmlReader reader,
  2. PropertyBag propertyBag
)
override
Loads from XML. The reader. The property bag.

Implementation

@override
Future<void> LoadPropertyValueFromXml(
    EwsServiceXmlReader reader, PropertyBag propertyBag) async {
  Set<EffectiveRights> value = Set();

  reader.EnsureCurrentNodeIsStartElementWithNamespace(
      XmlNamespace.Types, this.XmlElementName);

  if (!reader.IsEmptyElement) {
    do {
      await reader.Read();

      if (reader.IsStartElement()) {
        switch (reader.LocalName) {
          case XmlElementNames.CreateAssociated:
            if ((await reader.ReadElementValue<bool>())!) {
              value.add(EffectiveRights.CreateAssociated);
            }
            break;
          case XmlElementNames.CreateContents:
            if ((await reader.ReadElementValue<bool>())!) {
              value.add(EffectiveRights.CreateContents);
            }
            break;
          case XmlElementNames.CreateHierarchy:
            if ((await reader.ReadElementValue<bool>())!) {
              value.add(EffectiveRights.CreateHierarchy);
            }
            break;
          case XmlElementNames.Delete:
            if ((await reader.ReadElementValue<bool>())!) {
              value.add(EffectiveRights.Delete);
            }
            break;
          case XmlElementNames.Modify:
            if ((await reader.ReadElementValue<bool>())!) {
              value.add(EffectiveRights.Modify);
            }
            break;
          case XmlElementNames.Read:
            if ((await reader.ReadElementValue<bool>())!) {
              value.add(EffectiveRights.Read);
            }
            break;
          case XmlElementNames.ViewPrivateItems:
            if ((await reader.ReadElementValue<bool>())!) {
              value.add(EffectiveRights.ViewPrivateItems);
            }
            break;
        }
      }
    } while (!reader.IsEndElementWithNamespace(
        XmlNamespace.Types, this.XmlElementName));
  }

  propertyBag[this] = value;
}