001package org.andromda.cartridges.jbpm.metafacades; 002 003import org.andromda.metafacades.uml.ActivityGraphFacade; 004import org.andromda.metafacades.uml.StateMachineFacade; 005import org.andromda.utils.StringUtilsHelper; 006 007/** 008 * MetafacadeLogic implementation for org.andromda.cartridges.jbpm.metafacades.JBpmStateVertex. 009 * 010 * @see org.andromda.cartridges.jbpm.metafacades.JBpmStateVertex 011 * @author Bob Fields 012 */ 013public class JBpmStateVertexLogicImpl 014 extends JBpmStateVertexLogic 015{ 016 private static final long serialVersionUID = 34L; 017 /** 018 * @param metaObject 019 * @param context 020 */ 021 public JBpmStateVertexLogicImpl (Object metaObject, String context) 022 { 023 super (metaObject, context); 024 } 025 026 /** 027 * @see org.andromda.cartridges.jbpm.metafacades.JBpmStateVertexLogic#handleIsContainedInBusinessProcess() 028 * @see org.andromda.cartridges.jbpm.metafacades.JBpmStateVertex#isContainedInBusinessProcess() 029 */ 030 protected boolean handleIsContainedInBusinessProcess() 031 { 032 return this.getStateMachine()!= null 033 && this.getStateMachine() instanceof ActivityGraphFacade 034 && ((ActivityGraphFacade)this.getStateMachine()).getUseCase() instanceof JBpmProcessDefinition; 035 } 036 037 /** 038 * @see org.andromda.cartridges.jbpm.metafacades.JBpmStateVertexLogic#handleGetNodeClassName() 039 * @see org.andromda.cartridges.jbpm.metafacades.JBpmStateVertex#getNodeClassName() 040 */ 041 protected String handleGetNodeClassName() 042 { 043 return StringUtilsHelper.upperCamelCaseName(this.getName()) + "Node"; 044 } 045 046 /** 047 * @see org.andromda.cartridges.jbpm.metafacades.JBpmStateVertexLogic#handleGetNodePackageName() 048 * @see org.andromda.cartridges.jbpm.metafacades.JBpmStateVertex#getNodePackageName() 049 */ 050 protected String handleGetNodePackageName() 051 { 052 return (this.getProcessDefinition() == null) ? null : this.getProcessDefinition().getPackageName(); 053 } 054 055 /** 056 * @see org.andromda.cartridges.jbpm.metafacades.JBpmStateVertexLogic#handleGetProcessDefinition() 057 */ 058 protected Object handleGetProcessDefinition() 059 { 060 Object processDefinition = null; 061 062 final StateMachineFacade stateMachine = this.getStateMachine(); 063 if (stateMachine instanceof ActivityGraphFacade) 064 { 065 processDefinition = ((ActivityGraphFacade)stateMachine).getUseCase(); 066 } 067 068 return (processDefinition instanceof JBpmProcessDefinition) ? processDefinition : null; 069 } 070}