01: /*
02: * Copyright 2007 The Kuali Foundation.
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.kuali.module.financial.dao.ojb;
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.core.dao.ojb.PlatformAwareDaoBaseOjb;
23: import org.kuali.module.financial.bo.Payee;
24: import org.kuali.module.financial.dao.DisbursementVoucherDao;
25: import org.kuali.module.financial.document.DisbursementVoucherDocument;
26: import org.kuali.module.financial.rules.DisbursementVoucherRuleConstants;
27:
28: public class DisbursementVoucherDaoOjb extends PlatformAwareDaoBaseOjb
29: implements DisbursementVoucherDao {
30: private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
31: .getLogger(DisbursementVoucherDaoOjb.class);
32:
33: public void save(DisbursementVoucherDocument document) {
34: LOG.debug("save() started");
35:
36: getPersistenceBrokerTemplate().store(document);
37: }
38:
39: /**
40: * @see org.kuali.module.financial.dao.DisbursementVoucherDao#getDocument(java.lang.String)
41: */
42: public DisbursementVoucherDocument getDocument(String fdocNbr) {
43: LOG.debug("getDocument() started");
44:
45: Criteria criteria = new Criteria();
46: criteria.addEqualTo("documentNumber", fdocNbr);
47:
48: return (DisbursementVoucherDocument) getPersistenceBrokerTemplate()
49: .getObjectByQuery(
50: new QueryByCriteria(
51: DisbursementVoucherDocument.class,
52: criteria));
53: }
54:
55: /**
56: * @see org.kuali.module.financial.dao.DisbursementVoucherDao#getDocumentsByHeaderStatus(java.lang.String)
57: */
58: public Collection getDocumentsByHeaderStatus(String statusCode) {
59: LOG.debug("getDocumentsByHeaderStatus() started");
60:
61: Criteria criteria = new Criteria();
62: criteria.addEqualTo(
63: "documentHeader.financialDocumentStatusCode",
64: statusCode);
65: criteria.addEqualTo("disbVchrPaymentMethodCode",
66: DisbursementVoucherRuleConstants.PAYMENT_METHOD_CHECK);
67:
68: return getPersistenceBrokerTemplate().getCollectionByQuery(
69: new QueryByCriteria(DisbursementVoucherDocument.class,
70: criteria));
71: }
72:
73: /**
74: * @see org.kuali.module.financial.dao.DisbursementVoucherDao#getPayee(java.lang.String)
75: */
76: public Payee getPayee(String payeeId) {
77: LOG.debug("getPayee() started");
78:
79: Criteria criteria = new Criteria();
80: criteria.addEqualTo("payeeIdNumber", payeeId);
81:
82: return (Payee) getPersistenceBrokerTemplate().getObjectByQuery(
83: new QueryByCriteria(Payee.class, criteria));
84: }
85: }
|