Skip to content

Commit

Permalink
[1301] Add support to serialize referenced object concrete type in JSON
Browse files Browse the repository at this point in the history
resource

Bug: #1301
Signed-off-by: Laurent Fasani <laurent.fasani@obeo.fr>
  • Loading branch information
lfasani committed Aug 29, 2022
1 parent 4b411ee commit 558514c
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ https://github.com/eclipse-sirius/sirius-components/issues/1231[#1231] [diagram]
- [ADR-64] Add support for a ToggableAreaContainer in forms
- [ADR-65] Add support for a tree widget in forms
- [ADR-66] Add a new "Related Elements" view
- [ADR-67] Add support for having inter model references

=== Breaking changes

Expand Down Expand Up @@ -87,6 +88,7 @@ The actual definition of the application (e.g. Sirius Web), which must provide a
- https://github.com/eclipse-sirius/sirius-components/issues/1300[#1300] [core] Rename SiriusWebJSONResourceFactoryImpl to
JSONResourceFactoryImpl.
- https://github.com/eclipse-sirius/sirius-emf-json/issues/9[#9] [releng] Update emfjson dependency.
- https://github.com/eclipse-sirius/sirius-components/issues/1301[#1301] [core] Add support for having inter model references.

=== New features

Expand Down
26 changes: 26 additions & 0 deletions doc/adrs/067_add_support_for_intermodel_reference.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
= ADR-067 - Add suport for intermodel references

== Context

The context is an EMF editing context with a ResourceSet containing at least two models and references between the models.
We should be have to load and save properly those models.

Currently, the URI used to add resources in the ResourceSet is the id of the document.
That is an issue because IllegalArgumentException are raised from some EMF code part (such as URI.resolve(URI)).
A valid URI must contain a scheme.
So the URI of the resources added to the resourceSet should be on the form:
`<scheme>:///<id de la resource>`

For the URI, corresponding to document added in the project, loaded as JSONResource, the URI scheme is arbitrary :
``sirius``
Example: `sirius:///a264d307-97d9-451d-90f5-46d38668b69c`

== Decision

For the URI, corresponding to document added in the project, loaded as JSONResource, the URI scheme is arbitrary :
``sirius``
Example: `sirius:///a264d307-97d9-451d-90f5-46d38668b69c`

== Status

Accepted.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public JsonResource createResource(URI uri) {
Map<String, Object> options = new HashMap<>();

options.put(JsonResource.OPTION_ID_MANAGER, new EObjectIDManager());
options.put(JsonResource.OPTION_DISPLAY_DYNAMIC_INSTANCES, true);

return new JsonResourceImpl(uri, options);
}
}

0 comments on commit 558514c

Please sign in to comment.