1 package org.columba.core.search; 2 3 import java.util.List ; 4 5 import org.columba.api.command.ICommandReference; 6 import org.columba.core.search.api.ISearchRequest; 7 8 15 public class SearchCommandReference implements ICommandReference { 16 17 public static enum TYPE { 18 SIMPLE_ALL, SIMPLE_SPECIFIC_PROVIDER, SIMPLE_SPECIFIC_CRITERIA, COMPLEX 19 }; 20 21 private String searchTerm; 22 23 private String providerTechnicalName; 24 25 private int startIndex; 26 27 private int resultCount; 28 29 private String searchCriteriaTechnicalName; 30 31 private boolean searchInside; 32 33 private List <ISearchRequest> request; 34 35 private TYPE type; 36 37 private boolean matchAll; 38 39 public SearchCommandReference(List <ISearchRequest> request, 40 boolean matchAll, int startIndex, int resultCount, 41 boolean searchInside) { 42 super(); 43 44 this.request = request; 45 this.searchInside = searchInside; 46 this.startIndex = startIndex; 47 this.resultCount = resultCount; 48 this.matchAll = matchAll; 49 50 type = TYPE.COMPLEX; 51 } 52 53 public SearchCommandReference(String searchTerm, int startIndex, 54 int resultCount, boolean searchInside) { 55 super(); 56 57 this.searchTerm = searchTerm; 58 this.startIndex = startIndex; 59 this.resultCount = resultCount; 60 this.searchInside = searchInside; 61 62 type = TYPE.SIMPLE_ALL; 63 } 64 65 public SearchCommandReference(String searchTerm, 66 String providerTechnicalName, int startIndex, int resultCount) { 67 super(); 68 69 this.searchTerm = searchTerm; 70 this.providerTechnicalName = providerTechnicalName; 71 this.startIndex = startIndex; 72 this.resultCount = resultCount; 73 type = TYPE.SIMPLE_SPECIFIC_PROVIDER; 74 } 75 76 public SearchCommandReference(String searchTerm, 77 String providerTechnicalName, 78 String searchCriteriaTechnicalName, boolean searchInside, int startIndex, 79 int resultCount) { 80 super(); 81 82 this.searchTerm = searchTerm; 83 this.providerTechnicalName = providerTechnicalName; 84 this.searchCriteriaTechnicalName = searchCriteriaTechnicalName; 85 this.searchInside = searchInside; 86 this.startIndex = startIndex; 87 this.resultCount = resultCount; 88 type = TYPE.SIMPLE_SPECIFIC_CRITERIA; 89 } 90 91 public boolean tryToGetLock(Object locker) { 92 return true; 93 } 94 95 public void releaseLock(Object locker) { 96 } 97 98 public String getSearchTerm() { 99 return searchTerm; 100 } 101 102 public int getResultCount() { 103 return resultCount; 104 } 105 106 public int getStartIndex() { 107 return startIndex; 108 } 109 110 public String getProviderTechnicalName() { 111 return providerTechnicalName; 112 } 113 114 public String getSearchCriteriaTechnicalName() { 115 return searchCriteriaTechnicalName; 116 } 117 118 public boolean isSearchInside() { 119 return searchInside; 120 } 121 122 public List <ISearchRequest> getRequest() { 123 return request; 124 } 125 126 public TYPE getType() { 127 return type; 128 } 129 130 public boolean isMatchAll() { 131 return matchAll; 132 } 133 134 } 135 | Popular Tags |