enhancement
major
minor
major
minor
critical
#26850
Enums of a module disappear when creating and deleting enums in this module
The problem occurs regardless of whether you are editing in the table view or in the chart.
Cause
If the application’s database is deleted and then restarted, only the tl:TLModel is created in the tl:ModelService and saved to the database. Loading and caching parts of the model—such as classes, enumerations, and associations—does not occur directly when the tl:ModelService starts.
For example, if the user logs into a demo application, the tl:TableConfigurationProvider for the tl:DemoStructuredEditComponent is created, among other things. To do this, it searches the current tl:TLModel in all modules and singletons for the type me:DemoTypes.All, because that is what is displayed in this table. The SecurityRoot singleton of the SecurityStructure module is a tl:StructureElement. If the type being searched for has not yet been found, the tl:StructureElement SecurityRoot then searches for the type me:DemoTypes.All.
To do this, the corresponding (local) classes, enumerations, etc., are first determined. The enumerations, for example, are calculated using a tl:AssociationCache. Since none exist at this point, a tl:IndexedLinkQuery is used to search for matching enumerations in order to create and populate a new cache. The tl:IndexedLinkQuery itself retrieves its query from a QueryCache in the tl:KnowledgeBase. Assuming that no enumerations have been resolved in the model at this point, this cache contains no query for “enumerations.” Consequently, a new query is created. However, for the “target type” tl:StructureElement, (local) enumerations can never exist. A tl:EmptyCompiledQuery is returned. The new query is then stored in the KnowledgeBase query cache. This is problematic.
If the user creates new enumerations in the application, they are successfully created and persisted; however, the GUI, for example, cannot be updated because the cache cannot find any enumerations due to the tl:EmptyCompiledQuery. To the user, it appears as though no enumerations exist, even though “only” the AssociationCache is corrupted.
If the application is restarted, the remaining parts of the model are loaded into the cache when the tl:ModelService starts. In particular, a new search query is created for the KB query cache. tl:TLModule is used as the “target type” instead of StructureElement. The constructed query is, in fact, the one that is “always” desired at this point to find the appropriate enumerations in the corresponding module.
Test
Delete the database. Start the application. In the Model Editor, for example, add an enumeration in DemoTypes. The existing enumerations and the new one should be displayed in the type tree under the DemoTypes node.