001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package org.netbeans.modules.uml.core.metamodel.core.foundation;
043:
044: import org.netbeans.modules.uml.core.metamodel.structure.IProject;
045: import org.netbeans.modules.uml.core.metamodel.structure.ISourceFileArtifact;
046: import org.netbeans.modules.uml.core.reverseengineering.reframework.parsingframework.ILanguage;
047: import org.netbeans.modules.uml.core.support.umlutils.ETList;
048:
049: import org.openide.nodes.Node;
050:
051: /**
052: * <p>Title: </p>
053: * <p>Description: </p>
054: * <p>Copyright: Copyright (c) 2003</p>
055: * <p>Company: </p>
056: * @author not attributable
057: * @version 1.0
058: */
059:
060: public interface IElement extends IBaseElement, Node.Cookie {
061:
062: // Retrieves the name of the actual element, such as 'Class'.
063: // HRESULT ElementType([out, retval] BSTR* type );
064: public String getElementType();
065:
066: public String getExpandedElementType();
067:
068: public boolean getHasExpandedElementType();
069:
070: // Adds an element to this Element's collection of owned elements.
071: // HRESULT AddElement([in] IElement* element);
072: public IElement addElement(IElement elem);
073:
074: // Removes an element from the owned elements collection.
075: // HRESULT RemoveElement([in] IElement* element);
076: public IElement removeElement(IElement elem);
077:
078: // Retrieves a collection of elements owned by this element.
079: // HRESULT Elements([out, retval] IElements** pVal);
080: public ETList<IElement> getElements();
081:
082: // Sets / Gets the owner of this element.
083: // HRESULT Owner([out, retval] IElement* *pVal);
084: public IElement getOwner();
085:
086: // Sets / Gets the owner of this element.
087: // HRESULT Owner([in] IElement* newVal);
088: public void setOwner(IElement elem);
089:
090: // Retrieves the owner of this element that is also a Package element. Retrieves the first element going up the owning hierarchy.
091: // HRESULT OwningPackage([out, retval] IPackage* *pVal);
092: public IPackage getOwningPackage();
093:
094: // Determines whether or not an element with the passed in id is owned by this element.
095: // HRESULT IsOwnedElement( [in] BSTR elementID, [out, retval] VARIANT_BOOL* found );
096: public boolean isOwnedElement(String id);
097:
098: public boolean isOwnedElement(IElement elem);
099:
100: public String getTopLevelId();
101:
102: // Adds a source Flow relationship to this element.
103: // HRESULT AddSourceFlow([in] IFlow* flow );
104: public void addSourceFlow(IFlow flow);
105:
106: // Removes a source Flow relationship from this element.
107: // HRESULT RemoveSourceFlow([in] IFlow* flow );
108: public void removeSourceFlow(IFlow flow);
109:
110: // Retrieves the collection of source Flow relationships.
111: // HRESULT SourceFlows([out, retval] IFlows* *pVal);
112: public ETList<IFlow> getSourceFlows();
113:
114: // Adds a target Flow relationship to this element.
115: // HRESULT AddTargetFlow([in] IFlow* flow );
116: public void addTargetFlow(IFlow flow);
117:
118: // Removes a target Flow relationship to this element.
119: // HRESULT RemoveTargetFlow([in] IFlow* flow );
120: public void removeTargetFlow(IFlow flow);
121:
122: // Retrieves the collection of target Flow relationships.
123: // HRESULT TargetFlows([out, retval] IFlows* *pVal);
124: public ETList<IFlow> getTargetFlows();
125:
126: // The set of TaggedValues that are associated with this Element. Standard tags are not included ( e.g., documentation )
127: // HRESULT TaggedValues([out, retval] ITaggedValues** pVal);
128: public ETList<ITaggedValue> getTaggedValues();
129:
130: /** Retrieves the tagged values in a comma delimited string. */
131: public String getTaggedValuesAsString();
132:
133: // Adds a UML 1.3 conformant TaggedValue to this Element.
134: // HRESULT AddTaggedValue([in] BSTR tagName, [in] BSTR value, [out, retval] ITaggedValue** pVal);
135: public ITaggedValue addTaggedValue(String tagName, String value);
136:
137: // Removes the TaggedValue from this element's collection.
138: // HRESULT RemoveTaggedValue([in] ITaggedValue* tag );
139: public void removeTaggedValue(ITaggedValue tag);
140:
141: // Retrieves a tagged value based on the name of the tag passed in.
142: // HRESULT TaggedValueByName( [in]BSTR tagName, [out,retval] ITaggedValue** tag );
143: public ITaggedValue getTaggedValueByName(String tagName);
144:
145: // Retrieves all the TaggedValues with the specified name.
146: // HRESULT TaggedValuesByName( [in]BSTR tagName, [out,retval] ITaggedValues** tags );
147: public ETList<ITaggedValue> getTaggedValuesByName(String tagName);
148:
149: // Sets / Gets the documentation for this element.
150: // HRESULT Documentation([out, retval] BSTR *pVal);
151: public String getDocumentation();
152:
153: // Sets / Gets the documentation for this element.
154: // HRESULT Documentation([in] BSTR newVal);
155: public void setDocumentation(String doc);
156:
157: // Adds a PresentationElement to this element.
158: // HRESULT AddPresentationElement([in] IPresentationElement* newVal );
159: public IPresentationElement addPresentationElement(
160: IPresentationElement elem);
161:
162: // Removes the passed in PresentationElement from this element.
163: // HRESULT RemovePresentationElement([in] IPresentationElement* pVal );
164: public void removePresentationElement(IPresentationElement elem);
165:
166: // Retrieves all the PresentationElements representing this element.
167: // HRESULT PresentationElements([out, retval] IPresentationElements** pVal );
168: public ETList<IPresentationElement> getPresentationElements();
169:
170: // Determines whether or not the passed in presentation element is already associated with this element.
171: // HRESULT IsPresent([in] IPresentationElement* pVal, [out,retval] VARIANT_BOOL* isPresent );
172: public boolean isPresent(IPresentationElement elem);
173:
174: // Removes all PresentationElements from this element.
175: // HRESULT RemoveAllPresentationElements();
176: public void removePresentationElements();
177:
178: // Retrieves a presentation element by ID
179: // HRESULT GetPresentationElementByID( [in] BSTR id, [out, retval] IPresentationElement** element );
180: public IPresentationElement getPresentationElementById(String id);
181:
182: // Retrieves the ID of the top level namespace for this element. In most cases, this is the ID for the Project the element is in.
183: // HRESULT TopLevelID( [out,retval] BSTR* topID );
184: public String topLevelId();
185:
186: // Retrieves all the artifacts associated with this element. The collection returned will contain IArtifact interfaces.
187: // HRESULT AssociatedArtifacts([out, retval] IElements* *artifacts );
188: public ETList<IElement> getAssociatedArtifacts();
189:
190: // Retrieves the IProject this element is a part of.
191: // HRESULT Project( [out,retval] IDispatch** pProj );
192: public IProject getProject();
193:
194: // Adds this element to the Referencing side of the passed in Reference.
195: // HRESULT AddReferencingReference([in] IReference* pRef );
196: public IReference addReferencingReference(IReference ref);
197:
198: // Removes a referencing Reference relationship from this element.
199: // HRESULT RemoveReferencingReference([in] IReference* pRef);
200: public void removeReferencingReference(IReference ref);
201:
202: // Retrieves the collection of referencing Reference relationships.
203: // HRESULT ReferencingReferences([out, retval] IReferences* *pVal);
204: public ETList<IReference> getReferencingReferences();
205:
206: // Adds this element to the Referred side of the passed in Reference.
207: // HRESULT AddReferredReference([in] IReference* pRef );
208: public IReference addReferredReference(IReference ref);
209:
210: // Removes a referred Reference relationship from this element.
211: // HRESULT RemoveReferredReference([in] IReference* pRef);
212: public void removeReferredReference(IReference ref);
213:
214: // Retrieves the collection of referred Reference relationships.
215: // HRESULT ReferredReferences([out, retval] IReferences* *pVal);
216: public ETList<IReference> getReferredReferences();
217:
218: // Number of owned elements this element owns.
219: // HRESULT ElementCount([out, retval] long* pVal);
220: public long getElementCount();
221:
222: // SourceFlowCount.
223: // HRESULT SourceFlowCount([out, retval] long* pVal);
224: public long getSourceFlowCount();
225:
226: // .
227: // HRESULT TargetFlowCount([out, retval] long* pVal);
228: public long getTargetFlowCount();
229:
230: // .
231: // HRESULT TaggedValueCount([out, retval] long* pVal);
232: public long getTaggedValueCount();
233:
234: // .
235: // HRESULT PresentationElementCount([out, retval] long* pVal);
236: public long getPresentationElementCount();
237:
238: // .
239: // HRESULT AssociatedArtifactCount([out, retval] long* pVal);
240: public long getAssociatedArtifactCount();
241:
242: // .
243: // HRESULT ReferencingReferenceCount([out, retval] long* pVal);
244: public long getReferencingReferenceCount();
245:
246: // .
247: // HRESULT ReferredReferenceCount([out, retval] long* pVal);
248: public long getReferredReferenceCount();
249:
250: // Retrieves all tagged values, including standard tags..
251: // HRESULT AllTaggedValues([out, retval] ITaggedValues** pVal);
252: public ETList<ITaggedValue> getAllTaggedValues();
253:
254: // Retrieves a collection of ILanguage interfaces that indicate what language specific artifacts this element, or a parent, is associated with.
255: // HRESULT Languages([out, retval] ILanguages** pVal);
256: public ETList<ILanguage> getLanguages();
257:
258: // Retrieves a collection of SourceFileArtifacts that contain absolute paths to source files associated with this element. The collection returned will contain IArtifact interfaces.
259: // HRESULT SourceFiles([out, retval] IElements* *pVal );
260: public ETList<IElement> getSourceFiles();
261:
262: // Associates a source file with the model element.
263: // HRESULT AddSourceFile([in] BSTR filename);
264: public void addSourceFile(String fileName);
265:
266: // add the source file only if the element doesn't already has one with this fileName
267: public void addSourceFileNotDuplicate(String fileName);
268:
269: // Removes a source file from the model element. The model element will no longer be associatied with the model element.
270: // HRESULT RemoveSourceFile([in] BSTR filename);
271: public void removeSourceFile(String fileName);
272:
273: // Retrieves a collection of SourceFileArtifacts that contain absolute paths to source files associated with this element. The collection returned will contain IArtifact interfaces.
274: // HRESULT SourceFiles2( [in]BSTR lang, [out, retval] IElements* *pVal );
275: public ETList<IElement> getSourceFiles2(String language);
276:
277: // Retrieves a collection of SourceFileArtifacts that contain absolute paths to source files associated with this element. The collection returned will contain IArtifact interfaces.
278: // HRESULT SourceFiles3( [in]ILanguage* pLang, [out, retval] IElements* *pVal );
279: public ETList<IElement> getSourceFiles3(ILanguage language);
280:
281: // get the SourceFileArtifact with the given fileName
282: public IElement getSourceFile(String fileName);
283:
284: // check to see if this Element has a SourceFileArtifact with the given fileName
285: public boolean hasSourceFile(String fileName);
286:
287: // Retrieves a collection of stereotypes that are currently applied to this Element. The out parameter is an IStereotypes collection.
288: // HRESULT AppliedStereotypes( [out, retval] IDispatch** pStereotypes );
289: public ETList<Object> getAppliedStereotypes();
290:
291: // Retrieves the number of stereotypes that are currently applied to this Element.
292: // HRESULT NumAppliedStereotypes( [out, retval] long* pNumStereotypes );
293: public int getNumAppliedStereotypes();
294:
295: // Retrieves a collection of stereotypes in string form << xxx, yyy >>. NULL string is returned if no stereotypes exist.
296: // HRESULT AppliedStereotypesAsString( [out, retval] BSTR* sStereotypeString );
297: public String getAppliedStereotypesAsString(boolean honorAliasing);
298:
299: public String getAppliedStereotypesList();
300:
301: public ETList<String> getAppliedStereotypesAsString();
302:
303: // Applies the passed in IStereotype to this element. The in parameter is an IStereotype.
304: // HRESULT ApplyStereotype([in] IDispatch* pIStereotype );
305: public void applyStereotype(Object stereotype);
306:
307: // Removes the passed in IStereotype from this element. The in parameter is an IStereotype.
308: // HRESULT RemoveStereotype([in] IDispatch* pIStereotype );
309: public void removeStereotype(Object stereotype);
310:
311: // Removes all the IStereotypes from this element.
312: // HRESULT RemoveStereotypes();
313: public void removeStereotypes();
314:
315: // Applies the Stereotype with the passed in name to this element.
316: // HRESULT ApplyStereotype2([in] BSTR stereotypeName, [out, retval] IDispatch** pStereotype );
317: public Object applyStereotype2(String name);
318:
319: // Removes the Stereotype that matches the passed in name from this element.
320: // HRESULT RemoveStereotype2([in] BSTR stereotypeName );
321: public void removeStereotype2(String name);
322:
323: // Takes the cononical form of stereotypes <<xx,yy>> and sets this elements stereotypes to match the input string.
324: // HRESULT ApplyNewStereotypes([in] BSTR sCononicalStereotypeString );
325: public void applyNewStereotypes(String name);
326:
327: // Retrieves the applied stereotype that matches the name passed in.
328: // HRESULT RetrieveAppliedStereotype([in] BSTR name, [out,retval] IDispatch** sType );
329: public Object retrieveAppliedStereotype(String name);
330:
331: // Adds a Constraint to this Element. This Element directly owns the Constraint.
332: // HRESULT AddOwnedConstraint([in] IConstraint* newVal );
333: public void addOwnedConstraint(IConstraint constraint);
334:
335: // Removes a Constraint that this Element owns.
336: // HRESULT RemoveOwnedConstraint([in] IConstraint* pVal );
337: public void removeOwnedConstraint(IConstraint constraint);
338:
339: // Retrieves all the Constraints owned by this Element.
340: // HRESULT OwnedConstraints([out, retval] IConstraints** pVal );
341: public ETList<IConstraint> getOwnedConstraints();
342:
343: // Creates a new Constraint.
344: // HRESULT CreateConstraint([in] BSTR sName, [in] BSTR sExpression, [out, retval] IConstraint** newConstraint );
345: public IConstraint createConstraint(String name, String expr);
346:
347: // Determines whether or not the current element and the element passed in are in the same Project.
348: // HRESULT InSameProject( IElement* pElement, [out, retval] VARIANT_BOOL* projectsAreTheSame );
349: public boolean inSameProject(IElement elem);
350:
351: public void deleteReferenceRelations();
352:
353: public void deleteFlowRelations();
354:
355: //needed for element to display properly in navigation dialog.
356: public String toString();
357:
358: public String getConstraintsAsString();
359:
360: public ETList<String> getPossibleCollectionTypes();
361:
362: public String getPossibleCollectionTypesAsString();
363: }
|