Creating OTrunk Pas Step

Create a OTClass

Make a new java interface which extends OTPasStep
Add get and set methods for the properties of the step bean.

For example:

public interface OTDisplayPage extends OTPasStep {

	public URL getUrl();

	public void setUrl(URL url);
}

Create an OTController

Make a new java class which extends OTPasStepController
For example:

public class OTDisplayPageController extends OTPasStepController {

	public static Class[] realObjectClasses = { DisplayPage.class };
	public static Class otObjectClass = OTDisplayPage.class;

	public void loadRealObject(Object realObject) {
		super.loadRealObject(realObject);

		DisplayPage display = (DisplayPage) realObject;
		OTDisplayPage otDisplay = (OTDisplayPage) otObject;

		// FIXME use beanutils property mapper for all this

		// property:url
		display.setUrl(otDisplay.getUrl());
	}

	public void registerRealObject(Object arg0) {
		// TODO Auto-generated method stub

	}

	public void saveRealObject(Object arg0) {
		// TODO Auto-generated method stub

	}

}

For each controller you need to do the following things:

Declare classes

Define the following two public static fields:

public static Class[] realObjectClasses = { DisplayPage.class };
public static Class otObjectClass = OTDisplayPage.class;

Replace DisplayPage.class with the PasStep class this controller is working with.
Replace OTDisplayPage.class with the OTClass interface created above.

Implement loading code

Implement the "loadRealObject" method. It should get properties from the otObject field, and set them on
the realObject.

Register Controller

Open this class in pas-otrunk:
org.telscenter.pas.otrunk.skeleton.OTSkeletonPackage

In the initialize method add a call to register your new controller class:
for example:

public void initialize(OTrunk otrunk) {
  // get controller registry and reistrer our controllers
  OTControllerRegistry registry = (OTControllerRegistry) otrunk.getService(OTControllerRegistry.class);
		
  registry.registerControllerClass(OTPasProjectController.class);
  registry.registerControllerClass(OTPasActivityController.class);

  registry.registerControllerClass(OTDisplayPageController.class);
}

Testing Otml

add the new step to pas-test.otml

Add a import statement for the class

Add an instance of the OTObject to the stepList

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.