Source Code Cross Referenced for FrontEndUseCaseLogicImpl.java in  » UML » AndroMDA-3.2 » org » andromda » metafacades » emf » uml2 » 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 » UML » AndroMDA 3.2 » org.andromda.metafacades.emf.uml2 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.andromda.metafacades.emf.uml2;
002:
003:        import java.util.ArrayList;
004:        import java.util.Collection;
005:        import java.util.Collections;
006:        import java.util.Iterator;
007:        import java.util.LinkedHashMap;
008:        import java.util.LinkedHashSet;
009:        import java.util.List;
010:        import java.util.Map;
011:
012:        import org.andromda.metafacades.uml.ActivityGraphFacade;
013:        import org.andromda.metafacades.uml.AssociationEndFacade;
014:        import org.andromda.metafacades.uml.ClassifierFacade;
015:        import org.andromda.metafacades.uml.FrontEndAction;
016:        import org.andromda.metafacades.uml.FrontEndActivityGraph;
017:        import org.andromda.metafacades.uml.FrontEndFinalState;
018:        import org.andromda.metafacades.uml.FrontEndForward;
019:        import org.andromda.metafacades.uml.FrontEndParameter;
020:        import org.andromda.metafacades.uml.FrontEndUseCase;
021:        import org.andromda.metafacades.uml.FrontEndView;
022:        import org.andromda.metafacades.uml.Role;
023:        import org.andromda.metafacades.uml.UMLProfile;
024:
025:        /**
026:         * MetafacadeLogic implementation for
027:         * org.andromda.metafacades.uml.FrontEndUseCase.
028:         *
029:         * @see org.andromda.metafacades.uml.FrontEndUseCase
030:         */
031:        public class FrontEndUseCaseLogicImpl extends FrontEndUseCaseLogic {
032:            public FrontEndUseCaseLogicImpl(final Object metaObject,
033:                    final String context) {
034:                super (metaObject, context);
035:            }
036:
037:            /**
038:             * @see org.andromda.metafacades.uml.FrontEndUseCase#isEntryUseCase()
039:             */
040:            protected boolean handleIsEntryUseCase() {
041:                return this 
042:                        .hasStereotype(UMLProfile.STEREOTYPE_FRONT_END_APPLICATION);
043:            }
044:
045:            /**
046:             * @see org.andromda.metafacades.uml.FrontEndUseCase#getController()
047:             */
048:            protected java.lang.Object handleGetController() {
049:                final FrontEndActivityGraph graph = this .getActivityGraph();
050:                return graph == null ? null : graph.getController();
051:            }
052:
053:            /**
054:             * @see org.andromda.metafacades.uml.FrontEndUseCase#getActivityGraph()
055:             */
056:            protected java.lang.Object handleGetActivityGraph() {
057:                // There is a method in usecase Facade.
058:                // We can use it because, for now, we don't support hyperlink neither
059:                // tag value way to define
060:                // which activity graph is modelised for this use case.
061:                return this .getFirstActivityGraph();
062:            }
063:
064:            /**
065:             * @see org.andromda.metafacades.uml.FrontEndUseCase#getReferencingFinalStates()
066:             */
067:            protected List handleGetReferencingFinalStates() {
068:                return new ArrayList(this .getModel()
069:                        .findFinalStatesWithNameOrHyperlink(this ));
070:            }
071:
072:            /**
073:             * @see org.andromda.metafacades.uml.FrontEndUseCase#getAllUseCases()
074:             */
075:            protected List handleGetAllUseCases() {
076:                final List useCases = new ArrayList();
077:                for (final Iterator useCaseIterator = this .getModel()
078:                        .getAllUseCases().iterator(); useCaseIterator.hasNext();) {
079:                    final Object object = useCaseIterator.next();
080:                    if (object instanceof  FrontEndUseCase) {
081:                        useCases.add(object);
082:                    }
083:                }
084:                return useCases;
085:            }
086:
087:            /**
088:             * Gets those roles directly associated to this use-case.
089:             */
090:            private Collection getAssociatedRoles() {
091:                final Collection usersList = new ArrayList();
092:                final Collection associationEnds = this .getAssociationEnds();
093:                for (final Iterator iterator = associationEnds.iterator(); iterator
094:                        .hasNext();) {
095:                    final AssociationEndFacade associationEnd = (AssociationEndFacade) iterator
096:                            .next();
097:                    final ClassifierFacade classifier = associationEnd
098:                            .getOtherEnd().getType();
099:                    if (classifier instanceof  Role) {
100:                        usersList.add(classifier);
101:                    }
102:                }
103:                return usersList;
104:            }
105:
106:            /**
107:             * Recursively collects all roles generalizing the argument user, in the
108:             * specified collection.
109:             */
110:            private void collectRoles(final Role role, final Collection roles) {
111:                if (!roles.contains(role)) {
112:                    roles.add(role);
113:                    final Collection childUsers = role.getGeneralizedByActors();
114:                    for (final Iterator iterator = childUsers.iterator(); iterator
115:                            .hasNext();) {
116:                        final Role childUser = (Role) iterator.next();
117:                        this .collectRoles(childUser, roles);
118:                    }
119:                }
120:            }
121:
122:            /**
123:             * @see org.andromda.metafacades.uml.FrontEndUseCase#getRoles()
124:             */
125:            protected List handleGetRoles() {
126:                final Collection allRoles = new LinkedHashSet();
127:                final Collection associatedUsers = this .getAssociatedRoles();
128:                for (final Iterator iterator = associatedUsers.iterator(); iterator
129:                        .hasNext();) {
130:                    final Role user = (Role) iterator.next();
131:                    this .collectRoles(user, allRoles);
132:                }
133:                return new ArrayList(allRoles);
134:            }
135:
136:            /**
137:             * @see org.andromda.metafacades.uml.FrontEndUseCase#getAllRoles()
138:             */
139:            protected List handleGetAllRoles() {
140:                final Collection allRoles = new LinkedHashSet();
141:                for (final Iterator iterator = this .getAllUseCases().iterator(); iterator
142:                        .hasNext();) {
143:                    allRoles.addAll(((FrontEndUseCase) iterator.next())
144:                            .getRoles());
145:                }
146:                return new ArrayList(allRoles);
147:            }
148:
149:            /**
150:             * @see org.andromda.metafacades.uml.FrontEndUseCase#isSecured()
151:             */
152:            protected boolean handleIsSecured() {
153:                return !this .getRoles().isEmpty();
154:            }
155:
156:            /**
157:             * @see org.andromda.metafacades.uml.FrontEndUseCase#getViews()
158:             */
159:            protected List handleGetViews() {
160:                List views;
161:                final ActivityGraphFacade graph = this .getActivityGraph();
162:                if (graph == null) {
163:                    views = Collections.EMPTY_LIST;
164:                } else {
165:                    views = new ArrayList(this .getModel()
166:                            .getAllActionStatesWithStereotype(graph,
167:                                    UMLProfile.STEREOTYPE_FRONT_END_VIEW));
168:                }
169:                return views;
170:            }
171:
172:            /**
173:             * @see org.andromda.metafacades.uml.FrontEndUseCase#getViews()
174:             */
175:            protected List handleGetActions() {
176:                final Collection actions = new LinkedHashSet();
177:                final Collection pages = this .getViews();
178:                for (final Iterator pageIterator = pages.iterator(); pageIterator
179:                        .hasNext();) {
180:                    final FrontEndView view = (FrontEndView) pageIterator
181:                            .next();
182:                    actions.addAll(view.getActions());
183:                }
184:
185:                final FrontEndActivityGraph graph = this .getActivityGraph();
186:                if (graph != null) {
187:                    final FrontEndAction action = graph.getInitialAction();
188:                    if (action != null) {
189:                        actions.add(action);
190:                    }
191:                }
192:                return new ArrayList(actions);
193:            }
194:
195:            /**
196:             * @see org.andromda.metafacades.uml.FrontEndUseCase#getInitialView()
197:             */
198:            protected Object handleGetInitialView() {
199:                FrontEndView view = null;
200:                final FrontEndActivityGraph graph = this .getActivityGraph();
201:                final FrontEndAction action = graph != null ? this 
202:                        .getActivityGraph().getInitialAction() : null;
203:                final Collection forwards = action != null ? action
204:                        .getActionForwards() : null;
205:                if (forwards != null) {
206:                    for (final Iterator iterator = forwards.iterator(); iterator
207:                            .hasNext();) {
208:                        final FrontEndForward forward = (FrontEndForward) iterator
209:                                .next();
210:                        final Object target = forward.getTarget();
211:                        if (target instanceof  FrontEndView) {
212:                            view = (FrontEndView) target;
213:                        } else if (target instanceof  FrontEndFinalState) {
214:                            final FrontEndFinalState finalState = (FrontEndFinalState) target;
215:                            final FrontEndUseCase targetUseCase = finalState
216:                                    .getTargetUseCase();
217:                            if (targetUseCase != null
218:                                    && !targetUseCase.equals(this .THIS())) {
219:                                view = targetUseCase.getInitialView();
220:                            }
221:                        }
222:                    }
223:                }
224:                return view;
225:            }
226:
227:            /**
228:             * @see org.andromda.metafacades.uml.FrontEndUseCase#getViewVariables()
229:             */
230:            protected List handleGetViewVariables() {
231:                final Map pageVariableMap = new LinkedHashMap();
232:
233:                // - page variables can occur twice or more in the usecase if their
234:                // names are the same for different forms, storing them in a map
235:                // solves this issue because those names do not have the action-name
236:                // prefix
237:                final Collection views = this .getViews();
238:                for (final Iterator pageIterator = views.iterator(); pageIterator
239:                        .hasNext();) {
240:                    final FrontEndView view = (FrontEndView) pageIterator
241:                            .next();
242:                    final Collection variables = view.getVariables();
243:                    for (final Iterator variableIterator = variables.iterator(); variableIterator
244:                            .hasNext();) {
245:                        FrontEndParameter variable = (FrontEndParameter) variableIterator
246:                                .next();
247:                        final String name = variable.getName();
248:                        if (name != null && name.trim().length() > 0) {
249:                            final FrontEndParameter existingVariable = (FrontEndParameter) pageVariableMap
250:                                    .get(name);
251:                            if (existingVariable != null) {
252:                                if (existingVariable.isTable()) {
253:                                    variable = existingVariable;
254:                                }
255:                            }
256:                            pageVariableMap.put(name, variable);
257:                        }
258:                    }
259:                }
260:                return new ArrayList(pageVariableMap.values());
261:            }
262:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.