Skip to content

Commit 21f74b8

Browse files
committed
KERML_-119 Updated adapters for Annotation and AnnotatingElement.
1 parent 9c3e4aa commit 21f74b8

5 files changed

Lines changed: 4 additions & 55 deletions

File tree

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*******************************************************************************
22
* SysML 2 Pilot Implementation
3-
* Copyright (c) 2022, 2024 Model Driven Solutions, Inc.
3+
* Copyright (c) 2022, 2024, 2025 Model Driven Solutions, Inc.
44
*
55
* This program is free software: you can redistribute it and/or modify
66
* it under the terms of the GNU Lesser General Public License as published by
@@ -19,11 +19,7 @@
1919
*******************************************************************************/
2020
package org.omg.sysml.adapter;
2121

22-
import org.eclipse.emf.common.util.EList;
23-
import org.eclipse.emf.ecore.util.InternalEList;
2422
import org.omg.sysml.lang.sysml.AnnotatingElement;
25-
import org.omg.sysml.lang.sysml.Annotation;
26-
import org.omg.sysml.lang.sysml.Relationship;
2723

2824
public class AnnotatingElementAdapter extends ElementAdapter {
2925

@@ -34,25 +30,4 @@ public AnnotatingElementAdapter(AnnotatingElement element) {
3430
public AnnotatingElement getTarget() {
3531
return (AnnotatingElement)super.getTarget();
3632
}
37-
38-
public static void transformAnnotatingElement(AnnotatingElement annotatingElement) {
39-
EList<Annotation> annotations = annotatingElement.getAnnotation();
40-
if (annotations.isEmpty()) {
41-
Relationship owningRelationship = annotatingElement.getOwningRelationship();
42-
if (owningRelationship instanceof Annotation) {
43-
annotations.add((Annotation)owningRelationship);
44-
} else {
45-
annotatingElement.getOwnedRelationship().stream().
46-
filter(Annotation.class::isInstance).
47-
forEachOrdered(a->((InternalEList<Annotation>)annotations).basicAdd((Annotation)a, null));
48-
}
49-
}
50-
}
51-
52-
@Override
53-
public void doTransform() {
54-
super.doTransform();
55-
transformAnnotatingElement(getTarget());
56-
}
57-
5833
}

org.omg.sysml/src/org/omg/sysml/adapter/AnnotationAdapter.java

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*******************************************************************************
22
* SysML 2 Pilot Implementation
3-
* Copyright (c) 2024 Model Driven Solutions, Inc.
3+
* Copyright (c) 2024, 2025 Model Driven Solutions, Inc.
44
* Copyright (c) 2024 Budapest University of Technology and Economics
55
*
66
* This program is free software: you can redistribute it and/or modify
@@ -50,19 +50,6 @@ public void postProcess() {
5050
obj.setAnnotatedElement(owningRelatedElement);
5151
}
5252
}
53-
54-
// If there is no annotatingElement set, then set the AnnotatingElement to the owningRelatedElement,
55-
// if it is an AnnotatingElement, otherwise set it to the first ownedRelatedElement that is an
56-
// AnnotatingElement (if any).
57-
Object annotatingElement = obj.eGet(SysMLPackage.Literals.ANNOTATION__ANNOTATING_ELEMENT, false);
58-
if (annotatingElement == null) {
59-
Element owner = obj.getOwningRelatedElement();
60-
obj.setAnnotatingElement((AnnotatingElement)
61-
(owner instanceof AnnotatingElement? owner:
62-
obj.getOwnedRelatedElement().stream().
63-
filter(AnnotatingElement.class::isInstance).
64-
findFirst().orElse(null)));
65-
}
6653
}
6754

6855
}

org.omg.sysml/src/org/omg/sysml/adapter/ElementAdapter.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ public MetadataFeature getMetaclassFeature() {
6363
typing.setType(metaclass);
6464
typing.setTypedFeature(metaclassFeature);
6565
Annotation annotation = SysMLFactory.eINSTANCE.createAnnotation();
66-
annotation.setAnnotatingElement(metaclassFeature);
6766
annotation.setAnnotatedElement(element);
6867
metaclassFeature.getOwnedRelationship().add(typing);
6968
metaclassFeature.getOwnedRelationship().add(annotation);

org.omg.sysml/src/org/omg/sysml/adapter/MetadataFeatureAdapter.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*******************************************************************************
22
* SysML 2 Pilot Implementation
3-
* Copyright (c) 2022 Model Driven Solutions, Inc.
3+
* Copyright (c) 2022, 2025 Model Driven Solutions, Inc.
44
*
55
* This program is free software: you can redistribute it and/or modify
66
* it under the terms of the GNU Lesser General Public License as published by
@@ -46,11 +46,5 @@ protected String getDefaultSupertype() {
4646
protected List<Type> getBaseTypes() {
4747
return Collections.emptyList();
4848
}
49-
50-
@Override
51-
public void doTransform() {
52-
super.doTransform();
53-
AnnotatingElementAdapter.transformAnnotatingElement(getTarget());
54-
}
5549

5650
}

org.omg.sysml/src/org/omg/sysml/adapter/MetadataUsageAdapter.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*******************************************************************************
22
* SysML 2 Pilot Implementation
3-
* Copyright (c) 2022 Model Driven Solutions, Inc.
3+
* Copyright (c) 2022, 2025 Model Driven Solutions, Inc.
44
*
55
* This program is free software: you can redistribute it and/or modify
66
* it under the terms of the GNU Lesser General Public License as published by
@@ -38,10 +38,4 @@ protected String getDefaultSupertype() {
3838
return getDefaultSupertype("base");
3939
}
4040

41-
@Override
42-
public void doTransform() {
43-
super.doTransform();
44-
AnnotatingElementAdapter.transformAnnotatingElement(getTarget());
45-
}
46-
4741
}

0 commit comments

Comments
 (0)