Source Code Cross Referenced for EntityAttributeLogicImpl.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.EntityMetafacadeUtils;
005:        import org.andromda.metafacades.uml.EnumerationFacade;
006:        import org.andromda.metafacades.uml.NameMasker;
007:        import org.andromda.metafacades.uml.TypeMappings;
008:        import org.andromda.metafacades.uml.UMLMetafacadeProperties;
009:        import org.andromda.metafacades.uml.UMLProfile;
010:        import org.apache.commons.lang.ObjectUtils;
011:        import org.apache.commons.lang.StringUtils;
012:
013:        /**
014:         * MetafacadeLogic implementation for
015:         * org.andromda.metafacades.uml.EntityAttribute.
016:         *
017:         * @see org.andromda.metafacades.uml.EntityAttribute
018:         */
019:        public class EntityAttributeLogicImpl extends EntityAttributeLogic {
020:            public EntityAttributeLogicImpl(final Object metaObject,
021:                    final String context) {
022:                super (metaObject, context);
023:            }
024:
025:            /**
026:             * Overridden to provide name masking.
027:             *
028:             * @see org.andromda.metafacades.uml.ModelElementFacade#getName()
029:             */
030:            protected String handleGetName() {
031:                final String nameMask = String
032:                        .valueOf(this 
033:                                .getConfiguredProperty(UMLMetafacadeProperties.ENTITY_PROPERTY_NAME_MASK));
034:                return NameMasker.mask(super .handleGetName(), nameMask);
035:            }
036:
037:            /**
038:             * @see org.andromda.metafacades.uml.EntityAttribute#getColumnLength()
039:             */
040:            protected java.lang.String handleGetColumnLength() {
041:                return (String) this 
042:                        .findTaggedValue(UMLProfile.TAGGEDVALUE_PERSISTENCE_COLUMN_LENGTH);
043:            }
044:
045:            /**
046:             * @see org.andromda.metafacades.uml.EntityAttribute#getColumnName()
047:             */
048:            protected java.lang.String handleGetColumnName() {
049:                final Short maxSqlNameLength = Short
050:                        .valueOf((String) this 
051:                                .getConfiguredProperty(UMLMetafacadeProperties.MAX_SQL_NAME_LENGTH));
052:                final String columnNamePrefix = this 
053:                        .isConfiguredProperty(UMLMetafacadeProperties.COLUMN_NAME_PREFIX) ? ObjectUtils
054:                        .toString(this 
055:                                .getConfiguredProperty(UMLMetafacadeProperties.COLUMN_NAME_PREFIX))
056:                        : null;
057:                return EntityMetafacadeUtils
058:                        .getSqlNameFromTaggedValue(
059:                                columnNamePrefix,
060:                                this ,
061:                                UMLProfile.TAGGEDVALUE_PERSISTENCE_COLUMN,
062:                                maxSqlNameLength,
063:                                this 
064:                                        .getConfiguredProperty(UMLMetafacadeProperties.SQL_NAME_SEPARATOR));
065:            }
066:
067:            /**
068:             * @see org.andromda.metafacades.uml.EntityAttribute#getJdbcMappings()
069:             */
070:            protected org.andromda.metafacades.uml.TypeMappings handleGetJdbcMappings() {
071:                return this 
072:                        .getMappingsProperty(UMLMetafacadeProperties.JDBC_MAPPINGS_URI);
073:            }
074:
075:            /**
076:             * @see org.andromda.metafacades.uml.EntityAttribute#getJdbcType()
077:             */
078:            protected java.lang.String handleGetJdbcType() {
079:                String value = null;
080:                if (this .getJdbcMappings() != null) {
081:                    final ClassifierFacade type = this .getType();
082:                    if (type != null) {
083:                        final String typeName = type
084:                                .getFullyQualifiedName(true);
085:                        value = this .getJdbcMappings().getTo(typeName);
086:                    }
087:                }
088:
089:                return value;
090:            }
091:
092:            /**
093:             * @see org.andromda.metafacades.uml.EntityAttribute#getSqlMappings()
094:             */
095:            protected org.andromda.metafacades.uml.TypeMappings handleGetSqlMappings() {
096:                return this 
097:                        .getMappingsProperty(UMLMetafacadeProperties.SQL_MAPPINGS_URI);
098:            }
099:
100:            /**
101:             * @see org.andromda.metafacades.uml.EntityAttribute#getSqlType()
102:             */
103:            protected java.lang.String handleGetSqlType() {
104:                String value = null;
105:                if (this .getSqlMappings() != null) {
106:                    final ClassifierFacade type = this .getType();
107:                    if (type != null) {
108:                        String typeName = type.getFullyQualifiedName(true);
109:
110:                        // if its an enumeration, the sql type is the literal type
111:                        if (type.isEnumeration()) {
112:                            ClassifierFacade literalType = ((EnumerationFacade) type)
113:                                    .getLiteralType();
114:                            if (literalType != null) {
115:                                typeName = literalType
116:                                        .getFullyQualifiedName(true);
117:                            }
118:                        }
119:                        value = this .getSqlMappings().getTo(typeName);
120:                        final String columnLength = this .getColumnLength();
121:                        if (StringUtils.isNotEmpty(columnLength)) {
122:                            value = EntityMetafacadeUtils.constructSqlTypeName(
123:                                    value, columnLength);
124:                        }
125:                    }
126:                }
127:                return value;
128:            }
129:
130:            /**
131:             * @see org.andromda.metafacades.uml.EntityAttribute#isIdentifier()
132:             */
133:            protected boolean handleIsIdentifier() {
134:                return this .hasStereotype(UMLProfile.STEREOTYPE_IDENTIFIER);
135:            }
136:
137:            /**
138:             * @see org.andromda.metafacades.uml.EntityAttribute#isUnique()
139:             */
140:            protected boolean handleIsUnique() {
141:                // TODO: Do we consider isUnique from AttributeFacade ?
142:                return this .hasStereotype(UMLProfile.STEREOTYPE_UNIQUE);
143:            }
144:
145:            /**
146:             * @see org.andromda.metafacades.uml.EntityAttribute#getColumnIndex()
147:             */
148:            protected java.lang.String handleGetColumnIndex() {
149:                final String index = (String) this 
150:                        .findTaggedValue(UMLProfile.TAGGEDVALUE_PERSISTENCE_COLUMN_INDEX);
151:                return index != null ? StringUtils.trimToEmpty(index) : null;
152:            }
153:
154:            /**
155:             * Gets a Mappings instance from a property registered under the given
156:             * <code>propertyName</code>.
157:             *
158:             * @param propertyName
159:             *            the property name to register under.
160:             * @return the Mappings instance.
161:             */
162:            private TypeMappings getMappingsProperty(final String propertyName) {
163:                final Object property = this 
164:                        .getConfiguredProperty(propertyName);
165:                TypeMappings mappings = null;
166:                String uri = null;
167:                if (property instanceof  String) {
168:                    uri = (String) property;
169:                    try {
170:                        mappings = TypeMappings.getInstance(uri);
171:                        this .setProperty(propertyName, mappings);
172:                    } catch (Throwable th) {
173:                        String errMsg = "Error getting '" + propertyName
174:                                + "' --> '" + uri + "'";
175:                        this .logger.error(errMsg, th);
176:
177:                        // don't throw the exception
178:                    }
179:                } else {
180:                    mappings = (TypeMappings) property;
181:                }
182:                return mappings;
183:            }
184:
185:            protected boolean handleIsTransient() {
186:                return this .hasStereotype(UMLProfile.STEREOTYPE_TRANSIENT);
187:            }
188:
189:            /**
190:             * @see org.andromda.metafacades.uml.EntityAttribute#getUniqueGroup()
191:             */
192:            protected String handleGetUniqueGroup() {
193:                final String group = (String) this
194:                        .findTaggedValue(UMLProfile.TAGGEDVALUE_PERSISTENCE_COLUMN_UNIQUE_GROUP);
195:                return group != null ? StringUtils.trimToEmpty(group) : null;
196:            }
197:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.