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: import org.compass.core.Property;
020:
021: /**
022: * Maps a data column to Compass <code>Resource Property</code>.
023: * <p>
024: * The <code>PropertyIndex</code> defaults to
025: * <code>Property.Index.TOKENIZED</code>. the <code>PropertyStore</code>
026: * defaults to <code>Property.Store.YES</code>, the
027: * <code>PropertyTermVector</code> defaults to
028: * <code>Property.TermVector.NO</code> and the <code>Boost</code> defaults
029: * to <code>1.0f</code>.
030: *
031: * @author kimchy
032: */
033: public class DataColumnToPropertyMapping extends
034: AbstractColumnToPropertyMapping {
035:
036: private Property.Index propertyIndex = Property.Index.TOKENIZED;
037:
038: private Property.Store propertyStore = Property.Store.YES;
039:
040: private Property.TermVector propertyTermVector = Property.TermVector.NO;
041:
042: private float boost;
043:
044: /**
045: * Creates an empty data column to property mapping. Must set at least the
046: * colum index or colum name, and the property name.
047: * <p>
048: * The <code>PropertyIndex</code> defaults to
049: * <code>Property.Index.TOKENIZED</code>. the <code>PropertyStore</code>
050: * defaults to <code>Property.Store.YES</code>, the
051: * <code>PropertyTermVector</code> defaults to
052: * <code>Property.TermVector.NO</code> and the <code>Boost</code>
053: * defaults to <code>1.0f</code>.
054: */
055: public DataColumnToPropertyMapping() {
056:
057: }
058:
059: /**
060: * Creates a new data column to propery mapping given the column index and
061: * the property name.
062: * <p>
063: * The <code>PropertyIndex</code> defaults to
064: * <code>Property.Index.TOKENIZED</code>. the <code>PropertyStore</code>
065: * defaults to <code>Property.Store.YES</code>, the
066: * <code>PropertyTermVector</code> defaults to
067: * <code>Property.TermVector.NO</code> and the <code>Boost</code>
068: * defaults to <code>1.0f</code>.
069: *
070: * @param columnIndex
071: * The data column index that will be used to look up the column
072: * value.
073: * @param propertyName
074: * The Compass <code>Resource Property</code> name.
075: */
076: public DataColumnToPropertyMapping(int columnIndex,
077: String propertyName) {
078: this (columnIndex, propertyName, Property.Index.TOKENIZED,
079: Property.Store.YES, Property.TermVector.NO);
080: }
081:
082: /**
083: * Creates a new data column to propery mapping given the column name and
084: * the property name.
085: * <p>
086: * The <code>PropertyIndex</code> defaults to
087: * <code>Property.Index.TOKENIZED</code>. the <code>PropertyStore</code>
088: * defaults to <code>Property.Store.YES</code>, the
089: * <code>PropertyTermVector</code> defaults to
090: * <code>Property.TermVector.NO</code> and the <code>Boost</code>
091: * defaults to <code>1.0f</code>.
092: *
093: * @param columnName
094: * The data column name that will be used to look up the column
095: * value.
096: * @param propertyName
097: * The Compass <code>Resource Property</code> name.
098: */
099: public DataColumnToPropertyMapping(String columnName,
100: String propertyName) {
101: this (columnName, propertyName, Property.Index.TOKENIZED,
102: Property.Store.YES, Property.TermVector.NO);
103: }
104:
105: /**
106: * Creates a new data column to propery mapping given the column index,
107: * property name, <code>PropertyIndex</code>, and
108: * <code>PropertyStore</code>.
109: * <p>
110: * The <code>PropertyTermVector</code> defaults to
111: * <code>Property.TermVector.NO</code> and the <code>Boost</code>
112: * defaults to <code>1.0f</code>.
113: *
114: * @param columnIndex
115: * The data column index that will be used to look up the column
116: * value.
117: * @param propertyName
118: * The Compass <code>Resource Property</code> name.
119: * @param propertyIndex
120: * @param propertyStore
121: */
122: public DataColumnToPropertyMapping(int columnIndex,
123: String propertyName, Property.Index propertyIndex,
124: Property.Store propertyStore) {
125: this (columnIndex, propertyName, propertyIndex, propertyStore,
126: Property.TermVector.NO);
127: }
128:
129: /**
130: * Creates a new data column to propery mapping given the column name,
131: * property name, <code>PropertyIndex</code>, and
132: * <code>PropertyStore</code>.
133: * <p>
134: * The <code>PropertyTermVector</code> defaults to
135: * <code>Property.TermVector.NO</code> and the <code>Boost</code>
136: * defaults to <code>1.0f</code>.
137: *
138: * @param columnName
139: * The data column name that will be used to look up the column
140: * value.
141: * @param propertyName
142: * The Compass <code>Resource Property</code> name.
143: * @param propertyIndex
144: * @param propertyStore
145: */
146: public DataColumnToPropertyMapping(String columnName,
147: String propertyName, Property.Index propertyIndex,
148: Property.Store propertyStore) {
149: this (columnName, propertyName, propertyIndex, propertyStore,
150: Property.TermVector.NO);
151: }
152:
153: /**
154: * Creates a new data column to propery mapping given the column index,
155: * property name, <code>PropertyIndex</code>, and
156: * <code>PropertyStore</code>.
157: *
158: * @param columnIndex
159: * The data column index that will be used to look up the column
160: * value.
161: * @param propertyName
162: * The Compass <code>Resource Property</code> name.
163: * @param propertyIndex
164: * @param propertyStore
165: * @param propertyTermVector
166: */
167: public DataColumnToPropertyMapping(int columnIndex,
168: String propertyName, Property.Index propertyIndex,
169: Property.Store propertyStore,
170: Property.TermVector propertyTermVector) {
171: super (columnIndex, propertyName);
172: this .propertyIndex = propertyIndex;
173: this .propertyStore = propertyStore;
174: this .propertyTermVector = propertyTermVector;
175: }
176:
177: /**
178: * Creates a new data column to propery mapping given the column name,
179: * property name, <code>PropertyIndex</code>, and
180: * <code>PropertyStore</code>.
181: *
182: * @param columnName
183: * The data column name that will be used to look up the column
184: * value.
185: * @param propertyName
186: * The Compass <code>Resource Property</code> name.
187: * @param propertyIndex
188: * @param propertyStore
189: * @param propertyTermVector
190: */
191: public DataColumnToPropertyMapping(String columnName,
192: String propertyName, Property.Index propertyIndex,
193: Property.Store propertyStore,
194: Property.TermVector propertyTermVector) {
195: super (columnName, propertyName);
196: this .propertyIndex = propertyIndex;
197: this .propertyStore = propertyStore;
198: this .propertyTermVector = propertyTermVector;
199: }
200:
201: public Property.Index getPropertyIndex() {
202: return propertyIndex;
203: }
204:
205: public void setPropertyIndex(Property.Index propertyIndex) {
206: this .propertyIndex = propertyIndex;
207: }
208:
209: public void setPropertyIndexString(String propertyIndex) {
210: this .propertyIndex = Property.Index.fromString(propertyIndex);
211: }
212:
213: public Property.Store getPropertyStore() {
214: return propertyStore;
215: }
216:
217: public void setPropertyStore(Property.Store propertyStore) {
218: this .propertyStore = propertyStore;
219: }
220:
221: public void setPropertyStoreString(String propertyStore) {
222: this .propertyStore = Property.Store.fromString(propertyStore);
223: }
224:
225: public Property.TermVector getPropertyTermVector() {
226: return propertyTermVector;
227: }
228:
229: public void setPropertyTermVector(
230: Property.TermVector propertyTermVector) {
231: this .propertyTermVector = propertyTermVector;
232: }
233:
234: public void setPropertyTermVectorString(String propertyTermVector) {
235: this .propertyTermVector = Property.TermVector
236: .fromString(propertyTermVector);
237: }
238:
239: public float getBoost() {
240: return boost;
241: }
242:
243: public void setBoost(float boost) {
244: this.boost = boost;
245: }
246: }
|