Enhancement
Major
Detail
Major
Detail
Critical
#26850
Enums of a module disappear when creating and deleting enums in this module
The problem is independent of whether editing is done in the tabular view or in the diagram.
Cause
If the database of the application is deleted and then restarted, only the tl:TLModel is created in the tl:ModelService and stored in the database. The loading and caching of parts of the model, such as classes, enumerations and associations, does not take place directly when the tl:ModelService is started.
If the user logs into a demo application, for example, the tl:TableConfigurationProvider is created for the tl:DemoStructuredEditComponent. For this it searches in the current tl:TLModel in all modules and singletons for the type me:DemoTypes.All, because that is displayed in this table. The SecurityRoot singleton of the SecurityStructure module is a tl:StructureElement. In the tl:StructureElement SecurityRoot, if the searched type was not found yet, then the type me:DemoTypes.All is searched.
To do this, the corresponding (local) classes, enumerations, etc. are determined first. The enumerations are calculated e.g. with the help of a tl:AssociationCache. Since none exists at this point, a tl:IndexedLinkQuery is used to search for suitable enumerations in order to create and fill a new cache. The tl:IndexedLinkQuery itself gets its query from a QueryCache in the tl:KnowledgeBase. Assuming that no enumerations have been resolved in the model at this point, this does not contain a query for "enumerations". As a result, a new query is created. However, (local) enumerations can never exist for the "target type" tl:StructureElement. You get a tl:EmptyCompiledQuery. The new query is then stored in the KnowledgeBase QueryCache. This is bad.
If the user creates new enumerations in the application, they are successfully created and persisted, but the GUI, for example, cannot be updated because the cache cannot find enumerations based on the tl:EmptyCompiledQuery. To the user it looks like no enumerations exist, although "only" the AssociationCache is faulty.
If the application is restarted, the remaining parts of the model are loaded into the cache when the tl:ModelService is started. In particular, a new search query is created for the KB QueryCache. As "target type" tl:TLModule is used instead of StructureElement. The constructed query is de facto the one that is "always" desired at this point to find the matching enumerations in the corresponding module.
Test
Delete database. Start application. Add an enumeration in the Model Editor, e.g. in DemoTypes. The existing and the new enumeration should be displayed in the type tree under the DemoTypes node.