org.gedcomx.util
Class DocCheck

java.lang.Object
  extended by org.gedcomx.util.DocCheck

public class DocCheck
extends Object

Class for checking a GedcomX document to make sure its references are consistent. User: Randy Wilson Date: 10/2/2014 Time: 3:49 PM


Constructor Summary
DocCheck()
           
 
Method Summary
static String checkDocument(Gedcomx doc)
          Check a GedcomX document for problems.
static String checkDocument(Gedcomx doc, Gedcomx collection)
          Check a GedcomX document for problems.
static String checkRecordSet(RecordSet records, Gedcomx collection)
          Check a GedcomX RecordSet for problems.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DocCheck

public DocCheck()
Method Detail

checkDocument

public static String checkDocument(Gedcomx doc)
Check a GedcomX document for problems. Check the following: - There is a SourceDescription for the document, referenced by 'description'. - All SourceReference's point to a valid, local SourceDescription. - SourceReferences can appear as componentOf in a SourceDescription, - and also in any Conclusion - All relationships point to persons who are either (a) inside the doc, referenced by "#" + local ID, or (b) outside the doc, referenced by full URL. - All persons, records and collections have an identifier of type "Persistent" or "Primary". - PlaceReference references a valid PlaceDescription.

Parameters:
doc - - Document to check
Returns:
String containing a list of errors, or null if there were no errors.

checkDocument

public static String checkDocument(Gedcomx doc,
                                   Gedcomx collection)
Check a GedcomX document for problems. Calls checkDocument(doc), but further makes sure that all field values with a labelId can find the labelId in the RecordDescriptor in the accompanying collection doc.

Parameters:
doc - - Historical Record document to check.
collection - - Collection document to find RecordDescriptor in.
Returns:
String containing a list of errors, if any, or null if there were no errors.

checkRecordSet

public static String checkRecordSet(RecordSet records,
                                    Gedcomx collection)
Check a GedcomX RecordSet for problems. Calls checkDocument(doc, collection) on each record.

Parameters:
records - - Set of GedcomX documents to check.
collection - - Collection to use to check RecordDescriptors and labelIds. null => use records.getMetadata(), if any, or else don't check label IDs.
Returns:
String containing a list of errors, if any, or null if there were no errors.


Copyright © 2015. All rights reserved.