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