1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.fp.dataaccess.impl;
17
18 import java.util.Collection;
19
20 import org.apache.ojb.broker.query.Criteria;
21 import org.apache.ojb.broker.query.QueryByCriteria;
22 import org.kuali.ole.fp.dataaccess.DisbursementVoucherDao;
23 import org.kuali.ole.fp.document.DisbursementVoucherConstants;
24 import org.kuali.ole.fp.document.DisbursementVoucherDocument;
25 import org.kuali.rice.core.framework.persistence.ojb.dao.PlatformAwareDaoBaseOjb;
26
27 public class DisbursementVoucherDaoOjb extends PlatformAwareDaoBaseOjb implements DisbursementVoucherDao {
28 private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(DisbursementVoucherDaoOjb.class);
29
30
31
32
33 @Override
34 public DisbursementVoucherDocument getDocument(String fdocNbr) {
35 LOG.debug("getDocument() started");
36
37 Criteria criteria = new Criteria();
38 criteria.addEqualTo("documentNumber", fdocNbr);
39
40 return (DisbursementVoucherDocument) getPersistenceBrokerTemplate().getObjectByQuery(new QueryByCriteria(DisbursementVoucherDocument.class, criteria));
41 }
42
43
44
45
46 @Override
47 public Collection getDocumentsByHeaderStatus(String statusCode, boolean immediatesOnly) {
48 LOG.debug("getDocumentsByHeaderStatus() started");
49
50 Criteria criteria = new Criteria();
51 criteria.addEqualTo("documentHeader.financialDocumentStatusCode", statusCode);
52 criteria.addEqualTo("disbVchrPaymentMethodCode", DisbursementVoucherConstants.PAYMENT_METHOD_CHECK);
53 if (immediatesOnly) {
54 criteria.addEqualTo("immediatePaymentIndicator", Boolean.TRUE);
55 }
56
57 return getPersistenceBrokerTemplate().getCollectionByQuery(new QueryByCriteria(DisbursementVoucherDocument.class, criteria));
58 }
59 }
60