1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kns.util;
17
18 import org.apache.struts.action.ActionMessage;
19 import org.apache.struts.action.ActionMessages;
20 import org.kuali.rice.krad.util.ErrorMessage;
21 import org.kuali.rice.krad.util.MessageMap;
22
23 import java.io.Serializable;
24 import java.util.Iterator;
25 import java.util.List;
26 import java.util.Set;
27
28
29
30
31
32
33
34
35 @Deprecated
36 public abstract class MessageContainer implements Serializable {
37 private MessageMap errorMap;
38
39 protected MessageContainer(MessageMap errorMap) {
40 this.errorMap = errorMap;
41 }
42
43 protected MessageMap getMessageMap() {
44 return errorMap;
45 }
46
47 public ActionMessages getRequestMessages() {
48 ActionMessages requestErrors = new ActionMessages();
49 for (Iterator<String> iter = getMessagePropertyNames().iterator(); iter.hasNext();) {
50 String property = iter.next();
51 List errorList = (List) getMessagesForProperty(property);
52
53 for (Iterator iterator = errorList.iterator(); iterator.hasNext();) {
54 ErrorMessage errorMessage = (ErrorMessage) iterator.next();
55
56
57 requestErrors.add(property, new ActionMessage(errorMessage.getErrorKey(), errorMessage.getMessageParameters()));
58 }
59 }
60 return requestErrors;
61 }
62
63 public abstract int getMessageCount();
64
65 public abstract List<String> getMessagePropertyList();
66
67 protected abstract Set<String> getMessagePropertyNames();
68
69 protected abstract List getMessagesForProperty(String propertyName);
70 }