Is there any way to get a state table
from a IBM Rhapsody Statechart
diagram?
Opening the generated .rpy
file and trying to manually generate one is not such a good idea...
Is there any way to get a state table
from a IBM Rhapsody Statechart
diagram?
Opening the generated .rpy
file and trying to manually generate one is not such a good idea...
Yes, it is possible to view state-charts in a tabular format.
You need to change the state-chart property
StatechartDiagram::StateDiagram::DefaultView
to Tabular view
.
This feature is available since Rhapsody V7.5.
Details: here
You can utilize Rhapsody java api and write a code snippet to get details of elements of any given statechart. A sample code is provided for Creating a table matrix for statechart elements.
import com.telelogic.rhapsody.core.IRPApplication;
import com.telelogic.rhapsody.core.IRPModelElement;
import com.telelogic.rhapsody.core.IRPProject;
import com.telelogic.rhapsody.core.IRPStateVertex;
import com.telelogic.rhapsody.core.IRPStatechart;
import com.telelogic.rhapsody.core.IRPTransition;
import com.telelogic.rhapsody.core.RhapsodyAppServer;
public class Statechart_Info
{
public static void main(String[] args)
{
IRPApplication app = RhapsodyAppServer.getActiveRhapsodyApplication();
IRPProject prj = app.activeProject();
IRPModelElement moEle = app.getSelectedElement();
IRPStatechart mySC = (IRPStatechart) moEle;
String defTran=null;
for (Object obj : mySC.getNestedElementsRecursive().toList())
{
if(obj instanceof IRPTransition)
{
IRPTransition myTran = (IRPTransition) obj;
if(myTran.isDefaultTransition()==1)
defTran = myTran.getName();
}
}
for (Object obj : mySC.getNestedElementsRecursive().toList())
{
if(obj instanceof IRPStateVertex)
{
IRPStateVertex mySV = (IRPStateVertex) obj;
System.out.println("State: " + mySV.getName());
System.out.println("\nIncoming Transition(s) to " + mySV.getName());
for(Object obj1 : mySV.getInTransitions().toList())
{
IRPTransition myTran = (IRPTransition) obj1;
System.out.println("Transition: " + myTran.getName());
}
System.out.println("\nOutgoing Transition(s) from " + mySV.getName());
for(Object obj1 : mySV.getOutTransitions().toList())
{
IRPTransition myTran = (IRPTransition) obj1;
System.out.println("Transition: " + myTran.getName());
}
if(mySV.getName().equals("ROOT"))
System.out.println("Transition: " + defTran);
System.out.println("\n");
}
}
}
}