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.
This commit is contained in:
Rich 2013-08-27 17:14:24 +00:00
parent 5a81462bf7
commit 891615bbc1
2 changed files with 15 additions and 17 deletions

View File

@ -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;

View File

@ -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];