1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.kuali.ole.pdp.dataaccess.impl;
21
22 import java.util.Iterator;
23
24 import org.apache.ojb.broker.query.Criteria;
25 import org.apache.ojb.broker.query.QueryByCriteria;
26 import org.apache.ojb.broker.query.QueryFactory;
27 import org.kuali.ole.pdp.PdpPropertyConstants;
28 import org.kuali.ole.pdp.businessobject.GlPendingTransaction;
29 import org.kuali.ole.pdp.dataaccess.PendingTransactionDao;
30 import org.kuali.rice.core.framework.persistence.ojb.dao.PlatformAwareDaoBaseOjb;
31
32
33
34
35
36 public class PendingTransactionDaoOjb extends PlatformAwareDaoBaseOjb implements PendingTransactionDao {
37 private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(PendingTransactionDaoOjb.class);
38
39 public PendingTransactionDaoOjb() {
40 super();
41 }
42
43
44
45
46 public Iterator<GlPendingTransaction> getUnextractedTransactions() {
47 LOG.debug("save() started");
48
49 Criteria criteria = new Criteria();
50 criteria.addEqualTo(PdpPropertyConstants.PROCESS_IND, false);
51
52 Criteria criteria2 = new Criteria();
53 criteria2.addIsNull(PdpPropertyConstants.PROCESS_IND);
54
55 criteria.addOrCriteria(criteria2);
56 return getPersistenceBrokerTemplate().getIteratorByQuery(new QueryByCriteria(GlPendingTransaction.class, criteria));
57 }
58
59
60
61
62 public void clearExtractedTransactions() {
63 LOG.debug("clearExtractedTransactions() started");
64
65 Criteria criteria = new Criteria();
66 criteria.addEqualTo(PdpPropertyConstants.PROCESS_IND, true);
67
68 QueryByCriteria qbc = QueryFactory.newQuery(GlPendingTransaction.class, criteria);
69 getPersistenceBrokerTemplate().deleteByQuery(qbc);
70 getPersistenceBrokerTemplate().clearCache();
71 }
72
73 }