1
2
3
4 package org.andromda.metafacades.uml;
5
6 /***
7 * <p>
8 * Represents a model element.
9 * </p>
10 *
11 * Metafacade interface to be used by AndroMDA cartridges.
12 */
13 public interface ModelElementFacade
14 {
15
16 /***
17 * Indicates the metafacade type (used for metafacade mappings).
18 *
19 * @return always <code>true</code>
20 */
21 public boolean isModelElementFacadeMetaType();
22
23 /***
24 * Provides any required initialization of the metafacade.
25 */
26 void initialize();
27
28 /***
29 * Gets the metafacade that acts as the <code>owner</code> of this metafacade.
30 * (for example: an operation is an owner of its parameters, etc). This is used
31 * by AndroMDA's validation framework to provide more context as to where the
32 * error has occurred.
33 */
34 public Object getValidationOwner();
35
36 /***
37 * Gets the name of the metafacade used within validation messages. This provides
38 * the full name of the metafacade.
39 */
40 public String getValidationName();
41
42 /***
43 * Performs validation of any invariants found on this model element
44 * and stores the messages within the <code>validationMessages</code>
45 * collection.
46 *
47 * @param validationMessages the collection of messages to which additional
48 * validation messages will be added if invariants are broken.
49 */
50 void validateInvariants(java.util.Collection validationMessages);
51
52
53 /***
54 * <p>
55 * Copies all tagged values from the given ModelElementFacade to
56 * this model element facade.
57 * </p>
58 */
59 public void copyTaggedValues(org.andromda.metafacades.uml.ModelElementFacade element);
60
61 /***
62 * <p>
63 * Finds the tagged value with the specified 'tagName'. In case
64 * there are more values the first one found will be returned.
65 * </p>
66 */
67 public java.lang.Object findTaggedValue(java.lang.String tagName);
68
69 /***
70 * <p>
71 * Returns all the values for the tagged value with the specified
72 * name. The returned collection will contains only String
73 * instances, or will be empty. Never null.
74 * </p>
75 */
76 public java.util.Collection findTaggedValues(java.lang.String tagName);
77
78 /***
79 * <p>
80 * Gets all constraints belonging to the model element.
81 * </p>
82 */
83 public java.util.Collection getConstraints();
84
85 /***
86 * <p>
87 * Returns the constraints of the argument kind that have been
88 * placed onto this model. Typical kinds are "inv", "pre" and
89 * "post". Other kinds are possible.
90 * </p>
91 */
92 public java.util.Collection getConstraints(java.lang.String kind);
93
94 /***
95 *
96 */
97 public java.lang.String getDocumentation(java.lang.String indent, int lineLength, boolean htmlStyle);
98
99 /***
100 * <p>
101 * This method returns the documentation for this model element,
102 * with the lines wrapped after the specified number of characters,
103 * values of less than 1 will indicate no line wrapping is
104 * required. By default paragraphs are returned as HTML.
105 * </p>
106 * <p>
107 * This method is equivalent to <code>getDocumentation(indent,
108 * lineLength, true)</code>.
109 * </p>
110 */
111 public java.lang.String getDocumentation(java.lang.String indent, int lineLength);
112
113 /***
114 * <p>
115 * Gets the documentation for the model element, The indent
116 * argument is prefixed to each line. By default this method wraps
117 * lines after 64 characters.
118 * </p>
119 * <p>
120 * This method is equivalent to <code>getDocumentation(indent,
121 * 64)</code>.
122 * </p>
123 */
124 public java.lang.String getDocumentation(java.lang.String indent);
125
126 /***
127 * <p>
128 * Returns the fully qualified name of the model element. The fully
129 * qualified name includes complete package qualified name of the
130 * underlying model element. If modelName is true, then the
131 * original name of the model element (the name contained within
132 * the model) will be the name returned, otherwise a name from a
133 * language mapping will be returned.
134 * </p>
135 */
136 public java.lang.String getFullyQualifiedName(boolean modelName);
137
138 /***
139 * <p>
140 * The fully qualified name of this model element.
141 * </p>
142 */
143 public java.lang.String getFullyQualifiedName();
144
145 /***
146 * <p>
147 * Returns the fully qualified name as a path, the returned value
148 * always starts with out a slash '/'.
149 * </p>
150 */
151 public java.lang.String getFullyQualifiedNamePath();
152
153 /***
154 * <p>
155 * Gets the unique identifier of the underlying model element.
156 * </p>
157 */
158 public java.lang.String getId();
159
160 /***
161 * <p>
162 * The language mappings that have been set for this model elemnt.
163 * </p>
164 */
165 public org.andromda.metafacades.uml.TypeMappings getLanguageMappings();
166
167 /***
168 *
169 */
170 public org.andromda.metafacades.uml.ModelFacade getModel();
171
172 /***
173 * <p>
174 * The name of the model element.
175 * </p>
176 */
177 public java.lang.String getName();
178
179 /***
180 * <p>
181 * Gets the package to which this model element belongs.
182 * </p>
183 */
184 public org.andromda.metafacades.uml.ModelElementFacade getPackage();
185
186 /***
187 * <p>
188 * Gets the package name (optionally providing the ability to
189 * retrieve the model name and not the mapped name).
190 * </p>
191 */
192 public java.lang.String getPackageName(boolean modelName);
193
194 /***
195 * <p>
196 * The name of this model element's package.
197 * </p>
198 */
199 public java.lang.String getPackageName();
200
201 /***
202 * <p>
203 * Returns the package as a path, the returned value always starts
204 * with out a slash '/'.
205 * </p>
206 */
207 public java.lang.String getPackagePath();
208
209 /***
210 * <p>
211 * Gets the root package for the model element.
212 * </p>
213 */
214 public org.andromda.metafacades.uml.PackageFacade getRootPackage();
215
216 /***
217 * <p>
218 * Gets the dependencies for which this model element is the
219 * source.
220 * </p>
221 */
222 public java.util.Collection getSourceDependencies();
223
224 /***
225 * <p>
226 * If this model element is the context of an activity graph, this
227 * represents that activity graph.
228 * </p>
229 */
230 public org.andromda.metafacades.uml.StateMachineFacade getStateMachineContext();
231
232 /***
233 * <p>
234 * The collection of ALL stereotype names for this model element.
235 * </p>
236 */
237 public java.util.Collection getStereotypeNames();
238
239 /***
240 * <p>
241 * Gets all stereotypes for this model element.
242 * </p>
243 */
244 public java.util.Collection getStereotypes();
245
246 /***
247 *
248 */
249 public java.util.Collection getTaggedValues();
250
251 /***
252 * <p>
253 * Gets the dependencies for which this model element is the
254 * target.
255 * </p>
256 */
257 public java.util.Collection getTargetDependencies();
258
259 /***
260 *
261 */
262 public java.lang.Object getTemplateParameter(java.lang.String parameterName);
263
264 /***
265 *
266 */
267 public java.util.Collection getTemplateParameters();
268
269 /***
270 * <p>
271 * The visibility (i.e. public, private, protected or package) of
272 * the model element, will attempt a lookup for these values in the
273 * language mappings (if any).
274 * </p>
275 */
276 public java.lang.String getVisibility();
277
278 /***
279 * <p>
280 * Returns true if the model element has the exact stereotype
281 * (meaning no stereotype inheritence is taken into account when
282 * searching for the stereotype), false otherwise.
283 * </p>
284 */
285 public boolean hasExactStereotype(java.lang.String stereotypeName);
286
287 /***
288 * <p>
289 * Returns true if the model element has the specified stereotype.
290 * If the stereotype itself does not match, then a search will be
291 * made up the steretype inheritance hiearchy, and if one of the
292 * stereotype's ancestors has a matching name this method will
293 * return true, false otherwise.
294 * </p>
295 * <p>
296 * For example, if we have a certain stereotype called
297 * <<exception>> and a model element has a stereotype called
298 * <<applicationException>> which extends <<exception>>, when
299 * calling this method with 'stereotypeName' defined as 'exception'
300 * the method would return true since <<applicationException>>
301 * inherits from <<exception>>. If you want to check if the model
302 * element has the exact stereotype, then use the method
303 * 'hasExactStereotype' instead.
304 * </p>
305 */
306 public boolean hasStereotype(java.lang.String stereotypeName);
307
308 /***
309 *
310 */
311 public boolean isBindingDependenciesPresent();
312
313 /***
314 * <p>
315 * Indicates if any constraints are present on this model element.
316 * </p>
317 */
318 public boolean isConstraintsPresent();
319
320 /***
321 *
322 */
323 public boolean isTemplateParametersPresent();
324
325 /***
326 * <p>
327 * Searches for the constraint with the specified 'name' on this
328 * model element, and if found translates it using the specified
329 * 'translation' from a translation library discovered by the
330 * framework.
331 * </p>
332 */
333 public java.lang.String translateConstraint(java.lang.String name, java.lang.String translation);
334
335 /***
336 * <p>
337 * Translates all constraints belonging to this model element with
338 * the given 'translation'.
339 * </p>
340 */
341 public java.lang.String[] translateConstraints(java.lang.String translation);
342
343 /***
344 * <p>
345 * Translates the constraints of the specified 'kind' belonging to
346 * this model element.
347 * </p>
348 */
349 public java.lang.String[] translateConstraints(java.lang.String kind, java.lang.String translation);
350
351 }