| | 1 | | using Newtonsoft.Json.Linq; |
| | 2 | | using ValidateLib.ErrorsAndWarnings.Warnings; |
| | 3 | | using ValidateLib.Metadata.Descriptors; |
| | 4 | |
|
| | 5 | | namespace ValidateLib.Metadata.PropertyParsers.Transformation |
| | 6 | | { |
| | 7 | | internal class SourcePropertyParser : PropertyParserBase<TransformationDescriptor>, IPropertyParser<TransformationDe |
| | 8 | | { |
| 1 | 9 | | public SourcePropertyParser(List<Warning> warnings, TransformationDescriptor descriptor) : base(warnings, descri |
| | 10 | | { |
| 1 | 11 | | } |
| | 12 | |
|
| | 13 | | public void ParseProperty(JProperty property) |
| | 14 | | { |
| 1 | 15 | | if (property.Value.Type == JTokenType.Null) |
| | 16 | | { |
| 0 | 17 | | Descriptor.source = new Properties.AtomicProperties.AtomicPropertyString(null); |
| | 18 | | } |
| 1 | 19 | | else if (property.Value.Type == JTokenType.String) |
| | 20 | | { |
| 1 | 21 | | string[] allowedValues = new string[] { "json", "rdf" }; |
| 1 | 22 | | if (allowedValues.Contains(property.Value.ToString())) |
| | 23 | | { |
| 1 | 24 | | Descriptor.source = new Properties.AtomicProperties.AtomicPropertyString(property.Value.ToString()); |
| | 25 | | } |
| | 26 | | else |
| | 27 | | { |
| 0 | 28 | | Warnings.Add(WarningFactory.GetSourceWrongValueWarning(property.Value.ToString())); |
| 0 | 29 | | Descriptor.source = new Properties.AtomicProperties.AtomicPropertyString(null); |
| | 30 | | } |
| | 31 | | } |
| | 32 | | else |
| | 33 | | { |
| 0 | 34 | | Warnings.Add(WarningFactory.GetSourceWrongValueWarning(property.Value.ToString())); |
| 0 | 35 | | Descriptor.source = new Properties.AtomicProperties.AtomicPropertyString(null); |
| | 36 | | } |
| 0 | 37 | | } |
| | 38 | | } |
| | 39 | | } |