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.core.mapping;
018:
019: import org.compass.core.Property;
020: import org.compass.core.mapping.internal.InternalResourcePropertyMapping;
021:
022: /**
023: * @author kimchy
024: */
025: public abstract class AbstractResourcePropertyMapping extends
026: AbstractMapping implements InternalResourcePropertyMapping {
027:
028: private String rootAlias;
029:
030: private String analyzer;
031:
032: private float boost = 1.0f;
033:
034: private Property.Store store = Property.Store.YES;
035:
036: private Property.Index index = Property.Index.TOKENIZED;
037:
038: private Property.TermVector termVector = Property.TermVector.NO;
039:
040: private boolean isInternal = false;
041:
042: private ExcludeFromAllType excludeFromAll = ExcludeFromAllType.NO;
043:
044: private SpellCheckType spellCheck = SpellCheckType.NA;
045:
046: private boolean omitNorms = false;
047:
048: private ReverseType reverse = ReverseType.NO;
049:
050: private String nullValue = "";
051:
052: protected void copy(AbstractResourcePropertyMapping copy) {
053: super .copy(copy);
054: copy.setBoost(getBoost());
055: copy.setName(getName());
056: copy.setStore(getStore());
057: copy.setIndex(getIndex());
058: copy.setPath(getPath());
059: copy.setInternal(isInternal());
060: copy.setExcludeFromAll(getExcludeFromAll());
061: copy.setTermVector(getTermVector());
062: copy.setAnalyzer(getAnalyzer());
063: copy.setReverse(getReverse());
064: copy.setOmitNorms(isOmitNorms());
065: copy.setRootAlias(getRootAlias());
066: copy.setNullValue(getNullValue());
067: copy.setSpellCheck(getSpellCheck());
068: }
069:
070: public String getRootAlias() {
071: return rootAlias;
072: }
073:
074: public void setRootAlias(String rootAlias) {
075: this .rootAlias = rootAlias;
076: }
077:
078: public float getBoost() {
079: return this .boost;
080: }
081:
082: public void setBoost(float boost) {
083: this .boost = boost;
084: }
085:
086: public Property.Store getStore() {
087: return store;
088: }
089:
090: public void setStore(Property.Store store) {
091: this .store = store;
092: }
093:
094: public Property.Index getIndex() {
095: return index;
096: }
097:
098: public void setIndex(Property.Index index) {
099: this .index = index;
100: }
101:
102: public boolean isInternal() {
103: return isInternal;
104: }
105:
106: public void setInternal(boolean isInternal) {
107: this .isInternal = isInternal;
108: }
109:
110: public ExcludeFromAllType getExcludeFromAll() {
111: return excludeFromAll;
112: }
113:
114: public void setExcludeFromAll(ExcludeFromAllType excludeFromAll) {
115: this .excludeFromAll = excludeFromAll;
116: }
117:
118: public Property.TermVector getTermVector() {
119: return termVector;
120: }
121:
122: public void setTermVector(Property.TermVector termVector) {
123: this .termVector = termVector;
124: }
125:
126: public String getAnalyzer() {
127: return analyzer;
128: }
129:
130: public void setAnalyzer(String analyzer) {
131: this .analyzer = analyzer;
132: }
133:
134: public ReverseType getReverse() {
135: return reverse;
136: }
137:
138: public void setReverse(ReverseType reverse) {
139: this .reverse = reverse;
140: }
141:
142: public boolean isOmitNorms() {
143: return omitNorms;
144: }
145:
146: public void setOmitNorms(boolean omitNorms) {
147: this .omitNorms = omitNorms;
148: }
149:
150: public String getNullValue() {
151: return nullValue;
152: }
153:
154: public void setNullValue(String nullValue) {
155: if (nullValue == null) {
156: this .nullValue = "";
157: } else {
158: this .nullValue = nullValue;
159: }
160: }
161:
162: public boolean hasNullValue() {
163: return nullValue.length() > 0;
164: }
165:
166: public SpellCheckType getSpellCheck() {
167: return spellCheck;
168: }
169:
170: public void setSpellCheck(SpellCheckType spellCheck) {
171: this.spellCheck = spellCheck;
172: }
173: }
|