Source Code Cross Referenced for VcCMRField.java in  » J2EE » JOnAS-4.8.6 » org » objectweb » jonas_ejb » genic » 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 » J2EE » JOnAS 4.8.6 » org.objectweb.jonas_ejb.genic 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * JOnAS: Java(TM) Open Application Server
003:         * Copyright (C) 1999-2004 Bull S.A.
004:         * Contact: jonas-team@objectweb.org
005:         *
006:         * This library is free software; you can redistribute it and/or
007:         * modify it under the terms of the GNU Lesser General Public
008:         * License as published by the Free Software Foundation; either
009:         * version 2.1 of the License, or any later version.
010:         *
011:         * This library is distributed in the hope that it will be useful,
012:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014:         * Lesser General Public License for more details.
015:         *
016:         * You should have received a copy of the GNU Lesser General Public
017:         * License along with this library; if not, write to the Free Software
018:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
019:         * USA
020:         *
021:         * --------------------------------------------------------------------------
022:         * $Id: VcCMRField.java 7536 2005-10-19 22:08:18Z rhs $
023:         * --------------------------------------------------------------------------
024:         */package org.objectweb.jonas_ejb.genic;
025:
026:        import org.objectweb.jonas_ejb.deployment.api.EjbRelationshipRoleDesc;
027:        import org.objectweb.jonas_ejb.deployment.api.EntityCmp2Desc;
028:        import org.objectweb.jonas_ejb.lib.BeanNaming;
029:
030:        /**
031:         * This class is used in the velocity context.
032:         * It represents a CMR field.
033:         *
034:         * @author S.Chassande-Barrioz : Initial developer
035:         * @author Helene Joanin
036:         */
037:        public class VcCMRField {
038:
039:            /**
040:             * Name of the cmr field
041:             */
042:            private String name;
043:            /**
044:             * Name of cmr field with the first letter capitalized
045:             */
046:            private String uFLName;
047:            /**
048:             * Type's name of the cmr field
049:             */
050:            private String typeName;
051:            /**
052:             * First relationship-role of the cmr field
053:             */
054:            private EjbRelationshipRoleDesc rsr;
055:            /**
056:             * Second relationship-role of the cmr field
057:             */
058:            private EjbRelationshipRoleDesc rsr2;
059:            /**
060:             * Relation's type of the cmr field
061:             */
062:            private byte relationType = -1;
063:            /**
064:             * Name of the JORM genclass.
065:             * This field has a non null value if the cmr field is a multivalued relation
066:             */
067:            private String genClassName = null;
068:            /**
069:             * Description of the cmr filed.
070:             */
071:            private EntityCmp2Desc element = null;
072:
073:            /**
074:             * It builds a cmr field descriptor usable in velocity context.
075:             * @param rsr The EjbRelationshipRoleDesc where this CMR field is defined
076:             * @throws GenICException if the Deployment Decriptor is not conform
077:             */
078:            public VcCMRField(EjbRelationshipRoleDesc rsr)
079:                    throws GenICException {
080:                this .rsr = rsr;
081:                name = rsr.getCmrFieldName();
082:                uFLName = upperFL(name);
083:                element = rsr.getTargetBean();
084:                typeName = rsr.getCmrFieldType().getName();
085:                if (rsr.isTargetMultiple()) {
086:                    if (java.util.Collection.class
087:                            .equals(rsr.getCmrFieldType())) {
088:                        // TODO : Even if Collection has been defined as CMRField Type, we use a Set
089:                        genClassName = "org.objectweb.jonas_ejb.container.jorm.Set";
090:                    } else if (java.util.Set.class
091:                            .equals(rsr.getCmrFieldType())) {
092:                        genClassName = "org.objectweb.jonas_ejb.container.jorm.Set";
093:                    } else {
094:                        throw new GenICException(
095:                                "Unauthorized multivalued relation type:"
096:                                        + rsr.getCmrFieldType());
097:                    }
098:                }
099:                rsr2 = rsr.getOppositeRelationshipRole();
100:                relationType = rsr.getRelationType();
101:            }
102:
103:            /**
104:             * @return the name of the cmr field.
105:             */
106:            public String getName() {
107:                return name;
108:            }
109:
110:            /**
111:             * @return the type name of the cmr field.
112:             * It is the referenced class if the relation is multiple,
113:             * otherwise the type of the multivalued relation (java.util.Collection or java.util.Set).
114:             */
115:            public String getTypeName() {
116:                return typeName;
117:            }
118:
119:            /**
120:             * This is used to generate method names relative to the CMR Field
121:             * @return the name of cmr field with the first letter capitalized.
122:             */
123:            public String getUFLName() {
124:                return uFLName;
125:            }
126:
127:            public String jormGetter() {
128:                return "paGet" + getUFLName();
129:            }
130:
131:            public String jormSetter() {
132:                return "paSet" + getUFLName();
133:            }
134:
135:            /**
136:             * @return the JOnAS meta object where the CMR field is defined
137:             */
138:            public EjbRelationshipRoleDesc getRsr() {
139:                return rsr;
140:            }
141:
142:            /**
143:             * @return the name of opposite cmr field with the first letter capitalized.
144:             */
145:            public String getOppositeUFLCMRName() {
146:                return upperFL(rsr2.getCmrFieldName());
147:            }
148:
149:            /**
150:             * CoherenceHelper class is used to manage coherence in relations.
151:             * @return The JOnAS CoherenceHelper class name
152:             */
153:            public String getHelperClassName() {
154:                return "JOnAS" + rsr.getSourceBeanName() + "CoherenceHelper";
155:            }
156:
157:            /**
158:             * CoherenceHelper class is used to manage coherence in relations.
159:             * @return The Fully Qualified JOnAS CoherenceHelper class name
160:             */
161:            public String getHelperFQClassName() {
162:                String pn = BeanNaming.getPackageName(rsr2.getTargetBean()
163:                        .getFullDerivedBeanName());
164:                if (pn != null && pn.length() > 0) {
165:                    return pn + "." + getHelperClassName();
166:                } else {
167:                    return getHelperClassName();
168:                }
169:            }
170:
171:            /**
172:             * CoherenceHelper class is used to manage coherence in relations.
173:             * @return The JOnAS CoherenceHelper class name for opposite bean
174:             */
175:            public String getOppositeHelperClassName() {
176:                return "JOnAS" + rsr2.getSourceBeanName() + "CoherenceHelper";
177:            }
178:
179:            /**
180:             * CoherenceHelper class is used to manage coherence in relations.
181:             * @return The JOnAS CoherenceHelper fully qualified class name for opposite bean
182:             */
183:            public String getOppositeHelperFQClassName() {
184:                String pn = BeanNaming.getPackageName(rsr.getTargetBean()
185:                        .getFullDerivedBeanName());
186:                if (pn != null && pn.length() > 0) {
187:                    return pn + "." + getOppositeHelperClassName();
188:                } else {
189:                    return getOppositeHelperClassName();
190:                }
191:            }
192:
193:            /**
194:             * @return the class name of the gen class which must be used if the cmr is multiple
195:             * and return null otherwise.
196:             * The class which the is returned implements the interface which the name is returned by the 'getTypeName' method.
197:             */
198:            public String getGenClassName() {
199:                return genClassName;
200:            }
201:
202:            /**
203:             * @return the description of the field
204:             */
205:            public EntityCmp2Desc getElement() {
206:                return element;
207:            }
208:
209:            /**
210:             * It capitalizes the first letter of a word.
211:             * @param word is the input string to capitalize the first letter
212:             * @return a String with first letter capitalized
213:             */
214:            public String upperFL(String word) {
215:                return Character.toUpperCase(word.charAt(0))
216:                        + word.substring(1);
217:            }
218:
219:            /**
220:             * @return true if the relationship role is one-one unidirectional, false if not.
221:             */
222:            public boolean isOOu() {
223:                return relationType == EjbRelationshipRoleDesc.OOU;
224:            }
225:
226:            /**
227:             * @return true if the relationship role is one-one bidirectional, false if not.
228:             */
229:            public boolean isOOb() {
230:                return relationType == EjbRelationshipRoleDesc.OOB;
231:            }
232:
233:            /**
234:             * @return true if the relationship role is one-many unidirectional, false if not.
235:             */
236:            public boolean isOMu() {
237:                return relationType == EjbRelationshipRoleDesc.OMU;
238:            }
239:
240:            /**
241:             * @return true if the relationship role is many-one unidirectional, false if not.
242:             */
243:            public boolean isMOu() {
244:                return relationType == EjbRelationshipRoleDesc.MOU;
245:            }
246:
247:            /**
248:             * @return true if the relationship role is many-one bidirectional, false if not.
249:             */
250:            public boolean isMOb() {
251:                return relationType == EjbRelationshipRoleDesc.MOB;
252:            }
253:
254:            /**
255:             * @return true if the relationship role is one-many bidirectional, false if not.
256:             */
257:            public boolean isOMb() {
258:                return relationType == EjbRelationshipRoleDesc.OMB;
259:            }
260:
261:            /**
262:             * @return true if the relationship role is many-many unidirectional, false if not.
263:             */
264:            public boolean isMMu() {
265:                return relationType == EjbRelationshipRoleDesc.MMU;
266:            }
267:
268:            /**
269:             * @return true if the relationship role is many-many bidirectional, false if not.
270:             */
271:            public boolean isMMb() {
272:                return relationType == EjbRelationshipRoleDesc.MMB;
273:            }
274:
275:            /**
276:             * @return a string representation of the VcCMRField object for debug use
277:             */
278:            public String toString() {
279:                StringBuffer ret = new StringBuffer();
280:                ret.append("\n    Name                 = " + getName());
281:                ret.append("\n    TypeName             = " + getTypeName());
282:                ret.append("\n    UFLName              = " + getUFLName());
283:                ret.append("\n    OppositeUFLCMRName   = "
284:                        + getOppositeUFLCMRName());
285:                ret.append("\n    HelperClassName      = "
286:                        + getHelperClassName());
287:                ret.append("\n    HelperFQClassName    = "
288:                        + getHelperFQClassName());
289:                ret.append("\n    OppositeHelperClassName   = "
290:                        + getOppositeHelperClassName());
291:                ret.append("\n    OppositeHelperFQClassName = "
292:                        + getOppositeHelperFQClassName());
293:                ret.append("\n    GenClassName         = " + getGenClassName());
294:                ret.append("\n    isOOu                = " + isOOu());
295:                ret.append("\n    isOOb                = " + isOOb());
296:                ret.append("\n    isOMu                = " + isOMu());
297:                ret.append("\n    isOMb                = " + isOMb());
298:                ret.append("\n    isMOb                = " + isMOb());
299:                ret.append("\n    isMNu                = " + isMMu());
300:                ret.append("\n    isMNb                = " + isMMb());
301:                return (ret.toString());
302:            }
303:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.