001: package org.columba.core.search;
002:
003: import java.util.List;
004:
005: import org.columba.api.command.ICommandReference;
006: import org.columba.core.search.api.ISearchRequest;
007:
008: /**
009: * FIXME:
010: *
011: * @author fdietz: No locking of folders currently implemented!
012: *
013: * @author frd
014: */
015: public class SearchCommandReference implements ICommandReference {
016:
017: public static enum TYPE {
018: SIMPLE_ALL, SIMPLE_SPECIFIC_PROVIDER, SIMPLE_SPECIFIC_CRITERIA, COMPLEX
019: };
020:
021: private String searchTerm;
022:
023: private String providerTechnicalName;
024:
025: private int startIndex;
026:
027: private int resultCount;
028:
029: private String searchCriteriaTechnicalName;
030:
031: private boolean searchInside;
032:
033: private List<ISearchRequest> request;
034:
035: private TYPE type;
036:
037: private boolean matchAll;
038:
039: public SearchCommandReference(List<ISearchRequest> request,
040: boolean matchAll, int startIndex, int resultCount,
041: boolean searchInside) {
042: super ();
043:
044: this .request = request;
045: this .searchInside = searchInside;
046: this .startIndex = startIndex;
047: this .resultCount = resultCount;
048: this .matchAll = matchAll;
049:
050: type = TYPE.COMPLEX;
051: }
052:
053: public SearchCommandReference(String searchTerm, int startIndex,
054: int resultCount, boolean searchInside) {
055: super ();
056:
057: this .searchTerm = searchTerm;
058: this .startIndex = startIndex;
059: this .resultCount = resultCount;
060: this .searchInside = searchInside;
061:
062: type = TYPE.SIMPLE_ALL;
063: }
064:
065: public SearchCommandReference(String searchTerm,
066: String providerTechnicalName, int startIndex,
067: int resultCount) {
068: super ();
069:
070: this .searchTerm = searchTerm;
071: this .providerTechnicalName = providerTechnicalName;
072: this .startIndex = startIndex;
073: this .resultCount = resultCount;
074: type = TYPE.SIMPLE_SPECIFIC_PROVIDER;
075: }
076:
077: public SearchCommandReference(String searchTerm,
078: String providerTechnicalName,
079: String searchCriteriaTechnicalName, boolean searchInside,
080: int startIndex, int resultCount) {
081: super ();
082:
083: this .searchTerm = searchTerm;
084: this .providerTechnicalName = providerTechnicalName;
085: this .searchCriteriaTechnicalName = searchCriteriaTechnicalName;
086: this .searchInside = searchInside;
087: this .startIndex = startIndex;
088: this .resultCount = resultCount;
089: type = TYPE.SIMPLE_SPECIFIC_CRITERIA;
090: }
091:
092: public boolean tryToGetLock(Object locker) {
093: return true;
094: }
095:
096: public void releaseLock(Object locker) {
097: }
098:
099: public String getSearchTerm() {
100: return searchTerm;
101: }
102:
103: public int getResultCount() {
104: return resultCount;
105: }
106:
107: public int getStartIndex() {
108: return startIndex;
109: }
110:
111: public String getProviderTechnicalName() {
112: return providerTechnicalName;
113: }
114:
115: public String getSearchCriteriaTechnicalName() {
116: return searchCriteriaTechnicalName;
117: }
118:
119: public boolean isSearchInside() {
120: return searchInside;
121: }
122:
123: public List<ISearchRequest> getRequest() {
124: return request;
125: }
126:
127: public TYPE getType() {
128: return type;
129: }
130:
131: public boolean isMatchAll() {
132: return matchAll;
133: }
134:
135: }
|