Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change recorder generates incomplete change list on cascade deletion #71

Open
JanWittler opened this issue Jul 4, 2023 · 0 comments
Open
Labels
bug Something isn't working

Comments

@JanWittler
Copy link
Contributor

If there is an element a containing the element b and a is deleted, both a and b get deleted because b is contained by a. However, the EMF notification system does not generate any notifications for deleted objects (nor created). As a result, we generate the delete changes ourselves when finishing change recording in the ChangeRecorder.
With #48 we added support for generating delete changes for cascade deleted elements. However, this is not complete as any deletion is preceded by removing the deleted element from its container.
This becomes a problem when applying changes backwards. For a cascade deleted element, it is created when applying the delete change backwards but never inserted into its container as that particular change (i.e. some RemoveEReference / ReplaceSingleValuedEReference) is missing.

Expected result

Recording deletion of a containing b yields change sequence: DeleteEObject(b), RemoveFromContainment(b), DeleteEObject(a) where RemoveFromContainment(_) has to be the appropriate change type depending on the feature that b is contained by (single-/multi-value).

Actual result

Recording deletion of a contains b yield change sequence: DeleteEObject(b), DeleteEObject(a).

Misc

  • The container and contained in feature of an element are accessible through EObject::eContainer() and EObject::eContainingFeature
  • The problem currently never appears as we apply changes only backwards when generating hierarchical IDs. As we cache deleted elements there instead of creating new ones (what would be the proper way) the problem does not occur.
@JanWittler JanWittler added the bug Something isn't working label Jul 4, 2023
bjthehun added a commit to bjthehun/Vitruv-Change that referenced this issue Oct 31, 2024
createDeleteChanges (formerly createDeleteChange) creates, for each
deleted object that has a container, a

1. RemoveReferenceChange, if this containment relationship is
many(=multi)-valued,
2. ReplaceSingleReferenceChange, if the containment only allows one
contained object at at time.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant