1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.module.purap.document.service.impl;
17
18 import org.apache.log4j.Logger;
19 import org.kuali.ole.module.purap.businessobject.ReceivingAddress;
20 import org.kuali.ole.module.purap.document.dataaccess.ReceivingAddressDao;
21 import org.kuali.ole.module.purap.document.service.ReceivingAddressService;
22 import org.springframework.transaction.annotation.Transactional;
23
24 import java.util.Collection;
25 import java.util.Iterator;
26
27 @Transactional
28 public class ReceivingAddressServiceImpl implements ReceivingAddressService {
29 private static Logger LOG = Logger.getLogger(ReceivingAddressServiceImpl.class);
30
31 private ReceivingAddressDao dao;
32
33 public void setReceivingAddressDao(ReceivingAddressDao dao) {
34 this.dao = dao;
35 }
36
37
38
39
40 public Collection<ReceivingAddress> findActiveByChartOrg(String chartCode, String orgCode) {
41 LOG.debug("Entering findActiveByChartOrg(String,String)");
42 LOG.debug("Leaving findActiveByChartOrg(String,String)");
43 return dao.findActiveByChartOrg(chartCode, orgCode);
44 }
45
46
47
48
49 public Collection<ReceivingAddress> findDefaultByChartOrg(String chartCode, String orgCode) {
50 LOG.debug("Entering findDefaultByChartOrg(String,String)");
51 LOG.debug("Leaving findDefaultByChartOrg(String,String)");
52 return dao.findDefaultByChartOrg(chartCode, orgCode);
53 }
54
55
56
57
58 public ReceivingAddress findUniqueDefaultByChartOrg(String chartCode, String orgCode) {
59 LOG.debug("Entering findUniqueDefaultByChartOrg(String,String)");
60 Collection<ReceivingAddress> addresses = findDefaultByChartOrg(chartCode, orgCode);
61 if (addresses != null) {
62 Iterator iter = addresses.iterator();
63 if (iter.hasNext()) {
64 LOG.debug("Leaving findUniqueDefaultByChartOrg(String,String)");
65 return (ReceivingAddress) iter.next();
66 }
67 }
68 LOG.debug("Leaving findUniqueDefaultByChartOrg(String,String)");
69 return null;
70
71 }
72
73
74
75
76 public int countActiveByChartOrg(String chartCode, String orgCode) {
77 LOG.debug("Entering countActiveByChartOrg(String,String)");
78 LOG.debug("Leaving countActiveByChartOrg(String,String)");
79 return dao.countActiveByChartOrg(chartCode, orgCode);
80 }
81
82 }