7 Using the AIS Client Class Generator

This chapter contains the following topics:

7.1 Understanding Generating Objects with the AIS Client Class Generator

The AIS Client Class Generator generates Java classes for use in Java-based AIS clients. The AIS Client Class Generator is an extension to JDeveloper and must be installed before using it.

A form service call to the AIS Server, also referred to as a form service request, results in a response that contains a string in JSON format. In JDeveloper, you can access and use the AIS Client Class Generator to transform the response into object form because objects are easier to work with than strings. The AIS Client Class Generator generates classes matching the form. The generator is also able to generate classes for data service responses.

If you are building a mobile application using Oracle MAF, in the AIS Client Class Generator, choose the option to generate classes for a mobile application.

7.2 Installing the AIS Client Class Generator

The AIS Client Class Generator is JDeveloper extension. To install the extension:

  1. In JDeveloper, select the Help menu, Check for Updates.

  2. Click Next.

  3. Select Install From Local File, and then enter the location of the AISCGE 12c_v.x.x.zip file.

    This file is included with the download package for the AIS client that you are using. If you have not downloaded this package yet, see the "Developer's" guide for the AIS client you are using for information on how to obtain this download.

  4. Click Next, and then click Finish.

    JDeveloper closes automatically.

7.3 Configuring the AIS Client Class Generator

To configure the AIS Client Class Generator:

  1. In JDeveloper, access Preferences:

    On Microsoft Windows, select the Tools menu, Preferences.

    On Apple MacOS, select the JDeveloper menu, Preferences.

  2. Select AIS Client Class Generator.

  3. On Preferences, complete the following fields to specify the AIS Server location and AIS Server information:

    • AIS Server URL. This is a fully qualified URL to the AIS Server that includes the protocol, server, and port number. For example: http://myaisserver.com:8474)

    • JAS Server URL. (Optional) This is the URL to the EnterpriseOne HTML Server. Enter a URL only if you want to override the JAS Server URL configured on the AIS Server.)

    • Username. Enter a JD Edwards EnterpriseOne user name.

    • Password. Enter a JD Edwards EnterpriseOne user password.

    • Environment. (Optional) Enter a value only if you want to override the value configured on the AIS Server.

    • Role. (Optional). Enter a value only if you want to override the value configured on the AIS Server.

    • JSON Files Folder. The directory for storing the JSON files. The default location is the AISClientClassGenerator\input directory.)

    • Default Java Classes Folder. The directory where the generated form classes are stored, if an active project is not selected.

      The AIS Client Class Generator uses this folder only when it is run without a project open in JDeveloper. When a project is open in JDeveloper, the generator stores the Java files in the source directory for the project at the defined package path or the default package path which is com.oracle.e1.formservicetypes.

    • Java Package. Enter the name of the Java package assigned to the generated form classes. This will also determine the folder structure for the Java classes in the project src folder.

  4. Click OK.

7.4 Generating Data Classes Based on a Form

Use the AIS Client Class Generator to generate data classes for an EnterpriseOne form. In the AIS Client Class Generator, you supply the service request information.

Note:

The AIS Client Class Generator supports form interconnects only; it does not support form events.

To use the AIS Client Class Generator to generate data classes for a form service request:

  1. In JDeveloper, select the ApplicationController project. For ADF application development, select the Model project in your ADF application workspace.

    JDeveloper will save the classes generated by the AIS Client Class Generator in this location.

  2. Select the Tools menu and then select AIS Client Class Generator.

  3. Click the Form Service radio button. (Available in AIS Client Class Generator v1.6.2.)

  4. On AIS Client Class Generator, complete the following fields to supply the service request information:

    • Username. This contains the default value entered in the preferences.

    • Password. This contains the default value entered in the preferences.

    • Environment. This contains the default value entered in the preferences.

    • Role. This contains the default value entered in the preferences.

    • Application Name. Enter the name of the EnterpriseOne application.

    • Form Name. Enter the name of the EnterpriseOne application form.

    • Version. (Optional) Enter the version name. If you leave it blank, the generator will use ZJDE0001 by default.

    • MaxPageSize. (Optional)

    • ReturnControlIDs. (Optional) Use this field to specify the exact fields on the form that you want generated. The return control IDs can specify hidden fields or a subset of fields.

    • FormInputs. (Optional)

    • FormServiceAction. Enter the action to be performed. Valid values include: Create, Read, Update, Delete.

    • FindOnEntry. (Optional)

    • DemoMode. (Optional, but recommended) This ensures at least one grid row is present, so grid classes are generated even if there is no data in the database.

    • Generate for Mobile Application. Select this check box for mobile applications only. For ADF and AIS client applications, make sure that this check box is cleared or not checked.

    • Output Version. Select Version 1, Version 2, or Grid Data to generate classes based on the output type. The Grid Data option is available starting with AIS Client Class Generator v2.2.0.

      For more information about output types, see "Additional Supported Output Types for Form Service and Data Service" in the JD Edwards EnterpriseOne Application Interface Services Client Java API Developer's Guide.

  5. If you want to preview and keep the JSON files, select the Preview JSON Data and Keep JSON Files check boxes.

  6. Click the Generate button to generate the JSON, and then verify that it has the fields and records you need.

  7. Click Continue to generate the Java files.

    If successful, a confirmation message appears that shows the location of the JSON files and Java class files.

  8. Highlight the Application Controller project (or Model project for ADF applications) and then click the "refresh" button to display the new files.

    The AIS Client Class Generator displays a dialog box that shows where the classes are saved.

