Source Code Cross Referenced for FrontEndParameterLogicImpl.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.Iterator;
006:        import java.util.LinkedHashSet;
007:
008:        import org.andromda.metafacades.uml.AttributeFacade;
009:        import org.andromda.metafacades.uml.ClassifierFacade;
010:        import org.andromda.metafacades.uml.EventFacade;
011:        import org.andromda.metafacades.uml.FrontEndAction;
012:        import org.andromda.metafacades.uml.FrontEndControllerOperation;
013:        import org.andromda.metafacades.uml.FrontEndEvent;
014:        import org.andromda.metafacades.uml.FrontEndForward;
015:        import org.andromda.metafacades.uml.ModelElementFacade;
016:        import org.andromda.metafacades.uml.TransitionFacade;
017:        import org.andromda.metafacades.uml.UMLProfile;
018:        import org.apache.commons.collections.CollectionUtils;
019:        import org.apache.commons.collections.Predicate;
020:        import org.apache.commons.collections.Transformer;
021:        import org.apache.commons.lang.ObjectUtils;
022:        import org.apache.commons.lang.StringUtils;
023:
024:        /**
025:         * MetafacadeLogic implementation for
026:         * org.andromda.metafacades.uml.FrontEndParameter.
027:         *
028:         * @see org.andromda.metafacades.uml.FrontEndParameter
029:         */
030:        public class FrontEndParameterLogicImpl extends FrontEndParameterLogic {
031:            public FrontEndParameterLogicImpl(final Object metaObject,
032:                    final String context) {
033:                super (metaObject, context);
034:            }
035:
036:            /**
037:             * @see org.andromda.metafacades.uml.FrontEndParameter#isControllerOperationArgument()
038:             */
039:            protected boolean handleIsControllerOperationArgument() {
040:                return this .getControllerOperation() != null;
041:            }
042:
043:            /**
044:             * @see org.andromda.metafacades.uml.FrontEndParameter#getControllerOperation()
045:             */
046:            protected Object handleGetControllerOperation() {
047:                return this .getOperation();
048:            }
049:
050:            /**
051:             * @see org.andromda.metafacades.uml.FrontEndParameter#isContainedInFrontEndUseCase()
052:             */
053:            protected boolean handleIsContainedInFrontEndUseCase() {
054:                return this .getEvent() instanceof  FrontEndEvent
055:                        || this .getOperation() instanceof  FrontEndControllerOperation;
056:            }
057:
058:            /**
059:             * @see org.andromda.metafacades.uml.FrontEndParameter#getView()
060:             */
061:            protected Object handleGetView() {
062:                Object view = null;
063:                final EventFacade event = this .getEvent();
064:                if (event != null) {
065:                    final TransitionFacade transition = event.getTransition();
066:                    if (transition instanceof  FrontEndAction) {
067:                        final FrontEndAction action = (FrontEndAction) transition;
068:                        view = action.getInput();
069:                    } else if (transition instanceof  FrontEndForward) {
070:                        final FrontEndForward forward = (FrontEndForward) transition;
071:                        if (forward.isEnteringView()) {
072:                            view = forward.getTarget();
073:                        }
074:                    }
075:                }
076:                return view;
077:            }
078:
079:            /**
080:             * @see org.andromda.metafacades.uml.FrontEndParameter#isActionParameter()
081:             */
082:            protected boolean handleIsActionParameter() {
083:                final FrontEndAction action = this .getAction();
084:                return action != null
085:                        && action.getParameters().contains(this .THIS());
086:            }
087:
088:            /**
089:             * @see org.andromda.metafacades.uml.FrontEndParameter#getAction()
090:             */
091:            protected Object handleGetAction() {
092:                Object actionObject = null;
093:                final EventFacade event = this .getEvent();
094:                if (event != null) {
095:                    final TransitionFacade transition = event.getTransition();
096:                    if (transition instanceof  FrontEndAction) {
097:                        actionObject = transition;
098:                    }
099:                }
100:                return actionObject;
101:            }
102:
103:            /**
104:             * @see org.andromda.metafacades.uml.FrontEndParameter#isTable()
105:             */
106:            protected boolean handleIsTable() {
107:                boolean isTable = false;
108:                final ClassifierFacade type = this .getType();
109:                if (type != null) {
110:                    isTable = type.isCollectionType() || type.isArrayType();
111:                    if (isTable) {
112:                        final String tableTaggedValue = ObjectUtils
113:                                .toString(this 
114:                                        .findTaggedValue(UMLProfile.TAGGEDVALUE_PRESENTATION_IS_TABLE));
115:                        isTable = StringUtils.isNotBlank(tableTaggedValue) ? Boolean
116:                                .valueOf(tableTaggedValue.trim())
117:                                .booleanValue()
118:                                : true;
119:                        if (!isTable) {
120:                            isTable = !this .getTableColumnNames().isEmpty();
121:                        }
122:                    }
123:                }
124:                return isTable;
125:            }
126:
127:            /**
128:             * @see org.andromda.metafacades.uml.FrontEndParameter#getTableColumnNames()
129:             */
130:            protected Collection handleGetTableColumnNames() {
131:                final Collection tableColumnNames = new LinkedHashSet();
132:                final Collection taggedValues = this 
133:                        .findTaggedValues(UMLProfile.TAGGEDVALUE_PRESENTATION_TABLE_COLUMNS);
134:                if (!taggedValues.isEmpty()) {
135:                    for (final Iterator iterator = taggedValues.iterator(); iterator
136:                            .hasNext();) {
137:                        final String taggedValue = StringUtils
138:                                .trimToNull(String.valueOf(iterator.next()));
139:                        if (taggedValue != null) {
140:                            final String[] properties = taggedValue
141:                                    .split("[,\\s]+");
142:                            for (int ctr = 0; ctr < properties.length; ctr++) {
143:                                final String property = properties[ctr];
144:                                tableColumnNames.add(property);
145:                            }
146:                        }
147:                    }
148:                }
149:
150:                // - if we have no table column names explicitly defined, use the table
151:                // attribute names.
152:                if (tableColumnNames.isEmpty()) {
153:                    tableColumnNames.addAll(this .getTableAttributeNames());
154:                }
155:                return tableColumnNames;
156:            }
157:
158:            /**
159:             * @see org.andromda.metafacades.uml.FrontEndParameter#getTableColumns()
160:             */
161:            protected Collection handleGetTableColumns() {
162:                final Collection tableColumns = new ArrayList(this 
163:                        .getNonArrayAttributes());
164:                final Collection tableColumnNames = this .getTableColumnNames();
165:                CollectionUtils.filter(tableColumns, new Predicate() {
166:                    public boolean evaluate(final Object object) {
167:                        final ModelElementFacade attribute = (ModelElementFacade) object;
168:                        final String attributeName = attribute.getName();
169:                        return attributeName != null
170:                                && tableColumnNames.contains(attributeName);
171:                    }
172:                });
173:                return tableColumns;
174:            }
175:
176:            /**
177:             * Gets all attributes for an array type that has a corresponding non-array
178:             * type.
179:             *
180:             * @return the collection of attributes.
181:             */
182:            private Collection getNonArrayAttributes() {
183:                final Collection nonArrayAttributes = new ArrayList();
184:                final ClassifierFacade type = this .getType();
185:                if (type != null && type.isArrayType()) {
186:                    final ClassifierFacade nonArrayType = type.getNonArray();
187:                    if (nonArrayType != null) {
188:                        nonArrayAttributes.addAll(nonArrayType
189:                                .getAttributes(true));
190:                    }
191:                }
192:                return nonArrayAttributes;
193:            }
194:
195:            /**
196:             * @see org.andromda.metafacades.uml.FrontEndParameter#getTableAttributeNames()
197:             */
198:            protected Collection handleGetTableAttributeNames() {
199:                final Collection tableAttributeNames = new ArrayList(this 
200:                        .getNonArrayAttributes());
201:                CollectionUtils.transform(tableAttributeNames,
202:                        new Transformer() {
203:                            public Object transform(final Object object) {
204:                                return ((AttributeFacade) object).getName();
205:                            }
206:                        });
207:                return tableAttributeNames;
208:            }
209:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.