1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.student.core.messages.bo; |
17 | |
|
18 | |
import java.util.HashMap; |
19 | |
import java.util.LinkedHashMap; |
20 | |
import java.util.Map; |
21 | |
|
22 | |
import javax.persistence.Entity; |
23 | |
import javax.persistence.Table; |
24 | |
import javax.persistence.Transient; |
25 | |
|
26 | |
import org.kuali.rice.krad.service.KRADServiceLocator; |
27 | |
import org.kuali.student.core.bo.KsBusinessObjectBase; |
28 | |
import org.kuali.student.core.enumerationmanagement.bo.EnumeratedValue; |
29 | |
|
30 | |
@Entity |
31 | |
@Table(name = "KSMG_MESSAGE") |
32 | 0 | public class MessageEntity extends KsBusinessObjectBase { |
33 | |
|
34 | |
public static final String GROUP_NAME_ENUMERATION = "ks.message.groupNames"; |
35 | |
public static final String LOCALE_ENUMERATION = "ks.message.locales"; |
36 | |
|
37 | |
private static final long serialVersionUID = 1L; |
38 | |
|
39 | |
|
40 | |
private String messageId; |
41 | |
private String locale; |
42 | |
private String groupName; |
43 | |
private String value; |
44 | |
|
45 | |
@Transient |
46 | |
private transient EnumeratedValue localeEnumValue; |
47 | |
|
48 | |
@Transient |
49 | |
private transient EnumeratedValue groupNameEnumValue; |
50 | |
|
51 | |
|
52 | |
|
53 | |
|
54 | |
|
55 | |
|
56 | |
|
57 | |
|
58 | |
|
59 | |
|
60 | |
|
61 | |
|
62 | |
|
63 | |
|
64 | |
|
65 | |
protected EnumeratedValue retrieveEnumeratedValue(String enumerationId, String enumerationCode) { |
66 | 0 | Map<String, Object> criteria = new HashMap<String, Object>(); |
67 | 0 | criteria.put("enumerationId", enumerationId); |
68 | 0 | criteria.put("code", enumerationCode); |
69 | |
|
70 | 0 | return (EnumeratedValue) KRADServiceLocator.getBusinessObjectService().findByPrimaryKey(EnumeratedValue.class, criteria); |
71 | |
} |
72 | |
|
73 | |
|
74 | |
public String getLocale() { |
75 | 0 | return locale; |
76 | |
} |
77 | |
|
78 | |
public void setLocale(String locale) { |
79 | 0 | this.locale = locale; |
80 | 0 | } |
81 | |
|
82 | |
public String getGroupName() { |
83 | 0 | return groupName; |
84 | |
} |
85 | |
|
86 | |
public void setGroupName(String groupName) { |
87 | 0 | this.groupName = groupName; |
88 | 0 | } |
89 | |
|
90 | |
public String getMessageId() { |
91 | 0 | return messageId; |
92 | |
} |
93 | |
|
94 | |
public void setMessageId(String messageId) { |
95 | 0 | this.messageId = messageId; |
96 | 0 | } |
97 | |
|
98 | |
public String getValue() { |
99 | 0 | return value; |
100 | |
} |
101 | |
|
102 | |
public void setValue(String value) { |
103 | 0 | this.value = value; |
104 | 0 | } |
105 | |
|
106 | |
|
107 | |
public EnumeratedValue getLocaleEnumValue() { |
108 | 0 | if(localeEnumValue == null) { |
109 | 0 | localeEnumValue = retrieveEnumeratedValue(LOCALE_ENUMERATION, this.locale); |
110 | |
} |
111 | |
|
112 | 0 | return localeEnumValue; |
113 | |
} |
114 | |
|
115 | |
public void setLocaleEnumValue(EnumeratedValue localeEnumValue) { |
116 | 0 | this.localeEnumValue = localeEnumValue; |
117 | 0 | } |
118 | |
|
119 | |
public EnumeratedValue getGroupNameEnumValue() { |
120 | 0 | if(groupNameEnumValue == null) { |
121 | 0 | groupNameEnumValue = retrieveEnumeratedValue(GROUP_NAME_ENUMERATION, this.groupName); |
122 | |
} |
123 | |
|
124 | 0 | return groupNameEnumValue; |
125 | |
} |
126 | |
|
127 | |
public void setGroupNameEnumValue(EnumeratedValue groupNameEnumValue) { |
128 | 0 | this.groupNameEnumValue = groupNameEnumValue; |
129 | 0 | } |
130 | |
|
131 | |
} |