|
1 | 1 | /******************************************************************************* |
2 | | - * Copyright 2011-2017 Data Access Technologies, Inc. (Model Driven Solutions) |
| 2 | + * Copyright 2011-2018 Data Access Technologies, Inc. (Model Driven Solutions) |
3 | 3 | * All rights reserved worldwide. This program and the accompanying materials |
4 | 4 | * are made available for use under the terms of the GNU General Public License |
5 | 5 | * (GPL) version 3 that accompanies this distribution and is available at |
|
19 | 19 | import org.modeldriven.alf.syntax.common.ElementReference; |
20 | 20 | import org.modeldriven.alf.syntax.statements.Block; |
21 | 21 | import org.modeldriven.alf.syntax.units.ExternalNamespace; |
| 22 | +import org.modeldriven.alf.syntax.units.ImportReference; |
22 | 23 | import org.modeldriven.alf.syntax.units.NamespaceDefinition; |
23 | 24 | import org.modeldriven.alf.syntax.units.OperationDefinition; |
24 | 25 | import org.modeldriven.alf.syntax.units.RootNamespace; |
25 | | - |
| 26 | +import org.modeldriven.alf.syntax.units.UnitDefinition; |
26 | 27 | import org.modeldriven.alf.uml.*; |
27 | 28 |
|
28 | 29 | import java.util.ArrayList; |
@@ -255,6 +256,22 @@ public List<Element> mapBody() throws MappingError { |
255 | 256 | } |
256 | 257 |
|
257 | 258 | this.otherElements = ActivityDefinitionMapping.addElements(activity, elements, body, this); |
| 259 | + |
| 260 | + // If the operation definition has a subunit, then map any import references for |
| 261 | + // the subunit to imports on the operation method. |
| 262 | + UnitDefinition subunit = definition.getSubunit(); |
| 263 | + if (subunit != null) { |
| 264 | + for (ImportReference importReference: subunit.getImport()) { |
| 265 | + FumlMapping mapping = this.fumlMap(importReference); |
| 266 | + for (Element element: mapping.getModelElements()) { |
| 267 | + if (element instanceof ElementImport) { |
| 268 | + activity.addElementImport((ElementImport)element); |
| 269 | + } else if (element instanceof PackageImport) { |
| 270 | + activity.addPackageImport((PackageImport)element); |
| 271 | + } |
| 272 | + } |
| 273 | + } |
| 274 | + } |
258 | 275 | } |
259 | 276 |
|
260 | 277 | return this.otherElements; |
|
0 commit comments