Source Code Cross Referenced for AbstractRelation.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) 


001:        package com.bm.introspectors.relations;
002:
003:        import java.util.Set;
004:
005:        import javax.persistence.CascadeType;
006:        import javax.persistence.FetchType;
007:
008:        import com.bm.introspectors.Property;
009:        import com.bm.utils.Ejb3Utils;
010:
011:        /**
012:         * Abstract class for representation of relations.
013:         * 
014:         * @author Daniel Wiese
015:         */
016:        public abstract class AbstractRelation implements  EntityReleationInfo {
017:
018:            private final Class sourceClass;
019:
020:            private final Class targetClass;
021:
022:            private final Property sourceProperty;
023:
024:            private final Property targetProperty;
025:
026:            private final FetchType fetchType;
027:
028:            private final boolean isUnidirectional;
029:
030:            private final CascadeType[] cascadeType;
031:
032:            /**
033:             * Default constructor.
034:             * 
035:             * @param sourceClass -
036:             *            the type of the source entity bean
037:             * @param targetClass -
038:             *            the type of the target entity bean
039:             * @param sourceProperty -
040:             *            the property of the source entity bean
041:             * @param targetProperty -
042:             *            the property of the target entity bean
043:             * @param fetchType -
044:             *            fetch type
045:             * @param cascadeType -
046:             *            cascade type
047:             * 
048:             */
049:            public AbstractRelation(Class sourceClass, Class targetClass,
050:                    Property sourceProperty, Property targetProperty,
051:                    FetchType fetchType, CascadeType[] cascadeType) {
052:                this .sourceClass = sourceClass;
053:                this .targetClass = targetClass;
054:                this .targetProperty = targetProperty;
055:                this .sourceProperty = sourceProperty;
056:                this .fetchType = fetchType;
057:                this .cascadeType = cascadeType;
058:                this .isUnidirectional = (targetProperty == null);
059:            }
060:
061:            /**
062:             * Returns the cascadeType.
063:             * @return Returns the cascadeType.
064:             */
065:            public CascadeType[] getCascadeType() {
066:                return cascadeType;
067:            }
068:
069:            /**
070:             * Returns the fetchType.
071:             * @return Returns the fetchType.
072:             */
073:            public FetchType getFetchType() {
074:                return fetchType;
075:            }
076:
077:            /**
078:             * Returns the sourceClass.
079:             * 
080:             * @return Returns the sourceClass.
081:             */
082:            public Class getSourceClass() {
083:                return this .sourceClass;
084:            }
085:
086:            /**
087:             * Returns the sourceProperty.
088:             * 
089:             * @return Returns the sourceProperty.
090:             */
091:            public Property getSourceProperty() {
092:                return this .sourceProperty;
093:            }
094:
095:            /**
096:             * Returns the targetClass.
097:             * 
098:             * @return Returns the targetClass.
099:             */
100:            public Class getTargetClass() {
101:                return this .targetClass;
102:            }
103:
104:            /**
105:             * Returns the targetProperty.
106:             * 
107:             * @return Returns the targetProperty.
108:             */
109:            public Property getTargetProperty() {
110:                return this .targetProperty;
111:            }
112:
113:            /**
114:             * If the preperty is unidirectional.
115:             * @return the isUnidirectional
116:             */
117:            public boolean isUnidirectional() {
118:                return isUnidirectional;
119:            }
120:
121:            /**
122:             *{@inheritDoc}
123:             */
124:            @Override
125:            public String toString() {
126:                final StringBuilder sb = new StringBuilder();
127:                sb.append("[" + this .getReleationType() + "] ").append(
128:                        "Source class: ").append(
129:                        Ejb3Utils.getShortClassName(this .sourceClass)).append(
130:                        "\n");
131:                sb.append("Source attrib: ").append(
132:                        this .sourceProperty.getName()).append("\n");
133:                sb.append("Target class: ").append(
134:                        Ejb3Utils.getShortClassName(this .targetClass)).append(
135:                        "\n");
136:                sb.append("Target attrib: ").append(
137:                        this .targetProperty.getName());
138:                return sb.toString();
139:            }
140:
141:            /**
142:             * True wenn the delete operatio is cascading.
143:             * @return when the delete operation is cascading
144:             */
145:            public boolean isCascadeOnDelete() {
146:                boolean back = false;
147:                if (this .cascadeType != null) {
148:                    for (CascadeType current : this .cascadeType) {
149:                        if ((current.equals(CascadeType.ALL))
150:                                || (current.equals(CascadeType.REMOVE))) {
151:                            back = true;
152:                            break;
153:                        }
154:                    }
155:                }
156:
157:                return back;
158:            }
159:
160:            /**
161:             * Returns the primary key property (or properties, in case of a composite key) for the 
162:             * class that is target of the relation
163:             * @return	primary key property / properties.
164:             */
165:            public Set<Property> getTargetKeyProperty() {
166:                return null;
167:            }
168:
169:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.