Source Code Cross Referenced for MetaModelHelper.java in  » IDE-Netbeans » uml » org » netbeans » modules » uml » ui » support » viewfactorysupport » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Netbeans » uml » org.netbeans.modules.uml.ui.support.viewfactorysupport 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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:        /*
043:         *
044:         * Created on Jul 3, 2003
045:         * @author Trey Spiva
046:         */
047:        package org.netbeans.modules.uml.ui.support.viewfactorysupport;
048:
049:        import java.util.ArrayList;
050:
051:        import org.netbeans.modules.uml.core.metamodel.common.commonactivities.IActivityEdge;
052:        import org.netbeans.modules.uml.core.metamodel.common.commonactivities.IActivityNode;
053:        import org.netbeans.modules.uml.core.metamodel.common.commonstatemachines.IStateVertex;
054:        import org.netbeans.modules.uml.core.metamodel.common.commonstatemachines.ITransition;
055:        import org.netbeans.modules.uml.core.metamodel.core.constructs.IExtend;
056:        import org.netbeans.modules.uml.core.metamodel.core.constructs.IInclude;
057:        import org.netbeans.modules.uml.core.metamodel.core.constructs.IUseCase;
058:        import org.netbeans.modules.uml.core.metamodel.core.foundation.IDependency;
059:        import org.netbeans.modules.uml.core.metamodel.core.foundation.IElement;
060:        import org.netbeans.modules.uml.core.metamodel.core.foundation.INamedElement;
061:        import org.netbeans.modules.uml.core.metamodel.dynamics.ILifeline;
062:        import org.netbeans.modules.uml.core.metamodel.dynamics.IMessage;
063:        import org.netbeans.modules.uml.core.metamodel.dynamics.IMessageConnector;
064:        import org.netbeans.modules.uml.core.metamodel.infrastructure.coreinfrastructure.IAggregation;
065:        import org.netbeans.modules.uml.core.metamodel.infrastructure.coreinfrastructure.IAssociation;
066:        import org.netbeans.modules.uml.core.metamodel.infrastructure.coreinfrastructure.IAssociationEnd;
067:        import org.netbeans.modules.uml.core.metamodel.infrastructure.coreinfrastructure.IClassifier;
068:        import org.netbeans.modules.uml.core.metamodel.infrastructure.coreinfrastructure.IDerivation;
069:        import org.netbeans.modules.uml.core.metamodel.infrastructure.coreinfrastructure.IGeneralization;
070:        import org.netbeans.modules.uml.core.metamodel.infrastructure.coreinfrastructure.IImplementation;
071:        import org.netbeans.modules.uml.core.metamodel.structure.IComment;
072:        import org.netbeans.modules.uml.core.support.umlutils.ETList;
073:
074:        /**
075:         * Used for helping out with the meta model layer (ie getting the ends of a 
076:         * relationship).
077:         * 
078:         * @author Trey Spiva
079:         */
080:        public class MetaModelHelper {
081:            public RelationEnds getRelationshipEnds(IElement relationship) {
082:                RelationEnds retVal = new RelationEnds();
083:
084:                if (relationship instanceof  IDerivation) {
085:                    IDerivation derivation = (IDerivation) relationship;
086:                    retVal.setStartElement(getFirstDerivationEnd(derivation));
087:                    retVal.setEndElement(getSecondDerivationEnd(derivation));
088:                } else if (relationship instanceof  IComment) {
089:                    IComment comment = (IComment) relationship;
090:                    retVal.setStartElement(getFirstCommentEnd(comment));
091:                    retVal.setEndElement(null);
092:                } else if (relationship instanceof  IGeneralization) {
093:                    IGeneralization generalization = (IGeneralization) relationship;
094:                    retVal
095:                            .setStartElement(getFirstGeneralizationEnd(generalization));
096:                    retVal
097:                            .setEndElement(getSecondGeneralizationEnd(generalization));
098:                } else if (relationship instanceof  IDependency) {
099:                    IDependency dependency = (IDependency) relationship;
100:                    retVal.setStartElement(getFirstDependencyEnd(dependency));
101:                    retVal.setEndElement(getSecondDependencyEnd(dependency));
102:                } else if (relationship instanceof  IMessage) {
103:
104:                } else if (relationship instanceof  IAggregation) {
105:                    IAggregation aggregation = (IAggregation) relationship;
106:                    retVal.setStartElement(getFirstAggregationEnd(aggregation));
107:                    retVal.setEndElement(getSecondAggregationEnd(aggregation));
108:                } else if (relationship instanceof  IAssociation) {
109:                    IAssociation association = (IAssociation) relationship;
110:                    retVal.setStartElement(getFirstAssociationEnd(association));
111:                    retVal.setEndElement(getSecondAssociationEnd(association));
112:                } else if (relationship instanceof  IActivityEdge) {
113:                    IActivityEdge activityEdge = (IActivityEdge) relationship;
114:                    retVal
115:                            .setStartElement(getFirstActivityEdgeEnd(activityEdge));
116:                    retVal
117:                            .setEndElement(getSecondActivityEdgeEnd(activityEdge));
118:                } else if (relationship instanceof  IInclude) {
119:                    IInclude include = (IInclude) relationship;
120:                    retVal.setStartElement(getFirstIncludeEnd(include));
121:                    retVal.setEndElement(getSecondIncludeEnd(include));
122:                } else if (relationship instanceof  IExtend) {
123:                    IExtend extend = (IExtend) relationship;
124:                    retVal.setStartElement(getFirstExtendEnd(extend));
125:                    retVal.setEndElement(getSecondExtendEnd(extend));
126:                } else if (relationship instanceof  ITransition) {
127:                    ITransition transition = (ITransition) relationship;
128:                    retVal.setStartElement(getFirstTransitionEnd(transition));
129:                    retVal.setEndElement(getSecondTransitionEnd(transition));
130:                } else if (relationship instanceof  IMessageConnector) {
131:                    IMessageConnector connector = (IMessageConnector) relationship;
132:                    retVal
133:                            .setStartElement(getFirstMessageConnectorEnd(connector));
134:                    retVal
135:                            .setEndElement(getSecondMessageConnectorEnd(connector));
136:                }
137:
138:                //**************************************************
139:                // Binding Code
140:                //**************************************************
141:                //      else if (Dispatch.isType(relationship, IDerivation.GUID) == true)
142:                //      {
143:                //         IDerivation derivation = new IDerivationProxy((Dispatch)relationship);
144:                //         retVal.setStartElement(getFirstDerivationEnd(derivation));
145:                //         retVal.setEndElement(getSecondDerivationEnd(derivation));
146:                //      }
147:                //      else if (Dispatch.isType(relationship, IComment.GUID) == true)
148:                //      {
149:                //         IComment comment = new ICommentProxy((Dispatch)relationship);
150:                //         retVal.setStartElement(getFirstCommentEnd(comment));
151:                //         retVal.setEndElement(null);
152:                //      }
153:                //      else if (Dispatch.isType(relationship, IGeneralization.GUID) == true)
154:                //      {
155:                //         IGeneralization generalization = new IGeneralizationProxy((Dispatch)relationship);
156:                //         retVal.setStartElement(getFirstGeneralizationEnd(generalization));
157:                //         retVal.setEndElement(getSecondGeneralizationEnd(generalization));
158:                //      } 
159:                //      else if (Dispatch.isType(relationship, IDependency.GUID) == true)
160:                //      {
161:                //         IDependency dependency = new IDependencyProxy((Dispatch)relationship);
162:                //         retVal.setStartElement(getFirstDependencyEnd(dependency));
163:                //         retVal.setEndElement(getSecondDependencyEnd(dependency));
164:                //      }
165:                //      else if (Dispatch.isType(relationship, IMessage.GUID) == true)
166:                //      {
167:                //      
168:                //      }
169:                //      else if (Dispatch.isType(relationship, IAggregation.GUID) == true)
170:                //      {
171:                //         IAggregation aggregation = new IAggregationProxy((Dispatch)relationship);
172:                //         retVal.setStartElement(getFirstAggregationEnd(aggregation));
173:                //         retVal.setEndElement(getSecondAggregationEnd(aggregation));
174:                //      }
175:                //      else if (Dispatch.isType(relationship, IAssociation.GUID) == true)
176:                //      {
177:                //         IAssociation association = new IAssociationProxy((Dispatch)relationship);
178:                //         retVal.setStartElement(getFirstAssociationEnd(association));
179:                //         retVal.setEndElement(getSecondAssociationEnd(association));
180:                //      }
181:                //      else if (Dispatch.isType(relationship, IActivityEdge.GUID) == true)
182:                //      {
183:                //         IActivityEdge activityEdge = new IActivityEdgeProxy((Dispatch)relationship);
184:                //         retVal.setStartElement(getFirstActivityEdgeEnd(activityEdge));
185:                //         retVal.setEndElement(getSecondActivityEdgeEnd(activityEdge));
186:                //      }
187:                //      else if (Dispatch.isType(relationship, IInclude.GUID) == true)
188:                //      {
189:                //         IInclude include = new IIncludeProxy((Dispatch)relationship);
190:                //         retVal.setStartElement(getFirstIncludeEnd(include));
191:                //         retVal.setEndElement(getSecondIncludeEnd(include));
192:                //      }
193:                //      else if (Dispatch.isType(relationship, IExtend.GUID) == true)
194:                //      {
195:                //         IExtend extend = new IExtendProxy((Dispatch)relationship);
196:                //         retVal.setStartElement(getFirstExtendEnd(extend));
197:                //         retVal.setEndElement(getSecondExtendEnd(extend));
198:                //      }
199:                //      else if (Dispatch.isType(relationship, ITransition.GUID) == true)
200:                //      {
201:                //         ITransition transition = new ITransitionProxy((Dispatch)relationship);
202:                //         retVal.setStartElement(getFirstTransitionEnd(transition));
203:                //         retVal.setEndElement(getSecondTransitionEnd(transition));
204:                //      }
205:                //      else if (Dispatch.isType(relationship, IMessageConnector.GUID) == true)
206:                //      {
207:                //         IMessageConnector connector = new IMessageConnectorProxy((Dispatch)relationship);
208:                //         retVal.setStartElement(getFirstMessageConnectorEnd(connector));
209:                //         retVal.setEndElement(getSecondMessageConnectorEnd(connector));
210:                //      }
211:                //      if (relationship instanceof IDerivation)
212:                //      {
213:                //         IDerivation derivation = (IDerivation)relationship;
214:                //         addDerivationEnds(derivation, retVal);
215:                //      }
216:                //      else if (relationship instanceof IComment)
217:                //      {
218:                //         IComment comment = (IComment)relationship;
219:                //         addCommentEnds(comment, retVal);
220:                //      }
221:                //      else if (relationship instanceof IGeneralization)
222:                //      {
223:                //         IGeneralization generalization = (IGeneralization)relationship;
224:                //         addGeneralizationEnds(generalization, retVal);
225:                //      } 
226:                //      else if (relationship instanceof IDependency)
227:                //      {
228:                //         IDependency dependency = (IDependency)relationship;
229:                //         addDependencyEnds(dependency, retVal);
230:                //      }
231:                //      else if (relationship instanceof IMessage)
232:                //      {
233:                //         
234:                //      }
235:                //      else if (relationship instanceof IAggregation)
236:                //      {
237:                //         IAggregation aggregation = (IAggregation)relationship;
238:                //         addAggregationEnds(aggregation, retVal);
239:                //      }
240:                //      else if (relationship instanceof IAssociation)
241:                //      {
242:                //         IAssociation association = (IAssociation)relationship;
243:                //         addAssociationEnds(association, retVal);
244:                //      }
245:                //      else if (relationship instanceof IActivityEdge)
246:                //      {
247:                //         IActivityEdge activityEdge = (IActivityEdge)relationship;
248:                //         addActivityEdgeEnds(activityEdge, retVal);
249:                //      }
250:                //      else if (relationship instanceof IInclude)
251:                //      {
252:                //         IInclude include = (IInclude)relationship;
253:                //         addIncludeEnds(include, retVal);
254:                //      }
255:                //      else if (relationship instanceof IExtend)
256:                //      {
257:                //         IExtend extend = (IExtend)relationship;
258:                //         addExtendEnds(extend, retVal);
259:                //      }
260:                //      else if (relationship instanceof ITransition)
261:                //      {
262:                //         ITransition transition = (ITransition)relationship;
263:                //         addTransitionEnds(transition, retVal);
264:                //      }
265:                //      else if (relationship instanceof IMessageConnector)
266:                //      {
267:                //         IMessageConnector connector = (IMessageConnector)relationship;
268:                //         addMessageConnectorEnds(connector, retVal);
269:                //      }
270:
271:                return retVal;
272:            }
273:
274:            public IElement getFirstRelationshipEnd(IElement relationship) {
275:                IElement retVal = null;
276:
277:                if (relationship instanceof  IDerivation) {
278:                    IDerivation derivation = (IDerivation) relationship;
279:                    retVal = getFirstDerivationEnd(derivation);
280:                } else if (relationship instanceof  IComment) {
281:                    IComment comment = (IComment) relationship;
282:                    retVal = getFirstCommentEnd(comment);
283:                } else if (relationship instanceof  IGeneralization) {
284:                    IGeneralization generalization = (IGeneralization) relationship;
285:                    retVal = getFirstGeneralizationEnd(generalization);
286:                } else if (relationship instanceof  IDependency) {
287:                    IDependency dependency = (IDependency) relationship;
288:                    retVal = getFirstDependencyEnd(dependency);
289:                } else if (relationship instanceof  IMessage) {
290:
291:                } else if (relationship instanceof  IAggregation) {
292:                    IAggregation aggregation = (IAggregation) relationship;
293:                    retVal = getFirstAggregationEnd(aggregation);
294:                } else if (relationship instanceof  IAssociation) {
295:                    IAssociation association = (IAssociation) relationship;
296:                    retVal = getFirstAssociationEnd(association);
297:                } else if (relationship instanceof  IActivityEdge) {
298:                    IActivityEdge activityEdge = (IActivityEdge) relationship;
299:                    retVal = getFirstActivityEdgeEnd(activityEdge);
300:                } else if (relationship instanceof  IInclude) {
301:                    IInclude include = (IInclude) relationship;
302:                    retVal = getFirstIncludeEnd(include);
303:                } else if (relationship instanceof  IExtend) {
304:                    IExtend extend = (IExtend) relationship;
305:                    retVal = getFirstExtendEnd(extend);
306:                } else if (relationship instanceof  ITransition) {
307:                    ITransition transition = (ITransition) relationship;
308:                    retVal = getFirstTransitionEnd(transition);
309:                } else if (relationship instanceof  IMessageConnector) {
310:                    IMessageConnector connector = (IMessageConnector) relationship;
311:                    retVal = getFirstMessageConnectorEnd(connector);
312:                }
313:
314:                //**************************************************
315:                // Binding Code 
316:                //**************************************************
317:
318:                //      else if (Dispatch.isType(relationship, IDerivation.GUID) == true)
319:                //      {
320:                //         IDerivation derivation = new IDerivationProxy((Dispatch)relationship);
321:                //         retVal = getFirstDerivationEnd(derivation);
322:                //      }
323:                //      else if (Dispatch.isType(relationship, IComment.GUID) == true)
324:                //      {
325:                //         IComment comment = new ICommentProxy((Dispatch)relationship);
326:                //         retVal = getFirstCommentEnd(comment);
327:                //      }
328:                //      else if (Dispatch.isType(relationship, IGeneralization.GUID) == true)
329:                //      {
330:                //         IGeneralization generalization = new IGeneralizationProxy((Dispatch)relationship);
331:                //         retVal = getFirstGeneralizationEnd(generalization);
332:                //      } 
333:                //      else if (Dispatch.isType(relationship, IDependency.GUID) == true)
334:                //      {
335:                //         IDependency dependency = new IDependencyProxy((Dispatch)relationship);
336:                //         retVal = getFirstDependencyEnd(dependency);
337:                //      }
338:                //      else if (Dispatch.isType(relationship, IMessage.GUID) == true)
339:                //      {
340:                //      
341:                //      }
342:                //      else if (Dispatch.isType(relationship, IAggregation.GUID) == true)
343:                //      {
344:                //         IAggregation aggregation = new IAggregationProxy((Dispatch)relationship);
345:                //         retVal = getFirstAggregationEnd(aggregation);
346:                //      }
347:                //      else if (Dispatch.isType(relationship, IAssociation.GUID) == true)
348:                //      {
349:                //         IAssociation association = new IAssociationProxy((Dispatch)relationship);
350:                //         retVal = getFirstAssociationEnd(association);
351:                //      }
352:                //      else if (Dispatch.isType(relationship, IActivityEdge.GUID) == true)
353:                //      {
354:                //         IActivityEdge activityEdge = new IActivityEdgeProxy((Dispatch)relationship);
355:                //         retVal = getFirstActivityEdgeEnd(activityEdge);
356:                //      }
357:                //      else if (Dispatch.isType(relationship, IInclude.GUID) == true)
358:                //      {
359:                //         IInclude include = new IIncludeProxy((Dispatch)relationship);
360:                //         retVal = getFirstIncludeEnd(include);
361:                //      }
362:                //      else if (Dispatch.isType(relationship, IExtend.GUID) == true)
363:                //      {
364:                //         IExtend extend = new IExtendProxy((Dispatch)relationship);
365:                //         retVal = getFirstExtendEnd(extend);
366:                //      }
367:                //      else if (Dispatch.isType(relationship, ITransition.GUID) == true)
368:                //      {
369:                //         ITransition transition = new ITransitionProxy((Dispatch)relationship);
370:                //         retVal = getFirstTransitionEnd(transition);
371:                //      }
372:                //      else if (Dispatch.isType(relationship, IMessageConnector.GUID) == true)
373:                //      {
374:                //         IMessageConnector connector = new IMessageConnectorProxy((Dispatch)relationship);
375:                //         retVal = getFirstMessageConnectorEnd(connector);
376:                //      }
377:                return retVal;
378:            }
379:
380:            public IElement getSecondRelationshipEnd(IElement relationship) {
381:                IElement retVal = null;
382:
383:                if (relationship instanceof  IDerivation) {
384:                    IDerivation derivation = (IDerivation) relationship;
385:                    retVal = getSecondDerivationEnd(derivation);
386:                } else if (relationship instanceof  IComment) {
387:                    retVal = null;
388:                } else if (relationship instanceof  IGeneralization) {
389:                    IGeneralization generalization = (IGeneralization) relationship;
390:                    retVal = getSecondGeneralizationEnd(generalization);
391:                } else if (relationship instanceof  IDependency) {
392:                    IDependency dependency = (IDependency) relationship;
393:                    retVal = getSecondDependencyEnd(dependency);
394:                } else if (relationship instanceof  IMessage) {
395:
396:                } else if (relationship instanceof  IAggregation) {
397:                    IAggregation aggregation = (IAggregation) relationship;
398:                    retVal = getSecondAggregationEnd(aggregation);
399:                } else if (relationship instanceof  IAssociation) {
400:                    IAssociation association = (IAssociation) relationship;
401:                    retVal = getSecondAssociationEnd(association);
402:                } else if (relationship instanceof  IActivityEdge) {
403:                    IActivityEdge activityEdge = (IActivityEdge) relationship;
404:                    retVal = getSecondActivityEdgeEnd(activityEdge);
405:                } else if (relationship instanceof  IInclude) {
406:                    IInclude include = (IInclude) relationship;
407:                    retVal = getSecondIncludeEnd(include);
408:                } else if (relationship instanceof  IExtend) {
409:                    IExtend extend = (IExtend) relationship;
410:                    retVal = getSecondExtendEnd(extend);
411:                } else if (relationship instanceof  ITransition) {
412:                    ITransition transition = (ITransition) relationship;
413:                    retVal = getSecondTransitionEnd(transition);
414:                } else if (relationship instanceof  IMessageConnector) {
415:                    IMessageConnector connector = (IMessageConnector) relationship;
416:                    retVal = getSecondMessageConnectorEnd(connector);
417:                }
418:
419:                //**************************************************
420:                // Binding Code 
421:                //**************************************************
422:
423:                //      else if (Dispatch.isType(relationship, IDerivation.GUID) == true)
424:                //      {
425:                //         IDerivation derivation = new IDerivationProxy((Dispatch)relationship);
426:                //         retVal = getSecondDerivationEnd(derivation);
427:                //      }
428:                //      else if (Dispatch.isType(relationship, IComment.GUID) == true)
429:                //      {
430:                //         retVal = null;
431:                //      }
432:                //      else if (Dispatch.isType(relationship, IGeneralization.GUID) == true)
433:                //      {
434:                //         IGeneralization generalization = new IGeneralizationProxy((Dispatch)relationship);
435:                //         retVal = getSecondGeneralizationEnd(generalization);
436:                //      } 
437:                //      else if (Dispatch.isType(relationship, IDependency.GUID) == true)
438:                //      {
439:                //         IDependency dependency = new IDependencyProxy((Dispatch)relationship);
440:                //         retVal = getSecondDependencyEnd(dependency);
441:                //      }
442:                //      else if (Dispatch.isType(relationship, IMessage.GUID) == true)
443:                //      {
444:                //      
445:                //      }
446:                //      else if (Dispatch.isType(relationship, IAggregation.GUID) == true)
447:                //      {
448:                //         IAggregation aggregation = new IAggregationProxy((Dispatch)relationship);
449:                //         retVal = getSecondAggregationEnd(aggregation);
450:                //      }
451:                //      else if (Dispatch.isType(relationship, IAssociation.GUID) == true)
452:                //      {
453:                //         IAssociation association = new IAssociationProxy((Dispatch)relationship);
454:                //         retVal = getSecondAssociationEnd(association);
455:                //      }
456:                //      else if (Dispatch.isType(relationship, IActivityEdge.GUID) == true)
457:                //      {
458:                //         IActivityEdge activityEdge = new IActivityEdgeProxy((Dispatch)relationship);
459:                //         retVal = getSecondActivityEdgeEnd(activityEdge);
460:                //      }
461:                //      else if (Dispatch.isType(relationship, IInclude.GUID) == true)
462:                //      {
463:                //         IInclude include = new IIncludeProxy((Dispatch)relationship);
464:                //         retVal = getSecondIncludeEnd(include);
465:                //      }
466:                //      else if (Dispatch.isType(relationship, IExtend.GUID) == true)
467:                //      {
468:                //         IExtend extend = new IExtendProxy((Dispatch)relationship);
469:                //         retVal = getSecondExtendEnd(extend);
470:                //      }
471:                //      else if (Dispatch.isType(relationship, ITransition.GUID) == true)
472:                //      {
473:                //         ITransition transition = new ITransitionProxy((Dispatch)relationship);
474:                //         retVal = getSecondTransitionEnd(transition);
475:                //      }
476:                //      else if (Dispatch.isType(relationship, IMessageConnector.GUID) == true)
477:                //      {
478:                //         IMessageConnector connector = new IMessageConnectorProxy((Dispatch)relationship);
479:                //         retVal = getSecondMessageConnectorEnd(connector);
480:                //      }
481:
482:                return retVal;
483:            }
484:
485:            //   protected ILifeline getFirstMessageConnectorEnd(IMessageConnector connector)
486:            //   {
487:            //      return connector.getFromLifeline();
488:            //      ILifeline targetNode = connector.getToLifeline();
489:            //      
490:            //      if((sourceNode != null) && (targetNode != null))
491:            //      {
492:            //         ends.setFirstEnd(sourceNode);
493:            //         ends.setSecondEnd(targetNode);
494:            //      }
495:            //   }
496:
497:            protected ILifeline getFirstMessageConnectorEnd(
498:                    IMessageConnector connector) {
499:                return connector.getFromLifeline();
500:            }
501:
502:            protected ILifeline getSecondMessageConnectorEnd(
503:                    IMessageConnector connector) {
504:                return connector.getToLifeline();
505:            }
506:
507:            protected IStateVertex getFirstTransitionEnd(ITransition transition) {
508:                return transition.getSource();
509:            }
510:
511:            protected IStateVertex getSecondTransitionEnd(ITransition transition) {
512:                return transition.getTarget();
513:            }
514:
515:            protected IUseCase getFirstExtendEnd(IExtend extend) {
516:                return extend.getBase();
517:            }
518:
519:            protected IUseCase getSecondExtendEnd(IExtend extend) {
520:                return extend.getExtension();
521:            }
522:
523:            protected IUseCase getFirstIncludeEnd(IInclude include) {
524:                return include.getBase();
525:            }
526:
527:            protected IUseCase getSecondIncludeEnd(IInclude include) {
528:                return include.getAddition();
529:            }
530:
531:            protected IActivityNode getFirstActivityEdgeEnd(
532:                    IActivityEdge activityEdge) {
533:                return activityEdge.getSource();
534:            }
535:
536:            protected IActivityNode getSecondActivityEdgeEnd(
537:                    IActivityEdge activityEdge) {
538:                return activityEdge.getTarget();
539:            }
540:
541:            protected IClassifier getFirstAssociationEnd(
542:                    IAssociation association) {
543:                IClassifier retVal = null;
544:                ETList<IAssociationEnd> associationEnds = association.getEnds();
545:                if (associationEnds.size() == 2) {
546:                    if (associationEnds.get(0) != null) {
547:                        retVal = associationEnds.get(0).getParticipant();
548:                    }
549:                } else {
550:                    assert false : "Cannot handle != 2 ends";
551:                }
552:
553:                return retVal;
554:            }
555:
556:            protected IClassifier getSecondAssociationEnd(
557:                    IAssociation association) {
558:                IClassifier retVal = null;
559:                ETList<IAssociationEnd> associationEnds = association.getEnds();
560:                if (associationEnds.size() == 2) {
561:                    if (associationEnds.get(1) != null) {
562:                        retVal = associationEnds.get(1).getParticipant();
563:                    }
564:                } else {
565:                    assert false : "Cannot handle != 2 ends";
566:                }
567:                return retVal;
568:            }
569:
570:            protected IClassifier getFirstAggregationEnd(
571:                    IAggregation aggregation) {
572:                IClassifier retVal = null;
573:
574:                IAssociationEnd aggregateEnd = aggregation.getAggregateEnd();
575:                IClassifier aggregateParticipant = null;
576:                if (aggregateEnd != null) {
577:                    retVal = aggregateEnd.getParticipant();
578:                }
579:
580:                return retVal;
581:            }
582:
583:            protected IClassifier getSecondAggregationEnd(
584:                    IAggregation aggregation) {
585:                IClassifier retVal = null;
586:
587:                IAssociationEnd partEnd = aggregation.getPartEnd();
588:                IClassifier partParticipant = null;
589:                if (partEnd != null) {
590:                    retVal = partEnd.getParticipant();
591:                }
592:
593:                return retVal;
594:            }
595:
596:            protected IElement getFirstDependencyEnd(IDependency dependency) {
597:                IElement retVal = null;
598:
599:                if (dependency instanceof  IImplementation) {
600:                    IImplementation implementation = (IImplementation) dependency;
601:                    retVal = implementation.getImplementingClassifier();
602:                } else {
603:                    // All the rest - IDependency, IAbstraction, IUsage, IPermission, 
604:                    // IRealization
605:                    retVal = dependency.getClient();
606:                }
607:
608:                return retVal;
609:            }
610:
611:            protected IElement getSecondDependencyEnd(IDependency dependency) {
612:                IElement retVal = null;
613:
614:                if (dependency instanceof  IImplementation) {
615:                    IImplementation implementation = (IImplementation) dependency;
616:                    retVal = implementation.getContract();
617:                } else {
618:                    // All the rest - IDependency, IAbstraction, IUsage, IPermission, 
619:                    // IRealization
620:                    retVal = dependency.getSupplier();
621:                }
622:
623:                return retVal;
624:            }
625:
626:            protected IClassifier getFirstGeneralizationEnd(
627:                    IGeneralization generalization) {
628:                return generalization.getSpecific();
629:            }
630:
631:            protected IClassifier getSecondGeneralizationEnd(
632:                    IGeneralization generalization) {
633:                return generalization.getGeneral();
634:            }
635:
636:            protected INamedElement getFirstCommentEnd(IComment comment) {
637:                INamedElement retVal = null;
638:
639:                ETList<INamedElement> annotatedElements = comment
640:                        .getAnnotatedElements();
641:
642:                if (annotatedElements != null) {
643:                    if (annotatedElements.size() > 0) {
644:                        retVal = annotatedElements.get(0);
645:                    }
646:                }
647:
648:                return retVal;
649:            }
650:
651:            protected IClassifier getFirstDerivationEnd(IDerivation relationship) {
652:                return relationship.getDerivedClassifier();
653:            }
654:
655:            protected IClassifier getSecondDerivationEnd(
656:                    IDerivation relationship) {
657:
658:                return relationship.getTemplate();
659:            }
660:
661:            //   protected void addTransitionEnds(ITransition transition, 
662:            //                                    RelationEnds ends)
663:            //   {
664:            //      IStateVertex source = transition.getSource();
665:            //      IStateVertex target = transition.getTarget();
666:            //      
667:            //      if((source != null) && (target != null))
668:            //      {
669:            //         ends.setFirstEnd(source);
670:            //         ends.setSecondEnd(target);
671:            //      }
672:            //   }
673:            //
674:            //   protected void addExtendEnds(IExtend extend, 
675:            //                                RelationEnds ends)
676:            //   {
677:            //      IUseCase base = extend.getBase();
678:            //      IUseCase extension = extend.getExtension();
679:            //      
680:            //      if((base != null) && (extension != null))
681:            //      {
682:            //         ends.setFirstEnd(base);
683:            //         ends.setSecondEnd(extension);
684:            //      }
685:            //   }
686:            //
687:            //   protected void addIncludeEnds(IInclude include, 
688:            //                                 RelationEnds ends)
689:            //   {
690:            //      IUseCase base = include.getBase();
691:            //      IUseCase addition = include.getAddition();
692:            //      
693:            //      if((base != null) && (addition != null))
694:            //      {
695:            //         ends.setFirstEnd(base);
696:            //         ends.setSecondEnd(addition);
697:            //      }
698:            //   }
699:            //
700:            //   protected void addActivityEdgeEnds(IActivityEdge activityEdge, 
701:            //                                      RelationEnds ends)
702:            //   {
703:            //      IActivityNode sourceNode = activityEdge.getSource();
704:            //      IActivityNode targetNode = activityEdge.getTarget();
705:            //      
706:            //      if((sourceNode != null) && (targetNode != null))
707:            //      {
708:            //         ends.setFirstEnd(sourceNode);
709:            //         ends.setSecondEnd(targetNode);
710:            //      }
711:            //   }
712:            //
713:            //   protected void addAssociationEnds(IAssociation association, 
714:            //                                     RelationEnds ends)
715:            //   {
716:            //      IAssociationEnds associationEnds = association.getEnds();
717:            //      if(associationEnds.getCount() == 2)
718:            //      {
719:            //         IClassifier end1Participant = null;
720:            //         if(associationEnds.item(0) != null)
721:            //         {
722:            //            end1Participant = associationEnds.item(0).getParticipant();
723:            //         }
724:            //      
725:            //         IClassifier end2Participant = null;
726:            //         if(associationEnds.item(1) != null)
727:            //         {
728:            //            end2Participant = associationEnds.item(1).getParticipant();
729:            //         }
730:            //         
731:            //         if((end1Participant != null) && (end2Participant != null))
732:            //         {
733:            //            ends.setFirstEnd(end1Participant);
734:            //            ends.setSecondEnd(end2Participant);
735:            //         }
736:            //      }
737:            //      else
738:            //      {
739:            //         assert false : "Cannot handle != 2 ends";
740:            //      }
741:            //   }
742:            //
743:            //   protected void addAggregationEnds(IAggregation aggregation, 
744:            //                                     RelationEnds ends)
745:            //   {
746:            //      IAssociationEnd aggregateEnd = aggregation.getAggregateEnd();
747:            //      IClassifier aggregateParticipant = null;
748:            //      if(aggregateEnd != null)
749:            //      {
750:            //         aggregateParticipant = aggregateEnd.getParticipant();
751:            //      }
752:            //      
753:            //      IAssociationEnd partEnd = aggregation.getPartEnd();
754:            //      IClassifier partParticipant = null;
755:            //      if(partEnd != null)
756:            //      {
757:            //         partParticipant = partEnd.getParticipant();
758:            //      }
759:            //      if((aggregateParticipant != null) && (partParticipant != null))
760:            //      {
761:            //         ends.setFirstEnd(aggregateParticipant);
762:            //         ends.setSecondEnd(partParticipant);
763:            //      }
764:            //   }
765:            //
766:            //   protected void addDependencyEnds(IDependency dependency, 
767:            //                                    RelationEnds ends)
768:            //   {
769:            //      if (dependency instanceof IImplementation)
770:            //      {
771:            //         IImplementation implementation = (IImplementation)dependency;
772:            //         IClassifier implementing = implementation.getImplementingClassifier();
773:            //         IInterface  contract     = implementation.getContract();
774:            //         
775:            //         if((implementing != null) && (contract != null))
776:            //         {
777:            //            ends.setFirstEnd(implementing);
778:            //            ends.setSecondEnd(contract);
779:            //         }            
780:            //      }
781:            //      else
782:            //      {
783:            //         // All the rest - IDependency, IAbstraction, IUsage, IPermission, 
784:            //         // IRealization
785:            //         INamedElement client   = dependency.getClient();
786:            //         INamedElement supplier = dependency.getSupplier();
787:            //      
788:            //         if((client != null) && (supplier != null))
789:            //         {
790:            //            ends.setFirstEnd(client);
791:            //            ends.setSecondEnd(supplier);
792:            //         }            
793:            //      }
794:            //   }
795:            //
796:            //   protected void addGeneralizationEnds(IGeneralization generalization,
797:            //                                        RelationEnds ends)
798:            //   {
799:            //      IClassifier specific = generalization.getSpecific();
800:            //      IClassifier general  = generalization.getGeneral();
801:            //      
802:            //      if((specific != null) && (general != null))
803:            //      {
804:            //         ends.setFirstEnd(specific);
805:            //         ends.setSecondEnd(general);
806:            //      }
807:            //   }
808:            //
809:            //   protected void addCommentEnds(IComment comment, 
810:            //                                 RelationEnds ends)
811:            //   {
812:            //      INamedElements annotatedElements = comment.getAnnotatedElements();
813:            //      
814:            //      if(annotatedElements != null)
815:            //      {
816:            //         if(annotatedElements.getCount() > 0)
817:            //         {
818:            //            ends.setFirstEnd(annotatedElements.item(0));
819:            //         }
820:            //      }
821:            //   }
822:            //   
823:            //   protected void addDerivationEnds(IDerivation relationship, 
824:            //                                    RelationEnds ends)
825:            //   {
826:            //      
827:            //      
828:            //      IClassifier derivedClassifier = relationship.getDerivedClassifier();
829:            //      IClassifier template = relationship.getTemplate();
830:            //      if((derivedClassifier != null) && (template != null))
831:            //      {
832:            //         ends.setFirstEnd(derivedClassifier);
833:            //         ends.setSecondEnd(template);
834:            //      }
835:            //   }
836:
837:            /** 
838:             * RelationEnds is used to specify the ends of a relationship.
839:             */
840:            public class RelationEnds {
841:                private IElement m_StartEnd = null;
842:                private IElement m_EndEnd = null;
843:
844:                public RelationEnds() {
845:                }
846:
847:                public RelationEnds(IElement first, IElement second) {
848:                }
849:
850:                /**
851:                 * @return
852:                 */
853:                public IElement getEndElement() {
854:                    return m_EndEnd;
855:                }
856:
857:                /**
858:                 * @param element
859:                 */
860:                public void setEndElement(IElement element) {
861:                    m_EndEnd = element;
862:                }
863:
864:                /**
865:                 * @return
866:                 */
867:                public IElement getStartElement() {
868:                    return m_StartEnd;
869:                }
870:
871:                /**
872:                 * @param element
873:                 */
874:                public void setStartElement(IElement element) {
875:                    m_StartEnd = element;
876:                }
877:
878:            }
879:        }
w__w_w_._j___a__v__a2___s.co_m | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.