1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kcb.service.impl;
17
18 import java.util.Collection;
19 import java.util.HashMap;
20 import java.util.Map;
21
22 import org.kuali.rice.kcb.bo.Message;
23 import org.kuali.rice.kcb.service.MessageService;
24
25
26
27
28
29
30
31 public class MessageServiceImpl extends BusinessObjectServiceImpl implements MessageService {
32
33
34
35 public void deleteMessage(Message message) {
36 dao.delete(message);
37 }
38
39
40
41
42 public Message getMessage(Long id) {
43 Map<String, Object> fields = new HashMap<String, Object>(1);
44 fields.put(Message.ID_FIELD, id);
45 Message m = (Message) dao.findByPrimaryKey(Message.class, fields);
46 return m;
47 }
48
49
50
51
52 public Collection<Message> getAllMessages() {
53 return dao.findAll(Message.class);
54 }
55
56
57
58
59 public void saveMessage(Message message) {
60 dao.save(message);
61 }
62
63
64
65
66 public Message getMessageByOriginId(String originId) {
67 Map<String, Object> fields = new HashMap<String, Object>(1);
68 fields.put(Message.ORIGINID_FIELD, originId);
69 Collection<Message> messages = dao.findMatching(Message.class, fields);
70 if (messages.size() == 0) {
71 return null;
72 }
73 return messages.iterator().next();
74 }
75 }