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

[41] Use EMF's intrinsicIDToEObjectMap if present #47

Merged
merged 1 commit into from
Jun 26, 2024

Conversation

pcdavid
Copy link
Member

@pcdavid pcdavid commented Jun 26, 2024

The previous commit (1f44029) completely disabled EMF's default getEObjectByID in favor of using our own JSONResourceImpl-specific id map. However there are cases where we still want to lookup elements by their intrinsic (modeled) id instead of the IDManager-provided one, without incurring the cost of an eAllContents() on failure.

This change allows for this to work, as long as the JSONResourceImpl has been setup with a non-null intrinsicIDToEObjectMap. For example right after the resource creation:

((ResourceImpl) resource).setIntrinsicIDToEObjectMap(new HashMap<>());

Once this is done, any new object added to the resource will get its intrinsic id cached in this map (see ResourceImpl.attachedHelper()) and JsonResourceImpl.getEObjectById will find it there (if present) while still bypassing the whole eAllContents() search in super.getEObjectByID(id).

Bug: #41

The previous commit (1f44029) completely disabled EMF's default
getEObjectByID in favor of using our own JSONResourceImpl-specific id
map. However there are cases where we still want to lookup elements by
their intrinsic (modeled) id instead of the IDManager-provided one,
without incurring the cost of an eAllContents() on failure.

This change allows for this to work, as long as the JSONResourceImpl
has been setup with a non-null intrinsicIDToEObjectMap. For example
right after the resource creation:

  ((ResourceImpl) resource).setIntrinsicIDToEObjectMap(new HashMap<>());

Once this is done, any new object added to the resource will get its
intrinsic id cached in this map (see ResourceImpl.attachedHelper())
and JsonResourceImpl.getEObjectById will find it there (if present)
while still bypassing the whole eAllContents() search in
super.getEObjectByID(id).

Bug: #41
Signed-off-by: Pierre-Charles David <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant