C# Class SIL.FieldWorks.FixData.SequenceFixer

This class contains code to fix situations where merges have resulted in sequences that are empty and shouldn't be. In normal operation, FDO takes care of these situations automatically, but in a Send/Receive situation FDO might not 'know' that one user deleted a sequence element while another user deleted the other with the result on merging that now both are gone. Usually the required fix is to delete the parent that holds the sequence. This class also contains code to fix situations where merges have resulted in a Segment being deleted and dangling references still exist in TextTag objects and ConstChartWordGroup objects. In normal operation, FDO takes care of these situations automatically, but in a Send/Receive situation FDO might not 'know' that one user deleted a Segment element while another user created references to it, with the result on merging that now references to a non-existent Segment exist. The Original Fixer will delete the dangling references to the Segment, but the TextTag and WordGroup objects should not have empty Begin or EndSegment references. If both Begin and EndSegment belong to missing Segments, we delete the object in question. If only one belongs to a missing Segment, we replace its reference with a reference to the other Segment. This class also contains code to fix situations where a LexReference object is found to only contain one Target. The LexReference object will be deleted. There may have been bugs in the past which allowed this sort of thing to occur. They seem to have been fixed, but Send/Receive could conceivably generate such situations too.
Inheritance: RtFixer
Mostrar archivo Open project: sillsdev/FieldWorks

Private Methods

Method Description
AdjustBadSegmentReferenceAndReport ( System.Xml.Linq.XElement rt, System.Guid guid, System.Guid guidOwner, string className, FwDataFixer errorLogger ) : void
AnalyzeSegmentReferences ( System.Xml.Linq.XElement rt ) : AnalysisResult
CheckSegmentReference ( string propName, System.Xml.Linq.XElement rt ) : bool
FinalFixerInitialization ( Guid>.Dictionary owners, HashSet guids, Dictionary parentToOwnedObjsur, HashSet rtElementsToDelete ) : void
FixElement ( System.Xml.Linq.XElement rt, FwDataFixer errorLogger ) : bool

Do any fixes to this particular root element here. Return true if we are done fixing this element and can write it out. Return false if we need to delete this root element.

GetObjsurGuid ( System.Xml.Linq.XElement xeCell ) : System.Guid
GetSegmentReference ( string propName, System.Xml.Linq.XElement rt ) : System.Xml.Linq.XElement
HoldsEmptySequence ( string propertyName, System.Xml.Linq.XElement xeObject ) : bool

Determines whether the sequence held by this XElement object is empty or not. N.B. At this point, there must only be one sequence held by this object.

HoldsLessThanTwoInSequence ( string propertyName, System.Xml.Linq.XElement xeObject ) : bool

Determines whether the sequence held by this XElement object is empty or has less than two descendants or not. N.B. At this point, there must only be one sequence held by this object.

InspectElement ( System.Xml.Linq.XElement rt ) : void
ReplaceMissingSegmentReferenceWithOtherOne ( System.Xml.Linq.XElement rt ) : string
ReplaceSegmentReference ( System.Xml.Linq.XElement rt, string propName, System.Xml.Linq.XElement otherReference ) : void
ReportBadLexReference ( System.Guid guid, System.Guid guidOwner, FwDataFixer errorLogger ) : void
ReportOwnerOfBadSegmentReferences ( System.Guid guid, System.Guid guidOwner, string className, FwDataFixer errorLogger ) : void
ReportOwnerOfEmptySequence ( System.Guid guid, System.Guid guidOwner, string className, FwDataFixer errorLogger ) : void
Reset ( ) : void
SafelyGetOwnerGuid ( System.Guid guid ) : System.Guid

Gets the guid of the owner. If not found, returns Guid.Empty.

UpdateDanglingReferenceDictionary ( Dictionary dict, System.Guid owner, System.Guid ownee ) : void

Safely update a dictionary of dangling references to be deleted.

UpdateDictionaryOfOwnersLosingObjects ( Dictionary dict, System.Guid owner, System.Guid ownee ) : void

Safely update a dictionary of Owners (StText or ConstChartRow) that are losing and object. They will need to update their reference.