1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.workflow.attribute;
17
18 import org.kuali.rice.core.api.uif.RemotableAttributeError;
19 import org.kuali.rice.core.api.uif.RemotableAttributeField;
20 import org.kuali.rice.core.api.util.jaxb.MultiValuedStringMapAdapter;
21 import org.kuali.rice.kew.api.document.attribute.DocumentAttribute;
22 import org.kuali.rice.kew.api.document.attribute.WorkflowAttributeDefinition;
23 import org.kuali.rice.kew.api.extension.ExtensionDefinition;
24 import org.kuali.rice.kew.docsearch.DocSearchCriteriaDTO;
25 import org.kuali.rice.kew.docsearch.DocSearchDTO;
26 import org.kuali.rice.kew.docsearch.DocumentSearchGenerator;
27 import org.kuali.rice.kew.docsearch.DocumentSearchResultComponents;
28 import org.kuali.rice.kew.docsearch.DocumentSearchResultProcessor;
29 import org.kuali.rice.kew.docsearch.SearchableAttributeValue;
30 import org.kuali.rice.kew.docsearch.StandardDocumentSearchGenerator;
31 import org.kuali.rice.kew.docsearch.StandardDocumentSearchResultProcessor;
32 import org.kuali.rice.kew.exception.WorkflowServiceError;
33 import org.kuali.rice.kew.framework.document.lookup.DocumentSearchContext;
34 import org.kuali.rice.kew.framework.document.lookup.SearchableAttribute;
35 import org.kuali.rice.kew.rule.WorkflowAttributeValidationError;
36 import org.kuali.rice.kns.web.ui.Row;
37 import org.kuali.rice.krad.util.MessageMap;
38
39 import javax.jws.WebParam;
40 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
41 import java.sql.ResultSet;
42 import java.sql.SQLException;
43 import java.sql.Statement;
44 import java.util.List;
45 import java.util.Map;
46
47 public class DataDictionaryDocumentSearchCustomizer implements SearchableAttribute, DocumentSearchGenerator, DocumentSearchResultProcessor {
48
49
50 protected StandardDocumentSearchGenerator documentSearchGenerator = null;
51
52 protected SearchableAttribute searchableAttribute = null;
53
54 protected DocumentSearchResultProcessor searchResultProcessor = null;
55
56 public DocSearchCriteriaDTO clearSearch(DocSearchCriteriaDTO searchCriteria) {
57 return getDocumentSearchGenerator().clearSearch(searchCriteria);
58 }
59
60 public String generateSearchSql(DocSearchCriteriaDTO searchCriteria) {
61 return getDocumentSearchGenerator().generateSearchSql(searchCriteria);
62 }
63
64 public int getDocumentSearchResultSetLimit() {
65 return getDocumentSearchGenerator().getDocumentSearchResultSetLimit();
66 }
67
68 public List<WorkflowServiceError> performPreSearchConditions(String principalId, DocSearchCriteriaDTO searchCriteria) {
69 return getDocumentSearchGenerator().performPreSearchConditions(principalId, searchCriteria);
70 }
71
72 public List<DocSearchDTO> processResultSet(Statement searchAttributeStatement, ResultSet resultSet, DocSearchCriteriaDTO searchCriteria, String principalId) throws SQLException {
73 return getDocumentSearchGenerator().processResultSet(searchAttributeStatement, resultSet, searchCriteria, principalId);
74 }
75
76 @Deprecated
77 public List<DocSearchDTO> processResultSet(Statement searchAttributeStatement, ResultSet resultSet, DocSearchCriteriaDTO searchCriteria) throws SQLException {
78 return getDocumentSearchGenerator().processResultSet(searchAttributeStatement, resultSet, searchCriteria);
79 }
80
81 public void setSearchingUser(String principalId) {
82 getDocumentSearchGenerator().setSearchingUser(principalId);
83 }
84
85 public List<RemotableAttributeError> validateSearchableAttributes(DocSearchCriteriaDTO searchCriteria) {
86 return getDocumentSearchGenerator().validateSearchableAttributes(searchCriteria);
87 }
88
89 public boolean isProcessResultSet() {
90 return getDocumentSearchGenerator().isProcessResultSet();
91 }
92 public void setProcessResultSet(boolean isProcessResultSet){
93 getDocumentSearchGenerator().setProcessResultSet(isProcessResultSet);
94 }
95 public MessageMap getMessageMap(DocSearchCriteriaDTO searchCriteria) {
96 return getDocumentSearchGenerator().getMessageMap(searchCriteria);
97 }
98
99 @Override
100 public String generateSearchContent(ExtensionDefinition extensionDefinition,
101 String documentTypeName,
102 WorkflowAttributeDefinition attributeDefinition) {
103 return getSearchableAttribute().generateSearchContent(extensionDefinition, documentTypeName, attributeDefinition);
104 }
105
106 @Override
107 public List<DocumentAttribute> getDocumentAttributes(ExtensionDefinition extensionDefinition,
108 DocumentSearchContext documentSearchContext) {
109 return getSearchableAttribute().getDocumentAttributes(extensionDefinition, documentSearchContext);
110 }
111
112 @Override
113 public List<RemotableAttributeField> getSearchFields(ExtensionDefinition extensionDefinition,
114 String documentTypeName) {
115 return getSearchableAttribute().getSearchFields(extensionDefinition, documentTypeName);
116 }
117
118 @Override
119 public List<RemotableAttributeError> validateSearchFieldParameters(ExtensionDefinition extensionDefinition,
120 Map<String, List<String>> parameters,
121 String documentTypeName) {
122 return getSearchableAttribute().validateSearchFieldParameters(extensionDefinition, parameters, documentTypeName);
123 }
124
125
126
127
128
129
130 public DocumentSearchResultComponents processIntoFinalResults(
131 List<DocSearchDTO> docSearchResultRows,
132 DocSearchCriteriaDTO criteria, String principalId)
133 throws SQLException {
134
135 return this.getSearchResultProcessor().processIntoFinalResults(docSearchResultRows, criteria, principalId);
136 }
137
138
139
140
141
142
143 public void setProcessFinalResults(boolean isProcessFinalResults) {
144 this.getSearchResultProcessor().setProcessFinalResults(isProcessFinalResults);
145
146 }
147
148
149
150
151
152
153 public boolean isProcessFinalResults() {
154 return this.getSearchResultProcessor().isProcessFinalResults();
155 }
156
157
158
159
160 public void setDocumentSearchGenerator(
161 StandardDocumentSearchGenerator documentSearchGenerator) {
162 this.documentSearchGenerator = documentSearchGenerator;
163 }
164
165
166
167
168 public void setSearchResultProcessor(
169 DocumentSearchResultProcessor searchResultProcessor) {
170 this.searchResultProcessor = searchResultProcessor;
171 }
172
173
174
175
176 public void setSearchableAttribute(SearchableAttribute searchableAttribute) {
177 this.searchableAttribute = searchableAttribute;
178 }
179
180
181
182
183 public SearchableAttribute getSearchableAttribute() {
184 if(this.searchableAttribute == null){
185 this.searchableAttribute = new DataDictionarySearchableAttribute();
186 }
187 return this.searchableAttribute;
188 }
189
190
191
192
193 public StandardDocumentSearchGenerator getDocumentSearchGenerator() {
194 if(this.documentSearchGenerator == null){
195 this.documentSearchGenerator = new StandardDocumentSearchGenerator();
196 }
197 return this.documentSearchGenerator;
198 }
199
200
201
202
203 public DocumentSearchResultProcessor getSearchResultProcessor() {
204 if(this.searchResultProcessor == null){
205 this.searchResultProcessor = new StandardDocumentSearchResultProcessor();
206 }
207 return this.searchResultProcessor;
208 }
209
210
211
212
213 }