Source Code Cross Referenced for RelationPropertyResolver.java in  » Testing » Ejb3Unit » com » bm » introspectors » relations » 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 » Testing » Ejb3Unit » com.bm.introspectors.relations 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


01:        package com.bm.introspectors.relations;
02:
03:        import org.apache.log4j.Logger;
04:
05:        import com.bm.introspectors.EntityBeanIntrospector;
06:        import com.bm.introspectors.Property;
07:
08:        /**
09:         * Helper class to find properties wich are inwolved in releations.
10:         * 
11:         * @author Daniel Wiese
12:         * 
13:         */
14:        public final class RelationPropertyResolver {
15:
16:            private static final Logger log = Logger
17:                    .getLogger(RelationPropertyResolver.class);
18:
19:            private RelationPropertyResolver() {
20:                // empty to avoid contructions
21:            }
22:
23:            /**
24:             * Search the attribute representing the releation on the !other side!
25:             * 
26:             * @param declaredInClass -
27:             *            the other side class holding the mappedBy attribute
28:             * @param mappedBy -
29:             *            the attribute name mapping the property (on the other side)
30:             * @return - the property (if found)
31:             */
32:            public static Property findAttributeForRelationAtOtherSide(
33:                    Class<Object> declaredInClass, String mappedBy) {
34:                // now look for the other if exist at the global store
35:                Property relProp = GlobalRelationStore.getStore().getProperty(
36:                        declaredInClass, mappedBy);
37:                if (relProp == null) {
38:                    // use a new instrospector to put the relation to the global
39:                    // store
40:                    final EntityBeanIntrospector<Object> tmpIn = new EntityBeanIntrospector<Object>(
41:                            declaredInClass);
42:                    log.debug("Dependend class: " + tmpIn.getTableName());
43:                    // now it should be in theglobal store
44:
45:                    relProp = GlobalRelationStore.getStore().getProperty(
46:                            declaredInClass, mappedBy);
47:                    if (relProp == null) {
48:                        log
49:                                .debug("The relation is unidirectional. Cant´t resolve releations for property ("
50:                                        + mappedBy
51:                                        + ") decared in class ("
52:                                        + declaredInClass.getName() + ")");
53:                    }
54:                }
55:                return relProp;
56:            }
57:
58:            /**
59:             * Search the attribute representing the relation on the !other side!
60:             * 
61:             * @param aktProperty -
62:             *            the current property representing this side
63:             * @return - the property (if found)
64:             */
65:            @SuppressWarnings("unchecked")
66:            public static Property findAttributeForRelationAtOtherSide(
67:                    Property aktProperty) {
68:                // now look for the other if exist at the global store
69:                // WIR MÜSSEN DIE N SEITE FINDEN: die als target uns hat (aktProperty)
70:                // TODO WIR MÜSSEN DIE N SEITE FINDEN:
71:                Property relProp = GlobalRelationStore.getStore().getProperty(
72:                        aktProperty.getType(), aktProperty.getDeclaringClass());
73:                if (relProp == null) {
74:                    // use a new instrospector to put the relation to the global
75:                    // store
76:                    final EntityBeanIntrospector<Object> tmpIn = new EntityBeanIntrospector<Object>(
77:                            aktProperty.getType());
78:                    log.debug("Dependend class: " + tmpIn.getTableName());
79:                    // now it should be in theglobal store
80:                    relProp = GlobalRelationStore.getStore().getProperty(
81:                            aktProperty.getType(),
82:                            aktProperty.getDeclaringClass());
83:                    if (relProp == null) {
84:                        throw new RuntimeException(
85:                                "Cant´t resolve releations for property ("
86:                                        + aktProperty.getName()
87:                                        + ") in class ("
88:                                        + aktProperty.getDeclaringClass() + ")");
89:                    }
90:                }
91:                return relProp;
92:            }
93:
94:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.