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,10 +26,21 @@ 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");
if (convertProcedures)
{
_OutTran = new OutsideTransition(cn);
// load rofst (use it later).... // load rofst (use it later)....
rofst = new ROFST(pth + "\\ro.fst"); rofst = new ROFST(pth + "\\ro.fst");
// Migrate library documents // Migrate library documents
@ -37,26 +48,32 @@ namespace DataLoader
// Initialize Dictionaries // Initialize Dictionaries
dicTrans_ItemDone = new Dictionary<string, Item>(); dicTrans_ItemDone = new Dictionary<string, Item>();
dicTrans_ItemIds = new Dictionary<string, Item>(); dicTrans_ItemIds = new Dictionary<string, Item>();
dicTrans_MigrationErrors = new Dictionary<string, List<Item>>();
// Create a 'dummy' content record. This will be used for any transitions 'to' // 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 // that don't exist when dbf is processed. At end, use this to see if there
// are missing transitions. // are missing transitions.
TransDummyCont = Content.MakeContent(null, "DUMMY CONTENT FOR TRANSITION MIGRATION", null, null, null); 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)
if (convertProcedures)
{
ShowMissingTransitions(); ShowMissingTransitions();
log.InfoFormat("Completed Migration of {0}", pth); log.InfoFormat("Completed Migration of {0}", pth);
MessageBox.Show("Completed Migration of " + pth); MessageBox.Show("Completed Migration of " + pth);
rofst.Close(); rofst.Close();
cn.Close();
dicTrans_ItemDone.Clear(); dicTrans_ItemDone.Clear();
dicTrans_ItemDone = null; dicTrans_ItemDone = null;
}
cn.Close();
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);
} }
} }
} }