1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.sys.document.service.impl;
17
18 import java.util.ArrayList;
19 import java.util.Collection;
20 import java.util.Iterator;
21
22 import org.kuali.ole.sys.businessobject.FinancialSystemDocumentHeader;
23 import org.kuali.ole.sys.document.FinancialSystemTransactionalDocument;
24 import org.kuali.ole.sys.document.dataaccess.FinancialSystemDocumentDao;
25 import org.kuali.ole.sys.document.service.FinancialSystemDocumentService;
26 import org.kuali.rice.kew.api.exception.WorkflowException;
27 import org.kuali.rice.krad.document.Document;
28 import org.kuali.rice.krad.service.DocumentAdHocService;
29 import org.kuali.rice.krad.service.DocumentService;
30 import org.springframework.transaction.annotation.Transactional;
31
32
33
34
35
36 @Transactional
37 public class FinancialSystemDocumentServiceImpl implements FinancialSystemDocumentService {
38 private FinancialSystemDocumentDao financialSystemDocumentDao;
39 private DocumentService documentService;
40 protected DocumentAdHocService documentAdHocService;
41
42
43
44
45
46 @Override
47 public <T extends Document> Collection<T> findByDocumentHeaderStatusCode(Class<T> clazz, String statusCode) throws WorkflowException {
48 Collection<T> foundDocuments = getFinancialSystemDocumentDao().findByDocumentHeaderStatusCode(clazz, statusCode);
49 for (Document doc : foundDocuments)
50 documentAdHocService.addAdHocs(doc);
51
52 Collection<T> returnDocuments = new ArrayList<T>();
53 for (Iterator<T> iter = foundDocuments.iterator(); iter.hasNext();) {
54 Document doc = (Document) iter.next();
55 returnDocuments.add((T) getDocumentService().getByDocumentHeaderId(doc.getDocumentNumber()));
56 }
57 return returnDocuments;
58 }
59
60 public void prepareToCopy(FinancialSystemDocumentHeader oldDocumentHeader, FinancialSystemTransactionalDocument document) {
61
62 }
63
64 public FinancialSystemDocumentDao getFinancialSystemDocumentDao() {
65 return financialSystemDocumentDao;
66 }
67
68 public void setFinancialSystemDocumentDao(FinancialSystemDocumentDao financialSystemDocumentDao) {
69 this.financialSystemDocumentDao = financialSystemDocumentDao;
70 }
71
72 public DocumentService getDocumentService() {
73 return documentService;
74 }
75
76 public void setDocumentService(DocumentService documentService) {
77 this.documentService = documentService;
78 }
79
80 public void setDocumentAdHocService(DocumentAdHocService documentAdHocService) {
81 this.documentAdHocService = documentAdHocService;
82 }
83
84
85 }