Skip to content

Commit 4ac6bb8

Browse files
authored
Merge pull request #287 from Systems-Modeling/ST6RI-455
ST6RI-455 Updated implementation for 2021-09 API client
2 parents a7b819b + de917dc commit 4ac6bb8

3 files changed

Lines changed: 21 additions & 21 deletions

File tree

21 KB
Binary file not shown.

org.omg.sysml/src/org/omg/sysml/util/traversal/facade/impl/ApiElementProcessingFacade.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@
3434
import org.omg.sysml.api.ProjectApi;
3535
import org.omg.sysml.lang.sysml.Element;
3636
import org.omg.sysml.model.Commit;
37-
import org.omg.sysml.model.ElementVersion;
37+
import org.omg.sysml.model.DataVersion;
3838
import okhttp3.OkHttpClient;
3939

4040
/**
4141
* This is an element-processing facade that uses the SysML v2 REST API to write Elements to a repository.
42-
* A change set of ElementVersions is constructed during traversal of the model. Once the traversal is
42+
* A change set of DataVersions is constructed during traversal of the model. Once the traversal is
4343
* completed, this change set can be committed to the repository.
4444
*
4545
* @author Ed Seidewitz
@@ -121,7 +121,7 @@ public void commit() {
121121
try {
122122
this.project = projectApi.postProject(this.project);
123123

124-
List<ElementVersion> changes = this.getVersions();
124+
List<DataVersion> changes = this.getVersions();
125125
Commit commit = new Commit().change(changes);
126126
// System.out.println(new org.omg.sysml.JSON().serialize(commit));
127127

org.omg.sysml/src/org/omg/sysml/util/traversal/facade/impl/JsonElementProcessingFacade.java

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
import org.eclipse.emf.ecore.EStructuralFeature;
3737
import org.omg.sysml.lang.sysml.Element;
3838
import org.omg.sysml.lang.sysml.util.SysMLLibraryUtil;
39-
import org.omg.sysml.model.ElementIdentity;
40-
import org.omg.sysml.model.ElementVersion;
39+
import org.omg.sysml.model.DataIdentity;
40+
import org.omg.sysml.model.DataVersion;
4141
import org.omg.sysml.model.Identified;
4242
import org.omg.sysml.util.traversal.Traversal;
4343
import org.omg.sysml.util.traversal.facade.ElementProcessingFacade;
@@ -48,7 +48,7 @@
4848

4949
/**
5050
* This is an element-processing facade that uses the SysML v2 REST API client to export Elements to JSON.
51-
* A list of ElementVersions is constructed during traversal of the model. Once the traversal is
51+
* A list of DataVersions is constructed during traversal of the model. Once the traversal is
5252
* completed, this change set can be exported to JSON.
5353
*
5454
* @author Ed Seidewitz
@@ -67,7 +67,7 @@ public class JsonElementProcessingFacade implements ElementProcessingFacade {
6767
protected int elementCount = 0;
6868
protected int dotCount = 0;
6969

70-
private final List<ElementVersion> versions = new ArrayList<>();
70+
private final List<DataVersion> versions = new ArrayList<>();
7171
private final Gson gson = new GsonBuilder().setPrettyPrinting().create();
7272

7373
/**
@@ -125,21 +125,21 @@ public boolean isIncludeDerived() {
125125
}
126126

127127
/**
128-
* Return the collection of ElementVersions that have been created from
128+
* Return the collection of DataVersions that have been created from
129129
* processed model Elements.
130130
*
131-
* @return the collection of ElementVersions that have been created
131+
* @return the collection of DataVersions that have been created
132132
*/
133-
List<ElementVersion> getVersions() {
133+
List<DataVersion> getVersions() {
134134
return Collections.unmodifiableList(this.versions);
135135
}
136136

137137
/**
138-
* Add an ElementVersion to the collection.
138+
* Add a DataVersion to the collection.
139139
*
140-
* @param elementVersion the ElementVersion to be added to the collection
140+
* @param elementVersion the DataVersion to be added to the collection
141141
*/
142-
protected void addVersion(ElementVersion elementVersion) {
142+
protected void addVersion(DataVersion elementVersion) {
143143
this.versions.add(elementVersion);
144144
}
145145

@@ -178,17 +178,17 @@ protected List<Identified> getIdentified(List<Element> elements) {
178178
}
179179

180180
/**
181-
* Create an ElementVersion for the given model Element including the values of all its non-derived
181+
* Create a DataVersion for the given model Element including the values of all its non-derived
182182
* attributes (unless it is a library model element, in which case only its non-referential attribute values
183-
* are included). If isIncludeDerived is true, also include derived attributes. The ID for the ElementVersion
183+
* are included). If isIncludeDerived is true, also include derived attributes. The ID for the DataVersion
184184
* uses the identifier from the model Element.
185185
*
186186
* @param element the source model Element as it is represented in Ecore
187-
* @return an ElementVersion with the API representation of the given Element as its data
187+
* @return a DataVersion with the API representation of the given Element as its data
188188
*/
189189
@SuppressWarnings("unchecked")
190-
protected org.omg.sysml.model.ElementVersion createElementVersion(Element element) {
191-
org.omg.sysml.model.Element apiElement = new org.omg.sysml.model.Element();
190+
protected org.omg.sysml.model.DataVersion createElementVersion(Element element) {
191+
org.omg.sysml.model.Data apiElement = new org.omg.sysml.model.Data();
192192
EClass eClass = element.eClass();
193193
apiElement.put("@type", eClass.getName());
194194
boolean isLibraryElement = SysMLLibraryUtil.isModelLibrary(element.eResource());
@@ -206,8 +206,8 @@ protected org.omg.sysml.model.ElementVersion createElementVersion(Element elemen
206206
apiElement.put(name, value);
207207
}
208208
}
209-
return new ElementVersion().data(apiElement).
210-
identity(new ElementIdentity().atId(UUID.fromString(element.getIdentifier())));
209+
return new DataVersion().payload(apiElement).
210+
identity(new DataIdentity().atId(UUID.fromString(element.getIdentifier())));
211211
}
212212

213213
/**
@@ -256,7 +256,7 @@ public Object process(Element element) {
256256
}
257257

258258
/**
259-
* Post-process the given Element by creating an ElementVersion for it and adding that
259+
* Post-process the given Element by creating a DataVersion for it and adding that
260260
* to the change set being constructed. This is done as a post-processing step so that
261261
* derived references to library model Elements not included in the change set can be
262262
* excluded.

0 commit comments

Comments
 (0)