Business logic is any Java code invoked as an action in an event, such as a screen customization. Business logic is specific to the application and is not provided as part of HATS.
You can add business logic to your project using the Create Business Logic wizard. To invoke this wizard, right-click in the HATS Project View tab of the HATS Studio, and select New HATS > Business Logic. You can also right-click in the Navigator tab of the HATS Studio, and select New > Other > Host Access Transformation Server > HATS Business Logic, and then click Next.
In the Create Business Logic wizard, specify the project to which you want to add the business logic and supply the fully-qualified Java class name. Optionally, you can supply a package name, or select an existing Java package by clicking Browse. If you want your business logic to have access to the project global variables, check the Get global variable checkbox. Click Finish when you have provided the required information.
You can see the business logic files in the project by expanding the Source folder on the HATS Project View tab of the HATS Studio. Each package name or class name appears in the Source folder. Expand the package name folder to see the Java class name. Double-click on the class name to edit the class.
If you use the Create Business Logic wizard to create business logic, the method is named "execute" by default. If you write your own class, the method must meet specific requirements:
The method must follow the form:
public static void myMethod (BusinessLogicInfo businesslogic)
followed by your own business logic code.
The BusinessLogicInfo object passed to your custom Java code enables you to access and use or modify various objects and settings of your HATS project. These include:
For more information about the classes made available to you, see the Java documentation at the product Web site (http://www.ibm.com/software/webservers/hats) for the BusinessLogicInfo class.
You can incorporate Java code from other existing applications into your HATS projects in a variety of ways.
If you want to incorporate the source code (.java files) from your existing business logic so you can modify the code, you can import the .java files into the Source folder in your existing project. Select File > Import > File System to open the Import wizard. In the Import wizard, select the location of your source files in the Directory field. Select the Source folder of your project in the destination Folder entry field. When your source .java files are imported, they are automatically compiled and packaged into your HATS project. You can also edit, set breakpoints, and debug your source files in the WebSphere Studio workbench.
You can also incorporate a Java archive (.jar) file with compiled Java business logic. This method imports the Java archive file into the .ear project. There will only be a single copy of the Java file in the .ear file, but it is available to all of the HATS projects contained in that .ear project. There are three steps to this method.
There are other ways to import Java archives into the HATS project. HATS projects are extensions of Web projects in the WebSphere Studio workbench. For more information about importing Web projects, open the Help perspective in the WebSphere Studio workbench and select Application Developer Documentation. Expand the sections as follows to find information on Web projects: Concepts > Projects > Web projects.
[ Top of Page | Previous Page | Next Page ]