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 Item MigrateDocVersion(DocVersion docver)
{
return MigrateDocVersion(docver, true);
}
private OutsideTransition _OutTran;
public Item MigrateDocVersion(DocVersion docver, bool convertProcedures)
{
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");
// load rofst (use it later)....
rofst = new ROFST(pth + "\\ro.fst");
// Migrate library documents
MigrateLibDocs(cn, pth);
// Initialize Dictionaries
dicTrans_ItemDone = new Dictionary<string, Item>();
dicTrans_ItemIds = new Dictionary<string, Item>();
// 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);
if (convertProcedures)
{
_OutTran = new OutsideTransition(cn);
// load rofst (use it later)....
rofst = new ROFST(pth + "\\ro.fst");
// Migrate library documents
MigrateLibDocs(cn, pth);
// Initialize Dictionaries
dicTrans_ItemDone = 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'
// 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
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)
ShowMissingTransitions();
log.InfoFormat("Completed Migration of {0}", pth);
MessageBox.Show("Completed Migration of " + pth);
rofst.Close();
if (convertProcedures)
{
ShowMissingTransitions();
log.InfoFormat("Completed Migration of {0}", pth);
MessageBox.Show("Completed Migration of " + pth);
rofst.Close();
dicTrans_ItemDone.Clear();
dicTrans_ItemDone = null;
}
cn.Close();
dicTrans_ItemDone.Clear();
dicTrans_ItemDone = null;
if (itm != null)
{
docver.MyItem = itm;
docver.Title = "";
if (convertProcedures) docver.Title = ""; // clearing this tell us this docver (path) was converted?
if (!docver.IsSavable) ErrorRpt.ErrorReport(docver);
docver.Save();
}

View File

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