Source Code Cross Referenced for NodeSearchQuery.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 java.util.*;
013:        import org.mmbase.core.*;
014:        import org.mmbase.module.core.MMObjectBuilder;
015:        import org.mmbase.module.core.VirtualBuilder;
016:        import org.mmbase.module.corebuilders.InsRel;
017:        import org.mmbase.storage.search.*;
018:
019:        /**
020:         * A <code>NodeSearchQuery</code> implements a <code>SearchQuery</code>
021:         * that retrieves nodes of one specified nodetype.
022:         * <p>
023:         * The constructor creates the query with all persistent fields belonging to
024:         * the specified nodetype excluding byte[] type fields.
025:         * Use {@link #getField(CoreField) getField()} to retrieve each of these fields.
026:         * <p>
027:         * Once an instance is constructed, it is not possible to add more fields/steps.
028:         * Consequently calling one of these methods always results in an
029:         * <code>UnsupportedOperationException</code>:
030:         * <ul>
031:         * <li>{@link #addStep(MMObjectBuilder) addStep()}
032:         * <li>{@link #addRelationStep(InsRel,MMObjectBuilder) addRelationStep()}
033:         * <li>{@link #addField(Step,CoreField) addField()}
034:         * <li>{@link #addAggregatedField(Step,CoreField,int) addAggregatedField()}
035:         * </ul>
036:         *
037:         * @author  Rob van Maris
038:         * @version $Id: NodeSearchQuery.java,v 1.15 2006/09/08 18:42:59 michiel Exp $
039:         * @since MMBase-1.7
040:         */
041:        public class NodeSearchQuery extends BasicSearchQuery implements 
042:                SearchQuery {
043:
044:            /** Builder for the specified nodetype. */
045:            private MMObjectBuilder builder = null;
046:
047:            /** Map, maps fields to stepfields. */
048:            private Map<CoreField, BasicStepField> stepFields = new HashMap<CoreField, BasicStepField>();
049:
050:            /**
051:             * Creator.
052:             *
053:             * @param builder The builder for the nodetype, must not be a
054:             *        {@link org.mmbase.module.core.VirtualBuilder virtual} builder.
055:             * @throws IllegalArgumentException When an invalid argument is supplied.
056:             */
057:            public NodeSearchQuery(MMObjectBuilder builder) {
058:                if (builder == null) {
059:                    throw new IllegalArgumentException(
060:                            "Invalid builder value: " + builder);
061:                }
062:                if (builder instanceof  VirtualBuilder) {
063:                    throw new IllegalArgumentException(
064:                            "Invalid builder type, because this is a virtual builder: "
065:                                    + builder.getClass().getName());
066:                }
067:                Step step = super .addStep(builder);
068:                addFields(step);
069:                this .builder = builder;
070:            }
071:
072:            /*
073:            NodeSearchQuery(SearchQuery searchQuery) {
074:                super(searchQuery);
075:                List steps = searchQuery.getSteps();
076:                if (steps.size() != 1) throw new IllegalArgumentException("Given search-query cannot be a NodeSearchQuery");
077:                BasicStep step = (BasicStep) steps.get(0);
078:                fields.clear();
079:                addFields(step);
080:                builder = step.getBuilder();
081:            }
082:             */
083:
084:            protected void copySteps(SearchQuery q) {
085:                // no need, can be done by clone
086:            }
087:
088:            protected void copyFields(SearchQuery q) {
089:                // no need, can be done by clone
090:            }
091:
092:            /**
093:             * Returns the stepfield corresponding to the specified field.
094:             *
095:             * @param field The field.
096:             * @return The corresponding stepfield.
097:             * @throws IllegalArgumentException When the field is not a
098:             *         persistent field of the associated nodetype.
099:             */
100:            public BasicStepField getField(CoreField field) {
101:                BasicStepField stepField = stepFields.get(field);
102:                if (stepField == null) {
103:                    // Not found.
104:                    throw new IllegalArgumentException(
105:                            "Not a persistent field of builder "
106:                                    + builder.getTableName() + ": " + field);
107:                }
108:                return stepField;
109:            }
110:
111:            /**
112:             * Returns the builder for the specified nodetype.
113:             *
114:             * @return The builder.
115:             */
116:            public MMObjectBuilder getBuilder() {
117:                return builder;
118:            }
119:
120:            // javadoc is inherited
121:            public BasicStep addStep(MMObjectBuilder builder) {
122:                throw new UnsupportedOperationException(
123:                        "Adding more steps to NodeSearchQuery not supported.");
124:            }
125:
126:            // javadoc is inherited
127:            public BasicRelationStep addRelationStep(InsRel builder,
128:                    MMObjectBuilder nextBuilder) {
129:                throw new UnsupportedOperationException(
130:                        "Adding more steps to NodeSearchQuery not supported.");
131:            }
132:
133:            // javadoc is inherited
134:            public BasicStepField addField(Step step, CoreField fieldDefs) {
135:                if (builder != null) { // this means: inited already.
136:                    throw new UnsupportedOperationException(
137:                            "Adding more fields to NodeSearchQuery not supported.");
138:                } else {
139:                    return super .addField(step, fieldDefs);
140:                }
141:            }
142:
143:            // MM
144:            protected void mapField(CoreField field, BasicStepField stepField) {
145:                stepFields.put(field, stepField);
146:            }
147:
148:            // javadoc is inherited
149:            public BasicAggregatedField addAggregatedField(Step step,
150:                    CoreField fieldDefs, int aggregationType) {
151:                throw new UnsupportedOperationException(
152:                        "Adding more fields to NodeSearchQuery not supported.");
153:            }
154:
155:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.