Source Code Cross Referenced for AssociationEndFacadeLogicImpl.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.metafacades.uml.ClassifierFacade;
004:        import org.andromda.metafacades.uml.NameMasker;
005:        import org.andromda.metafacades.uml.TypeMappings;
006:        import org.andromda.metafacades.uml.UMLMetafacadeProperties;
007:        import org.andromda.metafacades.uml.UMLMetafacadeUtils;
008:        import org.andromda.metafacades.uml.UMLProfile;
009:        import org.andromda.utils.StringUtilsHelper;
010:        import org.apache.commons.lang.BooleanUtils;
011:        import org.apache.commons.lang.ObjectUtils;
012:        import org.apache.commons.lang.StringUtils;
013:        import org.eclipse.uml2.AggregationKind;
014:        import org.eclipse.uml2.MultiplicityElement;
015:
016:        /**
017:         * MetafacadeLogic implementation for
018:         * org.andromda.metafacades.uml.AssociationEndFacade.
019:         *
020:         * @see org.andromda.metafacades.uml.AssociationEndFacade
021:         */
022:        public class AssociationEndFacadeLogicImpl extends
023:                AssociationEndFacadeLogic {
024:            public AssociationEndFacadeLogicImpl(
025:                    final AssociationEnd metaObject, final String context) {
026:                super (metaObject, context);
027:            }
028:
029:            /**
030:             * @see org.andromda.metafacades.uml.AssociationEndFacade#isOne2One()
031:             */
032:            protected boolean handleIsOne2One() {
033:                return !this .isMany() && !this .getOtherEnd().isMany();
034:            }
035:
036:            /**
037:             * @see org.andromda.metafacades.uml.AssociationEndFacade#isOne2Many()
038:             */
039:            protected boolean handleIsOne2Many() {
040:                return !this .isMany() && this .getOtherEnd().isMany();
041:            }
042:
043:            /**
044:             * @see org.andromda.metafacades.uml.AssociationEndFacade#isMany2One()
045:             */
046:            protected boolean handleIsMany2One() {
047:                return this .isMany() && !this .getOtherEnd().isMany();
048:            }
049:
050:            /**
051:             * @see org.andromda.metafacades.uml.AssociationEndFacade#isMany2Many()
052:             */
053:            protected boolean handleIsMany2Many() {
054:                return this .isMany() && this .getOtherEnd().isMany();
055:            }
056:
057:            /**
058:             * @see org.andromda.metafacades.uml.AssociationEndFacade#isAggregation()
059:             */
060:            protected boolean handleIsAggregation() {
061:                return UmlUtilities.getOppositeAssociationEnd(this .metaObject)
062:                        .getAggregation()
063:                        .equals(AggregationKind.SHARED_LITERAL);
064:            }
065:
066:            /**
067:             * @see org.andromda.metafacades.uml.AssociationEndFacade#isComposition()
068:             */
069:            protected boolean handleIsComposition() {
070:                return UmlUtilities.getOppositeAssociationEnd(this .metaObject)
071:                        .getAggregation().equals(
072:                                AggregationKind.COMPOSITE_LITERAL);
073:            }
074:
075:            /**
076:             * @see org.andromda.metafacades.uml.AssociationEndFacade#isOrdered()
077:             */
078:            protected boolean handleIsOrdered() {
079:                return this .metaObject.isOrdered();
080:            }
081:
082:            /**
083:             * @see org.andromda.metafacades.uml.AssociationEndFacade#isReadOnly()
084:             */
085:            protected boolean handleIsReadOnly() {
086:                return this .metaObject.isReadOnly();
087:            }
088:
089:            /**
090:             * @see org.andromda.metafacades.uml.AssociationEndFacade#isNavigable()
091:             */
092:            protected boolean handleIsNavigable() {
093:                return this .metaObject.isNavigable();
094:            }
095:
096:            /**
097:             * @see org.andromda.metafacades.uml14.ModelElementFacadeLogic#handleGetName()
098:             */
099:            protected String handleGetName() {
100:                String name = super .handleGetName();
101:
102:                // if name is empty, then get the name from the type
103:                if (StringUtils.isEmpty(name)) {
104:                    final ClassifierFacade type = this .getType();
105:                    if (type != null) {
106:                        name = StringUtils.uncapitalize(StringUtils
107:                                .trimToEmpty(type.getName()));
108:                    }
109:                    if (this .isMany() && this .isPluralizeAssociationEndNames()) {
110:                        name = StringUtilsHelper.pluralize(name);
111:                    }
112:                }
113:                final String nameMask = String
114:                        .valueOf(this 
115:                                .getConfiguredProperty(UMLMetafacadeProperties.CLASSIFIER_PROPERTY_NAME_MASK));
116:                return NameMasker.mask(name, nameMask);
117:            }
118:
119:            /**
120:             * Indicates whether or not we should pluralize association end names.
121:             *
122:             * @return true/false
123:             */
124:            private boolean isPluralizeAssociationEndNames() {
125:                final Object value = this 
126:                        .getConfiguredProperty(UMLMetafacadeProperties.PLURALIZE_ASSOCIATION_END_NAMES);
127:                return value != null
128:                        && Boolean.valueOf(String.valueOf(value))
129:                                .booleanValue();
130:            }
131:
132:            /**
133:             * @see org.andromda.metafacades.uml.AssociationEndFacade#getGetterName()
134:             */
135:            protected java.lang.String handleGetGetterName() {
136:                return UMLMetafacadeUtils.getGetterPrefix(this .getType())
137:                        + StringUtils.capitalize(this .getName());
138:            }
139:
140:            /**
141:             * @see org.andromda.metafacades.uml.AssociationEndFacade#getSetterName()
142:             */
143:            protected java.lang.String handleGetSetterName() {
144:                return "set" + StringUtils.capitalize(this .getName());
145:            }
146:
147:            /**
148:             * @see org.andromda.metafacades.uml.AssociationEndFacade#getGetterSetterTypeName()
149:             */
150:            protected java.lang.String handleGetGetterSetterTypeName() {
151:                String name = null;
152:                if (this .isMany()) {
153:                    final TypeMappings mappings = this .getLanguageMappings();
154:                    if (mappings != null) {
155:                        name = mappings
156:                                .getTo(this .isOrdered() ? UMLProfile.LIST_TYPE_NAME
157:                                        : UMLProfile.COLLECTION_TYPE_NAME);
158:                    }
159:
160:                    // set this association end's type as a template parameter if
161:                    // required
162:                    if (this .getType() != null
163:                            && BooleanUtils
164:                                    .toBoolean(ObjectUtils
165:                                            .toString(this 
166:                                                    .getConfiguredProperty(UMLMetafacadeProperties.ENABLE_TEMPLATING)))) {
167:                        name = name + "<"
168:                                + this .getType().getFullyQualifiedName() + ">";
169:                    }
170:                }
171:                if (name == null && this .getType() != null) {
172:                    name = this .getType().getFullyQualifiedName();
173:                }
174:                return name;
175:            }
176:
177:            /**
178:             * @see org.andromda.metafacades.uml.AssociationEndFacade#isMany()
179:             */
180:            protected boolean handleIsMany() {
181:                // Because of MD11.5 (their multiplicity are String), we cannot use
182:                // isMultiValued()
183:                return this .getUpper() > 1
184:                        || this .getUpper() == MultiplicityElement.UNLIMITED_UPPER_BOUND;
185:            }
186:
187:            /**
188:             * @see org.andromda.metafacades.uml.AssociationEndFacade#isRequired()
189:             */
190:            protected boolean handleIsRequired() {
191:                return (this .getLower() > 0);
192:            }
193:
194:            /**
195:             * @see org.andromda.metafacades.uml.AssociationEndFacade#isChild()
196:             */
197:            protected boolean handleIsChild() {
198:                return this .getOtherEnd() != null
199:                        && this .getOtherEnd().isComposition();
200:            }
201:
202:            /**
203:             * @see org.andromda.metafacades.uml.AssociationEndFacade#getOtherEnd()
204:             */
205:            protected java.lang.Object handleGetOtherEnd() {
206:                return UmlUtilities.getOppositeAssociationEnd(this .metaObject);
207:            }
208:
209:            /**
210:             * @see org.andromda.metafacades.uml.AssociationEndFacade#getAssociation()
211:             */
212:            protected java.lang.Object handleGetAssociation() {
213:                return this .metaObject.getAssociation();
214:            }
215:
216:            /**
217:             * @see org.andromda.metafacades.uml.AssociationEndFacade#getType()
218:             */
219:            protected java.lang.Object handleGetType() {
220:                // In uml1.4 facade, it returns getParticipant
221:                return this .metaObject.getType();
222:            }
223:
224:            /**
225:             * @see org.andromda.core.metafacade.MetafacadeBase#getValidationOwner()
226:             */
227:            public Object getValidationOwner() {
228:                return this .getType();
229:            }
230:
231:            /**
232:             * Get the UML upper multiplicity Not implemented for UML1.4
233:             */
234:            protected int handleGetUpper() {
235:                // MD11.5 Exports multiplicity as String
236:                return UmlUtilities.parseMultiplicity(this .metaObject
237:                        .getUpperValue());
238:            }
239:
240:            /**
241:             * Get the UML lower multiplicity Not implemented for UML1.4
242:             */
243:            protected int handleGetLower() {
244:                // MD11.5 Exports multiplicity as String
245:                return UmlUtilities.parseMultiplicity(this.metaObject
246:                        .getLowerValue());
247:            }
248:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.