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


001:        package org.andromda.cartridges.bpm4struts.metafacades;
002:
003:        import java.util.ArrayList;
004:        import java.util.Collection;
005:        import java.util.Iterator;
006:        import java.util.LinkedHashSet;
007:        import java.util.List;
008:
009:        import org.andromda.cartridges.bpm4struts.Bpm4StrutsGlobals;
010:        import org.andromda.cartridges.bpm4struts.Bpm4StrutsUtils;
011:        import org.andromda.metafacades.uml.ActivityGraphFacade;
012:        import org.andromda.metafacades.uml.StateMachineFacade;
013:        import org.andromda.metafacades.uml.StateVertexFacade;
014:        import org.andromda.metafacades.uml.TransitionFacade;
015:        import org.andromda.metafacades.uml.UMLMetafacadeProperties;
016:        import org.andromda.metafacades.uml.UseCaseFacade;
017:        import org.andromda.utils.StringUtilsHelper;
018:        import org.apache.commons.lang.StringUtils;
019:
020:        /**
021:         * MetafacadeLogic implementation.
022:         *
023:         * @see org.andromda.cartridges.bpm4struts.metafacades.StrutsJsp
024:         */
025:        public class StrutsJspLogicImpl extends StrutsJspLogic {
026:            public StrutsJspLogicImpl(Object metaObject, String context) {
027:                super (metaObject, context);
028:            }
029:
030:            public String getPackageName() {
031:                String packageName = null;
032:
033:                final StateMachineFacade graphContext = getStateMachine();
034:                if (graphContext instanceof  ActivityGraphFacade) {
035:                    final UseCaseFacade graphUseCase = ((ActivityGraphFacade) graphContext)
036:                            .getUseCase();
037:                    if (graphUseCase instanceof  StrutsUseCase) {
038:                        final StrutsUseCase useCase = (StrutsUseCase) graphUseCase;
039:                        packageName = useCase.getPackageName();
040:                    }
041:                }
042:                return packageName;
043:            }
044:
045:            /**
046:             * @see org.andromda.metafacades.uml.ModelElementFacade#getPackagePath()
047:             */
048:            public String getPackagePath() {
049:                return StringUtils
050:                        .replace(
051:                                this .getPackageName(),
052:                                String
053:                                        .valueOf(this 
054:                                                .getConfiguredProperty(UMLMetafacadeProperties.NAMESPACE_SEPARATOR)),
055:                                "/");
056:            }
057:
058:            protected String handleGetMessageKey() {
059:                final StringBuffer messageKey = new StringBuffer();
060:
061:                if (!normalizeMessages()) {
062:                    final UseCaseFacade useCase = this .getUseCase();
063:                    if (useCase != null) {
064:                        messageKey.append(StringUtilsHelper
065:                                .toResourceMessageKey(useCase.getName()));
066:                        messageKey.append('.');
067:                    }
068:                }
069:
070:                messageKey.append(StringUtilsHelper
071:                        .toResourceMessageKey(getName()));
072:                return messageKey.toString();
073:            }
074:
075:            protected String handleGetMessageValue() {
076:                return StringUtilsHelper.toPhrase(getName());
077:            }
078:
079:            protected String handleGetTitleKey() {
080:                return getMessageKey() + ".title";
081:            }
082:
083:            protected String handleGetTitleValue() {
084:                return StringUtilsHelper.toPhrase(getName());
085:            }
086:
087:            protected String handleGetDocumentationKey() {
088:                return getMessageKey() + ".documentation";
089:            }
090:
091:            protected String handleGetDocumentationValue() {
092:                final String value = StringUtilsHelper
093:                        .toResourceMessage(getDocumentation(""));
094:                return (value == null) ? "" : value;
095:            }
096:
097:            protected String handleGetOnlineHelpKey() {
098:                return getMessageKey() + ".online.help";
099:            }
100:
101:            protected String handleGetOnlineHelpValue() {
102:                final String crlf = "<br/>";
103:                final StringBuffer buffer = new StringBuffer();
104:
105:                final String value = StringUtilsHelper
106:                        .toResourceMessage(getDocumentation("", 64, false));
107:                buffer
108:                        .append((value == null) ? "No page documentation has been specified"
109:                                : value);
110:                buffer.append(crlf);
111:                buffer.append(crlf);
112:
113:                return StringUtilsHelper.toResourceMessage(buffer.toString());
114:            }
115:
116:            protected String handleGetOnlineHelpPagePath() {
117:                return this .getFullPath() + "_help";
118:            }
119:
120:            protected String handleGetOnlineHelpActionPath() {
121:                final StringBuffer buffer = new StringBuffer();
122:
123:                if (StringUtils.isNotBlank(this .getPackagePath())) {
124:                    buffer.append('/');
125:                    buffer.append(this .getPackagePath());
126:                }
127:                buffer.append('/');
128:                buffer.append(StringUtilsHelper.upperCamelCaseName(this 
129:                        .getName()));
130:                buffer.append("Help");
131:
132:                return buffer.toString();
133:            }
134:
135:            protected String handleGetFullPath() {
136:                return '/' + (getPackageName() + '.' + Bpm4StrutsUtils
137:                        .toWebFileName(StringUtils.trimToEmpty(getName())))
138:                        .replace('.', '/');
139:            }
140:
141:            protected boolean handleIsValidationRequired() {
142:                final Collection actions = getActions();
143:                for (final Iterator actionIterator = actions.iterator(); actionIterator
144:                        .hasNext();) {
145:                    final StrutsAction action = (StrutsAction) actionIterator
146:                            .next();
147:                    if (action.isValidationRequired()) {
148:                        return true;
149:                    }
150:                }
151:                return false;
152:            }
153:
154:            protected boolean handleIsDateFieldPresent() {
155:                final Collection actions = getActions();
156:                for (final Iterator actionIterator = actions.iterator(); actionIterator
157:                        .hasNext();) {
158:                    final StrutsAction action = (StrutsAction) actionIterator
159:                            .next();
160:                    if (action.isDateFieldPresent()) {
161:                        return true;
162:                    }
163:                }
164:                return false;
165:            }
166:
167:            protected boolean handleIsCalendarRequired() {
168:                final Collection actions = getActions();
169:                for (final Iterator actionIterator = actions.iterator(); actionIterator
170:                        .hasNext();) {
171:                    final StrutsAction action = (StrutsAction) actionIterator
172:                            .next();
173:                    if (action.isCalendarRequired()) {
174:                        return true;
175:                    }
176:                }
177:                return false;
178:            }
179:
180:            /**
181:             * Overridden since StrutsAction does not extend FrontEndAction.
182:             * 
183:             * @see org.andromda.metafacades.uml.FrontEndView#getAllActionParameters()
184:             */
185:            public List getAllActionParameters() {
186:                final List actionParameters = new ArrayList();
187:                final Collection actions = getActions();
188:                for (final Iterator iterator = actions.iterator(); iterator
189:                        .hasNext();) {
190:                    final StrutsAction action = (StrutsAction) iterator.next();
191:                    actionParameters.addAll(action.getActionParameters());
192:                }
193:                return actionParameters;
194:            }
195:
196:            /**
197:             * Overridden because StrutsAction does not extend FrontEndAction.
198:             * 
199:             * @see org.andromda.metafacades.uml.FrontEndView#getActions()
200:             */
201:            public List getActions() {
202:                final List actions = new ArrayList();
203:                final Collection outgoing = this .getOutgoing();
204:
205:                for (final Iterator iterator = outgoing.iterator(); iterator
206:                        .hasNext();) {
207:                    final Object object = iterator.next();
208:                    if (object instanceof  StrutsAction)
209:                        actions.add(object);
210:                }
211:
212:                return actions;
213:            }
214:
215:            protected List handleGetNonActionForwards() {
216:                final List actions = new ArrayList();
217:                final Collection outgoing = getOutgoing();
218:
219:                for (final Iterator iterator = outgoing.iterator(); iterator
220:                        .hasNext();) {
221:                    final Object object = iterator.next();
222:                    if (!(object instanceof  StrutsAction)) {
223:                        actions.add(object);
224:                    }
225:                }
226:                return actions;
227:            }
228:
229:            protected List handleGetPageVariables() {
230:                return this .getVariables();
231:            }
232:
233:            protected List handleGetIncomingActions() {
234:                final List incomingActionsList = new ArrayList();
235:                collectIncomingActions(this , new LinkedHashSet(),
236:                        incomingActionsList);
237:                return incomingActionsList;
238:            }
239:
240:            /**
241:             * Collects all actions that are entering the argument state vertex.
242:             *
243:             * @param stateVertex          the statevertex to process
244:             * @param processedTransitions the transitions that have already been processed
245:             * @param actions              the actions collected so far
246:             */
247:            private void collectIncomingActions(StateVertexFacade stateVertex,
248:                    Collection processedTransitions, Collection actions) {
249:                final Collection incomingTransitions = stateVertex
250:                        .getIncoming();
251:                for (final Iterator iterator = incomingTransitions.iterator(); iterator
252:                        .hasNext();) {
253:                    final TransitionFacade incomingTransition = (TransitionFacade) iterator
254:                            .next();
255:                    collectIncomingActions(incomingTransition,
256:                            processedTransitions, actions);
257:                }
258:            }
259:
260:            /**
261:             * Collects all actions that are possibly traversing the argument transitions.
262:             *
263:             * @param transition           the transition to process
264:             * @param processedTransitions the transitions that have already been processed
265:             * @param actions              the actions collected so far
266:             */
267:            private void collectIncomingActions(TransitionFacade transition,
268:                    Collection processedTransitions, Collection actions) {
269:                if (!processedTransitions.contains(transition)) {
270:                    processedTransitions.add(transition);
271:                    if (transition instanceof  StrutsAction) {
272:                        actions.add(transition);
273:
274:                        /*  @todo: TEMPORARILY COMMENTED OUT -- needs verification that isCaseStart() forms are not populated, but I think they are
275:                         if (((StrutsAction)transition).isUseCaseStart())
276:                         {
277:                         Collection finalStates = getUseCase().getFinalStates();// todo: test usecase for null
278:                         for (final Iterator iterator = finalStates.iterator(); iterator.hasNext();)
279:                         {
280:                         FinalStateFacade finalState = (FinalStateFacade) iterator.next();
281:                         collectIncomingActions(finalState, processedTransitions, actions);
282:                         }
283:                         }
284:                         */
285:                    } else {
286:                        final Collection incomingTransitions = transition
287:                                .getSource().getIncoming();
288:                        for (final Iterator iterator = incomingTransitions
289:                                .iterator(); iterator.hasNext();) {
290:                            final TransitionFacade incomingTransition = (TransitionFacade) iterator
291:                                    .next();
292:                            collectIncomingActions(incomingTransition,
293:                                    processedTransitions, actions);
294:                        }
295:                    }
296:                }
297:            }
298:
299:            protected String handleGetCssFileName() {
300:                return getFullPath() + ".css";
301:            }
302:
303:            protected List handleGetNonTableActions() {
304:                final List nonTableActions = new ArrayList();
305:
306:                final Collection actions = getActions();
307:                for (final Iterator actionIterator = actions.iterator(); actionIterator
308:                        .hasNext();) {
309:                    final StrutsAction action = (StrutsAction) actionIterator
310:                            .next();
311:                    if (!action.isTableLink()) {
312:                        nonTableActions.add(action);
313:                    }
314:                }
315:
316:                return nonTableActions;
317:            }
318:
319:            protected List handleGetTables() {
320:                final List tables = new ArrayList();
321:
322:                final List pageVariables = getPageVariables();
323:                for (int i = 0; i < pageVariables.size(); i++) {
324:                    final StrutsParameter pageVariable = (StrutsParameter) pageVariables
325:                            .get(i);
326:                    if (pageVariable.isTable()) {
327:                        tables.add(pageVariable);
328:                    }
329:                }
330:
331:                return tables;
332:            }
333:
334:            private boolean normalizeMessages() {
335:                final String normalizeMessages = (String) getConfiguredProperty(Bpm4StrutsGlobals.PROPERTY_NORMALIZE_MESSAGES);
336:                return Boolean.valueOf(normalizeMessages).booleanValue();
337:            }
338:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.