1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
package org.kuali.rice.kew.docsearch.service.impl; |
18 | |
|
19 | |
import org.apache.commons.lang.StringUtils; |
20 | |
import org.kuali.rice.core.config.ConfigContext; |
21 | |
import org.kuali.rice.core.database.platform.DatabasePlatform; |
22 | |
import org.kuali.rice.core.jdbc.SqlBuilder; |
23 | |
import org.kuali.rice.core.reflect.ObjectDefinition; |
24 | |
import org.kuali.rice.core.resourceloader.GlobalResourceLoader; |
25 | |
import org.kuali.rice.core.util.RiceConstants; |
26 | |
import org.kuali.rice.kew.docsearch.*; |
27 | |
import org.kuali.rice.kew.docsearch.dao.DocumentSearchDAO; |
28 | |
import org.kuali.rice.kew.docsearch.service.DocumentSearchService; |
29 | |
import org.kuali.rice.kew.doctype.bo.DocumentType; |
30 | |
import org.kuali.rice.kew.engine.node.RouteNode; |
31 | |
import org.kuali.rice.kew.exception.WorkflowServiceError; |
32 | |
import org.kuali.rice.kew.exception.WorkflowServiceErrorException; |
33 | |
import org.kuali.rice.kew.exception.WorkflowServiceErrorImpl; |
34 | |
import org.kuali.rice.kew.service.KEWServiceLocator; |
35 | |
import org.kuali.rice.kew.useroptions.UserOptions; |
36 | |
import org.kuali.rice.kew.useroptions.UserOptionsService; |
37 | |
import org.kuali.rice.kew.util.KEWConstants; |
38 | |
import org.kuali.rice.kew.util.Utilities; |
39 | |
import org.kuali.rice.kew.web.KeyValue; |
40 | |
import org.kuali.rice.kim.bo.Group; |
41 | |
import org.kuali.rice.kim.bo.Person; |
42 | |
import org.kuali.rice.kim.service.KIMServiceLocator; |
43 | |
import org.kuali.rice.kns.service.DataDictionaryService; |
44 | |
import org.kuali.rice.kns.service.DictionaryValidationService; |
45 | |
import org.kuali.rice.kns.service.KNSServiceLocator; |
46 | |
import org.kuali.rice.kns.service.KualiConfigurationService; |
47 | |
import org.kuali.rice.kns.util.GlobalVariables; |
48 | |
|
49 | |
import java.text.MessageFormat; |
50 | |
import java.util.*; |
51 | |
|
52 | |
|
53 | 0 | public class DocumentSearchServiceImpl implements DocumentSearchService { |
54 | |
|
55 | 0 | private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(DocumentSearchServiceImpl.class); |
56 | |
|
57 | |
private static final int MAX_SEARCH_ITEMS = 5; |
58 | |
private static final String LAST_SEARCH_ORDER_OPTION = "DocSearch.LastSearch.Order"; |
59 | |
private static final String NAMED_SEARCH_ORDER_BASE = "DocSearch.NamedSearch."; |
60 | |
private static final String LAST_SEARCH_BASE_NAME = "DocSearch.LastSearch.Holding"; |
61 | |
private static final String DOC_SEARCH_CRITERIA_DTO_CLASS = "org.kuali.rice.kew.docsearch.DocSearchCriteriaDTO"; |
62 | |
|
63 | |
private static DictionaryValidationService dictionaryValidationService; |
64 | |
private static DataDictionaryService dataDictionaryService; |
65 | |
private static KualiConfigurationService kualiConfigurationService; |
66 | |
|
67 | |
private DocumentSearchDAO docSearchDao; |
68 | |
private UserOptionsService userOptionsService; |
69 | |
|
70 | 0 | private SqlBuilder sqlBuilder = null; |
71 | |
|
72 | |
public void setDocumentSearchDAO(DocumentSearchDAO docSearchDao) { |
73 | 0 | this.docSearchDao = docSearchDao; |
74 | 0 | } |
75 | |
|
76 | |
public void setUserOptionsService(UserOptionsService userOptionsService) { |
77 | 0 | this.userOptionsService = userOptionsService; |
78 | 0 | } |
79 | |
|
80 | |
public void clearNamedSearches(String principalId) { |
81 | 0 | String[] clearListNames = { NAMED_SEARCH_ORDER_BASE + "%", LAST_SEARCH_BASE_NAME + "%", LAST_SEARCH_ORDER_OPTION + "%" }; |
82 | 0 | for (String clearListName : clearListNames) |
83 | |
{ |
84 | 0 | List<UserOptions> records = userOptionsService.findByUserQualified(principalId, clearListName); |
85 | 0 | for (Iterator<UserOptions> iter = records.iterator(); iter.hasNext();) |
86 | |
{ |
87 | 0 | userOptionsService.deleteUserOptions((UserOptions) iter.next()); |
88 | |
} |
89 | |
} |
90 | 0 | } |
91 | |
|
92 | |
public SavedSearchResult getSavedSearchResults(String principalId, String savedSearchName) { |
93 | 0 | UserOptions savedSearch = userOptionsService.findByOptionId(savedSearchName, principalId); |
94 | 0 | if (savedSearch == null || savedSearch.getOptionId() == null) { |
95 | 0 | return null; |
96 | |
} |
97 | 0 | DocSearchCriteriaDTO criteria = getCriteriaFromSavedSearch(savedSearch); |
98 | 0 | return new SavedSearchResult(criteria, getList(principalId, criteria)); |
99 | |
} |
100 | |
|
101 | |
public DocumentSearchResultComponents getList(String principalId, DocSearchCriteriaDTO criteria) { |
102 | 0 | return getList(principalId, criteria, false); |
103 | |
} |
104 | |
|
105 | |
public DocumentSearchResultComponents getListRestrictedByCriteria(String principalId, DocSearchCriteriaDTO criteria) { |
106 | 0 | return getList(principalId, criteria, true); |
107 | |
} |
108 | |
|
109 | |
private DocumentSearchResultComponents getList(String principalId, DocSearchCriteriaDTO criteria, boolean useCriteriaRestrictions) { |
110 | 0 | DocumentSearchGenerator docSearchGenerator = null; |
111 | 0 | DocumentSearchResultProcessor docSearchResultProcessor = null; |
112 | |
|
113 | 0 | DocumentType documentType = KEWServiceLocator.getDocumentTypeService().findByName(criteria.getDocTypeFullName()); |
114 | 0 | if (documentType != null ) { |
115 | 0 | docSearchGenerator = documentType.getDocumentSearchGenerator(); |
116 | 0 | docSearchResultProcessor = documentType.getDocumentSearchResultProcessor(); |
117 | |
} else { |
118 | 0 | docSearchGenerator = getStandardDocumentSearchGenerator(); |
119 | 0 | docSearchResultProcessor = getStandardDocumentSearchResultProcessor(); |
120 | |
} |
121 | 0 | docSearchGenerator.setSearchingUser(principalId); |
122 | 0 | performPreSearchConditions(docSearchGenerator,principalId,criteria); |
123 | 0 | validateDocumentSearchCriteria(docSearchGenerator,criteria); |
124 | 0 | DocumentSearchResultComponents searchResult = null; |
125 | |
try { |
126 | 0 | List<DocSearchDTO> docListResults = null; |
127 | 0 | if (useCriteriaRestrictions) { |
128 | 0 | docListResults = docSearchDao.getListBoundedByCritera(docSearchGenerator,criteria, principalId); |
129 | |
} else { |
130 | 0 | docListResults = docSearchDao.getList(docSearchGenerator,criteria, principalId); |
131 | |
} |
132 | 0 | if (docSearchResultProcessor.isProcessFinalResults()) { |
133 | 0 | searchResult = docSearchResultProcessor.processIntoFinalResults(docListResults, criteria, principalId); |
134 | |
} else { |
135 | 0 | searchResult = new StandardDocumentSearchResultProcessor().processIntoFinalResults(docListResults, criteria, principalId); |
136 | |
} |
137 | |
|
138 | 0 | } catch (Exception e) { |
139 | 0 | String errorMsg = "Error received trying to execute search: " + e.getLocalizedMessage(); |
140 | 0 | LOG.error("getList() " + errorMsg,e); |
141 | 0 | throw new WorkflowServiceErrorException(errorMsg,new WorkflowServiceErrorImpl(errorMsg,"docsearch.DocumentSearchService.generalError",errorMsg)); |
142 | 0 | } |
143 | 0 | if (!useCriteriaRestrictions || !criteria.isSaveSearchForUser()) { |
144 | |
try { |
145 | 0 | saveSearch(principalId, criteria); |
146 | 0 | } catch (RuntimeException e) { |
147 | 0 | LOG.warn("Unable to save search due to RuntimeException with message: " + e.getMessage()); |
148 | 0 | LOG.warn("RuntimeException will be ignored and may cause transaction problems"); |
149 | |
|
150 | 0 | } |
151 | |
} |
152 | 0 | return searchResult; |
153 | |
} |
154 | |
|
155 | |
public DocumentSearchGenerator getStandardDocumentSearchGenerator() { |
156 | 0 | String searchGeneratorClass = ConfigContext.getCurrentContextConfig().getProperty(KEWConstants.STANDARD_DOC_SEARCH_GENERATOR_CLASS_CONFIG_PARM); |
157 | 0 | if (searchGeneratorClass == null){ |
158 | 0 | return new StandardDocumentSearchGenerator(); |
159 | |
} |
160 | 0 | return (DocumentSearchGenerator)GlobalResourceLoader.getObject(new ObjectDefinition(searchGeneratorClass)); |
161 | |
} |
162 | |
|
163 | |
public DocumentSearchResultProcessor getStandardDocumentSearchResultProcessor() { |
164 | 0 | String searchGeneratorClass = ConfigContext.getCurrentContextConfig().getProperty(KEWConstants.STANDARD_DOC_SEARCH_RESULT_PROCESSOR_CLASS_CONFIG_PARM); |
165 | 0 | if (searchGeneratorClass == null){ |
166 | 0 | return new StandardDocumentSearchResultProcessor(); |
167 | |
} |
168 | 0 | return (DocumentSearchResultProcessor)GlobalResourceLoader.getObject(new ObjectDefinition(searchGeneratorClass)); |
169 | |
} |
170 | |
|
171 | |
public void performPreSearchConditions(DocumentSearchGenerator docSearchGenerator,String principalId,DocSearchCriteriaDTO criteria) { |
172 | 0 | List<WorkflowServiceError> errors = docSearchGenerator.performPreSearchConditions(principalId,criteria); |
173 | 0 | if (!errors.isEmpty()) { |
174 | 0 | throw new WorkflowServiceErrorException("Document Search Precondition Errors", errors); |
175 | |
} |
176 | 0 | } |
177 | |
|
178 | |
public void validateDocumentSearchCriteria(DocumentSearchGenerator docSearchGenerator,DocSearchCriteriaDTO criteria) { |
179 | 0 | List<WorkflowServiceError> errors = this.validateWorkflowDocumentSearchCriteria(criteria); |
180 | 0 | errors.addAll(docSearchGenerator.validateSearchableAttributes(criteria)); |
181 | 0 | if (!errors.isEmpty() || !GlobalVariables.getMessageMap().hasNoErrors()) { |
182 | 0 | throw new WorkflowServiceErrorException("Document Search Validation Errors", errors); |
183 | |
} |
184 | 0 | } |
185 | |
|
186 | |
protected List<WorkflowServiceError> validateWorkflowDocumentSearchCriteria(DocSearchCriteriaDTO criteria) { |
187 | 0 | List<WorkflowServiceError> errors = new ArrayList<WorkflowServiceError>(); |
188 | |
|
189 | |
|
190 | 0 | if (!validatePersonByName(criteria.getApprover())) { |
191 | 0 | errors.add(new WorkflowServiceErrorImpl("Approver network id is invalid", "docsearch.DocumentSearchService.networkid.approver")); |
192 | |
} else { |
193 | 0 | if (criteria.getApprover() != null && !"".equals(criteria.getApprover().trim())) { |
194 | 0 | criteria.setApprover(criteria.getApprover().trim()); |
195 | |
} |
196 | |
} |
197 | 0 | if (!validatePersonByName(criteria.getViewer())) { |
198 | 0 | errors.add(new WorkflowServiceErrorImpl("Viewer network id is invalid", "docsearch.DocumentSearchService.networkid.viewer")); |
199 | |
} else { |
200 | 0 | if (criteria.getViewer() != null && !"".equals(criteria.getViewer().trim())) { |
201 | 0 | criteria.setViewer(criteria.getViewer().trim()); |
202 | |
} |
203 | |
} |
204 | 0 | if (!validatePersonByName(criteria.getInitiator())) { |
205 | 0 | errors.add(new WorkflowServiceErrorImpl("Initiator network id is invalid", "docsearch.DocumentSearchService.networkid.initiator")); |
206 | |
} else { |
207 | 0 | if (criteria.getInitiator() != null && !"".equals(criteria.getInitiator().trim())) { |
208 | 0 | criteria.setInitiator(criteria.getInitiator().trim()); |
209 | |
} |
210 | |
} |
211 | |
|
212 | 0 | if (! validateWorkgroup(criteria.getWorkgroupViewerId(), criteria.getWorkgroupViewerName())) { |
213 | 0 | errors.add(new WorkflowServiceErrorImpl("Workgroup Viewer Name is not a workgroup", "docsearch.DocumentSearchService.workgroup.viewer")); |
214 | |
} else { |
215 | 0 | if (!Utilities.isEmpty(criteria.getWorkgroupViewerName())){ |
216 | 0 | criteria.setWorkgroupViewerName(criteria.getWorkgroupViewerName().trim()); |
217 | |
} |
218 | |
} |
219 | |
|
220 | 0 | if (!validateNumber(criteria.getDocVersion())) { |
221 | 0 | errors.add(new WorkflowServiceErrorImpl("Non-numeric document version", "docsearch.DocumentSearchService.docVersion")); |
222 | |
} else { |
223 | 0 | if (criteria.getDocVersion() != null && !"".equals(criteria.getDocVersion().trim())) { |
224 | 0 | criteria.setDocVersion(criteria.getDocVersion().trim()); |
225 | |
} |
226 | |
} |
227 | 0 | if (!validateNumber(criteria.getRouteHeaderId())) { |
228 | 0 | errors.add(new WorkflowServiceErrorImpl("Non-numeric document id", "docsearch.DocumentSearchService.routeHeaderId")); |
229 | |
} else { |
230 | 0 | if (criteria.getRouteHeaderId() != null && !"".equals(criteria.getRouteHeaderId().trim())) { |
231 | 0 | criteria.setRouteHeaderId(criteria.getRouteHeaderId().trim()); |
232 | |
} |
233 | |
} |
234 | |
|
235 | |
|
236 | 0 | boolean compareDatePairs = true; |
237 | 0 | if (!validateDate("fromDateCreated", criteria.getFromDateCreated(), "fromDateCreated")) { |
238 | 0 | compareDatePairs = false; |
239 | |
} else { |
240 | 0 | if (criteria.getFromDateCreated() != null && !"".equals(criteria.getFromDateCreated().trim())) { |
241 | 0 | criteria.setFromDateCreated(criteria.getFromDateCreated().trim()); |
242 | |
} else { |
243 | 0 | compareDatePairs = false; |
244 | |
} |
245 | |
} |
246 | 0 | if (!validateDate("toDateCreated", criteria.getToDateCreated(), "toDateCreated")) { |
247 | 0 | compareDatePairs = false; |
248 | |
} else { |
249 | 0 | if (criteria.getToDateCreated() != null && !"".equals(criteria.getToDateCreated().trim())) { |
250 | 0 | criteria.setToDateCreated(criteria.getToDateCreated().trim()); |
251 | |
} else { |
252 | 0 | compareDatePairs = false; |
253 | |
} |
254 | |
} |
255 | 0 | if (compareDatePairs) { |
256 | 0 | if (!checkDateRanges(criteria.getFromDateCreated(), criteria.getToDateCreated())) { |
257 | 0 | String[] messageArgs = getDataDictionaryService().getAttributeValidatingErrorMessageParameters( |
258 | |
DOC_SEARCH_CRITERIA_DTO_CLASS, "fromDateCreated"); |
259 | 0 | errors.add(new WorkflowServiceErrorImpl(MessageFormat.format(getKualiConfigurationService().getPropertyString( |
260 | |
getDataDictionaryService().getAttributeValidatingErrorMessageKey(DOC_SEARCH_CRITERIA_DTO_CLASS, "fromDateCreated") + |
261 | |
".range"), messageArgs[0]), "docsearch.DocumentSearchService.dateCreatedRange")); |
262 | |
} |
263 | |
} |
264 | 0 | compareDatePairs = true; |
265 | 0 | if (!validateDate("fromDateApproved", criteria.getFromDateApproved(), "fromDateApproved")) { |
266 | 0 | compareDatePairs = false; |
267 | |
} else { |
268 | 0 | if (criteria.getFromDateApproved() != null && !"".equals(criteria.getFromDateApproved().trim())) { |
269 | 0 | criteria.setFromDateApproved(criteria.getFromDateApproved().trim()); |
270 | |
} else { |
271 | 0 | compareDatePairs = false; |
272 | |
} |
273 | |
} |
274 | 0 | if (!validateDate("toDateApproved", criteria.getToDateApproved(), "toDateApproved")) { |
275 | 0 | compareDatePairs = false; |
276 | |
} else { |
277 | 0 | if (criteria.getToDateApproved() != null && !"".equals(criteria.getToDateApproved().trim())) { |
278 | 0 | criteria.setToDateApproved(criteria.getToDateApproved().trim()); |
279 | |
} else { |
280 | 0 | compareDatePairs = false; |
281 | |
} |
282 | |
} |
283 | 0 | if (compareDatePairs) { |
284 | 0 | if (!checkDateRanges(criteria.getFromDateApproved(), criteria.getToDateApproved())) { |
285 | 0 | String[] messageArgs = getDataDictionaryService().getAttributeValidatingErrorMessageParameters( |
286 | |
DOC_SEARCH_CRITERIA_DTO_CLASS, "fromDateApproved"); |
287 | 0 | errors.add(new WorkflowServiceErrorImpl(MessageFormat.format(getKualiConfigurationService().getPropertyString( |
288 | |
getDataDictionaryService().getAttributeValidatingErrorMessageKey(DOC_SEARCH_CRITERIA_DTO_CLASS, "fromDateApproved") + |
289 | |
".range"), messageArgs[0]), "docsearch.DocumentSearchService.dateApprovedRange")); |
290 | |
} |
291 | |
} |
292 | 0 | compareDatePairs = true; |
293 | 0 | if (!validateDate("fromDateFinalized", criteria.getFromDateFinalized(), "fromDateFinalized")) { |
294 | 0 | compareDatePairs = false; |
295 | |
} else { |
296 | 0 | if (criteria.getFromDateFinalized() != null && !"".equals(criteria.getFromDateFinalized().trim())) { |
297 | 0 | criteria.setFromDateFinalized(criteria.getFromDateFinalized().trim()); |
298 | |
} else { |
299 | 0 | compareDatePairs = false; |
300 | |
} |
301 | |
} |
302 | 0 | if (!validateDate("toDateFinalized", criteria.getToDateFinalized(), "toDateFinalized")) { |
303 | 0 | compareDatePairs = false; |
304 | |
} else { |
305 | 0 | if (criteria.getToDateFinalized() != null && !"".equals(criteria.getToDateFinalized().trim())) { |
306 | 0 | criteria.setToDateFinalized(criteria.getToDateFinalized().trim()); |
307 | |
} else { |
308 | 0 | compareDatePairs = false; |
309 | |
} |
310 | |
} |
311 | 0 | if (compareDatePairs) { |
312 | 0 | if (!checkDateRanges(criteria.getFromDateFinalized(), criteria.getToDateFinalized())) { |
313 | 0 | String[] messageArgs = getDataDictionaryService().getAttributeValidatingErrorMessageParameters( |
314 | |
DOC_SEARCH_CRITERIA_DTO_CLASS, "fromDateFinalized"); |
315 | 0 | errors.add(new WorkflowServiceErrorImpl(MessageFormat.format(getKualiConfigurationService().getPropertyString( |
316 | |
getDataDictionaryService().getAttributeValidatingErrorMessageKey(DOC_SEARCH_CRITERIA_DTO_CLASS, "fromDateFinalized") + |
317 | |
".range"), messageArgs[0]), "docsearch.DocumentSearchService.dateFinalizedRange")); |
318 | |
} |
319 | |
} |
320 | 0 | compareDatePairs = true; |
321 | 0 | if (!validateDate("fromDateLastModified", criteria.getFromDateLastModified(), "fromDateLastModified")) { |
322 | 0 | compareDatePairs = false; |
323 | |
} else { |
324 | 0 | if (criteria.getFromDateLastModified() != null && !"".equals(criteria.getFromDateLastModified().trim())) { |
325 | 0 | criteria.setFromDateLastModified(criteria.getFromDateLastModified().trim()); |
326 | |
} else { |
327 | 0 | compareDatePairs = false; |
328 | |
} |
329 | |
} |
330 | 0 | if (!validateDate("toDateLastModified", criteria.getToDateLastModified(), "toDateLastModified")) { |
331 | 0 | compareDatePairs = false; |
332 | |
} else { |
333 | 0 | if (criteria.getToDateLastModified() != null && !"".equals(criteria.getToDateLastModified().trim())) { |
334 | 0 | criteria.setToDateLastModified(criteria.getToDateLastModified().trim()); |
335 | |
} else { |
336 | 0 | compareDatePairs = false; |
337 | |
} |
338 | |
} |
339 | 0 | if (compareDatePairs) { |
340 | 0 | if (!checkDateRanges(criteria.getFromDateLastModified(), criteria.getToDateLastModified())) { |
341 | 0 | String[] messageArgs = getDataDictionaryService().getAttributeValidatingErrorMessageParameters( |
342 | |
DOC_SEARCH_CRITERIA_DTO_CLASS, "fromDateLastModified"); |
343 | 0 | errors.add(new WorkflowServiceErrorImpl(MessageFormat.format(getKualiConfigurationService().getPropertyString( |
344 | |
getDataDictionaryService().getAttributeValidatingErrorMessageKey(DOC_SEARCH_CRITERIA_DTO_CLASS, "fromDateLastModified") + |
345 | |
".range"), messageArgs[0]), "docsearch.DocumentSearchService.dateLastModifiedRange")); |
346 | |
} |
347 | |
} |
348 | 0 | return errors; |
349 | |
} |
350 | |
|
351 | |
private boolean validateNetworkId(List<String> networkIds){ |
352 | 0 | for(String networkId: networkIds){ |
353 | 0 | if(!this.validateNetworkId(networkId)){ |
354 | 0 | return false; |
355 | |
} |
356 | |
} |
357 | 0 | return true; |
358 | |
} |
359 | |
private boolean validateNetworkId(String networkId) { |
360 | 0 | if ((networkId == null) || networkId.trim().equals("")) { |
361 | 0 | return true; |
362 | |
} |
363 | |
try { |
364 | 0 | return KIMServiceLocator.getIdentityManagementService().getPrincipalByPrincipalName(networkId.trim()) != null; |
365 | 0 | } catch (Exception ex) { |
366 | 0 | LOG.debug(ex, ex); |
367 | 0 | return false; |
368 | |
} |
369 | |
} |
370 | |
|
371 | |
private boolean validatePersonByName(String searchName){ |
372 | 0 | if(searchName == null || "".equals(searchName.trim())){ |
373 | 0 | return true; |
374 | |
} |
375 | |
try{ |
376 | 0 | Map<String, String> m = new HashMap<String, String>(); |
377 | 0 | m.put("principalName", searchName); |
378 | |
|
379 | |
|
380 | 0 | List<Person> pList = KIMServiceLocator.getPersonService().findPeople(m, false); |
381 | 0 | }catch(Exception ex) { |
382 | 0 | LOG.debug(ex, ex); |
383 | 0 | return false; |
384 | 0 | } |
385 | 0 | return true; |
386 | |
} |
387 | |
|
388 | |
private boolean validateDate(String dateFieldName, String dateFieldValue, String dateFieldErrorKey) { |
389 | |
|
390 | 0 | int oldErrorCount = GlobalVariables.getMessageMap().getErrorCount(); |
391 | 0 | getDictionaryValidationService().validateAttributeFormat(DOC_SEARCH_CRITERIA_DTO_CLASS, dateFieldName, dateFieldValue, |
392 | |
SearchableAttribute.DATA_TYPE_DATE, dateFieldErrorKey); |
393 | 0 | return (GlobalVariables.getMessageMap().getErrorCount() <= oldErrorCount); |
394 | |
|
395 | |
} |
396 | |
|
397 | |
private boolean checkDateRanges(String fromDate, String toDate) { |
398 | 0 | return Utilities.checkDateRanges(fromDate, toDate); |
399 | |
} |
400 | |
|
401 | |
private boolean validateNumber(List<String> integers) { |
402 | 0 | for(String integer: integers){ |
403 | 0 | if(!this.validateNumber(integer)){ |
404 | 0 | return false; |
405 | |
} |
406 | |
} |
407 | 0 | return true; |
408 | |
} |
409 | |
|
410 | |
private boolean validateNumber(String integer) { |
411 | 0 | if ((integer == null) || integer.trim().equals("")) { |
412 | 0 | return true; |
413 | |
} |
414 | 0 | return SqlBuilder.isValidNumber(integer); |
415 | |
|
416 | |
} |
417 | |
|
418 | |
private boolean validateWorkgroup(String id, String workgroupName) { |
419 | 0 | if (Utilities.isEmpty(workgroupName)) { |
420 | 0 | return true; |
421 | |
} |
422 | 0 | Group group = KIMServiceLocator.getIdentityManagementService().getGroup(id); |
423 | 0 | return group != null; |
424 | |
} |
425 | |
|
426 | |
public List<KeyValue> getNamedSearches(String principalId) { |
427 | 0 | List<UserOptions> namedSearches = userOptionsService.findByUserQualified(principalId, NAMED_SEARCH_ORDER_BASE + "%"); |
428 | 0 | List<KeyValue> sortedNamedSearches = new ArrayList<KeyValue>(0); |
429 | 0 | if (namedSearches != null && namedSearches.size() > 0) { |
430 | 0 | Collections.sort(namedSearches); |
431 | 0 | for (UserOptions namedSearch : namedSearches) { |
432 | 0 | KeyValue keyValue = new KeyValue(namedSearch.getOptionId(), namedSearch.getOptionId().substring(NAMED_SEARCH_ORDER_BASE.length(), namedSearch.getOptionId().length())); |
433 | 0 | sortedNamedSearches.add(keyValue); |
434 | 0 | } |
435 | |
} |
436 | 0 | return sortedNamedSearches; |
437 | |
} |
438 | |
|
439 | |
public List<KeyValue> getMostRecentSearches(String principalId) { |
440 | 0 | UserOptions order = userOptionsService.findByOptionId(LAST_SEARCH_ORDER_OPTION, principalId); |
441 | 0 | List<KeyValue> sortedMostRecentSearches = new ArrayList<KeyValue>(); |
442 | 0 | if (order != null && order.getOptionVal() != null && !"".equals(order.getOptionVal())) { |
443 | 0 | List<UserOptions> mostRecentSearches = userOptionsService.findByUserQualified(principalId, LAST_SEARCH_BASE_NAME + "%"); |
444 | 0 | String[] ordered = order.getOptionVal().split(","); |
445 | 0 | for (String anOrdered : ordered) |
446 | |
{ |
447 | 0 | UserOptions matchingOption = null; |
448 | 0 | for (UserOptions option : mostRecentSearches) |
449 | |
{ |
450 | 0 | if (anOrdered.equals(option.getOptionId())) |
451 | |
{ |
452 | 0 | matchingOption = option; |
453 | 0 | break; |
454 | |
} |
455 | |
} |
456 | 0 | if (matchingOption != null) |
457 | |
{ |
458 | |
try |
459 | |
{ |
460 | 0 | sortedMostRecentSearches.add(new KeyValue(anOrdered, getCriteriaFromSavedSearch(matchingOption).getDocumentSearchAbbreviatedString())); |
461 | |
} |
462 | 0 | catch (Exception e) |
463 | |
{ |
464 | 0 | String errorMessage = "Error found atttempting to get 'recent search' using user (principal id " + principalId + ") with option having id " + matchingOption.getOptionId() + " and value '" + matchingOption.getOptionVal() + "'"; |
465 | 0 | LOG.error("getMostRecentSearches() " + errorMessage, e); |
466 | 0 | } |
467 | |
} |
468 | |
} |
469 | |
} |
470 | 0 | return sortedMostRecentSearches; |
471 | |
} |
472 | |
|
473 | |
private void saveSearch(String principalId, DocSearchCriteriaDTO criteria) { |
474 | 0 | if (StringUtils.isBlank(principalId)) { |
475 | 0 | String message = "User given to save search was null."; |
476 | 0 | LOG.warn(message); |
477 | 0 | throw new IllegalArgumentException(message); |
478 | |
} |
479 | 0 | StringBuffer savedSearchString = new StringBuffer(); |
480 | 0 | savedSearchString.append(criteria.getAppDocId() == null || "".equals(criteria.getAppDocId()) ? "" : ",,appDocId=" + criteria.getAppDocId()); |
481 | 0 | savedSearchString.append(criteria.getApprover() == null || "".equals(criteria.getApprover()) ? "" : ",,approver=" + criteria.getApprover()); |
482 | |
|
483 | 0 | if (! Utilities.isEmpty(criteria.getDocRouteNodeId()) && !criteria.getDocRouteNodeId().equals("-1")) { |
484 | 0 | RouteNode routeNode = KEWServiceLocator.getRouteNodeService().findRouteNodeById(new Long(criteria.getDocRouteNodeId())); |
485 | |
|
486 | |
|
487 | 0 | savedSearchString.append(",,docRouteNodeId="); |
488 | 0 | savedSearchString.append(routeNode.getRouteNodeId()); |
489 | 0 | savedSearchString.append(criteria.getDocRouteNodeLogic() == null || "".equals(criteria.getDocRouteNodeLogic()) ? "" : ",,docRouteNodeLogic=" + criteria.getDocRouteNodeLogic()); |
490 | |
} |
491 | |
|
492 | 0 | savedSearchString.append(criteria.getDocRouteStatus() == null || "".equals(criteria.getDocRouteStatus()) ? "" : ",,docRouteStatus=" + criteria.getDocRouteStatus()); |
493 | 0 | savedSearchString.append(criteria.getDocTitle() == null || "".equals(criteria.getDocTitle()) ? "" : ",,docTitle=" + criteria.getDocTitle()); |
494 | 0 | savedSearchString.append(criteria.getDocTypeFullName() == null || "".equals(criteria.getDocTypeFullName()) ? "" : ",,docTypeFullName=" + criteria.getDocTypeFullName()); |
495 | 0 | savedSearchString.append(criteria.getDocVersion() == null || "".equals(criteria.getDocVersion()) ? "" : ",,docVersion=" + criteria.getDocVersion()); |
496 | 0 | savedSearchString.append(criteria.getFromDateApproved() == null || "".equals(criteria.getFromDateApproved()) ? "" : ",,fromDateApproved=" + criteria.getFromDateApproved()); |
497 | 0 | savedSearchString.append(criteria.getFromDateCreated() == null || "".equals(criteria.getFromDateCreated()) ? "" : ",,fromDateCreated=" + criteria.getFromDateCreated()); |
498 | 0 | savedSearchString.append(criteria.getFromDateFinalized() == null || "".equals(criteria.getFromDateFinalized()) ? "" : ",,fromDateFinalized=" + criteria.getFromDateFinalized()); |
499 | 0 | savedSearchString.append(criteria.getFromDateLastModified() == null || "".equals(criteria.getFromDateLastModified()) ? "" : ",,fromDateLastModified=" + criteria.getFromDateLastModified()); |
500 | 0 | savedSearchString.append(criteria.getInitiator() == null || "".equals(criteria.getInitiator()) ? "" : ",,initiator=" + criteria.getInitiator()); |
501 | 0 | savedSearchString.append(criteria.getOverrideInd() == null || "".equals(criteria.getOverrideInd()) ? "" : ",,overrideInd=" + criteria.getOverrideInd()); |
502 | 0 | savedSearchString.append(criteria.getRouteHeaderId() == null || "".equals(criteria.getRouteHeaderId()) ? "" : ",,routeHeaderId=" + criteria.getRouteHeaderId()); |
503 | 0 | savedSearchString.append(criteria.getToDateApproved() == null || "".equals(criteria.getToDateApproved()) ? "" : ",,toDateApproved=" + criteria.getToDateApproved()); |
504 | 0 | savedSearchString.append(criteria.getToDateCreated() == null || "".equals(criteria.getToDateCreated()) ? "" : ",,toDateCreated=" + criteria.getToDateCreated()); |
505 | 0 | savedSearchString.append(criteria.getToDateFinalized() == null || "".equals(criteria.getToDateFinalized()) ? "" : ",,toDateFinalized=" + criteria.getToDateFinalized()); |
506 | 0 | savedSearchString.append(criteria.getToDateLastModified() == null || "".equals(criteria.getToDateLastModified()) ? "" : ",,toDateLastModified=" + criteria.getToDateLastModified()); |
507 | 0 | savedSearchString.append(criteria.getViewer() == null || "".equals(criteria.getViewer()) ? "" : ",,viewer=" + criteria.getViewer()); |
508 | 0 | savedSearchString.append(criteria.getWorkgroupViewerName() == null || "".equals(criteria.getWorkgroupViewerName()) ? "" : ",,workgroupViewerName=" + criteria.getWorkgroupViewerName()); |
509 | 0 | savedSearchString.append(criteria.getWorkgroupViewerName() == null || "".equals(criteria.getWorkgroupViewerId()) ? "" : ",,workgroupViewerId=" + criteria.getWorkgroupViewerId()); |
510 | 0 | savedSearchString.append(criteria.getNamedSearch() == null || "".equals(criteria.getNamedSearch()) ? "" : ",,namedSearch=" + criteria.getNamedSearch()); |
511 | 0 | savedSearchString.append(criteria.getSearchableAttributes().isEmpty() ? "" : ",,searchableAttributes=" + buildSearchableAttributeString(criteria.getSearchableAttributes())); |
512 | |
|
513 | 0 | if (savedSearchString.toString() != null && !"".equals(savedSearchString.toString().trim())) { |
514 | |
|
515 | 0 | savedSearchString.append(criteria.getIsAdvancedSearch() == null || "".equals(criteria.getIsAdvancedSearch()) ? "" : ",,isAdvancedSearch=" + criteria.getIsAdvancedSearch()); |
516 | 0 | savedSearchString.append(criteria.getSuperUserSearch() == null || "".equals(criteria.getSuperUserSearch()) ? "" : ",,superUserSearch=" + criteria.getSuperUserSearch()); |
517 | |
|
518 | 0 | if (criteria.getNamedSearch() != null && !"".equals(criteria.getNamedSearch().trim())) { |
519 | 0 | userOptionsService.save(principalId, NAMED_SEARCH_ORDER_BASE + criteria.getNamedSearch(), savedSearchString.toString()); |
520 | |
} else { |
521 | |
|
522 | 0 | UserOptions searchOrder = userOptionsService.findByOptionId(LAST_SEARCH_ORDER_OPTION, principalId); |
523 | 0 | if (searchOrder == null) { |
524 | 0 | userOptionsService.save(principalId, LAST_SEARCH_BASE_NAME + "0", savedSearchString.toString()); |
525 | 0 | userOptionsService.save(principalId, LAST_SEARCH_ORDER_OPTION, LAST_SEARCH_BASE_NAME + "0"); |
526 | |
} else { |
527 | 0 | String[] currentOrder = searchOrder.getOptionVal().split(","); |
528 | 0 | if (currentOrder.length == MAX_SEARCH_ITEMS) { |
529 | 0 | String searchName = currentOrder[currentOrder.length - 1]; |
530 | 0 | String[] newOrder = new String[MAX_SEARCH_ITEMS]; |
531 | 0 | newOrder[0] = searchName; |
532 | 0 | for (int i = 0; i < currentOrder.length - 1; i++) { |
533 | 0 | newOrder[i + 1] = currentOrder[i]; |
534 | |
} |
535 | 0 | String newSearchOrder = ""; |
536 | 0 | for (String aNewOrder : newOrder) |
537 | |
{ |
538 | 0 | if (!"".equals(newSearchOrder)) |
539 | |
{ |
540 | 0 | newSearchOrder += ","; |
541 | |
} |
542 | 0 | newSearchOrder += aNewOrder; |
543 | |
} |
544 | 0 | userOptionsService.save(principalId, searchName, savedSearchString.toString()); |
545 | 0 | userOptionsService.save(principalId, LAST_SEARCH_ORDER_OPTION, newSearchOrder); |
546 | 0 | } else { |
547 | |
|
548 | |
|
549 | 0 | int absMax = 0; |
550 | 0 | for (String aCurrentOrder : currentOrder) |
551 | |
{ |
552 | 0 | int current = new Integer(aCurrentOrder.substring(LAST_SEARCH_BASE_NAME.length(), aCurrentOrder.length())); |
553 | 0 | if (current > absMax) |
554 | |
{ |
555 | 0 | absMax = current; |
556 | |
} |
557 | |
} |
558 | |
|
559 | 0 | String searchName = LAST_SEARCH_BASE_NAME + ++absMax; |
560 | 0 | String[] newOrder = new String[currentOrder.length + 1]; |
561 | 0 | newOrder[0] = searchName; |
562 | 0 | for (int i = 0; i < currentOrder.length; i++) { |
563 | 0 | newOrder[i + 1] = currentOrder[i]; |
564 | |
} |
565 | 0 | String newSearchOrder = ""; |
566 | 0 | for (String aNewOrder : newOrder) |
567 | |
{ |
568 | 0 | if (!"".equals(newSearchOrder)) |
569 | |
{ |
570 | 0 | newSearchOrder += ","; |
571 | |
} |
572 | 0 | newSearchOrder += aNewOrder; |
573 | |
} |
574 | 0 | userOptionsService.save(principalId, searchName, savedSearchString.toString()); |
575 | 0 | userOptionsService.save(principalId, LAST_SEARCH_ORDER_OPTION, newSearchOrder); |
576 | |
} |
577 | |
} |
578 | |
} |
579 | |
} |
580 | 0 | } |
581 | |
|
582 | |
|
583 | |
|
584 | |
|
585 | |
|
586 | |
|
587 | |
|
588 | |
|
589 | |
private String buildSearchableAttributeString(List<SearchAttributeCriteriaComponent> searchableAttributes) { |
590 | 0 | final StringBuilder searchableAttributeBuffer = new StringBuilder(); |
591 | |
|
592 | 0 | for (SearchAttributeCriteriaComponent component : searchableAttributes) { |
593 | |
|
594 | 0 | if ( (component.getFormKey() == null) || |
595 | |
(component.getValue() == null && (Utilities.isEmpty(component.getValues()))) ) { |
596 | 0 | continue; |
597 | |
} |
598 | |
|
599 | 0 | if (component.getValue() != null) { |
600 | 0 | if (searchableAttributeBuffer.length() > 0) { |
601 | 0 | searchableAttributeBuffer.append(","); |
602 | |
} |
603 | 0 | searchableAttributeBuffer.append(component.getFormKey()); |
604 | 0 | searchableAttributeBuffer.append(":"); |
605 | 0 | searchableAttributeBuffer.append(component.getValue()); |
606 | 0 | } else if (!Utilities.isEmpty(component.getValues())) { |
607 | 0 | for (String value : component.getValues()) { |
608 | 0 | if (searchableAttributeBuffer.length() > 0) { |
609 | 0 | searchableAttributeBuffer.append(","); |
610 | |
} |
611 | 0 | searchableAttributeBuffer.append(component.getFormKey()); |
612 | 0 | searchableAttributeBuffer.append(":"); |
613 | 0 | searchableAttributeBuffer.append(value); |
614 | |
} |
615 | |
} else { |
616 | 0 | throw new RuntimeException("Error occurred building searchable attribute string trying to find search attribute component value or values"); |
617 | |
} |
618 | |
} |
619 | |
|
620 | 0 | return searchableAttributeBuffer.toString(); |
621 | |
} |
622 | |
|
623 | |
|
624 | |
|
625 | |
|
626 | |
|
627 | |
|
628 | |
|
629 | |
|
630 | |
|
631 | |
|
632 | |
|
633 | |
|
634 | |
|
635 | |
|
636 | |
|
637 | |
|
638 | |
|
639 | |
|
640 | |
|
641 | |
|
642 | |
|
643 | |
|
644 | |
|
645 | |
|
646 | |
|
647 | |
|
648 | |
|
649 | |
|
650 | |
|
651 | |
|
652 | |
|
653 | |
|
654 | |
|
655 | |
|
656 | |
|
657 | |
|
658 | |
|
659 | |
|
660 | |
|
661 | |
|
662 | |
|
663 | |
|
664 | |
|
665 | |
|
666 | |
|
667 | |
|
668 | |
|
669 | |
|
670 | |
|
671 | |
|
672 | |
|
673 | |
|
674 | |
|
675 | |
|
676 | |
|
677 | |
|
678 | |
|
679 | |
|
680 | |
|
681 | |
|
682 | |
|
683 | |
|
684 | |
|
685 | |
|
686 | |
|
687 | |
|
688 | |
|
689 | |
|
690 | |
|
691 | |
|
692 | |
|
693 | |
|
694 | |
|
695 | |
|
696 | |
|
697 | |
|
698 | |
|
699 | |
|
700 | |
|
701 | |
|
702 | |
|
703 | |
|
704 | |
|
705 | |
|
706 | |
|
707 | |
|
708 | |
|
709 | |
|
710 | |
|
711 | |
|
712 | |
|
713 | |
|
714 | |
|
715 | |
|
716 | |
|
717 | |
|
718 | |
|
719 | |
|
720 | |
|
721 | |
|
722 | |
|
723 | |
|
724 | |
|
725 | |
|
726 | |
|
727 | |
|
728 | |
|
729 | |
|
730 | |
|
731 | |
|
732 | |
|
733 | |
|
734 | |
private static DocumentType getValidDocumentType(String docTypeName) { |
735 | |
|
736 | 0 | if (Utilities.isEmpty(docTypeName)) { |
737 | 0 | return null; |
738 | |
} |
739 | 0 | DocumentType dTypeCriteria = new DocumentType(); |
740 | 0 | dTypeCriteria.setName(docTypeName.trim()); |
741 | 0 | dTypeCriteria.setActive(true); |
742 | 0 | Collection<DocumentType> docTypeList = KEWServiceLocator.getDocumentTypeService().find(dTypeCriteria, null, false); |
743 | |
|
744 | |
|
745 | 0 | DocumentType firstDocumentType = null; |
746 | 0 | if(docTypeList != null && !docTypeList.isEmpty()){ |
747 | 0 | for(DocumentType dType: docTypeList){ |
748 | 0 | if (firstDocumentType == null) { |
749 | 0 | firstDocumentType = dType; |
750 | |
} |
751 | 0 | if (StringUtils.equals(docTypeName.toUpperCase(), dType.getName().toUpperCase())) { |
752 | 0 | return dType; |
753 | |
} |
754 | |
} |
755 | 0 | return firstDocumentType; |
756 | |
}else{ |
757 | 0 | throw new RuntimeException("No Valid Document Type Found for document type name '" + docTypeName + "'"); |
758 | |
} |
759 | |
} |
760 | |
|
761 | |
private DocumentType getValidDocumentTypeOld(String documentTypeFullName) { |
762 | 0 | if (Utilities.isEmpty(documentTypeFullName)) { |
763 | 0 | return null; |
764 | |
} |
765 | 0 | DocumentType docType = KEWServiceLocator.getDocumentTypeService().findByName(documentTypeFullName); |
766 | 0 | if (docType == null) { |
767 | 0 | throw new RuntimeException("No Valid Document Type Found for document type name '" + documentTypeFullName + "'"); |
768 | |
} else { |
769 | 0 | return docType; |
770 | |
} |
771 | |
} |
772 | |
|
773 | |
private DocSearchCriteriaDTO getCriteriaFromSavedSearch(UserOptions savedSearch) { |
774 | 0 | DocSearchCriteriaDTO criteria = new DocSearchCriteriaDTO(); |
775 | 0 | if (savedSearch != null) { |
776 | 0 | String docTypeFullName = getOptionCriteriaField(savedSearch, "docTypeFullName"); |
777 | 0 | if (!Utilities.isEmpty(docTypeFullName)) { |
778 | 0 | criteria = new DocSearchCriteriaDTO(); |
779 | |
} |
780 | 0 | criteria.setDocTypeFullName(getOptionCriteriaField(savedSearch, "docTypeFullName")); |
781 | 0 | criteria.setAppDocId(getOptionCriteriaField(savedSearch, "appDocId")); |
782 | 0 | criteria.setApprover(getOptionCriteriaField(savedSearch, "approver")); |
783 | 0 | criteria.setDocRouteNodeId(getOptionCriteriaField(savedSearch, "docRouteNodeId")); |
784 | 0 | if (criteria.getDocRouteNodeId() != null) { |
785 | 0 | criteria.setDocRouteNodeLogic(getOptionCriteriaField(savedSearch, "docRouteNodeLogic")); |
786 | |
} |
787 | 0 | criteria.setIsAdvancedSearch(getOptionCriteriaField(savedSearch, "isAdvancedSearch")); |
788 | 0 | criteria.setSuperUserSearch(getOptionCriteriaField(savedSearch, "superUserSearch")); |
789 | 0 | criteria.setDocRouteStatus(getOptionCriteriaField(savedSearch, "docRouteStatus")); |
790 | 0 | criteria.setDocTitle(getOptionCriteriaField(savedSearch, "docTitle")); |
791 | 0 | criteria.setDocVersion(getOptionCriteriaField(savedSearch, "docVersion")); |
792 | 0 | criteria.setFromDateApproved(getOptionCriteriaField(savedSearch, "fromDateApproved")); |
793 | 0 | criteria.setFromDateCreated(getOptionCriteriaField(savedSearch, "fromDateCreated")); |
794 | 0 | criteria.setFromDateFinalized(getOptionCriteriaField(savedSearch, "fromDateFinalized")); |
795 | 0 | criteria.setFromDateLastModified(getOptionCriteriaField(savedSearch, "fromDateLastModified")); |
796 | 0 | criteria.setInitiator(getOptionCriteriaField(savedSearch, "initiator")); |
797 | 0 | criteria.setOverrideInd(getOptionCriteriaField(savedSearch, "overrideInd")); |
798 | 0 | criteria.setRouteHeaderId(getOptionCriteriaField(savedSearch, "routeHeaderId")); |
799 | 0 | criteria.setToDateApproved(getOptionCriteriaField(savedSearch, "toDateApproved")); |
800 | 0 | criteria.setToDateCreated(getOptionCriteriaField(savedSearch, "toDateCreated")); |
801 | 0 | criteria.setToDateFinalized(getOptionCriteriaField(savedSearch, "toDateFinalized")); |
802 | 0 | criteria.setToDateLastModified(getOptionCriteriaField(savedSearch, "toDateLastModified")); |
803 | 0 | criteria.setViewer(getOptionCriteriaField(savedSearch, "viewer")); |
804 | 0 | criteria.setWorkgroupViewerNamespace(getOptionCriteriaField(savedSearch, "workgroupViewerNamespace")); |
805 | 0 | criteria.setWorkgroupViewerName(getOptionCriteriaField(savedSearch, "workgroupViewerName")); |
806 | 0 | criteria.setNamedSearch(getOptionCriteriaField(savedSearch, "namedSearch")); |
807 | 0 | criteria.setSearchableAttributes(DocSearchUtils.buildSearchableAttributesFromString(getOptionCriteriaField(savedSearch, "searchableAttributes"),criteria.getDocTypeFullName())); |
808 | |
} |
809 | 0 | return criteria; |
810 | |
} |
811 | |
|
812 | |
private String getOptionCriteriaField(UserOptions userOption, String fieldName) { |
813 | 0 | String value = userOption.getOptionVal(); |
814 | 0 | if (value != null) { |
815 | 0 | String[] fields = value.split(",,"); |
816 | 0 | for (String field : fields) |
817 | |
{ |
818 | 0 | if (field.startsWith(fieldName + "=")) |
819 | |
{ |
820 | 0 | return field.substring(field.indexOf(fieldName) + fieldName.length() + 1, field.length()); |
821 | |
} |
822 | |
} |
823 | |
} |
824 | 0 | return null; |
825 | |
} |
826 | |
|
827 | |
public static DictionaryValidationService getDictionaryValidationService() { |
828 | 0 | if (dictionaryValidationService == null) { |
829 | 0 | dictionaryValidationService = KNSServiceLocator.getDictionaryValidationService(); |
830 | |
} |
831 | 0 | return dictionaryValidationService; |
832 | |
} |
833 | |
|
834 | |
public static DataDictionaryService getDataDictionaryService() { |
835 | 0 | if (dataDictionaryService == null) { |
836 | 0 | dataDictionaryService = KNSServiceLocator.getDataDictionaryService(); |
837 | |
} |
838 | 0 | return dataDictionaryService; |
839 | |
} |
840 | |
|
841 | |
public static KualiConfigurationService getKualiConfigurationService() { |
842 | 0 | if (kualiConfigurationService == null) { |
843 | 0 | kualiConfigurationService = KNSServiceLocator.getKualiConfigurationService(); |
844 | |
} |
845 | 0 | return kualiConfigurationService; |
846 | |
} |
847 | |
|
848 | |
private List<String> tokenizeCriteria(String input){ |
849 | 0 | List<String> lRet = null; |
850 | |
|
851 | 0 | lRet = Arrays.asList(input.split("\\|")); |
852 | |
|
853 | 0 | return lRet; |
854 | |
} |
855 | |
|
856 | |
|
857 | |
|
858 | |
|
859 | |
public SqlBuilder getSqlBuilder() { |
860 | 0 | if(sqlBuilder == null){ |
861 | 0 | sqlBuilder = new SqlBuilder(); |
862 | 0 | sqlBuilder.setDbPlatform((DatabasePlatform) GlobalResourceLoader.getService(RiceConstants.DB_PLATFORM)); |
863 | 0 | sqlBuilder.setDateTimeService(KNSServiceLocator.getDateTimeService()); |
864 | |
} |
865 | 0 | return this.sqlBuilder; |
866 | |
} |
867 | |
|
868 | |
|
869 | |
|
870 | |
|
871 | |
public void setSqlBuilder(SqlBuilder sqlBuilder) { |
872 | 0 | this.sqlBuilder = sqlBuilder; |
873 | 0 | } |
874 | |
} |