From 891615bbc13e1f47fa8d0a60ea01a9d38c55ed1a Mon Sep 17 00:00:00 2001 From: Rich Date: Tue, 27 Aug 2013 17:14:24 +0000 Subject: [PATCH] Added Logic to handle and report Transition Conversion errors. Corrected logic to translate TranType 2 transitions when Range location is less than the To location. Corrected logic for translating dates. --- PROMS/DataLoader/TransitionFixer.cs | 2 ++ PROMS/DataLoader/Transitions.cs | 30 +++++++++++++---------------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/PROMS/DataLoader/TransitionFixer.cs b/PROMS/DataLoader/TransitionFixer.cs index d1b7c622..9868e2d0 100644 --- a/PROMS/DataLoader/TransitionFixer.cs +++ b/PROMS/DataLoader/TransitionFixer.cs @@ -27,6 +27,7 @@ namespace DataLoader } class TransitionFixer { + public static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); public event TransitionFixerEvent StatusChanged; private void OnStatusChanged(object sender, TransitionFixerEventArgs args) { @@ -107,6 +108,7 @@ namespace DataLoader catch (Exception ex) { Console.WriteLine("{0} {1}", ex.GetType().Name, ex.Message); + _MyLog.WarnFormat("Transition Conversion Error: {0}", ex.Message); } // Added for transitions to un-numbered steps if (tran.NewTransToUnNumberedItem) item.NewTransToUnNumberedItem = true; diff --git a/PROMS/DataLoader/Transitions.cs b/PROMS/DataLoader/Transitions.cs index 00104a71..df6b045d 100644 --- a/PROMS/DataLoader/Transitions.cs +++ b/PROMS/DataLoader/Transitions.cs @@ -73,7 +73,7 @@ namespace DataLoader log.ErrorFormat("{0}\r\n\r\n{1}", ex.Message, ex.InnerException); itype = -1; } - DateTime dts = GetDTS(MakeDate(dti.Substring(0, 8).Trim()), dti.Substring(8, 5).Trim()); + DateTime dts = GetDTS(MakeDate(dti.Substring(0, 8).Trim()), dti.Substring(8, 5).TrimEnd()); // if it's in the dictionary of structure elements already migrated, just use this // structure id, or if it's in the dictionary of structure elements that have @@ -134,22 +134,18 @@ namespace DataLoader if (dr2 != null) { string thekey2 = dr2["TONUMBER"].ToString() + "|" + dr2["TOSEQUENCE"].ToString(); - // Range transitions that are type 2 are called 'and' transitions. These should extend to the - // last sibling. In data, these are represented with the SQL database field in the transitions - // table 'IsRange' == 2, and the toid == rangeid. In the content record, the link is - // TransitionRange:[type] [tranid] [toid] [rangeid] -> and the toid == rangeid - // The following was commented out for the Shearon Harris data migration because the - // migrated data did not match 16bit. One example can be found EOPS/ECA-0.0, step 47, RNO. - // 16bit had Steps 47b AND c; 32bit had Steps 47b, c, d, e, f AND g before this code was - // commented out (June 2013). - //if (itype == 2) - //{ - // if (dr["TOSEQUENCE"].ToString().Length > 3 && - // dr["TOSEQUENCE"].ToString().Substring(0, 2) == dr2["TOSEQUENCE"].ToString().Substring(0, 2)) - // thekey2 = thekey; - // else - // thekey2 = dr2["TONUMBER"].ToString() + "|" + dr2["TOSEQUENCE"].ToString().Substring(0, 3); - //} + + // Range transitions that are type 2 are called 'AND' transitions. + // Example: Continue with steps 5b, 5c and 5d. + // if the second key is greater than the first key, then the transition terminates + // at the location specified in the second key. + // If the second key is less than or equal the first key, the transition extends + // to the last sibling of the first key. + // In data, these are represented with the SQL database field in the transitions + // table 'IsRange' == 2, toid and rangeid. In the content record, the link is + // TransitionRange:[type] [tranid] [toid] [rangeid]. + + if (itype == 2 && thekey.CompareTo(thekey2) >= 0) thekey2 = thekey; if (dicTrans_ItemDone.ContainsKey(thekey2)) { toItem2 = dicTrans_ItemDone[thekey2];