Source Code Cross Referenced for IdColumnToPropertyMapping.java in  » Search-Engine » compass-2.0 » org » compass » gps » device » jdbc » mapping » 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 » Search Engine » compass 2.0 » org.compass.gps.device.jdbc.mapping 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2004-2006 the original author or authors.
003:         * 
004:         * Licensed under the Apache License, Version 2.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         * 
008:         *      http://www.apache.org/licenses/LICENSE-2.0
009:         * 
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:
017:        package org.compass.gps.device.jdbc.mapping;
018:
019:        /**
020:         * Maps an id column to <code>Resource Property</code>. The id column is the column that identifies
021:         * or is part of columns that identifies the <code>ResultSet</code>. In a
022:         * table, it is the table primary keys.
023:         * <p>
024:         * The <code>PropertyIndex</code> is <code>Property.Index.UN_TOKENIZED</code>.
025:         * the <code>PropertyStore</code> is <code>Property.Store.YES</code>, the
026:         * <code>PropertyTermVector</code> is <code>Property.TermVector.NO</code>
027:         * and the <code>Boost</code> is <code>1.0f</code>.
028:         * <p>
029:         * The id mapping also holds an additional mapping, the
030:         * <code>columnNameForVersion</code> mapping. When performing the mirror
031:         * operation (if enabled), it is the id column name that is added to the select
032:         * query in order to filter by the specified ids. For example, if the select
033:         * query is (for a PARENT and CHILD table relationship):
034:         * <code>select p.id as parent_id, p.first_name as parent_first_name, p.last_name as parent_last_name, p.version as parent_version, COALESCE(c.id, 0) as child_id, c.first_name as child_first_name, c.last_name child_last_name, COALESCE(c.version, 0) as child_version from parent p left join child c on p.id = c.parent_id</code>
035:         * than when performing the query to get the values for certain values of ids
036:         * (the parent and child ids), the column names that will be used are:
037:         * <code>p.id</code> and <code>COALESCE(c.id, 0)</code>. And the actual
038:         * where clause will be: <code>where p.id = ? and COALESCE(c.id, 0) = ?</code>.
039:         * <p>
040:         * Note, that the id column name is <code>parent_id</code>, and
041:         * <code>child_id</code>. They are used for reading the id values, not
042:         * constructing queries.
043:         * 
044:         * @author kimchy
045:         */
046:        public class IdColumnToPropertyMapping extends
047:                AbstractConstantColumnToPropertyMapping {
048:
049:            private String columnNameForVersion;
050:
051:            /**
052:             * Creates an empty id column to property mapping. Must set at least the
053:             * colum index or colum name, and the property name. If using mirroring,
054:             * must set the column name for version as well.
055:             */
056:            public IdColumnToPropertyMapping() {
057:
058:            }
059:
060:            /**
061:             * Creates a new Id column to propery mapping given the column name and the
062:             * property name. The column name will also be used as the
063:             * <code>columnNameForVersion</code> value.
064:             * 
065:             * @param columnName
066:             *            The id column name that will be used to look up the id value
067:             *            (also acts as the columnNameForVersion).
068:             * @param propertyName
069:             *            The Compass <code>Resource Property</code> name.
070:             */
071:            public IdColumnToPropertyMapping(String columnName,
072:                    String propertyName) {
073:                this (columnName, propertyName, columnName);
074:            }
075:
076:            /**
077:             * Creates a new Id column to property mapping given the column name, the
078:             * property name, and the column name for the versioning (the mirror
079:             * operation).
080:             * 
081:             * @param columnName
082:             *            The id column name that will be used to look up the id value.
083:             * @param propertyName
084:             *            The Compass <code>Resource Property</code> name.
085:             * @param columnNameForVersion
086:             *            The id column name that will be used in the dynamically
087:             *            created where clause with the original select query.
088:             */
089:            public IdColumnToPropertyMapping(String columnName,
090:                    String propertyName, String columnNameForVersion) {
091:                super (columnName, propertyName);
092:                this .columnNameForVersion = columnNameForVersion;
093:            }
094:
095:            /**
096:             * Creates a new Id Column to property mapping given the column index and
097:             * the property name. Note that the column name for versioning will be null,
098:             * so if mirroring will be enabled, it must be set.
099:             * 
100:             * @param columnIndex
101:             *            The id column index that will be used to look up the id value.
102:             * @param propertyName
103:             *            The Compass <code>Resource Property</code> name.
104:             */
105:            public IdColumnToPropertyMapping(int columnIndex,
106:                    String propertyName) {
107:                this (columnIndex, propertyName, null);
108:            }
109:
110:            /**
111:             * Creates a new Id Column to property mapping given the column index, the
112:             * property name, and the column name for the versioning (the mirror
113:             * operation).
114:             * 
115:             * @param columnIndex
116:             *            The id column index that will be used to look up the id value.
117:             * @param propertyName
118:             *            The Compass <code>Resource Property</code> name.
119:             * @param columnNameForVersion
120:             *            The id column name that will be used in the dynamically
121:             *            created where clause with the original select query.
122:             */
123:            public IdColumnToPropertyMapping(int columnIndex,
124:                    String propertyName, String columnNameForVersion) {
125:                super (columnIndex, propertyName);
126:                this .columnNameForVersion = columnNameForVersion;
127:            }
128:
129:            /**
130:             * Returns the id column name that will be used in the dynamically created
131:             * where clause with the original select query.
132:             */
133:            public String getColumnNameForVersion() {
134:                return columnNameForVersion;
135:            }
136:
137:            /**
138:             * Sets the id column name that will be used in the dynamically created
139:             * where clause with the original select query.
140:             * 
141:             * @param columnNameForVersion
142:             *            The id column name that will be used in the dynamically
143:             *            created where clause with the original select query.
144:             */
145:            public void setColumnNameForVersion(String columnNameForVersion) {
146:                this.columnNameForVersion = columnNameForVersion;
147:            }
148:
149:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.