01: package org.andromda.cartridges.jbpm.metafacades;
02:
03: import org.andromda.utils.StringUtilsHelper;
04: import org.andromda.metafacades.uml.ActivityGraphFacade;
05: import org.andromda.metafacades.uml.UseCaseFacade;
06: import org.andromda.metafacades.uml.StateMachineFacade;
07: import org.apache.commons.lang.StringUtils;
08:
09: /**
10: * MetafacadeLogic implementation for org.andromda.cartridges.jbpm.metafacades.JBpmPseudostate.
11: *
12: * @see org.andromda.cartridges.jbpm.metafacades.JBpmPseudostate
13: */
14: public class JBpmPseudostateLogicImpl extends JBpmPseudostateLogic {
15:
16: public JBpmPseudostateLogicImpl(Object metaObject, String context) {
17: super (metaObject, context);
18: }
19:
20: public String getName() {
21: String name = super .getName();
22: if (StringUtils.isBlank(name)) {
23: name = "start";
24: }
25: return name;
26: }
27:
28: /**
29: * @see org.andromda.cartridges.jbpm.metafacades.JBpmPseudostate#getClassName()
30: */
31: protected java.lang.String handleGetClassName() {
32: return StringUtilsHelper.upperCamelCaseName(getName());
33: }
34:
35: /**
36: * @see org.andromda.cartridges.jbpm.metafacades.JBpmPseudostate#getSwimlane()
37: */
38: protected java.lang.Object handleGetSwimlane() {
39: return this .getPartition();
40: }
41:
42: protected String handleGetDecisionHandlerPackageName() {
43: String packageName = null;
44:
45: final StateMachineFacade stateMachine = this .getStateMachine();
46: if (stateMachine instanceof ActivityGraphFacade) {
47: final UseCaseFacade useCase = ((ActivityGraphFacade) stateMachine)
48: .getUseCase();
49: if (useCase != null) {
50: packageName = useCase.getPackageName();
51: }
52: }
53:
54: return packageName;
55: }
56:
57: protected String handleGetDecisionHandlerFullPath() {
58: return StringUtils.replace(this .getClazz(), ".", "/");
59: }
60:
61: protected String handleGetDecisionHandlerClassName() {
62: return StringUtilsHelper.upperCamelCaseName(this .getName());
63: }
64:
65: protected String handleGetClazz() {
66: String decisionHandlerClass = null;
67:
68: if (this .isDecisionPoint()) {
69: final StringBuffer clazzBuffer = new StringBuffer();
70: if (StringUtils.isNotBlank(this
71: .getDecisionHandlerPackageName())) {
72: clazzBuffer
73: .append(this .getDecisionHandlerPackageName());
74: clazzBuffer.append('.');
75: }
76: clazzBuffer.append(this.getDecisionHandlerClassName());
77: decisionHandlerClass = clazzBuffer.toString();
78: }
79:
80: return decisionHandlerClass;
81: }
82: }
|