EvaluationResult.fromXml constructor

EvaluationResult.fromXml(
  1. XmlElement elem
)

Implementation

factory EvaluationResult.fromXml(_s.XmlElement elem) {
  return EvaluationResult(
    evalActionName: _s.extractXmlStringValue(elem, 'EvalActionName')!,
    evalDecision: _s
        .extractXmlStringValue(elem, 'EvalDecision')!
        .toPolicyEvaluationDecisionType(),
    evalDecisionDetails: Map.fromEntries(
      elem.getElement('EvalDecisionDetails')?.findElements('entry').map(
                (c) => MapEntry(
                  _s.extractXmlStringValue(c, 'key')!,
                  _s
                      .extractXmlStringValue(c, 'value')!
                      .toPolicyEvaluationDecisionType(),
                ),
              ) ??
          {},
    ),
    evalResourceName: _s.extractXmlStringValue(elem, 'EvalResourceName'),
    matchedStatements: _s.extractXmlChild(elem, 'MatchedStatements')?.let(
        (elem) => elem
            .findElements('member')
            .map((c) => Statement.fromXml(c))
            .toList()),
    missingContextValues: _s
        .extractXmlChild(elem, 'MissingContextValues')
        ?.let((elem) => _s.extractXmlStringListValues(elem, 'member')),
    organizationsDecisionDetail: _s
        .extractXmlChild(elem, 'OrganizationsDecisionDetail')
        ?.let((e) => OrganizationsDecisionDetail.fromXml(e)),
    permissionsBoundaryDecisionDetail: _s
        .extractXmlChild(elem, 'PermissionsBoundaryDecisionDetail')
        ?.let((e) => PermissionsBoundaryDecisionDetail.fromXml(e)),
    resourceSpecificResults: _s
        .extractXmlChild(elem, 'ResourceSpecificResults')
        ?.let((elem) => elem
            .findElements('member')
            .map((c) => ResourceSpecificResult.fromXml(c))
            .toList()),
  );
}