public static void AddSecurityTag(this ElementNode node, ProcessResult result) { if (node == null) { return; } if (result.ProcessRecords.Count == 0) { return; } ElementNode metaNode = node.GetMeta(); Meta meta = metaNode?.ToPoco <Meta>() ?? new Meta(); if (result.IsRedacted && !meta.Security.Any(x => string.Equals(x.Code, SecurityLabels.REDACT.Code, StringComparison.InvariantCultureIgnoreCase))) { meta.Security.Add(SecurityLabels.REDACT); } if (result.IsAbstracted && !meta.Security.Any(x => string.Equals(x.Code, SecurityLabels.ABSTRED.Code, StringComparison.InvariantCultureIgnoreCase))) { meta.Security.Add(SecurityLabels.ABSTRED); } if (result.IsCryptoHashed && !meta.Security.Any(x => string.Equals(x.Code, SecurityLabels.CRYTOHASH.Code, StringComparison.InvariantCultureIgnoreCase))) { meta.Security.Add(SecurityLabels.CRYTOHASH); } if (result.IsPerturbed && !meta.Security.Any(x => string.Equals(x.Code, SecurityLabels.PERTURBED.Code, StringComparison.InvariantCultureIgnoreCase))) { meta.Security.Add(SecurityLabels.PERTURBED); } ElementNode newMetaNode = ElementNode.FromElement(meta.ToTypedElement()); if (metaNode == null) { node.Add(s_provider, newMetaNode); } else { node.Replace(s_provider, metaNode, newMetaNode); } }
public void AddSecurityTag(ElementNode node, ProcessResult result) { if (node == null || result.ProcessRecords.Count == 0) { return; } var metaNode = (ElementNode)node.GetMeta(); var meta = metaNode?.ToPoco <Meta>() ?? new Meta(); if (result.IsRedacted && !meta.Security.Any(x => string.Equals(x.Code, SecurityLabels.REDACT.Code, StringComparison.InvariantCultureIgnoreCase))) { meta.Security.Add(SecurityLabels.REDACT); } if (result.IsAbstracted && !meta.Security.Any(x => string.Equals(x.Code, SecurityLabels.ABSTRED.Code, StringComparison.InvariantCultureIgnoreCase))) { meta.Security.Add(SecurityLabels.ABSTRED); } if (result.IsCryptoHashed && !meta.Security.Any(x => string.Equals(x.Code, SecurityLabels.CRYTOHASH.Code, StringComparison.InvariantCultureIgnoreCase))) { meta.Security.Add(SecurityLabels.CRYTOHASH); } if (result.IsEncrypted && !meta.Security.Any(x => string.Equals(x.Code, SecurityLabels.MASKED.Code, StringComparison.InvariantCultureIgnoreCase))) { meta.Security.Add(SecurityLabels.MASKED); } if (result.IsPerturbed && !meta.Security.Any(x => string.Equals(x.Code, SecurityLabels.PERTURBED.Code, StringComparison.InvariantCultureIgnoreCase))) { meta.Security.Add(SecurityLabels.PERTURBED); } if (result.IsSubstituted && !meta.Security.Any(x => string.Equals(x.Code, SecurityLabels.SUBSTITUTED.Code, StringComparison.InvariantCultureIgnoreCase))) { meta.Security.Add(SecurityLabels.SUBSTITUTED); } if (result.IsGeneralized && !meta.Security.Any(x => string.Equals(x.Code, SecurityLabels.GENERALIZED.Code, StringComparison.InvariantCultureIgnoreCase))) { meta.Security.Add(SecurityLabels.GENERALIZED); } var newMetaNode = ElementNode.FromElement(meta.ToTypedElement()); if (metaNode == null) { node.Add(s_provider, newMetaNode, _metaNodeName); } else { node.Replace(s_provider, metaNode, newMetaNode); } }