Home > Jee Code Generation

JSF/STRUTS Code Generation



The JSF code generation needs three diagrams to be unify business logic and web tier presentation.

You need one or more:

  1. UseCase Diagram
  2. Class Diagram
  3. StateChart Diagram

 

The following example is a quick start to explain how to generate code

Create a UseCase Diagram

 

 

1. First Create a UseCase inside your UseCase Diagram:

 





Select Stereotypes as below:

 

 

You get the following usecase

 

 

2. Then Create a Class diagram, a class named CycleController

 

 

Select the UseCase in charge of the web Interface and click the OK button

 

 

You automatically get

 

 

You now need to add a method and a parameter to your class diagram

 

 


Enter the method name “numberofTimes” and click on the Add button.

 

 

 

 

Enter the parameter name and type

 

You now get a method inside your class diagram

 

 

 

3. Finlay, you now need to create a statechart diagram representing the JSF work flow

 

 

 

The GiveParameter need to have an Effect.

Click on the transition and open the contextual menu > Add Behavior > Effect

 

 

 

 

 

Click on the CallController State

 

 

Click on the Add button

 

 

Type a name and select Entry in the internal Activities wizard, then select New operation in order to connect the class diagram method and the state.

 

 

 

You will open the New Operation selector, which will display all classes having parameters and a stereotype “controller_usecase.

 

 

 

You finally need to connect your usecase to its Statechart Diagram

 

Select the Statechart diagram related to the usecase

  


After all presentation layers has been modeled, select your project.uml file in the package explorer
JEE UML Code Generation > Build All Components (with EclipseUML 3.3 and EclipseUML 3.4)

or

Click on the EclipseUML model in the Package Explorer Project name.uml file  > Transform to AndroMDA (with the latest EclipseUML builds)