Source Code Cross Referenced for BasicRelationStep.java in  » Database-ORM » MMBase » org » mmbase » storage » search » implementation » 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 » Database ORM » MMBase » org.mmbase.storage.search.implementation 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:
003:        This software is OSI Certified Open Source Software.
004:        OSI Certified is a certification mark of the Open Source Initiative.
005:
006:        The license (Mozilla version 1.0) can be read at the MMBase site.
007:        See http://www.MMBase.org/license
008:
009:         */
010:        package org.mmbase.storage.search.implementation;
011:
012:        import org.mmbase.module.corebuilders.InsRel;
013:        import org.mmbase.module.core.MMObjectNode;
014:        import org.mmbase.storage.search.*;
015:
016:        /**
017:         * Basic implementation.
018:         * <p>
019:         * The checkedDirectionality property defaults to false.
020:         * The directionality property defaults to DIRECTIONS_BOTH.
021:         *
022:         * @author Rob van Maris
023:         * @version $Id: BasicRelationStep.java,v 1.12 2006/10/16 12:56:57 pierre Exp $
024:         * @since MMBase-1.7
025:         */
026:        public class BasicRelationStep extends BasicStep implements 
027:                RelationStep {
028:
029:            /** Checked directionality property. */
030:            private boolean checkedDirectionality = false;
031:
032:            /** Directionality property. */
033:            private int directionality = RelationStep.DIRECTIONS_BOTH;
034:
035:            /** Role property. */
036:            private Integer role = null;
037:
038:            /** Previous step. */
039:            private Step previous = null;
040:
041:            /** Next step. */
042:            private Step next = null;
043:
044:            /**
045:             * Creator.
046:             *
047:             * @param builder The relation builder.
048:             * @param previous The previous step.
049:             * @param next The next step.
050:             * @throws IllegalArgumentException when an invalid argument is supplied.
051:             */
052:            // package visibility!
053:            BasicRelationStep(InsRel builder, Step previous, Step next) {
054:                super (builder);
055:                if (previous == null) {
056:                    throw new IllegalArgumentException(
057:                            "Invalid previous value: " + previous);
058:                }
059:                this .previous = previous;
060:                if (next == null) {
061:                    throw new IllegalArgumentException("Invalid next value: "
062:                            + next);
063:                }
064:                this .next = next;
065:            }
066:
067:            /**
068:             * Sets checkedDirectionality property.
069:             *
070:             * @param checkedDirectionality The checkedDirectionality property.
071:             * @return This <code>BasicRelationStep</code> instance.
072:             * @see #getCheckedDirectionality
073:             */
074:            public BasicRelationStep setCheckedDirectionality(
075:                    boolean checkedDirectionality) {
076:                this .checkedDirectionality = checkedDirectionality;
077:                return this ;
078:            }
079:
080:            /**
081:             * Sets directionality property.
082:             *
083:             * @param directionality The directionality.
084:             * Must be one of the values defined in <code>
085:             * {@link org.mmbase.storage.search.RelationStep RelationStep}.</code>
086:             * @return This <code>BasicRelationStep</code> instance.
087:             * @throws IllegalArgumentException when an invalid argument is supplied.
088:             */
089:            public BasicRelationStep setDirectionality(int directionality) {
090:                if (directionality != RelationStep.DIRECTIONS_SOURCE
091:                        && directionality != RelationStep.DIRECTIONS_DESTINATION
092:                        && directionality != RelationStep.DIRECTIONS_BOTH
093:                        && directionality != RelationStep.DIRECTIONS_ALL
094:                        && directionality != RelationStep.DIRECTIONS_EITHER) {
095:                    throw new IllegalArgumentException(
096:                            "Invalid directionality value: " + directionality);
097:                }
098:                this .directionality = directionality;
099:                return this ;
100:            }
101:
102:            /**
103:             * Sets role property.
104:             *
105:             * @param role The role.
106:             * @return This <code>BasicRelationStep</code> instance.
107:             */
108:            public BasicRelationStep setRole(Integer role) {
109:                this .role = role;
110:                return this ;
111:            }
112:
113:            // javadoc is inherited
114:            public boolean getCheckedDirectionality() {
115:                return checkedDirectionality;
116:            }
117:
118:            // javadoc is inherited
119:            public int getDirectionality() {
120:                return directionality;
121:            }
122:
123:            /**
124:             * Returns a description of the part
125:             */
126:            public String getDirectionalityDescription() {
127:                try {
128:                    return RelationStep.DIRECTIONALITY_DESCRIPTIONS[directionality];
129:                } catch (IndexOutOfBoundsException ioobe) {
130:                    return null;
131:                }
132:            }
133:
134:            // javadoc is inherited
135:            public Integer getRole() {
136:                return role;
137:            }
138:
139:            // javadoc is inherited
140:            public String getRoleDescription() {
141:                String roleName = "reldef:" + role;
142:                if (role != null && getBuilder() != null) {
143:                    MMObjectNode node = getBuilder().getNode(role.intValue());
144:                    if (node != null) {
145:                        roleName = node.getGUIIndicator();
146:                    }
147:                }
148:                return roleName;
149:            }
150:
151:            // javadoc is inherited
152:            public Step getPrevious() {
153:                return previous;
154:            }
155:
156:            // javadoc is inherited
157:            public Step getNext() {
158:                return next;
159:            }
160:
161:            // javadoc is inherited
162:            public boolean equals(Object obj) {
163:                if (obj == this ) {
164:                    return true;
165:                }
166:                if (obj instanceof  RelationStep) {
167:                    RelationStep step = (RelationStep) obj;
168:                    return getTableName().equals(step.getTableName())
169:                            && (alias != null ? alias.equals(step.getAlias())
170:                                    : step.getAlias() == null)
171:                            && getNodes().equals(step.getNodes())
172:                            && step.getDirectionality() == directionality
173:                            && (role == null ? step.getRole() == null : role
174:                                    .equals(step.getRole()));
175:                } else {
176:                    return false;
177:                }
178:            }
179:
180:            // javadoc is inherited
181:            public int hashCode() {
182:                return 41 * (getTableName().hashCode() + 43 * ((alias != null ? alias
183:                        .hashCode()
184:                        : 0) + 47 * (getNodes().hashCode() + 113 * (directionality + 31 * (role != null ? role
185:                        .intValue()
186:                        : 0)))));
187:            }
188:
189:            // javadoc is inherited
190:            public String toString() {
191:                StringBuilder sb = new StringBuilder("RelationStep(tablename:")
192:                        .append(getTableName()).append(", alias:").append(
193:                                getAlias()).append(", nodes:").append(
194:                                getNodes()).append(", dir:").append(
195:                                getDirectionalityDescription()).append(
196:                                ", role:").append(getRoleDescription()).append(
197:                                ")");
198:                return sb.toString();
199:            }
200:
201:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.