001// license-header java merge-point
002//
003// Attention: generated code (by Metafacade.vsl) - do not modify!
004//
005package org.andromda.metafacades.uml;
006
007import java.util.Collection;
008import org.andromda.core.metafacade.ModelValidationMessage;
009
010/**
011 * Represents a model element. It may be an Element or NamedElement. A named element is an element
012 * in a model that may have a name. An element is a constituent of a model. As such, it has the
013 * capability of owning other elements.
014 *
015 * Metafacade interface to be used by AndroMDA cartridges.
016 */
017public interface ModelElementFacade
018{
019    /**
020     * Indicates the metafacade type (used for metafacade mappings).
021     *
022     * @return boolean always <code>true</code>
023     */
024    public boolean isModelElementFacadeMetaType();
025
026    /**
027     * Provides any required initialization of the metafacade.
028     */
029    void initialize();
030
031    /**
032     * Gets the metafacade that acts as the <code>owner</code> of this metafacade.
033     * (for example: an operation is an owner of its parameters, etc). This is used
034     * by AndroMDA's validation framework to provide more context as to where the
035     * error has occurred.
036     * @return Object the Validation Owner
037     */
038    public Object getValidationOwner();
039
040    /**
041     * Gets the name of the metafacade used within validation messages.  This provides
042     * the full name of the metafacade.
043     * @return String the Validation Name
044     */
045    public String getValidationName();
046
047    /**
048     * Performs validation of any invariants found on this model element
049     * and stores the messages within the <code>validationMessages</code>
050     * collection.
051     *
052     * @param validationMessages the collection of messages to which additional
053     *        validation messages will be added if invariants are broken.
054     */
055    void validateInvariants(Collection<ModelValidationMessage> validationMessages);
056
057    /**
058     * Copies all tagged values from the given ModelElementFacade to this model element facade.
059     * @param element ModelElementFacade
060     */
061    public void copyTaggedValues(ModelElementFacade element);
062
063    /**
064     * Finds the tagged value with the specified 'tagName'. In case there are more values the first
065     * one found will be returned.
066     * @param tagName String
067     * @return Object
068     */
069    public Object findTaggedValue(String tagName);
070
071    /**
072     * Returns all the values for the tagged value with the specified name. The returned collection
073     * will contains only String instances, or will be empty. Never null.
074     * @param tagName String
075     * @return Collection<Object>
076     */
077    public Collection<Object> findTaggedValues(String tagName);
078
079    /**
080     * Returns the fully qualified name of the model element. The fully qualified name includes
081     * complete package qualified name of the underlying model element. The templates parameter will
082     * be replaced by the correct one given the binding relation of the parameter to this element.
083     * @param bindedElement ModelElementFacade
084     * @return String
085     */
086    public String getBindedFullyQualifiedName(ModelElementFacade bindedElement);
087
088    /**
089     * Gets all constraints belonging to the model element.
090     * @return Collection<ConstraintFacade>
091     */
092    public Collection<ConstraintFacade> getConstraints();
093
094    /**
095     * Returns the constraints of the argument kind that have been placed onto this model. Typical
096     * kinds are "inv", "pre" and "post". Other kinds are possible.
097     * @param kind String
098     * @return Collection<ConstraintFacade>
099     */
100    public Collection<ConstraintFacade> getConstraints(String kind);
101
102    /**
103     * Gets the documentation for the model element, The indent argument is prefixed to each line.
104     * By default this method wraps lines after 64 characters.
105     * This method is equivalent to <code>getDocumentation(indent, 64)</code>.
106     * @param indent String
107     * @return String
108     */
109    public String getDocumentation(String indent);
110
111    /**
112     * This method returns the documentation for this model element, with the lines wrapped after
113     * the specified number of characters, values of less than 1 will indicate no line wrapping is
114     * required. By default paragraphs are returned as HTML.
115     * This method is equivalent to <code>getDocumentation(indent, lineLength, true)</code>.
116     * @param indent String
117     * @param lineLength int
118     * @return String
119     */
120    public String getDocumentation(String indent, int lineLength);
121
122    /**
123     * This method returns the documentation for this model element, with the lines wrapped after
124     * the specified number of characters, values of less than 1 will indicate no line wrapping is
125     * required. HTML style determines if HTML Escaping is applied.
126     * @param indent String
127     * @param lineLength int
128     * @param htmlStyle boolean
129     * @return String
130     */
131    public String getDocumentation(String indent, int lineLength, boolean htmlStyle);
132
133    /**
134     * The fully qualified name of this model element.
135     * @return String
136     */
137    public String getFullyQualifiedName();
138
139    /**
140     * Returns the fully qualified name of the model element. The fully qualified name includes
141     * complete package qualified name of the underlying model element.  If modelName is true, then
142     * the original name of the model element (the name contained within the model) will be the name
143     * returned, otherwise a name from a language mapping will be returned.
144     * @param modelName boolean
145     * @return String
146     */
147    public String getFullyQualifiedName(boolean modelName);
148
149    /**
150     * Returns the fully qualified name as a path, the returned value always starts with out a slash
151     * '/'.
152     * @return String
153     */
154    public String getFullyQualifiedNamePath();
155
156    /**
157     * Gets the unique identifier of the underlying model element.
158     * @return String
159     */
160    public String getId();
161
162    /**
163     * UML2: Retrieves the keywords for this element. Used to modify implementation properties which
164     * are not represented by other properties, i.e. native, transient, volatile, synchronized,
165     * (added annotations) override, deprecated. Can also be used to suppress compiler warnings:
166     * (added annotations) unchecked, fallthrough, path, serial, finally, all. Annotations require
167     * JDK5 compiler level.
168     * @return Collection<String>
169     */
170    public Collection<String> getKeywords();
171
172    /**
173     * UML2: Retrieves a localized label for this named element.
174     * @return String
175     */
176    public String getLabel();
177
178    /**
179     * The language mappings that have been set for this model element.
180     * @return TypeMappings
181     */
182    public TypeMappings getLanguageMappings();
183
184    /**
185     * Return the model containing this model element (multiple models may be loaded and processed
186     * at the same time).
187     * @return ModelFacade
188     */
189    public ModelFacade getModel();
190
191    /**
192     * The name of the model element.
193     * @return String
194     */
195    public String getName();
196
197    /**
198     * Gets the package to which this model element belongs.
199     * @return ModelElementFacade
200     */
201    public ModelElementFacade getPackage();
202
203    /**
204     * The name of this model element's package.
205     * @return String
206     */
207    public String getPackageName();
208
209    /**
210     * Gets the package name (optionally providing the ability to retrieve the model name and not
211     * the mapped name).
212     * @param modelName boolean
213     * @return String
214     */
215    public String getPackageName(boolean modelName);
216
217    /**
218     * Returns the package as a path, the returned value always starts with out a slash '/'.
219     * @return String
220     */
221    public String getPackagePath();
222
223    /**
224     * UML2: Returns the value of the 'Qualified Name' attribute. A name which allows the
225     * NamedElement to be identified within a hierarchy of nested Namespaces. It is constructed from
226     * the names of the containing namespaces starting at the root of the hierarchy and ending with
227     * the name of the NamedElement itself.
228     * @return String
229     */
230    public String getQualifiedName();
231
232    /**
233     * Gets the root package for the model element.
234     * @return PackageFacade
235     */
236    public PackageFacade getRootPackage();
237
238    /**
239     * Gets the dependencies for which this model element is the source.
240     * @return Collection<DependencyFacade>
241     */
242    public Collection<DependencyFacade> getSourceDependencies();
243
244    /**
245     * If this model element is the context of an activity graph, this represents that activity
246     * graph.
247     * @return StateMachineFacade
248     */
249    public StateMachineFacade getStateMachineContext();
250
251    /**
252     * The collection of ALL stereotype names for this model element.
253     * @return Collection<String>
254     */
255    public Collection<String> getStereotypeNames();
256
257    /**
258     * Gets all stereotypes for this model element.
259     * @return Collection<StereotypeFacade>
260     */
261    public Collection<StereotypeFacade> getStereotypes();
262
263    /**
264     * Return the TaggedValues associated with this model element, under all stereotypes.
265     * @return Collection<TaggedValueFacade>
266     */
267    public Collection<TaggedValueFacade> getTaggedValues();
268
269    /**
270     * Gets the dependencies for which this model element is the target.
271     * @return Collection<DependencyFacade>
272     */
273    public Collection<DependencyFacade> getTargetDependencies();
274
275    /**
276     * Get the template parameter for this model element having the parameterName
277     * @param parameterName String
278     * @return Object
279     */
280    public Object getTemplateParameter(String parameterName);
281
282    /**
283     * Get the template parameters for this model element
284     * @return Collection<TemplateParameterFacade>
285     */
286    public Collection<TemplateParameterFacade> getTemplateParameters();
287
288    /**
289     * The visibility (i.e. public, private, protected or package) of the model element, will
290     * attempt a lookup for these values in the language mappings (if any).
291     * @return String
292     */
293    public String getVisibility();
294
295    /**
296     * Returns true if the model element has the exact stereotype (meaning no stereotype inheritance
297     * is taken into account when searching for the stereotype), false otherwise.
298     * @param stereotypeName String
299     * @return boolean
300     */
301    public boolean hasExactStereotype(String stereotypeName);
302
303    /**
304     * Does the UML Element contain the named Keyword? Keywords can be separated by space, comma,
305     * pipe, semicolon, or << >>
306     * @param keywordName String
307     * @return boolean
308     */
309    public boolean hasKeyword(String keywordName);
310
311    /**
312     * Returns true if the model element has the specified stereotype.  If the stereotype itself
313     * does not match, then a search will be made up the stereotype inheritance hierarchy, and if
314     * one of the stereotype's ancestors has a matching name this method will return true, false
315     * otherwise.
316     * For example, if we have a certain stereotype called <<exception>> and a model element has a
317     * stereotype called <<applicationException>> which extends <<exception>>, when calling this
318     * method with 'stereotypeName' defined as 'exception' the method would return true since
319     * <<applicationException>> inherits from <<exception>>.  If you want to check if the model
320     * element has the exact stereotype, then use the method 'hasExactStereotype' instead.
321     * @param stereotypeName String
322     * @return boolean
323     */
324    public boolean hasStereotype(String stereotypeName);
325
326    /**
327     * True if there are target dependencies from this element that are instances of BindingFacade.
328     * Deprecated in UML2: Use TemplateBinding parameters instead of dependencies.
329     * @return boolean
330     */
331    public boolean isBindingDependenciesPresent();
332
333    /**
334     * Indicates if any constraints are present on this model element.
335     * @return boolean
336     */
337    public boolean isConstraintsPresent();
338
339    /**
340     * Indicates if any documentation is present on this model element.
341     * @return boolean
342     */
343    public boolean isDocumentationPresent();
344
345    /**
346     * True if this element name is a reserved word in Java, C#, ANSI or ISO C, C++, JavaScript.
347     * @return boolean
348     */
349    public boolean isReservedWord();
350
351    /**
352     * True is there are template parameters on this model element. For UML2, applies to Class,
353     * Operation, Property, and Parameter.
354     * @return boolean
355     */
356    public boolean isTemplateParametersPresent();
357
358    /**
359     * True if this element name is a valid identifier name in Java, C#, ANSI or ISO C, C++,
360     * JavaScript. Contains no spaces, special characters etc. Constraint always applied on
361     * Enumerations and Interfaces, optionally applies on other model elements.
362     * @return boolean
363     */
364    public boolean isValidIdentifierName();
365
366    /**
367     * Searches for the constraint with the specified 'name' on this model element, and if found
368     * translates it using the specified 'translation' from a translation library discovered by the
369     * framework.
370     * @param name String
371     * @param translation String
372     * @return String
373     */
374    public String translateConstraint(String name, String translation);
375
376    /**
377     * Translates all constraints belonging to this model element with the given 'translation'.
378     * @param translation String
379     * @return String[]
380     */
381    public String[] translateConstraints(String translation);
382
383    /**
384     * Translates the constraints of the specified 'kind' belonging to this model element.
385     * @param kind String
386     * @param translation String
387     * @return String[]
388     */
389    public String[] translateConstraints(String kind, String translation);
390}