Skip to content

Commit 722120a

Browse files
committed
Issue #32 - Implemented mapping of profile application.
1 parent 950d4f6 commit 722120a

File tree

6 files changed

+112735
-112720
lines changed

6 files changed

+112735
-112720
lines changed

org.modeldriven.alf.eclipse/UML/_RunTests.uml

Lines changed: 112706 additions & 112706 deletions
Large diffs are not rendered by default.
206 Bytes
Binary file not shown.
206 Bytes
Binary file not shown.

org.modeldriven.alf/src/org/modeldriven/alf/fuml/mapping/FumlMapping.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright 2011-2015 Data Access Technologies, Inc. (Model Driven Solutions)
2+
* Copyright 2011-2016 Data Access Technologies, Inc. (Model Driven Solutions)
33
* All rights reserved worldwide. This program and the accompanying materials
44
* are made available for use under the terms of the GNU General Public License
55
* (GPL) version 3 that accompanies this distribution and is available at
@@ -138,6 +138,10 @@ public boolean supportsTemplates() {
138138
return getElementFactory().supportsTemplates();
139139
}
140140

141+
public boolean supportsProfileApplication() {
142+
return getElementFactory().supportsProfileApplication();
143+
}
144+
141145
public ActivityGraph createActivityGraph() {
142146
return new ActivityGraph(getElementFactory());
143147
}

org.modeldriven.alf/src/org/modeldriven/alf/fuml/mapping/units/PackageDefinitionMapping.java

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/*******************************************************************************
32
* Copyright 2011-2016 Data Access Technologies, Inc. (Model Driven Solutions)
43
* All rights reserved worldwide. This program and the accompanying materials
@@ -52,22 +51,26 @@ protected Package mapPackage() {
5251

5352
public void mapTo(Package package_) throws MappingError {
5453
PackageDefinition packageDefinition = this.getPackageDefinition();
55-
if (packageDefinition != null &&
56-
!packageDefinition.getAppliedProfile().isEmpty()) {
57-
this.throwError("Cannot map profile application to fUML for package " +
58-
packageDefinition.getName());
59-
}
60-
61-
if (package_ instanceof Model) {
62-
ElementReference standardProfile = RootNamespace.getRootScope().getStandardProfile();
63-
if (standardProfile != null) {
64-
Profile profile = (Profile)standardProfile.getImpl().getUml();
65-
if (profile != null) {
54+
if (this.supportsProfileApplication()){
55+
if (packageDefinition != null) {
56+
for (Profile profile: packageDefinition.getAppliedProfile()) {
6657
ProfileApplication profileApplication = this.create(ProfileApplication.class);
6758
profileApplication.setAppliedProfile(profile);
6859
package_.addProfileApplication(profileApplication);
6960
}
7061
}
62+
63+
if (package_ instanceof Model) {
64+
ElementReference standardProfile = RootNamespace.getRootScope().getStandardProfile();
65+
if (standardProfile != null) {
66+
Profile profile = (Profile)standardProfile.getImpl().getUml();
67+
if (profile != null) {
68+
ProfileApplication profileApplication = this.create(ProfileApplication.class);
69+
profileApplication.setAppliedProfile(profile);
70+
package_.addProfileApplication(profileApplication);
71+
}
72+
}
73+
}
7174
}
7275

7376
super.mapTo(package_);

org.modeldriven.alf/src/org/modeldriven/alf/uml/ElementFactory.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,16 @@ static private Constructor<?> getConstructor(Class<?> class_) {
113113
}
114114

115115
public boolean supportsTemplates() {
116+
return this.supportsElement("RedefinableTemplateSignature");
117+
}
118+
119+
public boolean supportsProfileApplication() {
120+
return this.supportsElement("ProfileApplication");
121+
}
122+
123+
public boolean supportsElement(String name) {
116124
try {
117-
Class.forName(this.getWrapperClassName("RedefinableTemplateSignature"));
125+
Class.forName(this.getWrapperClassName(name));
118126
return true;
119127
} catch (ClassNotFoundException e) {
120128
return false;

0 commit comments

Comments
 (0)