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: /*
17: * Created on Oct 1, 2004
18: *
19: */
20: package org.kuali.module.pdp.dao.ojb;
21:
22: import java.util.List;
23:
24: import org.apache.ojb.broker.query.Criteria;
25: import org.apache.ojb.broker.query.QueryByCriteria;
26: import org.kuali.core.dao.ojb.PlatformAwareDaoBaseOjb;
27: import org.kuali.module.pdp.bo.PaymentProcess;
28: import org.kuali.module.pdp.bo.ProcessSummary;
29: import org.kuali.module.pdp.dao.ProcessSummaryDao;
30:
31: /**
32: * @author jsissom
33: */
34: public class ProcessSummaryDaoOjb extends PlatformAwareDaoBaseOjb
35: implements ProcessSummaryDao {
36: private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
37: .getLogger(ProcessSummaryDaoOjb.class);
38:
39: public ProcessSummaryDaoOjb() {
40: }
41:
42: public List getByPaymentProcess(PaymentProcess fp) {
43: LOG.debug("getByPaymentProcess() started");
44:
45: Criteria criteria = new Criteria();
46: criteria.addEqualTo("processId", fp.getId());
47:
48: QueryByCriteria qbc = new QueryByCriteria(ProcessSummary.class,
49: criteria);
50: qbc.addOrderByDescending("disbursementTypeCode");
51: qbc.addOrderByAscending("sortGroupId");
52: qbc.addOrderByAscending("customerId");
53:
54: return (List) getPersistenceBrokerTemplate()
55: .getCollectionByQuery(qbc);
56: }
57:
58: public List getByProcessId(Integer id) {
59: LOG.debug("getByPaymentProcess() started");
60:
61: Criteria criteria = new Criteria();
62: criteria.addEqualTo("processId", id);
63:
64: QueryByCriteria qbc = new QueryByCriteria(ProcessSummary.class,
65: criteria);
66: qbc.addOrderByDescending("disbursementTypeCode");
67: qbc.addOrderByAscending("sortGroupId");
68: qbc.addOrderByAscending("customerId");
69:
70: return (List) getPersistenceBrokerTemplate()
71: .getCollectionByQuery(qbc);
72: }
73:
74: public void save(ProcessSummary ps) {
75: LOG.debug("save() started");
76:
77: getPersistenceBrokerTemplate().store(ps);
78: }
79: }
|