-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathSourceDescription.cs
More file actions
861 lines (821 loc) · 26.9 KB
/
Copy pathSourceDescription.cs
File metadata and controls
861 lines (821 loc) · 26.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
// <auto-generated>
//
//
// Generated by <a href="http://enunciate.codehaus.org">Enunciate</a>.
// </auto-generated>
using System;
using System.Collections.Generic;
using System.Linq;
using Gedcomx.Model.Rt;
using Gedcomx.Model.Util;
using Gx.Common;
using Gx.Conclusion;
using Gx.Model;
using Gx.Records;
using Gx.Types;
using Newtonsoft.Json;
namespace Gx.Source
{
/// <remarks>
/// Represents a description of a source.
/// </remarks>
/// <summary>
/// Represents a description of a source.
/// </summary>
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://gedcomx.org/v1/", TypeName = "SourceDescription")]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "http://gedcomx.org/v1/", ElementName = "sourceDescription")]
public partial class SourceDescription : Gx.Links.HypermediaEnabledData, IAttributable
{
private string _about;
private string _lang;
private string _mediaType;
private string _sortKey;
private string _resourceType;
private System.Collections.Generic.List<Gx.Source.SourceCitation> _citations;
private Gx.Common.ResourceReference _mediator;
private System.Collections.Generic.List<Gx.Source.SourceReference> _sources;
private Gx.Common.ResourceReference _analysis;
private Gx.Source.SourceReference _componentOf;
private Gx.Model.Collections.TextValues _titles;
private Gx.Common.TextValue _titleLabel;
private System.Collections.Generic.List<Gx.Common.Note> _notes;
private Gx.Common.Attribution _attribution;
private Gx.Model.Collections.TextValues _descriptions;
private System.Collections.Generic.List<Gx.Conclusion.Identifier> _identifiers;
private DateTime? _created;
private bool _createdSpecified;
private DateTime? _modified;
private bool _modifiedSpecified;
private System.Collections.Generic.List<Gx.Source.Coverage> _coverage;
private System.Collections.Generic.List<string> _rights;
private System.Collections.Generic.List<Gx.Records.Field> _fields;
private Gx.Common.ResourceReference _repository;
private Gx.Common.ResourceReference _descriptorRef;
/// <summary>
/// The URI (if applicable) of the actual source.
/// </summary>
[System.Xml.Serialization.XmlAttributeAttribute(AttributeName = "about")]
[Newtonsoft.Json.JsonProperty("about")]
public string About
{
get
{
return this._about;
}
set
{
this._about = value;
}
}
/// <summary>
/// The language of the genealogical data.
/// </summary>
[System.Xml.Serialization.XmlAttributeAttribute(AttributeName = "lang", Namespace = "http://www.w3.org/XML/1998/namespace")]
[Newtonsoft.Json.JsonProperty("lang")]
public string Lang
{
get
{
return this._lang;
}
set
{
this._lang = value;
}
}
/// <summary>
/// Hint about the media (MIME) type of the resource being described.
/// </summary>
[System.Xml.Serialization.XmlAttributeAttribute(AttributeName = "mediaType")]
[Newtonsoft.Json.JsonProperty("mediaType")]
public string MediaType
{
get
{
return this._mediaType;
}
set
{
this._mediaType = value;
}
}
/// <summary>
/// A sort key to be used in determining the position of this source relative to other sources in the same collection.
/// </summary>
[System.Xml.Serialization.XmlAttributeAttribute(AttributeName = "sortKey")]
[Newtonsoft.Json.JsonProperty("sortKey")]
public string SortKey
{
get
{
return this._sortKey;
}
set
{
this._sortKey = value;
}
}
/// <summary>
/// The type of the resource being described.
/// </summary>
[System.Xml.Serialization.XmlAttributeAttribute(AttributeName = "resourceType")]
[Newtonsoft.Json.JsonProperty("resourceType")]
public string ResourceType
{
get
{
return this._resourceType;
}
set
{
this._resourceType = value;
}
}
/// <summary>
/// Convenience property for treating ResourceType as an enum. See Gx.Types.ResourceTypeQNameUtil for details on getter/setter functionality.
/// </summary>
[System.Xml.Serialization.XmlIgnoreAttribute]
[Newtonsoft.Json.JsonIgnore]
public Gx.Types.ResourceType KnownResourceType
{
get
{
return XmlQNameEnumUtil.GetEnumValue<ResourceType>(this._resourceType);
}
set
{
this._resourceType = XmlQNameEnumUtil.GetNameValue(value);
}
}
/// <summary>
/// The bibliographic citations for this source.
/// </summary>
[System.Xml.Serialization.XmlElementAttribute(ElementName = "citation", Namespace = "http://gedcomx.org/v1/")]
[Newtonsoft.Json.JsonProperty("citations")]
public System.Collections.Generic.List<Gx.Source.SourceCitation> Citations
{
get
{
return this._citations ?? (_citations = new System.Collections.Generic.List<Gx.Source.SourceCitation>());
}
set
{
this._citations = value;
}
}
public bool ShouldSerializeCitations() => AnyCitations();
public bool AnyCitations()
{
return _citations?.Any() ?? false;
}
/// <summary>
/// A reference to the entity that mediates access to the described source.
/// </summary>
[System.Xml.Serialization.XmlElementAttribute(ElementName = "mediator", Namespace = "http://gedcomx.org/v1/")]
[Newtonsoft.Json.JsonProperty("mediator")]
public Gx.Common.ResourceReference Mediator
{
get
{
return this._mediator;
}
set
{
this._mediator = value;
}
}
/// <summary>
/// References to any sources to which this source is related (usually applicable to sources that are derived from or contained in another source).
/// </summary>
[System.Xml.Serialization.XmlElementAttribute(ElementName = "source", Namespace = "http://gedcomx.org/v1/")]
[Newtonsoft.Json.JsonProperty("sources")]
public System.Collections.Generic.List<Gx.Source.SourceReference> Sources
{
get
{
return this._sources ?? (_sources = new System.Collections.Generic.List<Gx.Source.SourceReference>());
}
set
{
this._sources = value;
}
}
public bool ShouldSerializeSources() => AnySources();
public bool AnySources()
{
return _sources?.Any() ?? false;
}
/// <summary>
/// A reference to the analysis document explaining the analysis that went into this description of the source.
/// </summary>
[System.Xml.Serialization.XmlElementAttribute(ElementName = "analysis", Namespace = "http://gedcomx.org/v1/")]
[Newtonsoft.Json.JsonProperty("analysis")]
public Gx.Common.ResourceReference Analysis
{
get
{
return this._analysis;
}
set
{
this._analysis = value;
}
}
/// <summary>
/// A reference to the source that contains this source.
/// </summary>
[System.Xml.Serialization.XmlElementAttribute(ElementName = "componentOf", Namespace = "http://gedcomx.org/v1/")]
[Newtonsoft.Json.JsonProperty("componentOf")]
public Gx.Source.SourceReference ComponentOf
{
get
{
return this._componentOf;
}
set
{
this._componentOf = value;
}
}
/// <summary>
/// A list of titles for this source.
/// </summary>
[System.Xml.Serialization.XmlElementAttribute(ElementName = "title", Namespace = "http://gedcomx.org/v1/")]
[Newtonsoft.Json.JsonProperty("titles")]
public Gx.Model.Collections.TextValues Titles
{
get
{
return this._titles ?? (_titles = new Gx.Model.Collections.TextValues());
}
set
{
this._titles = value;
}
}
public bool ShouldSerializeTitles() => AnyTitles();
public bool AnyTitles()
{
return _titles?.Any() ?? false;
}
/// <summary>
/// A label for the title of this description.
/// </summary>
[System.Xml.Serialization.XmlElementAttribute(ElementName = "titleLabel", Namespace = "http://gedcomx.org/v1/")]
[Newtonsoft.Json.JsonProperty("titleLabel")]
public Gx.Common.TextValue TitleLabel
{
get
{
return this._titleLabel;
}
set
{
this._titleLabel = value;
}
}
/// <summary>
/// Notes about a source.
/// </summary>
[System.Xml.Serialization.XmlElementAttribute(ElementName = "note", Namespace = "http://gedcomx.org/v1/")]
[Newtonsoft.Json.JsonProperty("notes")]
public System.Collections.Generic.List<Gx.Common.Note> Notes
{
get
{
return this._notes ?? (_notes = new System.Collections.Generic.List<Gx.Common.Note>());
}
set
{
this._notes = value;
}
}
public bool ShouldSerializeNotes() => AnyNotes();
public bool AnyNotes()
{
return _notes?.Any() ?? false;
}
/// <summary>
/// The attribution metadata for this source description.
/// </summary>
[System.Xml.Serialization.XmlElementAttribute(ElementName = "attribution", Namespace = "http://gedcomx.org/v1/")]
[Newtonsoft.Json.JsonProperty("attribution")]
public Gx.Common.Attribution Attribution
{
get
{
return this._attribution;
}
set
{
this._attribution = value;
}
}
/// <summary>
/// Human-readable descriptions of the source.
/// </summary>
[System.Xml.Serialization.XmlElementAttribute(ElementName = "description", Namespace = "http://gedcomx.org/v1/")]
[Newtonsoft.Json.JsonProperty("descriptions")]
public Gx.Model.Collections.TextValues Descriptions
{
get
{
return this._descriptions ?? (_descriptions = new Gx.Model.Collections.TextValues());
}
set
{
this._descriptions = value;
}
}
public bool ShouldSerializeDescriptions() => AnyDescriptions();
public bool AnyDescriptions()
{
return _descriptions?.Any() ?? false;
}
/// <summary>
/// The list of identifiers for the source.
/// </summary>
[System.Xml.Serialization.XmlElementAttribute(ElementName = "identifier", Namespace = "http://gedcomx.org/v1/")]
[Newtonsoft.Json.JsonProperty("identifiers")]
[JsonConverter(typeof(JsonIdentifiersConverter))]
public System.Collections.Generic.List<Gx.Conclusion.Identifier> Identifiers
{
get
{
return this._identifiers ?? (_identifiers = new System.Collections.Generic.List<Gx.Conclusion.Identifier>());
}
set
{
this._identifiers = value;
}
}
public bool ShouldSerializeIdentifiers() => AnyIdentifiers();
public bool AnyIdentifiers()
{
return _identifiers?.Any() ?? false;
}
/// <summary>
/// The date the source was created.
/// </summary>
[System.Xml.Serialization.XmlElementAttribute(ElementName = "created", Namespace = "http://gedcomx.org/v1/")]
[Newtonsoft.Json.JsonProperty("created")]
[JsonConverter(typeof(JsonUnixTimestampConverter))]
public DateTime Created
{
get
{
return this._created.GetValueOrDefault();
}
set
{
this._created = value;
this._createdSpecified = true;
}
}
/// <summary>
/// Property for the XML serializer indicating whether the "Created" property should be included in the output.
/// </summary>
[System.Xml.Serialization.XmlIgnoreAttribute]
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
[Newtonsoft.Json.JsonIgnore]
public bool CreatedSpecified
{
get
{
return this._createdSpecified;
}
set
{
this._createdSpecified = value;
}
}
/// <summary>
/// The date the source was last modified.
/// </summary>
[System.Xml.Serialization.XmlElementAttribute(ElementName = "modified", Namespace = "http://gedcomx.org/v1/")]
[Newtonsoft.Json.JsonProperty("modified")]
[JsonConverter(typeof(JsonUnixTimestampConverter))]
public DateTime Modified
{
get
{
return this._modified.GetValueOrDefault();
}
set
{
this._modified = value;
this._modifiedSpecified = true;
}
}
/// <summary>
/// Property for the XML serializer indicating whether the "Modified" property should be included in the output.
/// </summary>
[System.Xml.Serialization.XmlIgnoreAttribute]
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
[Newtonsoft.Json.JsonIgnore]
public bool ModifiedSpecified
{
get
{
return this._modifiedSpecified;
}
set
{
this._modifiedSpecified = value;
}
}
/// <summary>
/// Declarations of the coverage of the source.
/// </summary>
[System.Xml.Serialization.XmlElementAttribute(ElementName = "coverage", Namespace = "http://gedcomx.org/v1/")]
[Newtonsoft.Json.JsonProperty("coverage")]
public System.Collections.Generic.List<Gx.Source.Coverage> Coverage
{
get
{
return this._coverage ?? (_coverage = new System.Collections.Generic.List<Gx.Source.Coverage>());
}
set
{
this._coverage = value;
}
}
public bool ShouldSerializeCoverage() => AnyCoverage();
public bool AnyCoverage()
{
return _coverage?.Any() ?? false;
}
/// <summary>
/// The rights for this source.
/// </summary>
[System.Xml.Serialization.XmlElementAttribute(ElementName = "rights", Namespace = "http://gedcomx.org/v1/")]
[Newtonsoft.Json.JsonProperty("rights")]
public System.Collections.Generic.List<string> Rights
{
get
{
return this._rights ?? (_rights = new System.Collections.Generic.List<string> ());
}
set
{
this._rights = value;
}
}
public bool ShouldSerializeRights() => AnyRights();
public bool AnyRights()
{
return _rights?.Any() ?? false;
}
/// <summary>
/// The fields that are applicable to the resource being described.
/// </summary>
[System.Xml.Serialization.XmlElementAttribute(ElementName = "field", Namespace = "http://gedcomx.org/v1/")]
[Newtonsoft.Json.JsonProperty("fields")]
public System.Collections.Generic.List<Gx.Records.Field> Fields
{
get
{
return this._fields ?? (_fields = new System.Collections.Generic.List<Gx.Records.Field>());
}
set
{
this._fields = value;
}
}
public bool ShouldSerializeFields() => AnyFields();
public bool AnyFields()
{
return _fields?.Any() ?? false;
}
/// <summary>
/// Reference to an agent describing the repository in which the source is found.
/// </summary>
[System.Xml.Serialization.XmlElementAttribute(ElementName = "repository", Namespace = "http://gedcomx.org/v1/")]
[Newtonsoft.Json.JsonProperty("repository")]
public Gx.Common.ResourceReference Repository
{
get
{
return this._repository;
}
set
{
this._repository = value;
}
}
/// <summary>
/// Reference to a descriptor of fields and type of data that can be expected to be extracted from the source.
/// </summary>
[System.Xml.Serialization.XmlElementAttribute(ElementName = "descriptor", Namespace = "http://gedcomx.org/v1/")]
[Newtonsoft.Json.JsonProperty("descriptor")]
public Gx.Common.ResourceReference DescriptorRef
{
get
{
return this._descriptorRef;
}
set
{
this._descriptorRef = value;
}
}
/**
* Accept a visitor.
*
* @param visitor The visitor.
*/
public void Accept(IGedcomxModelVisitor visitor)
{
visitor.VisitSourceDescription(this);
}
/**
* Build out this envelope with a lang.
*
* @param lang The lang.
* @return this.
*/
public SourceDescription SetLang(String lang)
{
Lang = lang;
return this;
}
/**
* Build of this source description with a resource type.
* @param resourceType The resource type.
* @return this.
*/
public SourceDescription SetResourceType(String resourceType)
{
ResourceType = resourceType;
return this;
}
/**
* Build of this source description with a resource type.
* @param resourceType The resource type.
* @return this.
*/
public SourceDescription SetResourceType(ResourceType resourceType)
{
KnownResourceType = resourceType;
return this;
}
/**
* Build out this source description with a rights.
* @param rights The rights.
* @return this.
*/
public SourceDescription SetRights(String rights)
{
if (rights != null)
{
this.Rights.Add(rights);
}
return this;
}
/**
* Build out this source description with a citation.
* @param citation The citation.
* @return this.
*/
public SourceDescription SetCitation(SourceCitation citation)
{
if (citation != null)
{
Citations.Add(citation);
}
return this;
}
/**
* Build out this source description with a citation.
* @param citation The citation.
* @return this.
*/
public SourceDescription SetCitation(String citation)
{
return SetCitation(new SourceCitation().SetValue(citation));
}
/**
* Build out this source description with a media type.
* @param mediaType The media type.
* @return this.
*/
public SourceDescription SetMediaType(String mediaType)
{
MediaType = mediaType;
return this;
}
/**
* Build out this source description with an about reference.
* @param about the about.
* @return this.
*/
public SourceDescription SetAbout(String about)
{
About = about;
return this;
}
/**
* Build out this source description with a mediator.
*
* @param mediator The mediator.
* @return this.
*/
public SourceDescription SetMediator(ResourceReference mediator)
{
Mediator = mediator;
return this;
}
/**
* Build out this source description by adding a source reference.
* @param source The source reference.
* @return this.
*/
public SourceDescription SetSource(SourceReference source)
{
if (this._sources == null)
{
this._sources = new List<SourceReference>();
}
this._sources.Add(source);
return this;
}
/**
* Build out this source description with an analyis.
* @param analysis The analysis.
* @return this.
*/
public SourceDescription AddAnalysis(ResourceReference analysis)
{
Analysis = analysis;
return this;
}
/**
* Build out this source description with a component of.
* @param componentOf The component of.
* @return this.
*/
public SourceDescription SetComponentOf(SourceReference componentOf)
{
ComponentOf = componentOf;
return this;
}
/**
* Build out this source description with a component of.
* @param componentOf The component of.
* @return this.
*/
public SourceDescription SetComponentOf(SourceDescription componentOf)
{
ComponentOf = new SourceReference().SetDescription(componentOf);
return this;
}
public SourceDescription SetTitle(String title)
{
return SetTitle(new TextValue(title));
}
/**
* Build out this source description with a title.
* @param title The title.
* @return this.
*/
public SourceDescription SetTitle(TextValue title)
{
this.Titles.Add(title);
return this;
}
/**
* Build this out by applying a label for the title of this description.
* @param titleLabel The title label.
* @return this.
*/
public SourceDescription SetTitleLabel(TextValue titleLabel)
{
TitleLabel = titleLabel;
return this;
}
public SourceDescription SetNote(String note)
{
return SetNote(new Note().SetText(note));
}
/**
* Build out this source description with a note.
* @param note the note.
* @return this.
*/
public SourceDescription SetNote(Note note)
{
this.Notes.Add(note);
return this;
}
/**
* Build out this source description with attribution.
* @param attribution The attribution.
* @return this.
*/
public SourceDescription SetAttribution(Attribution attribution)
{
Attribution = attribution;
return this;
}
/**
* Build out this source description with an identifier.
* @param identifier the identifier.
* @return this.
*/
public SourceDescription SetIdentifier(Identifier identifier)
{
this.Identifiers.Add(identifier);
return this;
}
/**
* Build out this source description with a sort key.
* @param sortKey The sort key.
* @return This.
*/
public SourceDescription SetSortKey(String sortKey)
{
SortKey = sortKey;
return this;
}
public SourceDescription SetDescription(String description)
{
return SetDescription(new TextValue(description));
}
/**
* Build out this source description with a description.
* @param description The description.
* @return this.
*/
public SourceDescription SetDescription(TextValue description)
{
this.Descriptions.Add(description);
return this;
}
/**
* Build out this source description with a created date.
*
* @param created The created date.
* @return this.
*/
public SourceDescription SetCreated(DateTime created)
{
Created = created;
return this;
}
/**
* Build out this source description with a modified date.
* @param modified the modified date.
*/
public SourceDescription SetModified(DateTime modified)
{
Modified = modified;
return this;
}
/**
* Build out this source description with coverage.
* @param coverage The coverage.
* @return this.
*/
public SourceDescription SetCoverage(Coverage coverage)
{
this.Coverage.Add(coverage);
return this;
}
/**
* Build this out with a field.
* @param field The field.
* @return this.
*/
public SourceDescription SetField(Field field)
{
if (field != null)
{
this.Fields.Add(field);
}
return this;
}
/**
* Build out this source description with a repository.
*
* @param repository The repository.
* @return this.
*/
public SourceDescription SetRepository(ResourceReference repository)
{
Repository = repository;
return this;
}
/**
* Build out this source description with a descriptor ref.
*
* @param descriptorRef The descriptor ref.
* @return this.
*/
public SourceDescription SetDescriptorRef(ResourceReference descriptorRef)
{
DescriptorRef = descriptorRef;
return this;
}
}
}