1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.student.core.messages.service.impl; |
17 | |
|
18 | |
import java.util.ArrayList; |
19 | |
import java.util.List; |
20 | |
|
21 | |
import org.apache.log4j.Logger; |
22 | |
import org.kuali.student.common.messages.dto.Message; |
23 | |
import org.kuali.student.core.messages.entity.MessageEntity; |
24 | |
|
25 | 0 | public class MessageAssembler { |
26 | |
|
27 | 1 | final static Logger logger = Logger.getLogger(MessageAssembler.class); |
28 | |
|
29 | |
public static void toMessageEntity(Message message, |
30 | |
MessageEntity messageEntity) { |
31 | 1 | messageEntity.setGroupName(message.getGroupName()); |
32 | 1 | messageEntity.setMessageId(message.getId()); |
33 | 1 | messageEntity.setLocale(message.getLocale()); |
34 | 1 | messageEntity.setValue(message.getValue()); |
35 | 1 | } |
36 | |
|
37 | |
public static void toMessage(MessageEntity messageEntity, Message message) { |
38 | 15 | message.setGroupName(messageEntity.getGroupName()); |
39 | 15 | message.setId(messageEntity.getMessageId()); |
40 | 15 | message.setLocale(messageEntity.getLocale()); |
41 | 15 | message.setValue(messageEntity.getValue()); |
42 | 15 | } |
43 | |
|
44 | |
public static List<Message> toMessageList(List<MessageEntity> messages, |
45 | |
Class<Message> message) { |
46 | 5 | List<Message> result = new ArrayList<Message>(); |
47 | 5 | Message m1 = new Message(); |
48 | 5 | for (MessageEntity e : messages) { |
49 | 11 | toMessage(e, m1); |
50 | 11 | result.add(m1); |
51 | |
} |
52 | 5 | return result; |
53 | |
|
54 | |
} |
55 | |
} |