Skip to content

Commit b644cdf

Browse files
committed
Access Type of Components
1 parent 22f53a0 commit b644cdf

File tree

6 files changed

+25
-6
lines changed

6 files changed

+25
-6
lines changed

framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/LegacyModelExtractionStateByArCoTL.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,7 @@ private static ImmutableList<ModelInstance> initArchitectureInstances(Architectu
6060
for (ArchitectureItem architectureItem : architectureModel.getEndpoints()) {
6161
switch (architectureItem) {
6262
// TODO Use MetaModel
63-
case ArchitectureComponent component -> instances.add(new ModelInstanceImpl(component.getName(), component.getSubcomponents().isEmpty() ?
64-
"Component" :
65-
"CompositeComponent", component.getId()));
63+
case ArchitectureComponent component -> instances.add(new ModelInstanceImpl(component.getName(), component.getType(), component.getId()));
6664
case ArchitectureInterface ignored -> logger.debug("Skipping .. ArchitectureInterface not supported yet");
6765
case ArchitectureMethod ignored -> logger.debug("Skipping .. ArchitectureMethod not supported yet");
6866
}

framework/common/src/main/java/edu/kit/kastel/mcse/ardoco/core/api/models/arcotl/architecture/ArchitectureComponent.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,15 @@ public final class ArchitectureComponent extends ArchitectureItem {
1616
private final SortedSet<ArchitectureInterface> providedInterfaces;
1717

1818
private final SortedSet<ArchitectureInterface> requiredInterfaces;
19+
private final String type;
1920

2021
public ArchitectureComponent(String name, String id, SortedSet<ArchitectureComponent> subcomponents, SortedSet<ArchitectureInterface> providedInterfaces,
21-
SortedSet<ArchitectureInterface> requiredInterfaces) {
22+
SortedSet<ArchitectureInterface> requiredInterfaces, String type) {
2223
super(name, id);
2324
this.subcomponents = subcomponents;
2425
this.providedInterfaces = providedInterfaces;
2526
this.requiredInterfaces = requiredInterfaces;
27+
this.type = type;
2628
}
2729

2830
/**
@@ -54,6 +56,15 @@ public SortedSet<ArchitectureInterface> getRequiredInterfaces() {
5456
return requiredInterfaces;
5557
}
5658

59+
/**
60+
* Returns the type of this component as specified in the meta model.
61+
*
62+
* @return the type of this component
63+
*/
64+
public String getType() {
65+
return type;
66+
}
67+
5768
@Override
5869
public String toString() {
5970
return "Component: " + getName();

stages/model-provider/src/main/java/edu/kit/kastel/mcse/ardoco/core/models/connectors/generators/architecture/pcm/PcmExtractor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ private static List<ArchitectureComponent> extractComponents(PcmModel originalMo
8383
requiredInterfaces.add(modelInterface);
8484
}
8585
ArchitectureComponent modelComponent = new ArchitectureComponent(originalComponent.getEntityName(), originalComponent.getId(), subcomponents,
86-
providedInterfaces, requiredInterfaces);
86+
providedInterfaces, requiredInterfaces, originalComponent.getType());
8787
components.add(modelComponent);
8888
}
8989
return components;

stages/model-provider/src/main/java/edu/kit/kastel/mcse/ardoco/core/models/connectors/generators/architecture/uml/UmlExtractor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ private static List<ArchitectureComponent> extractComponents(UmlModel originalMo
8181
requiredInterfaces.add(modelInterface);
8282
}
8383
ArchitectureComponent modelComponent = new ArchitectureComponent(originalComponent.getName(), originalComponent.getId(), subcomponents,
84-
providedInterfaces, requiredInterfaces);
84+
providedInterfaces, requiredInterfaces, originalComponent.getType());
8585
components.add(modelComponent);
8686
}
8787
return components;

stages/model-provider/src/main/java/edu/kit/kastel/mcse/ardoco/core/models/connectors/generators/architecture/uml/parser/UmlElement.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@ abstract class UmlElement {
99

1010
protected final String id;
1111
protected final String name;
12+
private final String type;
1213

1314
UmlElement(PackagedElement element) {
1415
this.element = element;
1516
this.id = element.getId();
1617
this.name = element.getName();
18+
this.type = element.getType();
1719
}
1820

1921
public final String getId() {
@@ -23,4 +25,8 @@ public final String getId() {
2325
public final String getName() {
2426
return name;
2527
}
28+
29+
public final String getType() {
30+
return type;
31+
}
2632
}

stages/model-provider/src/main/java/edu/kit/kastel/mcse/ardoco/core/models/connectors/generators/architecture/uml/parser/xmlelements/PackagedElement.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,8 @@ public List<Reference> getInterfaceRealizations() {
5656
public List<Reference> getUsages() {
5757
return usages;
5858
}
59+
60+
public String getType() {
61+
return type;
62+
}
5963
}

0 commit comments

Comments
 (0)