0

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...

mariusmmg2
  • 713
  • 18
  • 37

2 Answers2

0

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.

enter image description here

Details: here

sergej
  • 17,147
  • 6
  • 52
  • 89
  • And how do I export that `TabulawView` to some kind of `.txt` file? `Reporter/ReporterPLUS` does not have this option (it will not export the table itself, I only got `stereotypes/object model diagrams/components` information. – mariusmmg2 Oct 21 '15 at 11:27
  • @MariusMarusanici You can print it as `.pdf`. I am not familiar with the Reporter, maybe you should ask a new question. – sergej Oct 21 '15 at 12:58
0

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");
            }
        }
    }
}
Sai
  • 46
  • 3