1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.mobility.emergencyinfo.service;
17
18 import java.util.ArrayList;
19 import java.util.List;
20 import javax.jws.WebService;
21 import javax.ws.rs.GET;
22 import javax.ws.rs.Path;
23 import javax.ws.rs.QueryParam;
24
25 import org.kuali.mobility.emergencyinfo.dao.EmergencyInfoDao;
26 import org.springframework.beans.factory.annotation.Autowired;
27 import org.springframework.stereotype.Service;
28 import org.springframework.transaction.annotation.Transactional;
29
30 import javax.ws.rs.PathParam;
31 import org.apache.commons.collections.CollectionUtils;
32 import org.apache.log4j.Logger;
33 import org.kuali.mobility.emergencyinfo.entity.EmergencyInfo;
34 import org.kuali.mobility.emergencyinfo.entity.EmergencyInfoImpl;
35 import org.kuali.mobility.emergencyinfo.util.EmergencyInfoTransform;
36 import org.springframework.beans.factory.annotation.Qualifier;
37
38 @Service(value="EmergencyInfoService")
39 @WebService(endpointInterface="org.kuali.mobility.emergencyinfo.service.EmergencyInfoService")
40 public class EmergencyInfoServiceImpl implements EmergencyInfoService {
41 private static final Logger LOG = Logger.getLogger( EmergencyInfoServiceImpl.class );
42 private String emergencyinfoSourceUrl;
43
44 public String getEmergencyinfoSourceUrl() {
45 return emergencyinfoSourceUrl;
46 }
47
48 public void setEmergencyinfoSourceUrl(String emergencyinfoSourceUrl) {
49 this.emergencyinfoSourceUrl = emergencyinfoSourceUrl;
50 }
51
52 @Autowired
53 @Qualifier("emergencyInfoDao")
54 private EmergencyInfoDao emergencyInfoDao;
55
56
57
58
59
60 public void deleteEmergencyInfoById(@QueryParam(value = "id") Long id) {
61 emergencyInfoDao.deleteEmergencyInfoById(id);
62 }
63
64 @GET
65 @Path("information/lookup")
66 @Transactional
67 @Override
68 public List<EmergencyInfoImpl> findAllEmergencyInfo() {
69 List<EmergencyInfoImpl> contacts = new ArrayList<EmergencyInfoImpl>();
70 CollectionUtils.collect( getEmergencyInfoDao().findAllEmergencyInfo(), new EmergencyInfoTransform(), contacts );
71 return contacts;
72 }
73
74 @GET
75 @Path("information/search")
76 @Transactional
77 @Override
78 public EmergencyInfoImpl findEmergencyInfoById(@QueryParam(value = "id") Long id) {
79 EmergencyInfoTransform transform = new EmergencyInfoTransform();
80 return transform.transform( getEmergencyInfoDao().findEmergencyInfoById(id) );
81 }
82
83
84
85
86
87 public Long saveEmergencyInfo(EmergencyInfo emergencyInfo) {
88 return emergencyInfoDao.saveEmergencyInfo(emergencyInfo);
89 }
90
91
92
93
94
95 public void reorder(@QueryParam(value = "id") Long id, @QueryParam(value = "up") boolean up) {
96 emergencyInfoDao.reorder(id, up);
97 }
98
99 @GET
100 @Path("information/bycampus/{campus}")
101 @Transactional
102 @Override
103 public List<EmergencyInfoImpl> findAllEmergencyInfoByCampus(@PathParam(value = "campus") String campus) {
104 List<EmergencyInfoImpl> contacts = new ArrayList<EmergencyInfoImpl>();
105 CollectionUtils.collect( getEmergencyInfoDao().findAllEmergencyInfoByCampus(campus), new EmergencyInfoTransform(), contacts );
106 LOG.debug( "Filtering emergency contacts for campus ["+campus+"] and found "+contacts.size() );
107 return contacts;
108 }
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128 public EmergencyInfoDao getEmergencyInfoDao() {
129 return emergencyInfoDao;
130 }
131
132
133
134
135 public void setEmergencyInfoDao(EmergencyInfoDao emergencyInfoDao) {
136 this.emergencyInfoDao = emergencyInfoDao;
137 }
138
139 }