1 package org.andromda.cartridges.jbpm.metafacades;
2
3 import org.andromda.metafacades.uml.ActivityGraphFacade;
4 import org.andromda.metafacades.uml.StateMachineFacade;
5 import org.andromda.metafacades.uml.UseCaseFacade;
6 import org.andromda.utils.StringUtilsHelper;
7 import org.apache.commons.lang.StringUtils;
8
9
10
11
12
13
14 public class JBpmPseudostateLogicImpl
15 extends JBpmPseudostateLogic
16 {
17 private static final long serialVersionUID = 34L;
18
19
20
21
22 public JBpmPseudostateLogicImpl (Object metaObject, String context)
23 {
24 super (metaObject, context);
25 }
26
27
28
29
30 public String getName()
31 {
32 String name = super.getName();
33 if (StringUtils.isBlank(name))
34 {
35 name = "start";
36 }
37 return name;
38 }
39
40
41
42
43
44 protected String handleGetClassName()
45 {
46 return StringUtilsHelper.upperCamelCaseName(getName());
47 }
48
49
50
51
52
53 protected Object handleGetSwimlane()
54 {
55 return this.getPartition();
56 }
57
58
59
60
61 protected String handleGetDecisionHandlerPackageName()
62 {
63 String packageName = null;
64
65 final StateMachineFacade stateMachine = this.getStateMachine();
66 if (stateMachine instanceof ActivityGraphFacade)
67 {
68 final UseCaseFacade useCase = ((ActivityGraphFacade)stateMachine).getUseCase();
69 if (useCase != null)
70 {
71 packageName = useCase.getPackageName();
72 }
73 }
74
75 return packageName;
76 }
77
78
79
80
81 protected String handleGetDecisionHandlerFullPath()
82 {
83 return StringUtils.replace(this.getClazz(), ".", "/");
84 }
85
86
87
88
89 protected String handleGetDecisionHandlerClassName()
90 {
91 return StringUtilsHelper.upperCamelCaseName(this.getName());
92 }
93
94
95
96
97 protected String handleGetClazz()
98 {
99 String decisionHandlerClass = null;
100
101 if (this.isDecisionPoint())
102 {
103 final StringBuilder clazzBuffer = new StringBuilder();
104 if (StringUtils.isNotBlank(this.getDecisionHandlerPackageName()))
105 {
106 clazzBuffer.append(this.getDecisionHandlerPackageName());
107 clazzBuffer.append('.');
108 }
109 clazzBuffer.append(this.getDecisionHandlerClassName());
110 decisionHandlerClass = clazzBuffer.toString();
111 }
112
113 return decisionHandlerClass;
114 }
115 }