1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.module.purap.dataaccess.impl;
17
18 import org.apache.ojb.broker.query.Criteria;
19 import org.apache.ojb.broker.query.QueryByCriteria;
20 import org.kuali.ole.module.purap.businessobject.ElectronicInvoiceItemMapping;
21 import org.kuali.ole.module.purap.businessobject.ItemType;
22 import org.kuali.ole.module.purap.dataaccess.ElectronicInvoiceItemMappingDao;
23 import org.springmodules.orm.ojb.support.PersistenceBrokerDaoSupport;
24
25 import java.util.List;
26
27 public class ElectronicInvoiceItemMappingDaoOjb extends PersistenceBrokerDaoSupport implements
28 ElectronicInvoiceItemMappingDao {
29 private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(ElectronicInvoiceItemMappingDaoOjb.class);
30
31
32
33
34 public List getAll() {
35 LOG.debug("getAll() started");
36 QueryByCriteria qbc = new QueryByCriteria(ElectronicInvoiceItemMapping.class);
37 qbc.addOrderBy("id", true);
38 List l = (List) getPersistenceBrokerTemplate().getCollectionByQuery(qbc);
39 return l;
40 }
41
42 public ElectronicInvoiceItemMapping getByUniqueKeys(Integer headerId, Integer detailId, String invoiceTypeCode) {
43 LOG.debug("getByUniqueKeys() started");
44 Criteria criteria = new Criteria();
45 criteria.addEqualTo("vendorHeaderGeneratedId", headerId);
46 criteria.addEqualTo("vendorDetailAssignedId", detailId);
47 criteria.addEqualTo("electronicInvoiceItemTypeCode", invoiceTypeCode);
48 QueryByCriteria qbc = new QueryByCriteria(ElectronicInvoiceItemMapping.class, criteria);
49 return (ElectronicInvoiceItemMapping) getPersistenceBrokerTemplate().getObjectByQuery(qbc);
50 }
51
52 public List getAllItemTypes() {
53 LOG.debug("getAllItemTypes() started");
54
55 Criteria criteria = new Criteria();
56 criteria.addEqualTo("active", Boolean.TRUE);
57
58 QueryByCriteria qbc = new QueryByCriteria(ItemType.class, criteria);
59 qbc.addOrderByAscending("code");
60
61 return (List) getPersistenceBrokerTemplate().getCollectionByQuery(qbc);
62 }
63
64 public ItemType getItemTypeByCode(String code) {
65 LOG.debug("getItemTypeByCode() started");
66 Criteria criteria = new Criteria();
67 criteria.addEqualTo("code", code);
68 QueryByCriteria qbc = new QueryByCriteria(ItemType.class, criteria);
69 return (ItemType) getPersistenceBrokerTemplate().getObjectByQuery(qbc);
70 }
71
72
73
74
75
76
77 public ElectronicInvoiceItemMapping getById(String id) {
78 LOG.debug("getById() started");
79 Criteria crit = new Criteria();
80 crit.addEqualTo("id", id);
81 ElectronicInvoiceItemMapping row = (ElectronicInvoiceItemMapping) getPersistenceBrokerTemplate().getObjectByQuery(new QueryByCriteria(ElectronicInvoiceItemMapping.class, crit));
82 return row;
83 }
84
85
86
87
88
89
90 public void delete(ElectronicInvoiceItemMapping row) {
91 LOG.debug("delete() started");
92 getPersistenceBrokerTemplate().delete(row);
93 }
94
95 }
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110