1
2
3
4
5 package org.andromda.metafacades.emf.uml22;
6
7 import java.util.Collection;
8 import org.andromda.core.metafacade.MetafacadeBase;
9 import org.andromda.core.metafacade.ModelValidationMessage;
10 import org.andromda.metafacades.uml.GeneralizableElementFacade;
11 import org.andromda.metafacades.uml.GeneralizationFacade;
12 import org.apache.log4j.Logger;
13 import org.eclipse.uml2.uml.Generalization;
14
15
16
17
18
19
20
21
22
23
24
25 public abstract class GeneralizationFacadeLogic
26 extends ModelElementFacadeLogicImpl
27 implements GeneralizationFacade
28 {
29
30
31
32
33 protected Generalization metaObject;
34
35
36
37
38
39 protected GeneralizationFacadeLogic(Generalization metaObjectIn, String context)
40 {
41 super(metaObjectIn, getContext(context));
42 this.metaObject = metaObjectIn;
43 }
44
45
46
47
48 private static final Logger logger = Logger.getLogger(GeneralizationFacadeLogic.class);
49
50
51
52
53
54
55 private static String getContext(String context)
56 {
57 if (context == null)
58 {
59 context = "org.andromda.metafacades.uml.GeneralizationFacade";
60 }
61 return context;
62 }
63
64
65
66
67 @Override
68 public void resetMetafacadeContext(String context)
69 {
70 if (!this.contextRoot)
71 {
72 context = getContext(context);
73 setMetafacadeContext (context);
74 }
75 }
76
77
78
79
80
81 public boolean isGeneralizationFacadeMetaType()
82 {
83 return true;
84 }
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99 public final GeneralizableElementFacade getParent()
100 {
101 GeneralizableElementFacade getParent1r = null;
102
103 Object result = handleGetParent();
104 MetafacadeBase shieldedResult = this.shieldedElement(result);
105 try
106 {
107 getParent1r = (GeneralizableElementFacade)shieldedResult;
108 }
109 catch (ClassCastException ex)
110 {
111
112 GeneralizationFacadeLogic.logger.warn("incorrect metafacade cast for GeneralizationFacadeLogic.getParent GeneralizableElementFacade " + result + ": " + shieldedResult);
113 }
114
115 return getParent1r;
116 }
117
118
119
120
121
122 protected abstract Object handleGetParent();
123
124
125
126
127
128
129
130
131
132
133
134
135 public final GeneralizableElementFacade getChild()
136 {
137 GeneralizableElementFacade getChild2r = null;
138
139 Object result = handleGetChild();
140 MetafacadeBase shieldedResult = this.shieldedElement(result);
141 try
142 {
143 getChild2r = (GeneralizableElementFacade)shieldedResult;
144 }
145 catch (ClassCastException ex)
146 {
147
148 GeneralizationFacadeLogic.logger.warn("incorrect metafacade cast for GeneralizationFacadeLogic.getChild GeneralizableElementFacade " + result + ": " + shieldedResult);
149 }
150
151 return getChild2r;
152 }
153
154
155
156
157
158 protected abstract Object handleGetChild();
159
160
161
162
163
164 @Override
165 public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
166 {
167 super.validateInvariants(validationMessages);
168 }
169 }