Source Code Cross Referenced for AttributeFacadeLogicImpl.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.EnumerationFacade;
005:        import org.andromda.metafacades.uml.NameMasker;
006:        import org.andromda.metafacades.uml.TypeMappings;
007:        import org.andromda.metafacades.uml.UMLMetafacadeProperties;
008:        import org.andromda.metafacades.uml.UMLMetafacadeUtils;
009:        import org.andromda.metafacades.uml.UMLProfile;
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.MultiplicityElement;
014:
015:        /**
016:         * MetafacadeLogic implementation for
017:         * org.andromda.metafacades.uml.AttributeFacade.
018:         *
019:         * @see org.andromda.metafacades.uml.AttributeFacade
020:         */
021:        public class AttributeFacadeLogicImpl extends AttributeFacadeLogic {
022:            public AttributeFacadeLogicImpl(final Attribute metaObject,
023:                    final String context) {
024:                super (metaObject, context);
025:            }
026:
027:            /**
028:             * @see org.andromda.metafacades.uml.AttributeFacade#getGetterName()
029:             */
030:            protected java.lang.String handleGetGetterName() {
031:                return UMLMetafacadeUtils.getGetterPrefix(this .getType())
032:                        + StringUtils.capitalize(this .getName());
033:            }
034:
035:            /**
036:             * @see org.andromda.metafacades.uml.AttributeFacade#getSetterName()
037:             */
038:            protected java.lang.String handleGetSetterName() {
039:                return "set" + StringUtils.capitalize(this .getName());
040:            }
041:
042:            /**
043:             * @see org.andromda.metafacades.uml.AttributeFacade#isReadOnly()
044:             */
045:            protected boolean handleIsReadOnly() {
046:                return this .metaObject.isReadOnly();
047:            }
048:
049:            /**
050:             * @see org.andromda.metafacades.uml.AttributeFacade#getDefaultValue()
051:             */
052:            protected java.lang.String handleGetDefaultValue() {
053:                String defaultValue = this .metaObject.getDefault();
054:                return defaultValue.equals("") ? null : defaultValue;
055:            }
056:
057:            /**
058:             * @see org.andromda.metafacades.uml.AttributeFacade#isStatic()
059:             */
060:            protected boolean handleIsStatic() {
061:                return this .metaObject.isStatic();
062:            }
063:
064:            /**
065:             * @see org.andromda.metafacades.uml.AssociationEndFacade#isMany()
066:             */
067:            protected boolean handleIsMany() {
068:                // Because of MD11.5 (their multiplicity are String), we cannot use
069:                // isMultiValued()
070:                return this .getUpper() > 1
071:                        || this .getUpper() == MultiplicityElement.UNLIMITED_UPPER_BOUND;
072:            }
073:
074:            /**
075:             * @see org.andromda.metafacades.uml.AssociationEndFacade#isRequired()
076:             */
077:            protected boolean handleIsRequired() {
078:                return this .getLower() > 0;
079:            }
080:
081:            /**
082:             * @see org.andromda.metafacades.uml.AttributeFacade#isChangeable()
083:             */
084:            protected boolean handleIsChangeable() {
085:                return !this .metaObject.isReadOnly();
086:            }
087:
088:            /**
089:             * @see org.andromda.metafacades.uml.AttributeFacade#isAddOnly()
090:             */
091:            protected boolean handleIsAddOnly() {
092:                // TODO: really nothing to do here ?
093:                return false;
094:            }
095:
096:            /**
097:             * @see org.andromda.metafacades.uml.AttributeFacade#isEnumerationLiteral()
098:             */
099:            protected boolean handleIsEnumerationLiteral() {
100:                final ClassifierFacade owner = this .getOwner();
101:                return (owner != null) && owner.isEnumeration();
102:            }
103:
104:            /**
105:             * @see org.andromda.metafacades.uml.AttributeFacade#getEnumerationValue()
106:             */
107:            protected String handleGetEnumerationValue() {
108:                String value = null;
109:                if (this .isEnumerationLiteral()) {
110:                    value = this .getDefaultValue();
111:                    value = (value == null) ? this .getName() : String
112:                            .valueOf(value);
113:                }
114:                if (this .getType().isStringType()) {
115:                    value = "\"" + value + "\"";
116:                }
117:                return value;
118:            }
119:
120:            /**
121:             * @see org.andromda.metafacades.uml.AttributeFacade#handleIsEnumerationMember()
122:             */
123:            protected boolean handleIsEnumerationMember() {
124:                boolean isMemberVariable = false;
125:                final String isMemberVariableAsString = (String) this 
126:                        .findTaggedValue(UMLProfile.TAGGEDVALUE_PERSISTENCE_ENUMERATION_MEMBER_VARIABLE);
127:                if (StringUtils.isNotEmpty(isMemberVariableAsString)
128:                        && BooleanUtils.toBoolean(isMemberVariableAsString)) {
129:                    isMemberVariable = true;
130:                }
131:                return isMemberVariable;
132:            }
133:
134:            /**
135:             * @see org.andromda.metafacades.uml.AttributeFacade#handleGetEnumerationLiteralParameters()
136:             */
137:            protected String handleGetEnumerationLiteralParameters() {
138:                return (String) this 
139:                        .findTaggedValue(UMLProfile.TAGGEDVALUE_PERSISTENCE_ENUMERATION_LITERAL_PARAMETERS);
140:            }
141:
142:            /**
143:             * @see org.andromda.metafacades.uml.AttributeFacade#handleIsEnumerationLiteralParametersExist()
144:             */
145:            protected boolean handleIsEnumerationLiteralParametersExist() {
146:                boolean parametersExist = false;
147:                if (StringUtils.isNotBlank(this 
148:                        .getEnumerationLiteralParameters())) {
149:                    parametersExist = true;
150:                }
151:                return parametersExist;
152:            }
153:
154:            /**
155:             * @see org.andromda.metafacades.uml.AttributeFacade#getGetterSetterTypeName()
156:             */
157:            protected java.lang.String handleGetGetterSetterTypeName() {
158:                String name = null;
159:                if (this .isMany()) {
160:                    final TypeMappings mappings = this .getLanguageMappings();
161:                    name = this .isOrdered() ? mappings
162:                            .getTo(UMLProfile.LIST_TYPE_NAME) : mappings
163:                            .getTo(UMLProfile.COLLECTION_TYPE_NAME);
164:
165:                    // set this attribute's type as a template parameter if required
166:                    if (BooleanUtils
167:                            .toBoolean(ObjectUtils
168:                                    .toString(this 
169:                                            .getConfiguredProperty(UMLMetafacadeProperties.ENABLE_TEMPLATING)))) {
170:                        name = name + "<"
171:                                + this .getType().getFullyQualifiedName() + ">";
172:                    }
173:                }
174:                if (name == null && this .getType() != null) {
175:                    name = this .getType().getFullyQualifiedName();
176:                }
177:                return name;
178:            }
179:
180:            /**
181:             * @see org.andromda.metafacades.uml.AttributeFacade#isOrdered()
182:             */
183:            protected boolean handleIsOrdered() {
184:                return this .metaObject.isOrdered();
185:            }
186:
187:            /**
188:             * @see org.andromda.metafacades.uml.AttributeFacade#getOwner()
189:             */
190:            protected java.lang.Object handleGetOwner() {
191:                // This is sure for attribute
192:                return this .metaObject.getClass_();
193:            }
194:
195:            /**
196:             * @see org.andromda.core.metafacade.MetafacadeBase#getValidationOwner()
197:             */
198:            public Object getValidationOwner() {
199:                return this .getOwner();
200:            }
201:
202:            /**
203:             * @see org.andromda.metafacades.uml.AttributeFacade#getType()
204:             */
205:            protected java.lang.Object handleGetType() {
206:                return this .metaObject.getType();
207:            }
208:
209:            /**
210:             * @see org.andromda.metafacades.uml.AttributeFacade#getEnumeration()
211:             */
212:            protected Object handleGetEnumeration() {
213:                return this .isEnumerationLiteral() ? this .getOwner() : null;
214:            }
215:
216:            protected boolean handleIsDefaultValuePresent() {
217:                return !(this .getDefaultValue() == null || this 
218:                        .getDefaultValue().equals(""));
219:            }
220:
221:            /**
222:             * Overridden to provide different handling of the name if this attribute represents a literal.
223:             *
224:             * @see org.andromda.metafacades.uml.ModelElementFacade#getName()
225:             */
226:            protected String handleGetName() {
227:                final String mask = String
228:                        .valueOf(this 
229:                                .getConfiguredProperty(this .getOwner() instanceof  EnumerationFacade ? UMLMetafacadeProperties.ENUMERATION_LITERAL_NAME_MASK
230:                                        : UMLMetafacadeProperties.CLASSIFIER_PROPERTY_NAME_MASK));
231:
232:                return NameMasker.mask(super .handleGetName(), mask);
233:            }
234:
235:            /*  protected boolean handleIsBindingDependenciesPresent()
236:              {
237:                  // TODO: Implement this with Templates.
238:                  // This method has been overriden. Why ?
239:                  return false;
240:              }
241:
242:              protected boolean handleIsTemplateParametersPresent()
243:              {
244:                  // TODO: This method has been overriden. Why ?
245:                  return false;
246:              }
247:
248:              protected void handleCopyTaggedValues(final ModelElementFacade element)
249:              {
250:                  // TODO: This method has been overriden. Why ?
251:              }
252:
253:              protected Object handleGetTemplateParameter(final String parameterName)
254:              {
255:                  // TODO: This method has been overriden. Why ?
256:                  return null;
257:              }
258:
259:              protected Collection handleGetTemplateParameters()
260:              {
261:                  // TODO: This method has been overriden. Why ?
262:                  return null;
263:              } */
264:
265:            /**
266:             * Get the UML upper multiplicity Not implemented for UML1.4
267:             */
268:            protected int handleGetUpper() {
269:                // MD11.5 Exports multiplicity as String
270:                return UmlUtilities.parseMultiplicity(this .metaObject
271:                        .getUpperValue());
272:            }
273:
274:            /**
275:             * Get the UML lower multiplicity Not implemented for UML1.4
276:             */
277:            protected int handleGetLower() {
278:                // MD11.5 Exports multiplicity as String
279:                return UmlUtilities.parseMultiplicity(this .metaObject
280:                        .getLowerValue());
281:            }
282:
283:            protected Object handleFindTaggedValue(String name,
284:                    final boolean follow) {
285:                name = StringUtils.trimToEmpty(name);
286:                Object value = this .findTaggedValue(name);
287:                if (follow) {
288:                    ClassifierFacade type = this .getType();
289:                    while (value == null && type != null) {
290:                        value = type.findTaggedValue(name);
291:                        type = (ClassifierFacade) type.getGeneralization();
292:                    }
293:                }
294:                return value;
295:            }
296:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.