/// <summary> /// Initializes a new instance of GenerateReportDialog /// </summary> public GenerateReportDialog(ORMModel model) { InitializeComponent(); myModel = model; chkLbOptions.Sorted = true; chkLbOptions.Value = VerbalizationReportContent.All; }
/// <summary> /// Implements <see cref="IAnswerSurveyQuestion{SurveyErrorState}.AskQuestion"/> /// </summary> protected int AskErrorQuestion(object contextElement) { ORMModel model = ResolvedModel; return((model == null) ? -1 : (int)(ModelError.HasErrors(this, ModelErrorUses.DisplayPrimary, model.ModelErrorDisplayFilter) ? SurveyErrorState.HasError : SurveyErrorState.NoError)); }
/// <summary> /// AddRule: typeof(AssimilationMappingCustomizesFactType) /// </summary> private static void AssimilationMappingAddedRule(ElementAddedEventArgs e) { ORMCore.ORMModel ormModel = ((AssimilationMappingCustomizesFactType)e.ModelElement).FactType.Model; if (ormModel != null) { RebuildAbstractionModel(AbstractionModelIsForORMModel.GetAbstractionModel(ormModel)); } }
private static void ValidateDefaultReferenceModeNamingChanged(DefaultReferenceModeNamingCustomizesORMModel defaultReferenceModeNamingCustomizesORMModel) { if (null != defaultReferenceModeNamingCustomizesORMModel) { ORMCore.ORMModel model = defaultReferenceModeNamingCustomizesORMModel.ORMModel; if (null != model) { foreach (ConceptType conceptType in AbstractionModelHasConceptType.GetConceptTypeCollection( AbstractionModelIsForORMModel.GetAbstractionModel(model))) { ValidateConceptTypeNameChanged(conceptType); } } } }
/// <summary> /// Creates a new form to filter errors for the given ORM model. /// </summary> /// <param name="model">The orm model for which to filter errors.</param> public ModelErrorDisplayFilterForm(ORMModel model) { this.myModel = model; InitializeComponent(); LoadCategories(); ITree tree = new VirtualTree(); IBranch rootBranch = new InitialCategoriesBranch(myCategories, myErrors); tree.Root = rootBranch; #if VISUALSTUDIO_9_0 // MSBUG: Hack workaround crashing bug in VirtualTreeControl.OnToggleExpansion this.virtualTreeControl.ColumnPermutation = new ColumnPermutation(1, new int[]{0}, false); #endif this.virtualTreeControl.Tree = tree; }
/// <summary> /// Perfom initial gateway checks when an <see cref="ORMModel"/> is first considered for absorption /// </summary> /// <param name="model">The <see cref="ORMModel"/> to verify and exclude elements in</param> /// <param name="notifyExcluded">A callback notifying when an element is being excluded. Used during deserialization. Can be <see langword="null"/>.</param> public static void Initialize(ORMModel model, NotifyORMElementExcluded notifyExcluded) { AbstractionModel abstractionModel = AbstractionModelIsForORMModel.GetAbstractionModel(model); foreach (ObjectType objectType in model.ObjectTypeCollection) { if (!IsElementExcluded(objectType) && !ShouldConsiderObjectType(objectType, null, false)) { ExcludeObjectType(objectType, abstractionModel, true, notifyExcluded); } } foreach (FactType factType in model.FactTypeCollection) { if (!IsElementExcluded(factType) && !ShouldConsiderFactType(factType, null, false)) { ExcludeFactType(factType, abstractionModel, true, notifyExcluded); } } }
/// <summary> /// Sets the reference modes for the control /// </summary> /// <param name="model"></param> public void SetModel(ORMModel model) { if (model != myModel) { Store newStore = (model == null) ? null : model.Store; if (myStore != null && myStore != newStore && !myStore.Disposed) { ManageStoreEvents(myStore, EventHandlerAction.Remove); } if (newStore != null && newStore != myStore) { ManageStoreEvents(newStore, EventHandlerAction.Add); } this.myModel = model; this.myStore = newStore; int count = myIntrinsicReferenceModesList.Count; this.myIntrinsicReferenceModesList.Clear(); if (myModify != null && count != 0) { myModify(this, BranchModificationEventArgs.DeleteItems(this, 0, count)); } if (model != null) { foreach (ReferenceMode mode in model.ReferenceModeCollection) { IntrinsicReferenceMode intMode = mode as IntrinsicReferenceMode; if (intMode != null) { this.myIntrinsicReferenceModesList.Add(intMode); } } myIntrinsicReferenceModesList.Sort(); } count = myIntrinsicReferenceModesList.Count; if (myModify != null && count != 0) { myModify(this, BranchModificationEventArgs.InsertItems(this, -1, count)); } } }
/// <summary> /// Sets the Reference modes /// </summary> /// <param name="model"></param> public void SetModel(ORMModel model) { myHeaders.SetModel(model); }
public void SetModel(ORMModel model) { myRefModeEditor.SetModel(model); }
/// <summary> /// Sets the reference modes for the class /// </summary> /// <param name="model"></param> public void SetModel(ORMModel model) { myCustomBranch.SetModel(model); myIntrinsicBranch.SetModel(model); myReferenceModeKindsBranch.SetModel(model); }
/// <summary> /// Initializes a new instance of ObjectTypeListReport /// </summary> /// <param name="model">The model for the report</param> /// <param name="objectTypeList">The object type list.</param> /// <param name="snippets">The snippets.</param> /// <param name="headerSnippet">The header snippet.</param> /// <param name="footerSnippet">The footer snippet.</param> /// <param name="reportContent">Content of the report.</param> public ObjectTypeListReport( ORMModel model, IList<ObjectType> objectTypeList, IVerbalizationSets<ReportVerbalizationSnippetType> snippets, ReportVerbalizationSnippetType headerSnippet, ReportVerbalizationSnippetType footerSnippet, VerbalizationReportContent reportContent) { myModel = model; myObjectTypeList = objectTypeList; mySnippets = snippets; myHeaderSnippet = headerSnippet; myFooterSnippet = footerSnippet; myReportContent = reportContent; }
/// <summary> /// Initializes a new instance of ModelContextWrapper /// </summary> /// <param name="model">The context model to describe</param> /// <param name="openSnippet">The open snippet.</param> /// <param name="closeSnippet">The close snippet.</param> public ModelContextWrapper(ORMModel model, ReportVerbalizationSnippetType openSnippet, ReportVerbalizationSnippetType closeSnippet) { myModel = model; myOpenSnippet = openSnippet; myCloseSnippet = closeSnippet; }
/// <summary> /// Generates a report of the Verbalizations /// </summary> /// <param name="model">The model to report on</param> /// <param name="reportContent">The filter to apply to the report</param> /// <param name="baseDir">The base directory to output the report</param> public static void GenerateReport(ORMModel model, VerbalizationReportContent reportContent, string baseDir) { #region Member Variable const VerbalizationSign sign = VerbalizationSign.Positive | VerbalizationSign.AttemptOppositeSign; IORMToolServices toolServices = (IORMToolServices)model.Store; IDictionary<Type, IVerbalizationSets> snippetsDictionary = toolServices.GetVerbalizationSnippetsDictionary(HtmlReport.HtmlReportTargetName); IVerbalizationSets<ReportVerbalizationSnippetType> snippets = (IVerbalizationSets<ReportVerbalizationSnippetType>)snippetsDictionary[typeof(ReportVerbalizationSnippetType)]; IExtensionVerbalizerService extensionVerbalizer = toolServices.ExtensionVerbalizerService; Dictionary<IVerbalize, IVerbalize> alreadyVerbalized; Dictionary<object, object> locallyVerbalized = new Dictionary<object, object>(); Stream fileStream; TextWriter textWriter; VerbalizationCallbackWriter writer; #endregion // Member Variable #region ObjectType Reports ObjectType[] objectTypeList = null; if (0 != (reportContent & VerbalizationReportContent.ObjectTypes)) { alreadyVerbalized = new Dictionary<IVerbalize, IVerbalize>(); objectTypeList = model.ObjectTypeCollection.ToArray(); int objectTypeCount = objectTypeList.Length; if (objectTypeCount != 0) { Array.Sort<ObjectType>(objectTypeList, NamedElementComparer<ObjectType>.CurrentCulture); #region Object Type List Report fileStream = new FileStream(Path.Combine(baseDir, "ObjectTypeList.html"), FileMode.Create, FileAccess.ReadWrite); textWriter = new StreamWriter(fileStream); writer = new VerbalizationReportCallbackWriter(snippetsDictionary, textWriter); bool firstCall = true; IVerbalizeCustomChildren objectTypeListReport = new ObjectTypeListReport(model, objectTypeList, snippets, ReportVerbalizationSnippetType.ObjectTypeListHeader, ReportVerbalizationSnippetType.ObjectTypeListFooter, reportContent); VerbalizationHelper.VerbalizeChildren( objectTypeListReport.GetCustomChildVerbalizations(null, sign), null, snippetsDictionary, extensionVerbalizer, HtmlReport.HtmlReportTargetName, alreadyVerbalized, locallyVerbalized, sign, writer, false, ref firstCall); if (!firstCall) { writer.WriteDocumentFooter(); } textWriter.Flush(); textWriter.Close(); #endregion // Object Type List Report string objectTypeDir = Path.Combine(baseDir, "ObjectTypes"); if (!Directory.Exists(objectTypeDir)) { Directory.CreateDirectory(objectTypeDir); } #region Individual ObjectType Pages for (int i = 0; i < objectTypeCount; ++i) { bool firstCallPending = true; locallyVerbalized.Clear(); ObjectType objectType = objectTypeList[i]; fileStream = new FileStream(Path.Combine(objectTypeDir, AsFileName(objectType.Name) + ".html"), FileMode.Create, FileAccess.ReadWrite); textWriter = new StreamWriter(fileStream); writer = new VerbalizationReportCallbackWriter(snippetsDictionary, textWriter); ObjectTypePageReport objectTypePageReport = new ObjectTypePageReport(objectType, reportContent, snippets); VerbalizationHelper.VerbalizeChildren( ((IVerbalizeCustomChildren)objectTypePageReport).GetCustomChildVerbalizations(objectTypePageReport, sign), null, snippetsDictionary, extensionVerbalizer, HtmlReport.HtmlReportTargetName, alreadyVerbalized, locallyVerbalized, sign, writer, false, ref firstCallPending); if (!firstCallPending) { writer.WriteDocumentFooter(); } textWriter.Flush(); textWriter.Close(); } #endregion // Individual ObjectType Pages } } #endregion // ObjectType Reports #region Individual FactType Page Reports FactType[] factTypeList = null; if (0 != (VerbalizationReportContent.FactTypes & reportContent)) { factTypeList = model.FactTypeCollection.ToArray(); alreadyVerbalized = new Dictionary<IVerbalize, IVerbalize>(); int factCount = factTypeList.Length; if (factCount != 0) { string factTypeDir = Path.Combine(baseDir, "FactTypes"); if (!Directory.Exists(factTypeDir)) { Directory.CreateDirectory(factTypeDir); } Array.Sort<FactType>(factTypeList, NamedElementComparer<FactType>.CurrentCulture); for (int i = 0; i < factCount; ++i) { bool firstCallPending = true; alreadyVerbalized.Clear(); locallyVerbalized.Clear(); fileStream = new FileStream(Path.Combine(factTypeDir, AsFileName(factTypeList[i].Name) + ".html"), FileMode.Create, FileAccess.ReadWrite); textWriter = new StreamWriter(fileStream); writer = new VerbalizationReportCallbackWriter(snippetsDictionary, textWriter); FactTypePageReport factTypePageReport = new FactTypePageReport(factTypeList[i], reportContent, snippets); VerbalizationHelper.VerbalizeChildren( ((IVerbalizeCustomChildren)factTypePageReport).GetCustomChildVerbalizations(factTypePageReport, sign), null, snippetsDictionary, extensionVerbalizer, HtmlReport.HtmlReportTargetName, alreadyVerbalized, locallyVerbalized, sign, writer, false, ref firstCallPending); if (!firstCallPending) { writer.WriteDocumentFooter(); } textWriter.Flush(); textWriter.Close(); } } } #endregion // Individual FactType Page Reports #region Constraint Validation Report if (0 != (reportContent & VerbalizationReportContent.ValidationReport)) { alreadyVerbalized = new Dictionary<IVerbalize, IVerbalize>(); bool firstCall = true; if (factTypeList == null) { factTypeList = model.FactTypeCollection.ToArray(); Array.Sort<FactType>(factTypeList, NamedElementComparer<FactType>.CurrentCulture); } if (factTypeList.Length != 0) { fileStream = new FileStream(Path.Combine(baseDir, "ConstraintValidationReport.html"), FileMode.Create, FileAccess.ReadWrite); textWriter = new StreamWriter(fileStream); writer = new VerbalizationReportCallbackWriter(snippetsDictionary, textWriter); FactTypeConstraintValidationListReport factTypeConstraintValidationReport = new FactTypeConstraintValidationListReport(model, factTypeList, reportContent, snippets); VerbalizationHelper.VerbalizeChildren( ((IVerbalizeCustomChildren)factTypeConstraintValidationReport).GetCustomChildVerbalizations(factTypeConstraintValidationReport, sign), null, snippetsDictionary, extensionVerbalizer, HtmlReport.HtmlReportTargetName, alreadyVerbalized, null, sign, writer, false, ref firstCall); if (!firstCall) { writer.WriteDocumentFooter(); } textWriter.Flush(); textWriter.Close(); } } #endregion // Constraint Validation Report }
/// <summary> /// Initializes a new instance of FactTypeConstraintValidationListReport /// </summary> /// <param name="model">Context model</param> /// <param name="factTypeList">The fact type list.</param> /// <param name="reportContent">Content of the report.</param> /// <param name="snippets">The snippets.</param> public FactTypeConstraintValidationListReport(ORMModel model, IList<FactType> factTypeList, VerbalizationReportContent reportContent, IVerbalizationSets<ReportVerbalizationSnippetType> snippets) { myModel = model; myFactTypeList = factTypeList; mySnippets = snippets; myReportContent = reportContent; }