View Javadoc
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.utils.StringUtilsHelper;
6   
7   /**
8    * MetafacadeLogic implementation for org.andromda.cartridges.jbpm.metafacades.JBpmStateVertex.
9    *
10   * @see org.andromda.cartridges.jbpm.metafacades.JBpmStateVertex
11   * @author Bob Fields
12   */
13  public class JBpmStateVertexLogicImpl
14      extends JBpmStateVertexLogic
15  {
16      private static final long serialVersionUID = 34L;
17      /**
18       * @param metaObject
19       * @param context
20       */
21      public JBpmStateVertexLogicImpl (Object metaObject, String context)
22      {
23          super (metaObject, context);
24      }
25  
26      /**
27       * @see org.andromda.cartridges.jbpm.metafacades.JBpmStateVertexLogic#handleIsContainedInBusinessProcess()
28       * @see org.andromda.cartridges.jbpm.metafacades.JBpmStateVertex#isContainedInBusinessProcess()
29       */
30      protected boolean handleIsContainedInBusinessProcess()
31      {
32          return this.getStateMachine()!= null
33                  && this.getStateMachine() instanceof ActivityGraphFacade
34                  && ((ActivityGraphFacade)this.getStateMachine()).getUseCase() instanceof JBpmProcessDefinition;
35      }
36  
37      /**
38       * @see org.andromda.cartridges.jbpm.metafacades.JBpmStateVertexLogic#handleGetNodeClassName()
39       * @see org.andromda.cartridges.jbpm.metafacades.JBpmStateVertex#getNodeClassName()
40       */
41      protected String handleGetNodeClassName()
42      {
43          return StringUtilsHelper.upperCamelCaseName(this.getName()) + "Node";
44      }
45  
46      /**
47       * @see org.andromda.cartridges.jbpm.metafacades.JBpmStateVertexLogic#handleGetNodePackageName()
48       * @see org.andromda.cartridges.jbpm.metafacades.JBpmStateVertex#getNodePackageName()
49       */
50      protected String handleGetNodePackageName()
51      {
52          return (this.getProcessDefinition() == null) ? null : this.getProcessDefinition().getPackageName();
53      }
54  
55      /**
56       * @see org.andromda.cartridges.jbpm.metafacades.JBpmStateVertexLogic#handleGetProcessDefinition()
57       */
58      protected Object handleGetProcessDefinition()
59      {
60          Object processDefinition = null;
61  
62          final StateMachineFacade stateMachine = this.getStateMachine();
63          if (stateMachine instanceof ActivityGraphFacade)
64          {
65              processDefinition = ((ActivityGraphFacade)stateMachine).getUseCase();
66          }
67  
68          return (processDefinition instanceof JBpmProcessDefinition) ? processDefinition : null;
69      }
70  }