Outside Transition logic and annotations for unresolved transitions

This commit is contained in:
Jsj 2008-02-21 16:41:38 +00:00
parent f7c2a291d3
commit 4157c3b094
2 changed files with 41 additions and 22 deletions

View File

@ -26,37 +26,54 @@ namespace DataLoader
public partial class Loader public partial class Loader
{ {
public Item MigrateDocVersion(DocVersion docver) public Item MigrateDocVersion(DocVersion docver)
{
return MigrateDocVersion(docver, true);
}
private OutsideTransition _OutTran;
public Item MigrateDocVersion(DocVersion docver, bool convertProcedures)
{ {
string pth = docver.Title; string pth = docver.Title;
// Open connection // TODO: If set.dbf is missing or curset.dat is missing don't process it.
if (!File.Exists(pth + @"\set.dbf") || !File.Exists(pth + @"\curset.dat")) return null; // Open connection
OleDbConnection cn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + pth + ";Extended Properties=dBase III;Persist Security Info=False"); OleDbConnection cn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + pth + ";Extended Properties=dBase III;Persist Security Info=False");
// load rofst (use it later).... if (convertProcedures)
rofst = new ROFST(pth + "\\ro.fst"); {
// Migrate library documents _OutTran = new OutsideTransition(cn);
MigrateLibDocs(cn, pth); // load rofst (use it later)....
// Initialize Dictionaries rofst = new ROFST(pth + "\\ro.fst");
dicTrans_ItemDone = new Dictionary<string, Item>(); // Migrate library documents
dicTrans_ItemIds = new Dictionary<string, Item>(); MigrateLibDocs(cn, pth);
// Initialize Dictionaries
// Create a 'dummy' content record. This will be used for any transitions 'to' dicTrans_ItemDone = new Dictionary<string, Item>();
// that don't exist when dbf is processed. At end, use this to see if there dicTrans_ItemIds = new Dictionary<string, Item>();
// are missing transitions. dicTrans_MigrationErrors = new Dictionary<string, List<Item>>();
TransDummyCont = Content.MakeContent(null, "DUMMY CONTENT FOR TRANSITION MIGRATION", null, null, null);
// Create a 'dummy' content record. This will be used for any transitions 'to'
// that don't exist when dbf is processed. At end, use this to see if there
// are missing transitions.
TransDummyCont = Content.MakeContent(null, "DUMMY CONTENT FOR TRANSITION MIGRATION", null, null, null);
}
// Process Procedures // Process Procedures
Item itm = MigrateProcedures(cn,pth,docver); Item itm = null;
if (convertProcedures || docver.VersionType == (int)VEPROMS.CSLA.Library.VersionTypeEnum.WorkingDraft)
itm = MigrateProcedures(cn, pth, docver, convertProcedures);
// Show any Missing Transtitons (i.e. Transitions which have not been processed) // Show any Missing Transtitons (i.e. Transitions which have not been processed)
ShowMissingTransitions(); if (convertProcedures)
log.InfoFormat("Completed Migration of {0}", pth); {
MessageBox.Show("Completed Migration of " + pth); ShowMissingTransitions();
rofst.Close(); log.InfoFormat("Completed Migration of {0}", pth);
MessageBox.Show("Completed Migration of " + pth);
rofst.Close();
dicTrans_ItemDone.Clear();
dicTrans_ItemDone = null;
}
cn.Close(); cn.Close();
dicTrans_ItemDone.Clear();
dicTrans_ItemDone = null;
if (itm != null) if (itm != null)
{ {
docver.MyItem = itm; docver.MyItem = itm;
docver.Title = ""; if (convertProcedures) docver.Title = ""; // clearing this tell us this docver (path) was converted?
if (!docver.IsSavable) ErrorRpt.ErrorReport(docver); if (!docver.IsSavable) ErrorRpt.ErrorReport(docver);
docver.Save(); docver.Save();
} }

View File

@ -9,6 +9,7 @@ namespace DataLoader
{ {
public static class ErrorRpt public static class ErrorRpt
{ {
public static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public static void ErrorReport(IVEHasBrokenRules mybr) public static void ErrorReport(IVEHasBrokenRules mybr)
{ {
string smess = mybr.GetType().Name; string smess = mybr.GetType().Name;
@ -22,7 +23,8 @@ namespace DataLoader
smess += "\n" + br.Property + " - " + br.Description; smess += "\n" + br.Property + " - " + br.Description;
} }
} }
MessageBox.Show(smess); //MessageBox.Show(smess);
_MyLog.Error(smess);
} }
} }
} }