Example 7-1 Example of Classes Generated from the AIS Client Class Generator

This example shows the generated classes for form W01012B in application P01012.

This image is described in surrounding text.

Notice that the structure of the generated classes in JDeveloper represent the EnterpriseOne form. The form fields are in the class P01012_W01012B_FormData; the grid data is also within that form. Inside the P01012_W01012B_GridData class is a rowset that contains the grid records. Each row in the rowset is from the P01012_W01012B_GridRow class, which is where all the columns are listed.

JSON string responses for the P01012_W01012B form can now be de-serialized into these classes.

If you need any fields on the form that have not been generated, you can add them manually. The code in Example 7-2 shows an example of additional hidden grid columns added to the _GridRow class.

Example 7-2 Additional Grid Columns Added to the _GridRow Class

Field sAddressLine1_40  = new Field();
Field sCity_44  = new Field();
Field SPrefix_81  = new Field();
Field sPhoneNumber_46  = new Field();
 
public void setsAddressLine1_40(Field sAddressLine1_40)
{
this.sAddressLine1_40 = sAddressLine1_40;
}
public Field getSAddressLine1_40()
{
return sAddressLine1_40;
}
public void setsCity_44(Field sCity_44)
{
this.sCity_44 = sCity_44;
}
public Field getSCity_44()
{
return sCity_44;
}
public void setsPrefix_81(Field SPrefix_81)
{
this.SPrefix_81 = SPrefix_81;
}
public Field getSPrefix_81()
{
return SPrefix_81;
}
public void setsPhoneNumber_46(Field sPhoneNumber_46)
{
this.sPhoneNumber_46 = sPhoneNumber_46;
}
public Field getSPhoneNumber_46()
{
return sPhoneNumber_46;
}

7.5 Generating Data Classes Based on a Data Request (AIS Client Class Generator v1.6.2)

The dataservice endpoint on the AIS Server enables AIS clients to receive responses from EnterpriseOne that contain either a count or a list of records matching a query of a table or view. You can use the AIS Client Class Generator to generate data classes based on the data request.

To use the AIS Client Class Generator to generate data classes based on the data request:

  1. In JDeveloper, select the ApplicationController project.

    JDeveloper will save the classes generated by the AIS Client Class Generator in this location.

  2. Select the Tools menu, AIS Client Class Generator.

  3. Click the Data Service radio button. (Available in AIS Client Class Generator v1.6.2.)

  4. On AIS Client Class Generator, complete the following fields to supply the service request information:

    • Username. This contains the default value entered in the preferences.

    • Password. This contains the default value entered in the preferences.

    • Environment. This contains the default value entered in the preferences.

    • Role. This contains the default value entered in the preferences.

    • Target Type. This is the table or view based on the object on which the query is performed.

    • Target Name. The object name to be queried, for example F0101 or V0101A.

    • ReturnControlIDs. (Optional) Use this field to specify the exact fields on the form that you want generated. Specify fields by Table.Column, for example F0101.AN8 and F0101.ALPH.

    • MaxPageSize. (Optional)

    • FindOnEntry. (Optional)

    • DemoMode. (Optional, but recommended) This ensures at least one grid row is present, so grid classes are generated even if there is no data in the database.

    • Output Version. Select Version 1, Version 2, or Grid Data to generate classes based on the output type. The Grid Data option is available starting with AIS Client Class Generator v2.2.0.

      For more information about output types, see "Additional Supported Output Types for Form Service and Data Service" in the JD Edwards EnterpriseOne Application Interface Services Client Java API Developer's Guide.

  5. Make sure to select the Preview JSON Data and Keep JSON Files check boxes if you want to preview and keep the JSON files.

  6. Click the Generate button to generate the JSON, and then in the preview, verify that it has the fields and records you need.

  7. Click Continue to generate the Java files.

    If successful, a confirmation message appears that shows the location of the JSON and Java class files.

  8. Click OK and close the generator.

  9. Highlight the Application Controller project and then click the "refresh" button to display the new files.

    The AIS Client Class Generator displays a dialog box that shows where the classes are saved.

Example 7-3 Example of Classes Generated from the AIS Client Class Generator Data Request

This example shows the generated classes for data in the F0101_AN8 and F0101_ALPH columns.

Description of classgenrtr_datareqst.png follows
Description of the illustration ''classgenrtr_datareqst.png''