Detail
#28071
Deletion of inline composition elements in the form fails if deleted object triggers further deletions
Background
The following model:
"A "s have "B "s and "B "s have "C "s. Each ordered as a composition, multiple values. All classes have a "name" attribute of type String.
A form shows an instance of A with the fields "name" and "B "s. "B "s are displayed as a table that only has the column "name":
The form context of the form is built recursively via the composition hierarchy, so in addition to the fields of A, it also contains those of the linked "B "s and the contained "C "s.
Problem
If a row (an instance of B) is deleted from the table, saving the change fails because the fields of all linked instances of C are also contained in the form context and are checked for modifiability, although these instances were deleted as parts of B and therefore cannot be modified in principle:
Caused by: com.top_logic.knowledge.wrap.exceptions.WrapperRuntimeException: Target object is deleted: DeletedObject(DBKnowledgeObject[wrapper: AttributedWrapper(type:Test:C, id: GenericObject:623170, name: A1.B1.C3)]) at com.top_logic.element.meta.AttributeOperations.checkAlive(AttributeOperations.java:346) at com.top_logic.element.meta.AttributeOperations.checkUpdate(AttributeOperations.java:240) at com.top_logic.element.meta.AttributeUpdate$1.checkUpdate(AttributeUpdate.java:109) at com.top_logic.element.meta.AttributeUpdate.checkUpdate(AttributeUpdate.java:681) at com.top_logic.element.meta.form.overlay.FormObjectOverlay.store(FormObjectOverlay.java:303) at com.top_logic.element.meta.AttributeUpdateContainer.store(AttributeUpdateContainer.java:659) at com.top_logic.element.meta.form.AttributeFormContext.store(AttributeFormContext.java:143) at com.top_logic.element.meta.form.component.AbstractApplyAttributedCommandHandler.saveMetaAttributes(AbstractApplyAttributedCommandHandler.java:48) at com.top_logic.element.meta.form.component.DefaultApplyAttributedCommandHandler.storeChanges(DefaultApplyAttributedCommandHandler.java:29) at com.top_logic.layout.form.component.AbstractApplyCommandHandler.applyChanges(AbstractApplyCommandHandler.java:196)
Note: In order to reproduce the problem, further references with a set deletion strategy are required, which result in other objects being deleted when parts are deleted from compositions. See test case.
The problem can also be reproduced in the instance tab:
Caused by: com.top_logic.knowledge.wrap.exceptions.WrapperRuntimeException: Target object is deleted: DeletedObject(DBKnowledgeObject[wrapper: AttributedWrapper(type:Test:C, id: GenericObject:623170, name: A1.B1.C3)]) at com.top_logic.element.meta.AttributeOperations.checkAlive(AttributeOperations.java:346) at com.top_logic.element.meta.AttributeOperations.checkUpdate(AttributeOperations.java:240) at com.top_logic.element.meta.AttributeUpdate$1.checkUpdate(AttributeUpdate.java:109) at com.top_logic.element.meta.AttributeUpdate.checkUpdate(AttributeUpdate.java:681) at com.top_logic.element.meta.form.overlay.FormObjectOverlay.store(FormObjectOverlay.java:303) at com.top_logic.element.meta.AttributeUpdateContainer.store(AttributeUpdateContainer.java:659) at com.top_logic.element.meta.form.AttributeFormContext.store(AttributeFormContext.java:143) at com.top_logic.element.layout.grid.DefaultGridApplyHandler.storeChanges(DefaultGridApplyHandler.java:30) at com.top_logic.element.layout.grid.GridComponent.storeRowValues(GridComponent.java:1363)
Test
- /com.top_logic.demo/src/test/java/test/com/top_logic/demo/scripted/model/attribute/composition/TestDeleteNestedCompositions.script.xml