1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.seasar.teeda.extension.annotation.handler; |
17 | |
|
18 | |
import java.lang.reflect.Field; |
19 | |
import java.util.Map; |
20 | |
|
21 | |
import javax.faces.application.FacesMessage; |
22 | |
|
23 | |
import org.seasar.framework.beans.BeanDesc; |
24 | |
import org.seasar.framework.util.StringUtil; |
25 | |
import org.seasar.framework.util.tiger.AnnotationUtil; |
26 | |
import org.seasar.teeda.extension.annotation.message.MessageAggregation; |
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | 3 | public class TigerFacesMessageAnnotationHandler extends |
33 | |
ConstantFacesMessageAnnotationHandler { |
34 | |
|
35 | |
protected void processField(String componentName, BeanDesc beanDesc, |
36 | |
Field field) { |
37 | 3 | MessageAggregation annotation = field |
38 | |
.getAnnotation(MessageAggregation.class); |
39 | 3 | if (annotation != null) { |
40 | 2 | Map props = AnnotationUtil.getProperties(annotation); |
41 | 2 | String id = (String) props.remove("id"); |
42 | 2 | FacesMessage facesMessage = null; |
43 | 2 | facesMessage = createFacesMessage(id); |
44 | 2 | String summary = (String) props.remove("summary"); |
45 | 2 | if (!StringUtil.isEmpty(summary)) { |
46 | 1 | facesMessage.setSummary(summary); |
47 | |
} |
48 | 2 | String detail = (String) props.remove("detail"); |
49 | 2 | if (!StringUtil.isEmpty(detail)) { |
50 | 1 | facesMessage.setDetail(detail); |
51 | |
} |
52 | 2 | registerFacesMessage(componentName, field.getName(), facesMessage); |
53 | |
} |
54 | 3 | super.processField(componentName, beanDesc, field); |
55 | 3 | } |
56 | |
|
57 | |
} |