1
2
3
4 package org.andromda.cartridges.jsf2.metafacades;
5
6 import org.andromda.cartridges.jsf2.JSFProfile;
7 import org.andromda.metafacades.uml.StateVertexFacade;
8 import org.andromda.metafacades.uml.UseCaseFacade;
9 import org.andromda.utils.StringUtilsHelper;
10
11
12
13
14
15
16
17 public class JSFExceptionHandlerLogicImpl
18 extends JSFExceptionHandlerLogic
19 {
20 private static final long serialVersionUID = 34L;
21
22
23
24
25
26
27 public JSFExceptionHandlerLogicImpl(Object metaObject, String context)
28 {
29 super(metaObject, context);
30 }
31
32
33
34
35
36
37
38
39
40 protected String handleGetExceptionKey()
41 {
42 final String type = getExceptionType();
43 final int dotIndex = type.lastIndexOf('.');
44
45
46 return StringUtilsHelper.toResourceMessageKey((dotIndex < type.length() - 1)
47 ? type.substring(dotIndex + 1) : type);
48 }
49
50
51
52
53
54
55
56
57
58 protected String handleGetExceptionPath()
59 {
60 final StateVertexFacade target = getTarget();
61 if (target instanceof JSFForward)
62 {
63 return (target).getFullyQualifiedNamePath() + ".jsf";
64 }
65 else if (target instanceof JSFFinalState)
66 {
67 return ((JSFFinalState)target).getFullyQualifiedNamePath();
68 }
69 else
70 {
71 return "";
72 }
73 }
74
75
76
77
78
79
80
81
82
83 protected String handleGetExceptionType()
84 {
85 final Object value = this.findTaggedValue(JSFProfile.TAGGEDVALUE_EXCEPTION_TYPE);
86 return value == null ? "" : value.toString();
87 }
88
89
90
91
92
93
94 protected String handleGetMessageKey()
95 {
96 final UseCaseFacade useCase = this.getUseCase();
97 return useCase != null ? StringUtilsHelper.toResourceMessageKey(useCase.getName()) : null;
98 }
99 }