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.util.Parameter;
021:
022: /**
023: * @author kimchy
024: */
025: public interface ResourcePropertyMapping extends Mapping {
026:
027: public static class ReverseType extends Parameter {
028:
029: private static final long serialVersionUID = 9135849961654313364L;
030:
031: protected ReverseType(String name) {
032: super (name);
033: }
034:
035: public static final ReverseType NO = new ReverseType("NO");
036:
037: public static final ReverseType READER = new ReverseType(
038: "READER");
039:
040: public static final ReverseType STRING = new ReverseType(
041: "STRING");
042:
043: public static ReverseType fromString(String reverseType) {
044: if ("no".equalsIgnoreCase(reverseType)) {
045: return ReverseType.NO;
046: } else if ("reader".equalsIgnoreCase(reverseType)) {
047: return ReverseType.READER;
048: } else if ("string".equalsIgnoreCase(reverseType)) {
049: return ReverseType.STRING;
050: }
051: throw new IllegalArgumentException(
052: "Can't find reverse type for [" + reverseType + "]");
053: }
054: }
055:
056: public static class ExcludeFromAllType extends Parameter {
057:
058: protected ExcludeFromAllType(String name) {
059: super (name);
060: }
061:
062: public static final ExcludeFromAllType NO = new ExcludeFromAllType(
063: "NO");
064:
065: public static final ExcludeFromAllType YES = new ExcludeFromAllType(
066: "YES");
067:
068: public static final ExcludeFromAllType NO_ANALYZED = new ExcludeFromAllType(
069: "NO_ANALYZED");
070:
071: public static ExcludeFromAllType fromString(
072: String excludeFromAllType) {
073: if ("no".equalsIgnoreCase(excludeFromAllType)
074: || "false".equalsIgnoreCase(excludeFromAllType)) {
075: return ExcludeFromAllType.NO;
076: } else if ("yes".equalsIgnoreCase(excludeFromAllType)
077: || "true".equalsIgnoreCase(excludeFromAllType)) {
078: return ExcludeFromAllType.YES;
079: } else if ("no_analyzed"
080: .equalsIgnoreCase(excludeFromAllType)) {
081: return ExcludeFromAllType.NO_ANALYZED;
082: }
083: throw new IllegalArgumentException(
084: "Can't find exclude from all type for ["
085: + excludeFromAllType + "]");
086: }
087:
088: public static String toString(
089: ExcludeFromAllType excludeFromAllType) {
090: if (excludeFromAllType == NO) {
091: return "no";
092: }
093: if (excludeFromAllType == NO_ANALYZED) {
094: return "no_analyzed";
095: }
096: if (excludeFromAllType == YES) {
097: return "yes";
098: }
099: return "no";
100: }
101: }
102:
103: /**
104: * Returns the anayzer name that is associated with the property.
105: * Can be <code>null</code> (i.e. not set).
106: */
107: String getAnalyzer();
108:
109: /**
110: * Returns the root resource mapping alias name this resource property mapping belongs to.
111: */
112: String getRootAlias();
113:
114: /**
115: * Returns <code>true</code> if this mapping is an internal one (<code>$/</code> notation).
116: */
117: boolean isInternal();
118:
119: float getBoost();
120:
121: boolean isOmitNorms();
122:
123: ExcludeFromAllType getExcludeFromAll();
124:
125: SpellCheckType getSpellCheck();
126:
127: Property.Store getStore();
128:
129: Property.Index getIndex();
130:
131: Property.TermVector getTermVector();
132:
133: ReverseType getReverse();
134:
135: String getNullValue();
136:
137: boolean hasNullValue();
138: }
|