Source Code Cross Referenced for EnumerationFacadeLogicImpl.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 org.andromda.core.metafacade.MetafacadeConstants;
004:        import org.andromda.metafacades.uml.AttributeFacade;
005:        import org.andromda.metafacades.uml.ClassifierFacade;
006:        import org.andromda.metafacades.uml.ModelElementFacade;
007:        import org.andromda.metafacades.uml.NameMasker;
008:        import org.andromda.metafacades.uml.UMLMetafacadeProperties;
009:        import org.apache.commons.collections.CollectionUtils;
010:        import org.apache.commons.collections.Predicate;
011:        import org.apache.commons.lang.BooleanUtils;
012:        import org.apache.commons.lang.StringUtils;
013:        import org.eclipse.uml2.Enumeration;
014:        import org.eclipse.uml2.NamedElement;
015:        import org.eclipse.uml2.EnumerationLiteral;
016:
017:        import java.util.Collection;
018:
019:        /**
020:         * MetafacadeLogic implementation for
021:         * org.andromda.metafacades.uml.EnumerationFacade.
022:         *
023:         * @see org.andromda.metafacades.uml.EnumerationFacade
024:         */
025:        public class EnumerationFacadeLogicImpl extends EnumerationFacadeLogic {
026:            public EnumerationFacadeLogicImpl(final Object metaObject,
027:                    final String context) {
028:                super (metaObject, context);
029:            }
030:
031:            /**
032:             * Overridden to provide name masking.
033:             *
034:             * @see org.andromda.metafacades.uml.ModelElementFacade#getName()
035:             */
036:            protected String handleGetName() {
037:                final String nameMask = String
038:                        .valueOf(this 
039:                                .getConfiguredProperty(UMLMetafacadeProperties.ENUMERATION_NAME_MASK));
040:                return NameMasker.mask(super .handleGetName(), nameMask);
041:            }
042:
043:            /**
044:             * @see org.andromda.metafacades.uml.EnumerationFacade#getLiterals()
045:             */
046:            protected java.util.Collection handleGetLiterals() {
047:                // To Check: could be sufficient to return the collection of literals only
048:                //           without filtering
049:                final Collection literals = (this .metaObject instanceof  Enumeration ? ((Enumeration) this .metaObject)
050:                        .getOwnedLiterals()
051:                        : CollectionUtils.collect(this .getAttributes(),
052:                                UmlUtilities.ELEMENT_TRANSFORMER));
053:
054:                CollectionUtils.filter(literals, new Predicate() {
055:                    public boolean evaluate(Object object) {
056:                        // evaluates to true in case it's a native literal
057:                        // or an attribute which is not considered a regular member
058:                        return (object instanceof  EnumerationLiteral)
059:                                || (object instanceof  AttributeFacade && !((AttributeFacade) object)
060:                                        .isEnumerationMember());
061:                    }
062:                });
063:                return literals;
064:            }
065:
066:            /**
067:             * @see org.andromda.metafacades.uml.EnumerationFacade#getMemberVariables()
068:             */
069:            protected Collection handleGetMemberVariables() {
070:                // To Check: could be sufficient to return the collection of attributes only
071:                //           without filtering
072:                final Collection variables = (this .metaObject instanceof  Enumeration ? ((Enumeration) this .metaObject)
073:                        .getOwnedLiterals()
074:                        : CollectionUtils.collect(this .getAttributes(),
075:                                UmlUtilities.ELEMENT_TRANSFORMER));
076:
077:                CollectionUtils.filter(variables, new Predicate() {
078:                    public boolean evaluate(Object object) {
079:                        // evaluates to true in case it's NOT a native literal
080:                        // but an attribute which considered as a regular member
081:                        return object instanceof  AttributeFacade
082:                                && ((AttributeFacade) object)
083:                                        .isEnumerationMember();
084:                    }
085:                });
086:                return variables;
087:            }
088:
089:            /**
090:             * @see org.andromda.metafacades.uml.EnumerationFacade#getFromOperationSignature()
091:             */
092:            protected String handleGetFromOperationSignature() {
093:                final StringBuffer signature = new StringBuffer(this 
094:                        .getFromOperationName());
095:                final ClassifierFacade type = this .getLiteralType();
096:                if (type != null) {
097:                    signature.append('(');
098:                    signature.append(type.getFullyQualifiedName());
099:                    signature.append(" value)");
100:                }
101:                return signature.toString();
102:            }
103:
104:            /**
105:             * @see org.andromda.metafacades.uml.EnumerationFacade#isTypeSafe()
106:             */
107:            protected boolean handleIsTypeSafe() {
108:                return BooleanUtils
109:                        .toBoolean(String
110:                                .valueOf(this 
111:                                        .getConfiguredProperty(UMLMetafacadeProperties.TYPE_SAFE_ENUMS_ENABLED)));
112:            }
113:
114:            /**
115:             * @see org.andromda.metafacades.uml.EnumerationFacade#getFromOperationName()
116:             */
117:            protected String handleGetFromOperationName() {
118:                final StringBuffer name = new StringBuffer("from");
119:                final ClassifierFacade type = this .getLiteralType();
120:                if (type != null) {
121:                    name.append(StringUtils.capitalize(type.getName()));
122:                }
123:                return name.toString();
124:            }
125:
126:            /**
127:             * @see org.andromda.metafacades.uml.EnumerationFacade#getLiteralType()
128:             */
129:            protected Object handleGetLiteralType() {
130:                Object type = null;
131:                final Collection literals = this .getLiterals();
132:                if (literals != null && !literals.isEmpty()) {
133:                    ModelElementFacade literal = (ModelElementFacade) literals
134:                            .iterator().next();
135:                    if (literal instanceof  AttributeFacade) {
136:                        type = ((AttributeFacade) literals.iterator().next())
137:                                .getType();
138:                    } else {
139:                        type = UmlUtilities.findByFullyQualifiedName(
140:                                ((NamedElement) this .metaObject).eResource()
141:                                        .getResourceSet(),
142:                                "datatype::String", // todo: use this (doesn't work for some reason): UMLMetafacadeProperties.DEFAULT_ENUMERATION_LITERAL_TYPE,
143:                                MetafacadeConstants.NAMESPACE_SCOPE_OPERATOR,
144:                                true);
145:                    }
146:                }
147:                return type;
148:            }
149:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.