11
22/*******************************************************************************
3- * Copyright 2011-2013 Data Access Technologies, Inc. (Model Driven Solutions)
3+ * Copyright 2011-2017 Data Access Technologies, Inc. (Model Driven Solutions)
44 * All rights reserved worldwide. This program and the accompanying materials
55 * are made available for use under the terms of the GNU General Public License
66 * (GPL) version 3 that accompanies this distribution and is available at
1010
1111package org .modeldriven .alf .fuml .mapping .units ;
1212
13+ import org .modeldriven .alf .fuml .mapping .FumlMapping ;
14+ import org .modeldriven .alf .fuml .mapping .common .ElementReferenceMapping ;
1315import org .modeldriven .alf .fuml .mapping .units .ClassifierDefinitionMapping ;
1416import org .modeldriven .alf .mapping .MappingError ;
15-
17+ import org . modeldriven . alf . syntax . common . ElementReference ;
1618import org .modeldriven .alf .syntax .units .ClassifierTemplateParameter ;
17-
19+ import org .modeldriven .alf .uml .Activity ;
20+ import org .modeldriven .alf .uml .Association ;
21+ import org .modeldriven .alf .uml .Class_ ;
1822import org .modeldriven .alf .uml .Classifier ;
1923import org .modeldriven .alf .uml .DataType ;
2024import org .modeldriven .alf .uml .Element ;
25+ import org .modeldriven .alf .uml .Enumeration ;
2126import org .modeldriven .alf .uml .NamedElement ;
27+ import org .modeldriven .alf .uml .Signal ;
2228
2329import java .util .ArrayList ;
2430import java .util .List ;
@@ -30,6 +36,34 @@ public class ClassifierTemplateParameterMapping extends
3036
3137 @ Override
3238 public Classifier mapClassifier () {
39+ ClassifierTemplateParameter source = this .getClassifierTemplateParameter ();
40+
41+ for (ElementReference specializationReferent : source .getSpecializationReferent ()) {
42+ Classifier constrainingClassifier = (Classifier )specializationReferent .getImpl ().getUml ();
43+ if (constrainingClassifier == null ) {
44+ FumlMapping mapping = this .fumlMap (specializationReferent );
45+ if (mapping instanceof ElementReferenceMapping ) {
46+ mapping = ((ElementReferenceMapping )mapping ).getMapping ();
47+ }
48+ if (mapping instanceof ClassifierDefinitionMapping ) {
49+ constrainingClassifier = ((ClassifierDefinitionMapping )mapping ).getClassifierOnly ();
50+ }
51+ }
52+ if (constrainingClassifier instanceof Activity ) {
53+ return (Classifier )this .create (Activity .class );
54+ } else if (constrainingClassifier instanceof Class_ ) {
55+ return (Classifier )this .create (Class_ .class );
56+ } else if (constrainingClassifier instanceof DataType ) {
57+ return (Classifier )this .create (DataType .class );
58+ } else if (constrainingClassifier instanceof Association ) {
59+ return (Classifier )this .create (Association .class );
60+ } else if (constrainingClassifier instanceof Enumeration ) {
61+ return (Classifier )this .create (Enumeration .class );
62+ } else if (constrainingClassifier instanceof Signal ) {
63+ return (Classifier )this .create (Signal .class );
64+ }
65+ }
66+
3367 return (Classifier )this .create (DataType .class );
3468 }
3569
0 commit comments