1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.module.purap.service.impl;
17
18 import org.kuali.ole.module.purap.businessobject.PurchaseOrderSensitiveData;
19 import org.kuali.ole.module.purap.businessobject.SensitiveData;
20 import org.kuali.ole.module.purap.businessobject.SensitiveDataAssignment;
21 import org.kuali.ole.module.purap.businessobject.SensitiveDataAssignmentDetail;
22 import org.kuali.ole.module.purap.dataaccess.SensitiveDataDao;
23 import org.kuali.ole.module.purap.document.dataaccess.PurchaseOrderDao;
24 import org.kuali.ole.module.purap.service.SensitiveDataService;
25 import org.kuali.ole.sys.context.SpringContext;
26 import org.kuali.rice.krad.service.BusinessObjectService;
27
28 import java.util.*;
29
30 public class SensitiveDataServiceImpl implements SensitiveDataService {
31 private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(SensitiveDataServiceImpl.class);
32
33 private SensitiveDataDao sensitiveDataDao;
34 private PurchaseOrderDao purchaseOrderDao;
35
36 public void setPurchaseOrderDao(PurchaseOrderDao purchaseOrderDao) {
37 this.purchaseOrderDao = purchaseOrderDao;
38 }
39
40 public SensitiveDataDao getSensitiveDataDao() {
41 return sensitiveDataDao;
42 }
43
44 public void setSensitiveDataDao(SensitiveDataDao sensitiveDataDao) {
45 this.sensitiveDataDao = sensitiveDataDao;
46 }
47
48
49
50
51 public SensitiveData getSensitiveDataByCode(String sensitiveDataCode) {
52 LOG.debug("getSensitiveDataByCode(String) started");
53 Map<String, Object> primaryKeys = new HashMap<String, Object>();
54 primaryKeys.put("sensitiveDataCode", sensitiveDataCode);
55 return (SensitiveData) SpringContext.getBean(BusinessObjectService.class).findByPrimaryKey(SensitiveData.class, primaryKeys);
56 }
57
58
59
60
61 public List<SensitiveData> getAllSensitiveDatas() {
62 LOG.debug("getSensitiveDataByPoId(Integer) started");
63
64 List<SensitiveData> sds = new ArrayList<SensitiveData>();
65 Collection<SensitiveData> sdColl = SpringContext.getBean(BusinessObjectService.class).findAll(SensitiveData.class);
66 for (Object sd : sdColl) {
67 sds.add((SensitiveData) sd);
68 }
69
70 return sds;
71 }
72
73 public List<SensitiveData> getSensitiveDatasAssignedByRelatedDocId(Integer accountsPayablePurchasingDocumentLinkIdentifier) {
74 Integer poId = purchaseOrderDao.getPurchaseOrderIdForCurrentPurchaseOrderByRelatedDocId(accountsPayablePurchasingDocumentLinkIdentifier);
75 return getSensitiveDatasAssignedByPoId(poId);
76 }
77
78
79
80
81 public List<SensitiveData> getSensitiveDatasAssignedByPoId(Integer poId) {
82 LOG.debug("getSensitiveDatasAssignedByPoId(Integer) started");
83 return sensitiveDataDao.getSensitiveDatasAssignedByPoId(poId);
84 }
85
86
87
88
89 public List<SensitiveData> getSensitiveDatasAssignedByReqId(Integer reqId) {
90 LOG.debug("getSensitiveDatasAssignedByReqId(Integer) started");
91 return sensitiveDataDao.getSensitiveDatasAssignedByReqId(reqId);
92 }
93
94
95
96
97 public void deletePurchaseOrderSensitiveDatas(Integer poId) {
98 LOG.debug("deletePurchaseOrderSensitiveDatas(Integer) started");
99 sensitiveDataDao.deletePurchaseOrderSensitiveDatas(poId);
100 }
101
102
103
104
105 public void savePurchaseOrderSensitiveDatas(List<PurchaseOrderSensitiveData> posds) {
106 LOG.debug("savePurchaseOrderSensitiveDatas(List<PurchaseOrderSensitiveData>) started");
107 SpringContext.getBean(BusinessObjectService.class).save(posds);
108 }
109
110
111
112
113 public SensitiveDataAssignment getLastSensitiveDataAssignment(Integer poId) {
114 LOG.debug("getLastSensitiveDataAssignment(Integer) started");
115 return sensitiveDataDao.getLastSensitiveDataAssignment(poId);
116 }
117
118
119
120
121 public Integer getLastSensitiveDataAssignmentId(Integer poId) {
122 LOG.debug("getLastSensitiveDataAssignmentId(Integer) started");
123 return getLastSensitiveDataAssignment(poId).getSensitiveDataAssignmentIdentifier();
124 }
125
126
127
128
129 public void saveSensitiveDataAssignment(SensitiveDataAssignment sda) {
130 LOG.debug("saveSensitiveDataAssignment(SensitiveDataAssignment) started");
131 SpringContext.getBean(BusinessObjectService.class).save(sda);
132 }
133
134
135
136
137 public List<SensitiveDataAssignmentDetail> getLastSensitiveDataAssignmentDetails(Integer poId) {
138 LOG.debug("getLastSensitiveDataAssignmentDetails(Integer) started");
139 Integer sdaId = getLastSensitiveDataAssignmentId(poId);
140 Map<String, Object> fieldValues = new HashMap<String, Object>();
141 fieldValues.put("sensitiveDataAssignmentIdentifier", sdaId);
142 return (List<SensitiveDataAssignmentDetail>) SpringContext.getBean(BusinessObjectService.class).findMatching(SensitiveDataAssignmentDetail.class, fieldValues);
143 }
144
145
146
147
148 public void saveSensitiveDataAssignmentDetails(List<SensitiveDataAssignmentDetail> sdads) {
149 LOG.debug("saveSensitiveDataAssignmentDetails(List<SensitiveDataAssignmentDetail>) started");
150 SpringContext.getBean(BusinessObjectService.class).save(sdads);
151 }
152
153
154 }