6 Executing AIS Calls for Retrieving Data

This chapter contains the following topics:

6.1 Understanding JD Edwards EnterpriseOne ADF Framework Container

The JD Edwards EnterpriseOne ADF Container (JDEADFContainer) is a web application that executes ADF applications created as bounded task flows and packaged in ADF Library JAR files. These EnterpriseOne ADF applications must use the AIS Client API to perform REST services on the AIS Server to interact with EnterpriseOne. The AIS Client API provides classes and methods to perform form service requests, retrieve processing options and jargon, and interact with text and photo media objects.

For more information, see the JD Edwards EnterpriseOne Application Interface Services (AIS) Client API Reference

6.2 Understanding AIS Server Capabilities

The AIS Server exposes various capabilities on which client applications may or may not depend. If your ADF application requires a certain capability, you must first identify the capability used by your application and then verify that the capability is provided by the AIS Server.

You can access the AIS Server capabilities using the following URL:

http://<AIS Server>:<Port>/jderest/defaultconfig

The following code shows the available capabilities along with a description of each capability:

Example 6-1 Capability List

Each AIS capability used by your ADF application only needs to be added to the required capability list once, so you should perform this setup in your data control's class constructor after the LoginEnvironment object is available.

  "capabilityList":  [
            {
         "name": "grid",
         "shortDescription": "Grid Actions",
         "longDescription": "Ability to update, insert and delete grid records.",
         "asOfRelease": "9.1.4.4"
      },
            {
         "name": "editable",
         "shortDescription": "Enabled/Disabled",
         "longDescription": "Ability to indicate if form field or grid cell is editable (enabled) or not (disabled).",
         "asOfRelease": "9.1.4.4"
      },
            {
         "name": "log",
         "shortDescription": "Logging",
         "longDescription": "Endpoint exposed for logging to AIS server log from client",
         "asOfRelease": "9.1.4.6"
      },
            {
         "name": "processingOption",
         "shortDescription": "Processing Options",
         "longDescription": "Processing Option Service exposed for fetching PO values from E1",
         "asOfRelease": "9.1.4.6"
      },
            {
         "name": "ignoreFDAFindOnEntry",
         "shortDescription": "Ignore FDA Find On Entry",
         "longDescription": "Ability to use the IgnoreFDAFindOnEntry flag",
         "asOfRelease": "9.1.4.6"
      },
            {
         "name": "selectAllGridRows",
         "shortDescription": "Select or Unselect All Grid Rows",
         "longDescription": "Ability to use select and unselect all grid rows, or unselect a single row in an action event",
         "asOfRelease": "9.1.5"
      },
            {
         "name": "applicationStack",
         "shortDescription": "Operations on a Stack of E1 Applications",
         "longDescription": "Ability to maintain a statck of open E1 applications and operate forms that are called",
         "asOfRelease": "9.1.5"
      },
            {
         "name": "thumbnailSize",
         "shortDescription": "Specify desired thumbnail size for MO List",
         "longDescription": "Ability to request a specific sized thumbnail images in a Media Object List Request",
         "asOfRelease": "9.1.5"
      },
            {
         "name": "gridCellClick",
         "shortDescription": "Click Grid Cell Hyperlink",
         "longDescription": "Ability to use GridCellClick event, to execute hyperlink in grid",
         "asOfRelease": "9.1.5.2"
      },
            {
         "name": "query",
         "shortDescription": "Query",
         "longDescription": "Ability to use Query on forms that support it",
         "asOfRelease": "9.1.5.2"
      },
            {
         "name": "taskAuthorization",
         "shortDescription": "Task Authorization",
         "longDescription": "Ability to receive a list of authorized tasks based on a task view id, or task id and parent id with in a task view",
         "asOfRelease": "9.1.5.2"
      },
            {
         "name": "urlMediaObjects",
         "shortDescription": "URL Media Objects",
         "longDescription": "Ability to view, add or delete url type media objects",
         "asOfRelease": "9.1.5.2"
      },
            {
         "name": "jargon",
         "shortDescription": "Data Item Jargon Service",
         "longDescription": "Ability to request data item descriptions based on users language and jargon (system) code",
         "asOfRelease": "9.1.5.3"
      },
            {
         "name": "aliasNaming",
         "shortDescription": "Alias Naming",
         "longDescription": "Ability receive form service responses with fields named by Data Dictionary alias ",
         "asOfRelease": "9.1.5.3"
      }
   ]

Example 6-2

public void DataControlDC()
{
    String handshakeId = (String) ADFContext.getCurrent().getPageFlowScope().get("handshakeId");
    if (handshakeId == null || (handshakeId != null && handshakeId.length() == 0))
    {
        userBean = new E1UserSessionBean(AIS_SERVER, USER_NAME, PASSWORD, ENVIRONMENT, ROLE, DEVICE_NAME);
    }
    else
    {
        // Initialize application About properties when running in the container.
        E1AdfUtils.intializeAppInstance("/com/oracle/e1/E0801/");
    }
        
    loginEnv = E1AdfUtils.getLoginEnvironment(userBean);
        
    // Load required capabilities.
    if (loginEnv != null)
    {
        List<String> reqCapabilities = loginEnv.getRequiredCapabilities();
        reqCapabilities.add(AISClientCapability.GRID);
        reqCapabilities.add(AISClientCapability.PROCESSING_OPTION);
    }
}

Service requests for a required capability can throw a CapabilityException, so the request needs to be embedded within a try-catch block. When you execute a service request for a capability that is not provided by the AIS Server, control will transfer to the CapabilityException catch block, which you can use to perform alternate logic in place of the service request. Alternatively, you can use the AISClientCapability.isCapabilityAvailable(LoginEnvironment loginEnv, String capability) method to verify that a required capability exists before executing a service request. This also gives you the option to add alternate logic when the capability is not available. The below ADF example shows both of these methods.

Example 6-3

private void retrieveJargonLabels()
{
    try
    {
        if (AISClientCapability.isCapabilityAvailable(loginEnv, AISClientCapability.JARGON))
        {
            JargonRequest jargonReq = new JargonRequest(loginEnv, jargonCode);
            jargonReq.addDataItem("STRT");
            jargonReq.addDataItem("DRQJ");
    
            String response = JDERestServiceProvider.jdeRestServiceCall(loginEnv, jargonReq, 
                               JDERestServiceProvider.POST_METHOD, 
                               JDERestServiceProvider.JARGON_SERVICE);
            JargonResponse jargonResp = loginEnv.getObjectMapper().readValue(response, JargonResponse.class);
    
            if (jargonResp != null)
            {
                // Process jargon response.
            }
        }
        else
        {
            // Perform alternate logic for missing AIS capability.
        }
    }
    catch (CapabilityException e)
    {
        // Perform alternate logic for missing AIS capability, like notifying the user or populating 
        // values/list from alternate source.
    }
    catch (Exception e)
    {
        System.out.println(e);
    }
}

6.3 Understanding Form Service Requests (FSRs)

AIS Server calls retrieve data from forms in the EnterpriseOne web client. These calls are called form service requests (FSRs). ADF applications use FSRs to interact with EnterpriseOne web client forms. FSRs, formatted as REST service calls that use POST, contain form service events or commands that invoke actions on an EnterpriseOne form.

FSRs enable you to perform various operations on a single form. By sending an ordered list of commands, an FSR can replicate the actions taken by an EnterpriseOne web client user, including populating fields, pressing buttons, and other actions.

To send an FSR to the AIS Server, send a POST to the following URL and send JSON in the body:

http://<AIS Server>:<Port>/formservice

If testing with a REST testing tool, you can send JSON directly. If using the JD Edwards ADF helpers in an ADF application, you must specify only the URI when calling the jdeRestServiceCall. The URI is "formservice" and you can use the static variable, for example:

JDERestServiceProvider.FORM_SERVICE_URI

6.3.1 Events Used in an FSR

The following table lists the events that you can include in an FSR, and describes the action that each event performs.

Event Description Parameters
Set Control value Sets the value of a control on a form, like filter fields or any other form control. controlID ("25")

value ("Bob" or "01/01/2015")

Set QBE Value Sets the value of a QBE column. controlID ("1[42]" or "1_2[25]")

value ("Jill" or "55")

Set Checkbox Value Sets the value of a check box. controlID ("77")

value ("on" or "off")

Set Radio Button Sets the value of the radio button. controllID ("87")

value ("87")

Set Combo Value Sets the value of a combo box entry. contolID ("125")

value (2) - Index of the entry.

Do Action Presses a button or Hyper Item. controlID ("156")
Select Row Selects the specified row in a grid. controlID ("1.30") - ID of the grid dot then row index (zero based).
Select All Rows Select all rows in the specified grid (if multiple selection is allowed). controlID ("1") - ID of the grid.
Un Select All Rows Unselects all rows in the specified grid (if multiple selection is allowed). controlID ("1") - ID of the grid.
Un Select Row Unselects the specified row in a grid. controlID ("1.30") - ID of the grid dot then row index (zero based).
Click Grid Cell Click the hyperlink in a grid cell. controlID("1.5.22") - ID of the grid dot then the row index dot column ID.

The last three events listed in the table are available only with the selectAllGridRows capability which is available starting with EnterpriseOne Tools 9.1 Update 5 release. The AIS Client API requires these events to be in a try block because they throw a Capability Exception.

6.3.2 Using the Form Service Request Event in Form Design Aid (FDA)

Starting with EnterpriseOne Tools release 9.1.4, the Form Service Request event is available within FDA for each form. This event occurs after the Post Dialog Initialized event, but before any of the form actions requested in the form service call execute. This event enables you to perform some operations, or business logic, when you know the form is being called from an FSR.

This event also provides access to the requested form service actions, referred to as CRUD (Create, Read, Update, or Delete) actions, by using the "Get Form Service Request Action" system function. This enables you to create additional logic based on the value sent in the form service request.

Using the Form Service Request event in FDA should be secondary to using events (actions) provided in the Form Service Request from the ADF application. Oracle recommends that you only use the FDA event if you cannot accomplish a desired result with the form action events.

6.3.3 Placing Events in the Proper Order

Place the events in the FSR in the order in which you want them to execute. For example, populate a filter field value and then click the Find button. Remember that the FDA Form Service Request event occurs before the events you add to this list. Do not set the "Find On Entry" option when using the event model; the extra "find" is not necessary because it executes before the events you requested.

6.3.4 Considering Hidden Filters and Hidden QBE

By default, values are not written to hidden filter fields or hidden QBE columns. You must use the Form Service Request event to show the fields and columns first. Then values can be written to these fields and subsequently applied to the query.

6.3.5 Example of Events on Power Forms

The Form Service Request event and other events that perform actions in a form are also available on power forms so that you can populate a subform value or press a button on a subform. Indicate a subform by adding an extra prefix on the control, for example:

3_1[25]

In this example, 3 is the subform ID, 1 is the subform grid, and 25 is the grid column ID.

Another example is 3_43, in which 3 is the subform ID and 43 is the field ID. Getting a JSON representation of the form should help you find the exact IDs that you need.

6.3.6 Example of JSON Code in a FSR

The sample code in Example 6-4 is an example of JSON code in a FSR that executes EnterpriseOne actions in the following order:

  1. Open the Find/Browse form in P01012.

  2. Enter a value in a QBE field.

  3. Enter a value in a field control.

  4. Select two check boxes.

  5. Click the Find button.

Example 6-4 Executing EnterpriseOne Actions - JSON Request

 {
    "token": "044BlLYkCUcjQGRxvR3r+LH27liC6l6psFHOTp9whmkPxE=MDE4MDA2MTYxMDIwOTQ1MDU2NTc0NDY0U29hcFVJMTM4NDQ0NjU2NTUwNQ==",
    "version": "ZJDE0001",
    "formActions": [
        {
 
            "command": "SetQBEValue",
            "value": "E",
            "controlID": "1[50]"
        },
        {
            "command": "SetControlValue",
            "value": "Al*",
            "controlID": "58"
        },
        {
            "command": "SetCheckboxValue",
            "value": "on",
            "controlID": "62"
        },
        {
            "command": "SetCheckboxValue",
            "value": "on",
            "controlID": "63"
        },
        {
            "command": "DoAction",
            "controlID": "15"
        }
    ],
    "deviceName": "REST Service Testing Tool",
    "formName": "P01012_W01012B"
}

Example 6-5 Executing EnterpriseOne Actions - JSON Response

{
  "fs_P01012_W01012B" : {
    "title" : "Work With Addresses",
    "data" : {
      "z_AT1_53" : {
        "id" : 53,
        "title" : "Search Type",
        "dataType" : 2,
        "visible" : true,
        "bsvw" : false,
        "longName" : "lblSearchType_53",
        "value" : "Search Type",
        "editable" : false
      },
      "z_AT1_54" : {
        "id" : 54,
        "title" : "Search Type",
        "dataType" : 2,
        "staticText" : "Search Type",
        "visible" : true,
        "bsvw" : true,
        "longName" : "txtSearchType_54",
        "value" : "*",
        "editable" : true,
        "assocDesc" : ""
      },
      "z_ALPH_57" : {
        "id" : 57,
        "title" : "Alpha Name",
        "dataType" : 2,
        "visible" : true,
        "bsvw" : false,
        "longName" : "lblAlphaName_57",
        "value" : "Alpha Name",
        "editable" : false
      },
      "z_ALPH_58" : {
        "id" : 58,
        "internalValue" : "Allen*",
        "title" : "Alpha Name",
        "dataType" : 2,
        "staticText" : "Alpha Name",
        "visible" : true,
        "bsvw" : false,
        "longName" : "txtAlphaName_58",
        "value" : "Allen*",
        "editable" : true
      },
      "z_DL01_66" : {
        "id" : 66,
        "title" : "",
        "dataType" : 2,
        "visible" : true,
        "bsvw" : false,
        "longName" : "lblDL01_66",
        "value" : "",
        "editable" : false
      },
      "z_EV01_63" : {
        "id" : 63,
        "internalValue" : "1",
        "title" : "Display Address",
        "dataType" : 1,
        "visible" : true,
        "bsvw" : false,
        "longName" : "chkDisplayAddress_63",
        "value" : "on",
        "editable" : true
      },
      "z_EV01_62" : {
        "id" : 62,
        "internalValue" : "1",
        "title" : "Display Phone",
        "dataType" : 1,
        "visible" : true,
        "bsvw" : false,
        "longName" : "chkDisplayPhone_62",
        "value" : "on",
        "editable" : true
      },
      "gridData" : {
        "titles" : {
          "col_19" : "Address Number",
          "col_20" : "Alpha Name",
          "col_40" : "Address Line 1",
          "col_44" : "City",
          "col_81" : "Prefix",
          "col_46" : "Phone Number",
          "col_47" : "Phone Type",
          "col_48" : "Long Address",
          "col_49" : "Industry Class",
          "col_50" : "Sch Typ",
          "col_51" : "Tax ID"
        },
        "rowset" : [ {
          "rowIndex" : 0,
          "MOExist" : true,
          "z_AN8_19" : {
            "id" : 19,
            "internalValue" : 6001,
            "title" : "Address Number",
            "dataType" : 9,
            "visible" : true,
            "mathValue" : {
              "currencyDecimals" : 0,
              "zero" : false,
              "negative" : false,
              "intValue" : 6001,
              "decimalPosition" : 0
            },
            "bsvw" : true,
            "longName" : "mnAddressNumber_19",
            "value" : "6001",
            "editable" : false
          },
          "z_ALPH_20" : {
            "id" : 20,
            "internalValue" : "Allen, Ray",
            "title" : "Alpha Name",
            "dataType" : 2,
            "visible" : true,
            "bsvw" : true,
            "longName" : "sAlphaName_20",
            "value" : "Allen, Ray",
            "editable" : false
          },
          "z_ADD1_40" : {
            "id" : 40,
            "internalValue" : "410 17th Avenue",
            "title" : "Address Line 1",
            "dataType" : 2,
            "visible" : true,
            "bsvw" : false,
            "longName" : "sAddressLine1_40",
            "value" : "410 17th Avenue",
            "editable" : false
          },
          "z_CTY1_44" : {
            "id" : 44,
            "internalValue" : "Denver",
            "title" : "City",
            "dataType" : 2,
            "visible" : true,
            "bsvw" : false,
            "longName" : "sCity_44",
            "value" : "Denver",
            "editable" : false
          },
          "z_AR1_81" : {
            "id" : 81,
            "internalValue" : "",
            "title" : "Prefix",
            "dataType" : 2,
            "visible" : true,
            "bsvw" : false,
            "longName" : "sPrefix_81",
            "value" : "",
            "editable" : false
          },
          "z_PH3_46" : {
            "id" : 46,
            "internalValue" : "",
            "title" : "Phone Number",
            "dataType" : 2,
            "visible" : true,
            "bsvw" : false,
            "longName" : "sPhoneNumber_46",
            "value" : "",
            "editable" : false
          },
          "z_PHTP_47" : {
            "id" : 47,
            "internalValue" : "",
            "title" : "Phone Type",
            "dataType" : 2,
            "visible" : true,
            "bsvw" : false,
            "longName" : "sPhoneType_47",
            "value" : "",
            "editable" : false
          },
          "z_ALKY_48" : {
            "id" : 48,
            "internalValue" : " ",
            "title" : "Long Address",
            "dataType" : 2,
            "visible" : true,
            "bsvw" : true,
            "longName" : "sLongAddress_48",
            "value" : " ",
            "editable" : false
          },
          "z_SIC_49" : {
            "id" : 49,
            "internalValue" : " ",
            "title" : "Industry Class",
            "dataType" : 2,
            "visible" : true,
            "bsvw" : true,
            "longName" : "sIndustryClass_49",
            "value" : " ",
            "editable" : false
          },
          "z_AT1_50" : {
            "id" : 50,
            "internalValue" : "E",
            "title" : "Sch Typ",
            "dataType" : 2,
            "visible" : true,
            "bsvw" : true,
            "longName" : "sSchTyp_50",
            "value" : "E",
            "editable" : false
          },
          "z_TAX_51" : {
            "id" : 51,
            "internalValue" : "798525841",
            "title" : "Tax ID",
            "dataType" : 2,
            "visible" : true,
            "bsvw" : true,
            "longName" : "sTaxID_51",
            "value" : "798525841",
            "editable" : false
          }
        } ],
        "summary" : {
          "records" : 1,
          "moreRecords" : false
        }
      }
    },
    "errors" : [ ],
    "warnings" : [ ]
  },
  "stackId" : 1,
  "stateId" : 1,
  "rid" : "785dbb271b6068a6",
  "currentApp" : "P01012_W01012B_ZJDE0001",
  "sysErrors" : [ ]
}

6.3.7 Example of API Methods for an FSR

Oracle provides API methods that you can use to set the commands when coding ADF applications.

Important:

When you set a date field value, use the form field or QBE Date methods that use the java.util.Date for input. These methods format the date value into the proper format for data entry in EnterpriseOne.

Example 6-6 API Methods for Setting Commands

        FormRequest formRequest = new FormRequest(loginEnv);
        formRequest.setFormName("P01012_W01012B");
        formRequest.setVersion("ZJDE0001");
        formRequest.setFormServiceAction(FormRequest.ACTION_READ);
        
        // Create event holder and add actions in order
        FSREvent formEvents = new FSREvent();
        formEvents.setQBEValue("1[50]", searchType);
        formEvents.setFieldValue("58", name);
        formEvents.checkBoxChecked("62");
        formEvents.checkBoxChecked("63");
        formEvents.doControlAction("15");
        
        // Add event holder to the form request
        formRequest.addFSREvent(formEvents);
        
        // Execute form service request and process response
        try
        {
            String response = JDERestServiceProvider.jdeRestServiceCall(loginEnv, formRequest, JDERestServiceProvider.POST_METHOD, JDERestServiceProvider.FORM_SERVICE_URI);
 
            P01012_W01012B_FormParent newFormParent = loginEnv.getObjectMapper().readValue(response, P01012_W01012B_FormParent.class);
        }
        catch (JDERestServiceException e)
        {
            System.out.println(JDERestServiceProvider.handleServiceException(e));
        }
        catch (Exception e)
        {
            System.out.println(e);
        }

6.3.8 Grid Action Events

In addition to interacting with fields on the form, you can interact with grids using grid action events. If you use a grid action event, you must identify "grid" as a required capability before executing the form request.

See Section 6.2, "Understanding AIS Server Capabilities" for more information.

The types of grid action events include:

  • Selecting grid rows

    This action enables you to delete records in the grid by sending a row select event, followed by a delete button press event, and then finally an OK button press event. This is the exact sequence that a user would follow to delete a record in an EnterpriseOne application.

  • Inserting grid rows

    This action enables you to insert one or more rows into a grid, setting the column value for each row. This includes text entry columns, drop-down columns, or check box columns. You must include an OK button pressed event to commit the inserts.

  • Updating grid rows

    This action enables you to update one or more existing grid rows by setting the column values for each row. This includes text entry columns, drop-down columns, or check box columns. You must include an OK button pressed event to commit the updates.

The following table describes the commands that you can use in grid column events to set values for a cell in a grid insert or update event:

Grid Column Event Description Parameters
Set Grid Cell Value Sets the value of a cell in a grid. "value": "720",

"command": "SetGridCellValue",

"columnID": "28"

Set Grid Combo Value Sets the value of a drop-down column in a grid. The value that you send is in the "Code" for the UDC associated with the column. "value": "ABC"

"command": "SetGridComboValue",

"columnID": "43"


6.3.9 Example of Grid Action Events

This section provides examples of grid action events in both JSON and Oracle ADF code.

The sample code in Example 6-7 is an example of JSON that deletes a phone number in the third row of a grid. It is important to note:

  • The row index is zero based.

  • You must get the row index based on a previous fetch (since rows may be hidden and the index may not be consecutive).

  • Three form actions are sent to first select row 3, then select the Delete button, and then select the OK button to confirm the delete.

  • The form inputs will get the correct set of phone records for address number 6001, who's who line 0.

  • The formServiceAction code is a U for update, so the form is in update mode.

Example 6-7 Selecting Grid Rows - JSON Request

{
    "token": "0443HC90ZH4pq9CScdvJ+nkecflSJI9q+YGbc7lXrGZ7So=MDE5MDA2ODQ4MjcyMDk2MTUwMjg0NDkyOFNvYXBVSTEzOTIwNzE5NzY4NzE=",
     
    "formActions": [
        
           {
            "command": "SelectRow",
            "controlID": "1.3"
        }  
        ,
        {
            "command": "DoAction",
            "controlID": "59"
        },
        {
            "command": "DoAction",
            "controlID": "4"
        }
    ],
    "formInputs": [
        {
            "value": "6001",
            "id": "4"
        },
        {
            "value": "0",
            "id": "5"
        }
    ],
    
    "formServiceAction": "U",
    "deviceName": "RESTclient",
    "formName": "P0115_W0115A"
}

Example 6-8 Selecting Grid Rows - JSON Response

{
  "fs_P0115_W0115A" : {
    "title" : "Phone Numbers",
    "data" : {
      "z_DL01_71" : {
        "id" : 71,
        "title" : "Ray Allen",
        "dataType" : 2,
        "visible" : true,
        "bsvw" : false,
        "longName" : "lblDL01_71",
        "value" : "Ray Allen",
        "editable" : false
      },
      "z_ALPH_52" : {
        "id" : 52,
        "title" : "Who's Who Line",
        "dataType" : 2,
        "visible" : true,
        "bsvw" : false,
        "longName" : "lblWhosWhoLine_52",
        "value" : "Who's Who Line",
        "editable" : false
      },
      "z_AN8_7" : {
        "id" : 7,
        "internalValue" : 6001,
        "title" : "Address Number",
        "dataType" : 9,
        "staticText" : "Address Number",
        "visible" : true,
        "mathValue" : {
          "currencyCode" : "",
          "currencyDecimals" : 0,
          "zero" : false,
          "negative" : false,
          "intValue" : 6001,
          "decimalPosition" : 0
        },
        "bsvw" : true,
        "longName" : "txtAddressNumber_7",
        "value" : "6001",
        "editable" : false,
        "assocDesc" : "Allen, Ray"
      },
      "z_DL01_54" : {
        "id" : 54,
        "title" : "Allen, Ray",
        "dataType" : 2,
        "visible" : true,
        "bsvw" : false,
        "longName" : "lblDL01_54",
        "value" : "Allen, Ray",
        "editable" : false
      },
      "gridData" : {
        "titles" : {
          "col_28" : "Prefix",
          "col_29" : "Phone Number",
          "col_27" : "Phone Type",
          "col_66" : "Phone Type Description",
          "col_26" : "Line Number"
        },
        "rowset" : [ {
          "rowIndex" : 0,
          "MOExist" : false,
          "z_AR1_28" : {
            "id" : 28,
            "internalValue" : "303",
            "title" : "Prefix",
            "dataType" : 2,
            "visible" : true,
            "bsvw" : true,
            "longName" : "sPrefix_28",
            "value" : "303",
            "editable" : true
          },
          "z_PH1_29" : {
            "id" : 29,
            "internalValue" : "555-1212",
            "title" : "Phone Number",
            "dataType" : 2,
            "visible" : true,
            "bsvw" : true,
            "longName" : "sPhoneNumber_29",
            "value" : "555-1212",
            "editable" : true
          },
          "z_PHTP_27" : {
            "id" : 27,
            "internalValue" : "CAR",
            "title" : "Phone Type",
            "dataType" : 2,
            "visible" : true,
            "bsvw" : true,
            "longName" : "sPhoneType_27",
            "value" : "CAR",
            "editable" : true
          },
          "z_DL01_66" : {
            "id" : 66,
            "internalValue" : "Car or Mobile",
            "title" : "Phone Type Description",
            "dataType" : 2,
            "visible" : true,
            "bsvw" : false,
            "longName" : "sPhoneTypeDescription_66",
            "value" : "Car or Mobile",
            "editable" : false
          },
          "z_RCK7_26" : {
            "id" : 26,
            "internalValue" : 2,
            "title" : "Line Number",
            "dataType" : 9,
            "visible" : true,
            "mathValue" : {
              "currencyDecimals" : 0,
              "zero" : false,
              "negative" : false,
              "intValue" : 2,
              "decimalPosition" : 0
            },
            "bsvw" : true,
            "longName" : "mnLineNumber_26",
            "value" : "2",
            "editable" : false
          }
        } ],
        "summary" : {
          "records" : 1,
          "moreRecords" : false
        }
      },
      "z_AN8_6" : {
        "id" : 6,
        "title" : "Address Number",
        "dataType" : 9,
        "visible" : true,
        "bsvw" : false,
        "longName" : "lblAddressNumber_6",
        "value" : "Address Number",
        "editable" : false
      },
      "z_IDLN_32" : {
        "id" : 32,
        "internalValue" : 0,
        "title" : "Who&#39;s Who Line",
        "dataType" : 9,
        "visible" : true,
        "mathValue" : {
          "currencyDecimals" : 0,
          "zero" : true,
          "negative" : false,
          "intValue" : 0,
          "decimalPosition" : 0
        },
        "bsvw" : true,
        "longName" : "txtWhosWhoLine_32",
        "value" : "0",
        "editable" : false,
        "assocDesc" : "Ray Allen"
      }
    },
    "errors" : [ ],
    "warnings" : [ ]
  },
  "stackId" : 1,
  "stateId" : 1,
  "rid" : "5b45563764cddbc4",
  "currentApp" : "P0115_W0115A",
  "sysErrors" : [ ]
}

Example 6-9 Selecting Grid Rows - ADF Application Code

This sample code performs the same delete operation as the JSON request example in the preceding section; it deletes a single phone number in a grid of phone numbers.

    private void deletePhone(int row)
    {
        FormRequest formRequest = new FormRequest(loginEnv);
        formRequest.setFormName("P0115_W0115A"); 
        formRequest.setFormServiceAction(FormRequest.ACTION_UPDATE);
        formRequest.addToFISet("4", addressNumber);
        formRequest.addToFISet("5", "0");
        
        FSREvent formEvents = new FSREvent();
        
        // Select row to delete
        formEvents.selectRow("1", row);
        
        // Press Delete button.
        formEvents.doControlAction("59");
        
        // Press OK button
        formEvents.doControlAction("4");
        
        // Add event holder to the request
        formRequest.addFSREvent(formEvents);
        
        // Execute form service request and process response
        try
        {      
            String response = JDERestServiceProvider.jdeRestServiceCall(loginEnv, formRequest, JDERestServiceProvider.POST_METHOD, JDERestServiceProvider.FORM_SERVICE_URI);
            
            P0115_W0115A_FormParent newFormParent = loginEnv.getObjectMapper().readValue(response, P0115_W0115A_FormParent.class);
        }
        catch (JDERestServiceException e)
        {
            System.out.println(JDERestServiceProvider.handleServiceException(e));
        }
        catch (Exception e)
        {
            System.out.println(e);
        }
    }

Example 6-10 Request Insert Rows - JSON

This sample code is an example of adding a phone number with two form actions: a grid action that adds a row followed by an OK button selection. The form inputs will get the correct set of phone records for address number 6001, who's who line 0. Also, it is important to note that the formServiceAction code is a U for update, which indicates that the form is in update mode.

{
    "token": "0449WQ44KE69+ahEmpJPStYG/iqyjTCMpmygYwMkveitD0=MDE5MDEwNTI4ODYyMjg4MDczNzU4OTE4OWphdmFjbGllbnQxNDI0NjcyNTU4ODAy",
    "deviceName": "javaclient",
    "formName": "P0115_W0115A",
    "formInputs": [
        {
            "id": "4",
            "value": "6001"
        },
        {
            "id": "5",
            "value": "0"
        }
    ],
    "formServiceAction": "U",
    "formActions": [
        {
            "gridAction": {
                "gridID": "1",
                "gridRowInsertEvents": [
                    {
                        "gridColumnEvents": [
                            {
                                "command": "SetGridCellValue",
                                "columnID": "27",
                                "value": "HOM"
                            },
                            {
                                "command": "SetGridCellValue",
                                "columnID": "28",
                                "value": "303"
                            },
                            {
                                "command": "SetGridCellValue",
                                "columnID": "29",
                                "value": "334-4000"
                            }
                        ]
                    }
                ]
            }
        },
        {
            "command": "DoAction",
            "controlID": "4"
        }
    ]
}

Example 6-11 Insert Rows - JSON Response

{
  "fs_P0115_W0115A" : {
    "title" : "Phone Numbers",
    "data" : {
      "z_DL01_71" : {
        "id" : 71,
        "title" : "Ray Allen",
        "dataType" : 2,
        "visible" : true,
        "bsvw" : false,
        "longName" : "lblDL01_71",
        "value" : "Ray Allen",
        "editable" : false
      },
      "z_ALPH_52" : {
        "id" : 52,
        "title" : "Who's Who Line",
        "dataType" : 2,
        "visible" : true,
        "bsvw" : false,
        "longName" : "lblWhosWhoLine_52",
        "value" : "Who's Who Line",
        "editable" : false
      },
      "z_AN8_7" : {
        "id" : 7,
        "internalValue" : 6001,
        "title" : "Address Number",
        "dataType" : 9,
        "staticText" : "Address Number",
        "visible" : true,
        "mathValue" : {
          "currencyCode" : "",
          "currencyDecimals" : 0,
          "zero" : false,
          "negative" : false,
          "intValue" : 6001,
          "decimalPosition" : 0
        },
        "bsvw" : true,
        "longName" : "txtAddressNumber_7",
        "value" : "6001",
        "editable" : false,
        "assocDesc" : "Allen, Ray"
      },
      "z_DL01_54" : {
        "id" : 54,
        "title" : "Allen, Ray",
        "dataType" : 2,
        "visible" : true,
        "bsvw" : false,
        "longName" : "lblDL01_54",
        "value" : "Allen, Ray",
        "editable" : false
      },
      "gridData" : {
        "titles" : {
          "col_28" : "Prefix",
          "col_29" : "Phone Number",
          "col_27" : "Phone Type",
          "col_66" : "Phone Type Description",
          "col_26" : "Line Number"
        },
        "rowset" : [ {
          "rowIndex" : 0,
          "MOExist" : false,
          "z_AR1_28" : {
            "id" : 28,
            "internalValue" : "303",
            "title" : "Prefix",
            "dataType" : 2,
            "visible" : true,
            "bsvw" : true,
            "longName" : "sPrefix_28",
            "value" : "303",
            "editable" : true
          },
          "z_PH1_29" : {
            "id" : 29,
            "internalValue" : "555-1212",
            "title" : "Phone Number",
            "dataType" : 2,
            "visible" : true,
            "bsvw" : true,
            "longName" : "sPhoneNumber_29",
            "value" : "555-1212",
            "editable" : true
          },
          "z_PHTP_27" : {
            "id" : 27,
            "internalValue" : "CAR",
            "title" : "Phone Type",
            "dataType" : 2,
            "visible" : true,
            "bsvw" : true,
            "longName" : "sPhoneType_27",
            "value" : "CAR",
            "editable" : true
          },
          "z_DL01_66" : {
            "id" : 66,
            "internalValue" : "Car or Mobile",
            "title" : "Phone Type Description",
            "dataType" : 2,
            "visible" : true,
            "bsvw" : false,
            "longName" : "sPhoneTypeDescription_66",
            "value" : "Car or Mobile",
            "editable" : false
          },
          "z_RCK7_26" : {
            "id" : 26,
            "internalValue" : 1,
            "title" : "Line Number",
            "dataType" : 9,
            "visible" : true,
            "mathValue" : {
              "currencyCode" : "",
              "currencyDecimals" : 0,
              "zero" : false,
              "negative" : false,
              "intValue" : 1,
              "decimalPosition" : 0
            },
            "bsvw" : true,
            "longName" : "mnLineNumber_26",
            "value" : "1",
            "editable" : false
          }
        }, {
          "rowIndex" : 1,
          "MOExist" : false,
          "z_AR1_28" : {
            "id" : 28,
            "internalValue" : "303",
            "title" : "Prefix",
            "dataType" : 2,
            "visible" : true,
            "bsvw" : true,
            "longName" : "sPrefix_28",
            "value" : "303",
            "editable" : true
          },
          "z_PH1_29" : {
            "id" : 29,
            "internalValue" : "334-4000",
            "title" : "Phone Number",
            "dataType" : 2,
            "visible" : true,
            "bsvw" : true,
            "longName" : "sPhoneNumber_29",
            "value" : "334-4000",
            "editable" : true
          },
          "z_PHTP_27" : {
            "id" : 27,
            "internalValue" : "HOM",
            "title" : "Phone Type",
            "dataType" : 2,
            "visible" : true,
            "bsvw" : true,
            "longName" : "sPhoneType_27",
            "value" : "HOM",
            "editable" : true
          },
          "z_DL01_66" : {
            "id" : 66,
            "internalValue" : "Home",
            "title" : "Phone Type Description",
            "dataType" : 2,
            "visible" : true,
            "bsvw" : false,
            "longName" : "sPhoneTypeDescription_66",
            "value" : "Home",
            "editable" : false
          },
          "z_RCK7_26" : {
            "id" : 26,
            "internalValue" : 2,
            "title" : "Line Number",
            "dataType" : 9,
            "visible" : true,
            "mathValue" : {
              "currencyCode" : "",
              "currencyDecimals" : 0,
              "zero" : false,
              "negative" : false,
              "intValue" : 2,
              "decimalPosition" : 0
            },
            "bsvw" : true,
            "longName" : "mnLineNumber_26",
            "value" : "2",
            "editable" : false
          }
        } ],
        "summary" : {
          "records" : 2,
          "moreRecords" : false
        }
      },
      "z_AN8_6" : {
        "id" : 6,
        "title" : "Address Number",
        "dataType" : 9,
        "visible" : true,
        "bsvw" : false,
        "longName" : "lblAddressNumber_6",
        "value" : "Address Number",
        "editable" : false
      },
      "z_IDLN_32" : {
        "id" : 32,
        "internalValue" : 0,
        "title" : "Who&#39;s Who Line",
        "dataType" : 9,
        "visible" : true,
        "mathValue" : {
          "currencyCode" : "",
          "currencyDecimals" : 0,
          "zero" : true,
          "negative" : false,
          "intValue" : 0,
          "decimalPosition" : 0
        },
        "bsvw" : true,
        "longName" : "txtWhosWhoLine_32",
        "value" : "0",
        "editable" : false,
        "assocDesc" : "Ray Allen"
      }
    },
    "errors" : [ ],
    "warnings" : [ ]
  },
  "stackId" : 1,
  "stateId" : 1,
  "rid" : "93f87493f9d19a14",
  "currentApp" : "P0115_W0115A",
  "sysErrors" : [ ]
}

Example 6-12 Insert Rows - ADF Application Code

This sample code is an example of adding one new phone number using grid actions.

Important: Your ADF application should add records only when the record count is below the maximum. You can determine this by checking the moreRecords field in the grid summary when you fetch existing records. You will not receive an error message if you attempt to add a record beyond the maximum allowed. The record will simply not be added.

    public void addPhone()
    {
        try
        {
            loginEnv.getRequiredCapabilities().add(AISClientCapability.GRID);
            FormRequest formRequest = new FormRequest(loginEnv);
            
            formRequest.setFormName("P0115_W0115A"); 
            formRequest.setFormServiceAction(FormRequest.ACTION_UPDATE);
            formRequest.addToFISet("4", addressNumber);
            formRequest.addToFISet("5", "0");
            
            FSREvent formEvents = new FSREvent();
            GridAction gridAction = new GridAction(loginEnv);
            
            // Add new grid row to grid action
            GridRowInsertEvent rowInsert = new GridRowInsertEvent();
            rowInsert.setGridColumnValue("27", phoneType);
            rowInsert.setGridColumnValue("28", phonePrefix);
            rowInsert.setGridColumnValue("29", phoneNumber);
            gridAction.insertGridRow("1", rowInsert);
  
            // Add grid action to form events
            formEvents.addGridAction(gridAction);
            
            // Press OK button
            formEvents.doControlAction("4");
            
            // Add event holder to the request
            formRequest.addFSREvent(formEvents);
        
            // Execute form service request and process response
            String response = JDERestServiceProvider.jdeRestServiceCall(loginEnv, formRequest, JDERestServiceProvider.POST_METHOD, JDERestServiceProvider.FORM_SERVICE_URI);
            
            P0115_W0115A_FormParent newFormParent = loginEnv.getObjectMapper().readValue(response, P0115_W0115A_FormParent.class);
        }
        catch (CapabilityException e)
        {
            System.out.println("Grid action capability not supported.");  
        }
        catch (JDERestServiceException e)
        {
            System.out.println(JDERestServiceProvider.handleServiceException(e));
        }
        catch (Exception e)
        {
            System.out.println(e);
        }
    }

Example 6-13 Request Update Rows - JSON

This sample code is an example of updating a phone number. You must specify the index of the row you want to update. The row index is included in the information returned when you query the grid. Therefore, you must perform a query before you update a row. In this example, the JSON code updates row 1 and sets values in each of the three columns for this row.

This sample code also includes syntax that shows a column that contains a drop-down selection. The value should be the 'code' value, not the description.

This sample code shows the phones update request:

{
    "token": "04462IGg6KFX/zTq02/bmYxxXl+SPnJsvD9zbTZ+bDAFxA=MDIwMDEwLTM0NzkyOTQwNDM4MzI5MTc1MDhqYXZhY2xpZW50MTQyNDY3MzM1NjIzNA==",
    "deviceName": "javaclient",
    "formName": "P0115_W0115A",
    "formInputs": [
        {
            "id": "4",
            "value": "6001"
        },
        {
            "id": "5",
            "value": "0"
        }
    ],
    "formServiceAction": "U",
    "formActions": [
        {
            "gridAction": {
                "gridID": "1",
                "gridRowUpdateEvents": [
                    {
                        "rowNumber": 1,
                        "gridColumnEvents": [
                            {
                                "command": "SetGridCellValue",
                                "columnID": "27",
                                "value": "FAX"
                            },
                            {
                                "command": "SetGridCellValue",
                                "columnID": "28",
                                "value": "720"
                            },
                            {
                                "command": "SetGridCellValue",
                                "columnID": "29",
                                "value": "334-4010"
                            }
                        ]
                    }
                ]
            }
        },
        {
            "command": "DoAction",
            "controlID": "4"
        }
    ]
}

Example 6-14 Update Rows - JSON Response

{
  "fs_P0115_W0115A" : {
    "title" : "Phone Numbers",
    "data" : {
      "z_DL01_71" : {
        "id" : 71,
        "title" : "Ray Allen",
        "dataType" : 2,
        "visible" : true,
        "bsvw" : false,
        "longName" : "lblDL01_71",
        "value" : "Ray Allen",
        "editable" : false
      },
      "z_ALPH_52" : {
        "id" : 52,
        "title" : "Who's Who Line",
        "dataType" : 2,
        "visible" : true,
        "bsvw" : false,
        "longName" : "lblWhosWhoLine_52",
        "value" : "Who's Who Line",
        "editable" : false
      },
      "z_AN8_7" : {
        "id" : 7,
        "internalValue" : 6001,
        "title" : "Address Number",
        "dataType" : 9,
        "staticText" : "Address Number",
        "visible" : true,
        "mathValue" : {
          "currencyCode" : "",
          "currencyDecimals" : 0,
          "zero" : false,
          "negative" : false,
          "intValue" : 6001,
          "decimalPosition" : 0
        },
        "bsvw" : true,
        "longName" : "txtAddressNumber_7",
        "value" : "6001",
        "editable" : false,
        "assocDesc" : "Allen, Ray"
      },
      "z_DL01_54" : {
        "id" : 54,
        "title" : "Allen, Ray",
        "dataType" : 2,
        "visible" : true,
        "bsvw" : false,
        "longName" : "lblDL01_54",
        "value" : "Allen, Ray",
        "editable" : false
      },
      "gridData" : {
        "titles" : {
          "col_28" : "Prefix",
          "col_29" : "Phone Number",
          "col_27" : "Phone Type",
          "col_66" : "Phone Type Description",
          "col_26" : "Line Number"
        },
        "rowset" : [ {
          "rowIndex" : 0,
          "MOExist" : false,
          "z_AR1_28" : {
            "id" : 28,
            "internalValue" : "303",
            "title" : "Prefix",
            "dataType" : 2,
            "visible" : true,
            "bsvw" : true,
            "longName" : "sPrefix_28",
            "value" : "303",
            "editable" : true
          },
          "z_PH1_29" : {
            "id" : 29,
            "internalValue" : "555-1212",
            "title" : "Phone Number",
            "dataType" : 2,
            "visible" : true,
            "bsvw" : true,
            "longName" : "sPhoneNumber_29",
            "value" : "555-1212",
            "editable" : true
          },
          "z_PHTP_27" : {
            "id" : 27,
            "internalValue" : "CAR",
            "title" : "Phone Type",
            "dataType" : 2,
            "visible" : true,
            "bsvw" : true,
            "longName" : "sPhoneType_27",
            "value" : "CAR",
            "editable" : true
          },
          "z_DL01_66" : {
            "id" : 66,
            "internalValue" : "Car or Mobile",
            "title" : "Phone Type Description",
            "dataType" : 2,
            "visible" : true,
            "bsvw" : false,
            "longName" : "sPhoneTypeDescription_66",
            "value" : "Car or Mobile",
            "editable" : false
          },
          "z_RCK7_26" : {
            "id" : 26,
            "internalValue" : 1,
            "title" : "Line Number",
            "dataType" : 9,
            "visible" : true,
            "mathValue" : {
              "currencyDecimals" : 0,
              "zero" : false,
              "negative" : false,
              "intValue" : 1,
              "decimalPosition" : 0
            },
            "bsvw" : true,
            "longName" : "mnLineNumber_26",
            "value" : "1",
            "editable" : false
          }
        }, {
          "rowIndex" : 1,
          "MOExist" : false,
          "z_AR1_28" : {
            "id" : 28,
            "internalValue" : "720",
            "title" : "Prefix",
            "dataType" : 2,
            "visible" : true,
            "bsvw" : true,
            "longName" : "sPrefix_28",
            "value" : "720",
            "editable" : true
          },
          "z_PH1_29" : {
            "id" : 29,
            "internalValue" : "334-4010",
            "title" : "Phone Number",
            "dataType" : 2,
            "visible" : true,
            "bsvw" : true,
            "longName" : "sPhoneNumber_29",
            "value" : "334-4010",
            "editable" : true
          },
          "z_PHTP_27" : {
            "id" : 27,
            "internalValue" : "FAX",
            "title" : "Phone Type",
            "dataType" : 2,
            "visible" : true,
            "bsvw" : true,
            "longName" : "sPhoneType_27",
            "value" : "FAX",
            "editable" : true
          },
          "z_DL01_66" : {
            "id" : 66,
            "internalValue" : "FAX",
            "title" : "Phone Type Description",
            "dataType" : 2,
            "visible" : true,
            "bsvw" : false,
            "longName" : "sPhoneTypeDescription_66",
            "value" : "FAX",
            "editable" : false
          },
          "z_RCK7_26" : {
            "id" : 26,
            "internalValue" : 2,
            "title" : "Line Number",
            "dataType" : 9,
            "visible" : true,
            "mathValue" : {
              "currencyDecimals" : 0,
              "zero" : false,
              "negative" : false,
              "intValue" : 2,
              "decimalPosition" : 0
            },
            "bsvw" : true,
            "longName" : "mnLineNumber_26",
            "value" : "2",
            "editable" : false
          }
        } ],
        "summary" : {
          "records" : 2,
          "moreRecords" : false
        }
      },
      "z_AN8_6" : {
        "id" : 6,
        "title" : "Address Number",
        "dataType" : 9,
        "visible" : true,
        "bsvw" : false,
        "longName" : "lblAddressNumber_6",
        "value" : "Address Number",
        "editable" : false
      },
      "z_IDLN_32" : {
        "id" : 32,
        "internalValue" : 0,
        "title" : "Who&#39;s Who Line",
        "dataType" : 9,
        "visible" : true,
        "mathValue" : {
          "currencyCode" : "",
          "currencyDecimals" : 0,
          "zero" : true,
          "negative" : false,
          "intValue" : 0,
          "decimalPosition" : 0
        },
        "bsvw" : true,
        "longName" : "txtWhosWhoLine_32",
        "value" : "0",
        "editable" : false,
        "assocDesc" : "Ray Allen"
      }
    },
    "errors" : [ ],
    "warnings" : [ ]
  },
  "stackId" : 1,
  "stateId" : 1,
  "rid" : "d483223d39880eb",
  "currentApp" : "P0115_W0115A",
  "sysErrors" : [ ]
}

Example 6-15 Update Rows - ADF Application Code

This sample code is an example of updating a single phone row from an ADF application.

    public void updatePhone(int row)
    {
        try
        {
            loginEnv.getRequiredCapabilities().add(AISClientCapability.GRID);
            FormRequest formRequest = new FormRequest(loginEnv);
            
            formRequest.setFormName("P0115_W0115A"); 
            formRequest.setFormServiceAction(FormRequest.ACTION_UPDATE);
            formRequest.addToFISet("4", addressNumber);
            formRequest.addToFISet("5", "0");
            
            FSREvent formEvents = new FSREvent();
            GridAction gridAction = new GridAction(loginEnv);
            
            // Add grid row update to grid action
            GridRowUpdateEvent rowUpdate = new GridRowUpdateEvent();
            rowUpdate.setGridColumnValue("27", phoneType);
            rowUpdate.setGridColumnValue("28", phonePrefix);
            rowUpdate.setGridColumnValue("29", phoneNumber);
            
            // Update row identified by its index (zero-based)
            gridAction.updateGridRow("1", row, rowUpdate);
        
            // Add grid action to form events
            formEvents.addGridAction(gridAction);
            
            // Press OK button
            formEvents.doControlAction("4");
            
            // Add event holder to the request
            formRequest.addFSREvent(formEvents);
        
            // Execute form service request and process response
            String response = JDERestServiceProvider.jdeRestServiceCall(loginEnv, formRequest, JDERestServiceProvider.POST_METHOD, JDERestServiceProvider.FORM_SERVICE_URI);
            P0115_W0115A_FormParent newFormParent = loginEnv.getObjectMapper().readValue(response, P0115_W0115A_FormParent.class);
        }
        catch (CapabilityException e)
        {
            System.out.println("Grid action capability not supported.");  
        }
        catch (JDERestServiceException e)
        {
            System.out.println(JDERestServiceProvider.handleServiceException(e));
        }
        catch (Exception e)
        {
            System.out.println(e);
        }
    }

6.4 Understanding Batch Form Service

If you make several sequential calls to forms without any data dependencies between them, consider using the Batch Form Service. The Batch Form Service will improve your ADF application's performance.

6.4.1 Batch Form Service - JSON Input and Output

The Batch Form Service requires JSON input and output.

The request URL is: POST http://aisserver:port/jderest/batchformservice

You can use this URL in a REST testing tool. In the preceding URL, batchformservice represents the URI, which you define when you perform the jdeRestServiceCall from the API.

The following examples show JSON input and JSON output in a Batch Form Service.

Example 6-16 JSON Input in a Batch Form Request

The JSON consists of an array of form requests along with other single form request fields such as token, environment, role, and so forth. You may send as many requests as desired to the same or different form. Each request is executed individually by the EnterpriseOne HTML (JAS) Server and all responses are compiled into a single response.

This example shows a request for two form executions: P01012_W01012B and P0115_W0115A. Each have different form interconnect sets, control sets, and so forth. They are completely independent requests.

{
    "token": "044YQDBopCiD3hGUgEOalPmsWsf4/fPpc9ijQs0WcCp/2I=MDE5MDEwMjYxMzQ2OTM1NzUzNDc3MTEwM2phdmFjbGllbnQxNDI0NzA3NDUzODM2",
    "deviceName": "javaclient",
    "formRequests": [
        {
            "formName": "P01012_W01012B",
            "version": "ZJDE0001",
            "formServiceAction": "R",
            "formActions": [
                {
                    "command": "SetQBEValue",
                    "controlID": "1[19]",
                    "value": "6001"
                },
                {
                    "command": "SetControlValue",
                    "controlID": "54",
                    "value": "E"
                },
                {
                    "command": "SetCheckboxValue",
                    "controlID": "62",
                    "value": "on"
                },
                {
                    "command": "SetCheckboxValue",
                    "controlID": "63",
                    "value": "on"
                },
                {
                    "command": "DoAction",
                    "controlID": "15"
                }
            ]
        },
        {
            "formName": "P0115_W0115A",
            "formInputs": [
                {
                    "id": "4",
                    "value": "6001"
                },
                {
                    "id": "5",
                    "value": "0"
                }
            ],
            "formServiceAction": "R"
        }
    ]
}

Example 6-17 JSON Output in a Batch Form Service

The JSON output contains one form element for each form that is called. The forms are numbered in the order they were requested. This is not an array of elements; they are individually defined.

The following sample code is an example of JSON output. For fs_0_P01012_W01012B, the 0 indicates it was the first form requested. For fs_1_P0115_W0115A, the 1 indicates it was the second form requested.

{
  "fs_0_P01012_W01012B" : {
    "title" : "Work With Addresses",
    "data" : {
      "z_AT1_53" : {
        "id" : 53,
        "title" : "Search Type",
        "dataType" : 2,
        "visible" : true,
        "bsvw" : false,
        "longName" : "lblSearchType_53",
        "value" : "Search Type",
        "editable" : false
      },
      "z_AT1_54" : {
        "id" : 54,
        "internalValue" : "E",
        "title" : "Search Type",
        "dataType" : 2,
        "staticText" : "Search Type",
        "visible" : true,
        "bsvw" : true,
        "longName" : "txtSearchType_54",
        "value" : "E",
        "editable" : true,
        "assocDesc" : "Employees"
      },
      "z_ALPH_57" : {
        "id" : 57,
        "title" : "Alpha Name",
        "dataType" : 2,
        "visible" : true,
        "bsvw" : false,
        "longName" : "lblAlphaName_57",
        "value" : "Alpha Name",
        "editable" : false
      },
      "z_ALPH_58" : {
        "id" : 58,
        "internalValue" : " ",
        "title" : "Alpha Name",
        "dataType" : 2,
        "staticText" : "Alpha Name",
        "visible" : true,
        "bsvw" : false,
        "longName" : "txtAlphaName_58",
        "value" : " ",
        "editable" : true
      },
      "z_DL01_66" : {
        "id" : 66,
        "title" : "Employees",
        "dataType" : 2,
        "visible" : true,
        "bsvw" : false,
        "longName" : "lblDL01_66",
        "value" : "Employees",
        "editable" : false
      },
      "z_EV01_63" : {
        "id" : 63,
        "internalValue" : "1",
        "title" : "Display Address",
        "dataType" : 1,
        "visible" : true,
        "bsvw" : false,
        "longName" : "chkDisplayAddress_63",
        "value" : "on",
        "editable" : true
      },
      "z_EV01_62" : {
        "id" : 62,
        "internalValue" : "1",
        "title" : "Display Phone",
        "dataType" : 1,
        "visible" : true,
        "bsvw" : false,
        "longName" : "chkDisplayPhone_62",
        "value" : "on",
        "editable" : true
      },
      "gridData" : {
        "titles" : {
          "col_19" : "Address Number",
          "col_20" : "Alpha Name",
          "col_40" : "Address Line 1",
          "col_44" : "City",
          "col_81" : "Prefix",
          "col_46" : "Phone Number",
          "col_47" : "Phone Type",
          "col_48" : "Long Address",
          "col_49" : "Industry Class",
          "col_50" : "Sch Typ",
          "col_51" : "Tax ID"
        },
        "rowset" : [ {
          "rowIndex" : 0,
          "MOExist" : true,
          "z_AN8_19" : {
            "id" : 19,
            "internalValue" : 6001,
            "title" : "Address Number",
            "dataType" : 9,
            "visible" : true,
            "mathValue" : {
              "currencyDecimals" : 0,
              "zero" : false,
              "negative" : false,
              "intValue" : 6001,
              "decimalPosition" : 0
            },
            "bsvw" : true,
            "longName" : "mnAddressNumber_19",
            "value" : "6001",
            "editable" : false
          },
          "z_ALPH_20" : {
            "id" : 20,
            "internalValue" : "Allen, Ray",
            "title" : "Alpha Name",
            "dataType" : 2,
            "visible" : true,
            "bsvw" : true,
            "longName" : "sAlphaName_20",
            "value" : "Allen, Ray",
            "editable" : false
          },
          "z_ADD1_40" : {
            "id" : 40,
            "internalValue" : "410 17th Avenue",
            "title" : "Address Line 1",
            "dataType" : 2,
            "visible" : true,
            "bsvw" : false,
            "longName" : "sAddressLine1_40",
            "value" : "410 17th Avenue",
            "editable" : false
          },
          "z_CTY1_44" : {
            "id" : 44,
            "internalValue" : "Denver",
            "title" : "City",
            "dataType" : 2,
            "visible" : true,
            "bsvw" : false,
            "longName" : "sCity_44",
            "value" : "Denver",
            "editable" : false
          },
          "z_AR1_81" : {
            "id" : 81,
            "internalValue" : "303",
            "title" : "Prefix",
            "dataType" : 2,
            "visible" : true,
            "bsvw" : false,
            "longName" : "sPrefix_81",
            "value" : "303",
            "editable" : false
          },
          "z_PH3_46" : {
            "id" : 46,
            "internalValue" : "555-1212",
            "title" : "Phone Number",
            "dataType" : 2,
            "visible" : true,
            "bsvw" : false,
            "longName" : "sPhoneNumber_46",
            "value" : "555-1212",
            "editable" : false
          },
          "z_PHTP_47" : {
            "id" : 47,
            "internalValue" : "CAR",
            "title" : "Phone Type",
            "dataType" : 2,
            "visible" : true,
            "bsvw" : false,
            "longName" : "sPhoneType_47",
            "value" : "CAR",
            "editable" : false
          },
          "z_ALKY_48" : {
            "id" : 48,
            "internalValue" : " ",
            "title" : "Long Address",
            "dataType" : 2,
            "visible" : true,
            "bsvw" : true,
            "longName" : "sLongAddress_48",
            "value" : " ",
            "editable" : false
          },
          "z_SIC_49" : {
            "id" : 49,
            "internalValue" : " ",
            "title" : "Industry Class",
            "dataType" : 2,
            "visible" : true,
            "bsvw" : true,
            "longName" : "sIndustryClass_49",
            "value" : " ",
            "editable" : false
          },
          "z_AT1_50" : {
            "id" : 50,
            "internalValue" : "E",
            "title" : "Sch Typ",
            "dataType" : 2,
            "visible" : true,
            "bsvw" : true,
            "longName" : "sSchTyp_50",
            "value" : "E",
            "editable" : false
          },
          "z_TAX_51" : {
            "id" : 51,
            "internalValue" : "798525841",
            "title" : "Tax ID",
            "dataType" : 2,
            "visible" : true,
            "bsvw" : true,
            "longName" : "sTaxID_51",
            "value" : "798525841",
            "editable" : false
          }
        } ],
        "summary" : {
          "records" : 1,
          "moreRecords" : false
        }
      }
    },
    "errors" : [ ],
    "warnings" : [ ]
  },
  "fs_1_P0115_W0115A" : {
    "title" : "Phone Numbers",
    "data" : {
      "z_DL01_71" : {
        "id" : 71,
        "title" : "Ray Allen",
        "dataType" : 2,
        "visible" : true,
        "bsvw" : false,
        "longName" : "lblDL01_71",
        "value" : "Ray Allen",
        "editable" : false
      },
      "z_ALPH_52" : {
        "id" : 52,
        "title" : "Who's Who Line",
        "dataType" : 2,
        "visible" : true,
        "bsvw" : false,
        "longName" : "lblWhosWhoLine_52",
        "value" : "Who's Who Line",
        "editable" : false
      },
      "z_AN8_7" : {
        "id" : 7,
        "internalValue" : 6001,
        "title" : "Address Number",
        "dataType" : 9,
        "staticText" : "Address Number",
        "visible" : true,
        "mathValue" : {
          "currencyCode" : "",
          "currencyDecimals" : 0,
          "zero" : false,
          "negative" : false,
          "intValue" : 6001,
          "decimalPosition" : 0
        },
        "bsvw" : true,
        "longName" : "txtAddressNumber_7",
        "value" : "6001",
        "editable" : false,
        "assocDesc" : "Allen, Ray"
      },
      "z_DL01_54" : {
        "id" : 54,
        "title" : "Allen, Ray",
        "dataType" : 2,
        "visible" : true,
        "bsvw" : false,
        "longName" : "lblDL01_54",
        "value" : "Allen, Ray",
        "editable" : false
      },
      "gridData" : {
        "titles" : {
          "col_28" : "Prefix",
          "col_29" : "Phone Number",
          "col_27" : "Phone Type",
          "col_66" : "Phone Type Description",
          "col_26" : "Line Number"
        },
        "rowset" : [ {
          "rowIndex" : 0,
          "MOExist" : false,
          "z_AR1_28" : {
            "id" : 28,
            "internalValue" : "303",
            "title" : "Prefix",
            "dataType" : 2,
            "visible" : true,
            "bsvw" : true,
            "longName" : "sPrefix_28",
            "value" : "303",
            "editable" : true
          },
          "z_PH1_29" : {
            "id" : 29,
            "internalValue" : "555-1212",
            "title" : "Phone Number",
            "dataType" : 2,
            "visible" : true,
            "bsvw" : true,
            "longName" : "sPhoneNumber_29",
            "value" : "555-1212",
            "editable" : true
          },
          "z_PHTP_27" : {
            "id" : 27,
            "internalValue" : "CAR",
            "title" : "Phone Type",
            "dataType" : 2,
            "visible" : true,
            "bsvw" : true,
            "longName" : "sPhoneType_27",
            "value" : "CAR",
            "editable" : true
          },
          "z_DL01_66" : {
            "id" : 66,
            "internalValue" : "Car or Mobile",
            "title" : "Phone Type Description",
            "dataType" : 2,
            "visible" : true,
            "bsvw" : false,
            "longName" : "sPhoneTypeDescription_66",
            "value" : "Car or Mobile",
            "editable" : false
          },
          "z_RCK7_26" : {
            "id" : 26,
            "internalValue" : 1,
            "title" : "Line Number",
            "dataType" : 9,
            "visible" : true,
            "mathValue" : {
              "currencyDecimals" : 0,
              "zero" : false,
              "negative" : false,
              "intValue" : 1,
              "decimalPosition" : 0
            },
            "bsvw" : true,
            "longName" : "mnLineNumber_26",
            "value" : "1",
            "editable" : false
          }
        }, {
          "rowIndex" : 1,
          "MOExist" : false,
          "z_AR1_28" : {
            "id" : 28,
            "internalValue" : "720",
            "title" : "Prefix",
            "dataType" : 2,
            "visible" : true,
            "bsvw" : true,
            "longName" : "sPrefix_28",
            "value" : "720",
            "editable" : true
          },
          "z_PH1_29" : {
            "id" : 29,
            "internalValue" : "334-4010",
            "title" : "Phone Number",
            "dataType" : 2,
            "visible" : true,
            "bsvw" : true,
            "longName" : "sPhoneNumber_29",
            "value" : "334-4010",
            "editable" : true
          },
          "z_PHTP_27" : {
            "id" : 27,
            "internalValue" : "FAX",
            "title" : "Phone Type",
            "dataType" : 2,
            "visible" : true,
            "bsvw" : true,
            "longName" : "sPhoneType_27",
            "value" : "FAX",
            "editable" : true
          },
          "z_DL01_66" : {
            "id" : 66,
            "internalValue" : "FAX",
            "title" : "Phone Type Description",
            "dataType" : 2,
            "visible" : true,
            "bsvw" : false,
            "longName" : "sPhoneTypeDescription_66",
            "value" : "FAX",
            "editable" : false
          },
          "z_RCK7_26" : {
            "id" : 26,
            "internalValue" : 2,
            "title" : "Line Number",
            "dataType" : 9,
            "visible" : true,
            "mathValue" : {
              "currencyDecimals" : 0,
              "zero" : false,
              "negative" : false,
              "intValue" : 2,
              "decimalPosition" : 0
            },
            "bsvw" : true,
            "longName" : "mnLineNumber_26",
            "value" : "2",
            "editable" : false
          }
        } ],
        "summary" : {
          "records" : 2,
          "moreRecords" : false
        }
      },
      "z_AN8_6" : {
        "id" : 6,
        "title" : "Address Number",
        "dataType" : 9,
        "visible" : true,
        "bsvw" : false,
        "longName" : "lblAddressNumber_6",
        "value" : "Address Number",
        "editable" : false
      },
      "z_IDLN_32" : {
        "id" : 32,
        "internalValue" : 0,
        "title" : "Who&#39;s Who Line",
        "dataType" : 9,
        "visible" : true,
        "mathValue" : {
          "currencyDecimals" : 0,
          "zero" : true,
          "negative" : false,
          "intValue" : 0,
          "decimalPosition" : 0
        },
        "bsvw" : true,
        "longName" : "txtWhosWhoLine_32",
        "value" : "0",
        "editable" : false,
        "assocDesc" : "Ray Allen"
      }
    },
    "errors" : [ ],
    "warnings" : [ ]
  }
}

6.4.2 Implementing the Batch Form Service

This section describes how to implement the Batch Form Service in your ADF application.

6.4.2.1 Batch Request Parent Class

To consume the JSON response, the ADF application must have a class that matches the response. You must manually code this class because you have to provide the forms in the order in which they are being called.

Example 6-18 Batch Request Parent Class

The following sample code is an example of what the new class looks like with one member defined, with the form level type for each of the forms called. Notice that the names of the class members match the names returned by the JSON response. This is the most important aspect of the class, to enable the deserialization from JSON to this object.

The form objects, which are P01012_W01012B and P0115_W0115A in the following sample code, are the same ones generated by the AIS Client Class Generator and are used for a single form request.

package com.oracle.e1.formservicetypes;
 
 
public class BatchResponseParent
{
    private P01012_W01012B fs_0_P01012_W01012B;
    private P0115_W0115A fs_1_P0115_W0115A;
    
    public BatchResponseParent()
    {
    }
    
    // Getters and setters for each class variable.
    
}

6.4.2.2 Performing a Batch Form Request

In the data control class, create a method for performing the batch form request. An example of a method named batchFormRequest() follows the steps below.

To create this method:

  1. Create a BatchFormRequest object.

  2. Add each form request to the list of requests. Each form request is an object called SingleFormRequest.

  3. Populate these requests in the same manner that you would use for a single form request.

  4. Call the service with uri JDERestServiceProvider.BATCH_FORM_SERVICE_URI and marshal the JSON response to an instance of BatchResponseParent class.

Example 6-19 Batch Form Request

You can use each member of the BatchResponseParent class the same way you would use the response from a single form request. In the following sample code, each form in the batch is saved to a member variable of the main data control class.

    public void performBatchFormServiceRequest()
    {
        BatchFormRequest batchFormRequest = new BatchFormRequest(loginEnv);
        
        SingleFormRequest w01012BFormRequest = new SingleFormRequest();
        w01012BFormRequest.setFormName("P01012_W01012B"); 
        w01012BFormRequest.setVersion("ZJDE0001");
        w01012BFormRequest.setFormServiceAction(FormRequest.ACTION_READ);
        
        FSREvent formEvents = new FSREvent();
        formEvents.setQBEValue("1[19]", addressNumber);
        formEvents.setFieldValue("54", "E");
        formEvents.checkBoxChecked("62");
        formEvents.checkBoxChecked("63");
        formEvents.doControlAction("15");
        w01012BFormRequest.addFSREvent(formEvents);
        batchFormRequest.getFormRequests().add(w01012BFormRequest);
        
        SingleFormRequest w0115AFormRequest = new SingleFormRequest();
        w0115AFormRequest.setFormName("P0115_W0115A"); 
        w0115AFormRequest.setFormServiceAction(FormRequest.ACTION_READ);
        w0115AFormRequest.addToFISet("4", addressNumber);
        w0115AFormRequest.addToFISet("5", "0");
        batchFormRequest.getFormRequests().add(w0115AFormRequest);
        
        try
        {
            // Execute form service request and process response            
            String response = JDERestServiceProvider.jdeRestServiceCall(loginEnv, batchFormRequest, JDERestServiceProvider.POST_METHOD, JDERestServiceProvider.BATCH_FORM_SERVICE_URI);
            
            BatchResponseParent newBatchResponseParent = loginEnv.getObjectMapper().readValue(response, BatchResponseParent.class);
            
            if (newBatchResponseParent != null)
            {
                w01012BFormResponse = newBatchResponseParent.getFs_0_P01012_W01012B();
                if (w01012BFormResponse != null)
                {
                    // Retrieve form response data
                }
                
                w0115AFormResponse = newBatchRequestParent.getFs_1_P0115_W0115A();
                if (w0115AFormResponse != null)
                {
                    // Retrieve form response data
                }
            }
        }
        catch (JDERestServiceException e)
        {
            System.out.println(JDERestServiceProvider.handleServiceException(e));
        }
        catch (Exception e)
        {
            System.out.println(e);
        }
    }

6.5 Working with the EnterpriseOne REST Services Interface

You can make REST calls directly to the AIS Server without using APIs from the AIS_client.jar. Use a REST service testing tool to call AIS services directly by sending JSON text to the URL for the service. All services are accessed using URLs with this format:

http://<server>:<port>/jderest/<URI>

See Section 2.3.4, "EnterpriseOne Rest Services Interface" for an illustration of JSON input and output communication between an ADF device and the AIS Server and between the AIS Server and the EnterpriseOne HTML Server.

The following services are available on the AIS Server, along with the HTTP method used to access them. Unless otherwise stated, the request and response are in the form of JSON strings.

URI HTTP Method Description
/defaultconfig GET Response includes information about the AIS Server including the release level, JAS configuration and capabilities list. Different versions of AIS have different capabilities, even if the client API you are using is up to date with the latest capabilities, the AIS Server may not be.
/tokenrequest POST Based on the input, the response will contain login information including a login token and user details.
/formservice POST Based on the input, the response will contain a JSON representation of the form requested.
/batchformservice POST Based on the input, the response will contain a JSON representation of all of the forms requested.
/file/gettext POST Based on the input, the response will contain the text for the first text media object.
/file/updatetext POST Based on the input, the response will contain the status of the text update.
/file/list POST Based on the input, the response will contain the list of media objects for the structure and key requested.
/file/upload POST (Multi-part Form) The response will contain the details of the uploaded file, including the media object sequence number
/file/download POST This response is a Multi-Part form including the data for the attachment.
/file/delete POST The response indicates the success or failure to delete the media object for the sequence number passed in.
/poservice POST Based on the input, the response will contain the processing option values for the requested application and version.
/log POST Based on the input, the AIS Server will write a log entry with the information passed to the log service.
/appstack POST This service is available starting with the Tools 9.1 Update 5 release.

Based on the input, the response will contain the current form open on the stack and any stack related information.

/jargonservice POST This service enables you to retrieve data item descriptions for any EnterpriseOne data dictionary item based on the users language and jargon (system) code. This service depends on language packs applied to the EnterpriseOne system as well as data item description overrides entered with jargon codes. If there is no language pack or no overrides, then the base data item description is returned.

6.5.1 Using a REST Services Client to Interact with AIS

In the text area in the bottom left of the form, enter the JSON string that is the input to the tokenrequest service. Entering an environment and role is optional. Include them only if you want to override the default values.

Example 6-20 Acceptable Output for the defaultconfig Service on JSON

The defaultconfig service is the only service that uses an HTTP GET operation. It accepts one parameter for the required capabilities in the client application. If any required capabilities listed in that parameter are missing, the response will indicate the missing capabilities in the "requiredCapabilityMissing" field.

{
   "jasHost": "jasserver.domain.com",
   "jasPort": "8412",
   "jasProtocol": "http",
   "defaultEnvironment": "DV910",
   "defaultRole": "*ALL",
   "displayEnvironment": true,
   "displayRole": true,
   "displayJasServer": false,
   "defaultJasServer": "http://jasserver.domain.com:port",
   "ssoAllowed": true,
   "allowSelfSignedSsl": false,
   "sessionTimeout": "30",
   "timeToLive": "720",
   "aisVersion": "EnterpriseOne 9.1.4.6",
   "capabilityList":    [
            {
         "name": "grid",
         "shortDescription": "Grid Actions",
         "longDescription": "Ability to update, insert and delete grid records.",
         "asOfRelease": "9.1.4.4"
      },
            {
         "name": "editable",
         "shortDescription": "Enabled/Disabled",
         "longDescription": "Ability to indicate if form field or grid cell is editable (enabled) or not (disabled).",
         "asOfRelease": "9.1.4.4"
      },
            {
         "name": "log",
         "shortDescription": "Logging",
         "longDescription": "Endpoint exposed for logging to AIS server log from client",
         "asOfRelease": "9.1.4.6"
      },
            {
         "name": "processingOption",
         "shortDescription": "Processing Options",
         "longDescription": "Processing Option Service exposed for fetching PO values from E1",
         "asOfRelease": "9.1.4.6"
      },
            {
         "name": "ignoreFDAFindOnEntry",
         "shortDescription": "Ignore FDA Find On Entry",
         "longDescription": "Ability to use the IgnoreFDAFindOnEntry flag",
         "asOfRelease": "9.1.4.6"
      }
   ],
   "requiredCapabilityMissing": false,
   "keepJasSessionOpen": true,
   "jasSessionCookieName": "JSESSIONID"
}

Example 6-21 Acceptable Input for the tokenrequest Service in JSON

{
"username":"jde",
"password":"jde",
"deviceName":"RESTclient",
"environment":"JDV910",
"role":"*ALL"
}

Example 6-22 Acceptable Output for the token request Service in JSON Response

{
   "username": "jde",
   "environment": "JDV910",
   "role": "*ALL",
   "jasserver": "http://jasserver.domain.com:port",
   "userInfo":    {
      "token": "044kbwMICIsL8P4jttMj/VtpnEhrSK17i7fa2q8V+hVDlc=MDE4MDEwNjA1NTMwODkwMzQ1ODY0MTkyUkVTVGNsaWVudDE0MTI2MDg3MDgzODY=",
      "langPref": "  ",
      "locale": "en",
      "dateFormat": "MDE",
      "dateSeperator": "/",
      "simpleDateFormat": "MM/dd/yyyy",
      "decimalFormat": ".",
      "addressNumber": 2111,
      "alphaName": "Ingram, Paul"
   },
   "userAuthorized": false,
   "version": null,
   "poStringJSON": null,
   "altPoStringJSON": null,
   "aisSessionCookie": "W3XmCk8k6vhb3H-dwxSdBpCGZWAb7kh5D4gzemFoqoFqcoWgwqF_!-1217528743!1412608708388"
}

6.5.1.1 Form Request Attributes

The following list contains a description of the form request attributes. For an example of a form request, see Example 6-23.

  • maxPageSize. (optional) If you do not specify a value for this attribute, then AIS will only return 100 rows. If you want more rows than that, you must specify a value. However, AIS still will not return more rows than the max record number specified in the JAS ini (DBFetchLimitBeforeWarning).

    Note:

    Consider the value in the DBFetchLimitBeforeWarning setting to be the maximum value that the FSR request can send a value in for max rows with each request. The value sent in will be the one that is used, unless it is greater than the jas setting for DBFetchLimitBeforeWarning. The default shipped value is 2000
  • returnControlIDs. (optional) Indicates which form and grid fields the service passes back. Grid is usually 1 and has an array of fields. Form fields are bar delimited after grid, for example 1[19,20,50,48]|54|55. For power forms, indicate the control ID of the subform and then underscore and the control within the subform, for example 1_20|1_22[23,34].

  • formInputs. (optional) Collection of ID value pairs that represent the form interconnect input to the form. Associate a string for the FI ID with the value to be passed into that FI.

  • version. The version of the application, for example ZJDE0001.

  • formName. (required) Application and form name, for example P01012_W01012B.

  • formServiceAction. (optional) The CRUD operation the form will perform.

  • token. (required) The EnterpriseOne token that was returned from the tokenrequest service.

  • environment. (optional) EnterpriseOne environment that was used to request the token.

  • role. (optional) The EnterpriseOne role used to request the token.

  • findOnEntry. (optional) Valid values are TRUE or FALSE. Performs a find automatically when the EnterpriseOne application launches. In the EnterpriseOne application this autofind event occurs after post dialog initialized.

  • ignoreFDAFindOnEntry. (optional) Valid values are TRUE or FALSE. Applies to applications that have the box checked for "Automatically Find on Entry" in the grid in FDA. Allows the form service caller to control if that flag is used or not.

  • formActions. (optional) A set of actions to be performed on the form, in the order listed. The actions can include entering a value into a form field, QBE field, selecting a radio button, pressing a button, and selecting a check box value.

Example 6-23 Form Request

{
    "token": "044RnByWbW3FbLzpxWjSg55QzZWguAGnYqUNMlyB30IgyU=MDE5MDA2ODg0MDE5NjYwNzM1ODcyNDA5NlNvYXBVSTEzODc0ODc4OTEzNTc=",
    "maxPageSize": "10",
    "returnControlIDs": "1[19,20]58|62",
    "version": "ZJDE0001",
    "formInputs": [
        {
            "value": "E",
            "id": "2"
        }
    ],
    "formActions": [
        {
            "value": "E",
            "command": "SetQBEValue",
            "controlID": "1[50]"
        },
        {
            "value": "Al*",
            "command": "SetControlValue",
            "controlID": "58"
        },
        {
            "value": "on",
            "command": "SetCheckboxValue",
            "controlID": "62"
        },
        {
            "value": "on",
            "command": "SetCheckboxValue",
            "controlID": "63"
        },
        {
            "command": "DoAction",
            "controlID": "15"
        }    ],
            "role": "*ALL",
        "environment": "JDV910",
           "formsServiceAction":"R",
    "deviceName": "RESTclient",
    "formName": "P01012_W01012B"
}

6.5.1.2 Calling FormService on Local EnterpriseOne HTML (JAS) Server through the AIS Server

You have the option to use this technique if you have FDA changes locally and want to test the JSON output while still accessing the AIS Server. This is the closest approximation of how the ADF application will call the REST services.

Configure your local EnterpriseOne HTML Server to accept requests from the AIS Server. To do so:

  1. Locate the jas.ini file on the local EnterpriseOne Windows client (development client) machine:

    C:\E910_1\system\OC4J\j2ee\home\applications\webclient.ear\webclient\WEB-INF\classes\jas.ini

  2. Add or modify the form service section like this:

    #specify hosts allowed to call the form service and media object service
    [FORMSERVICE]
    allowedhosts=127.0.0.1|10.123.456.7
    

    The two preceding entries are the local host IP address and the IP address of the AIS Server. This enables you to make calls through the AIS Server to your local EnterpriseOne HTML Server. For the AIS Server, you can also use allowedhosts=* if you do not know the AIS Server IP address or want to allow access for any AIS Server.

  3. Restart the EnterpriseOne Windows client.

  4. Test the configuration by making the following changes to the JSON requests:

    For tokenrequest: Indicate the JAS server, which is your local EnterpriseOne HTML Server. Also, Oracle recommends that you always include the environment and role because the defaults stored on the AIS Server may not work with a local instance (such as JDV910 vs DV910).

    {"username":"JDE",
    "password":"jde",
    "deviceName":"RESTclient",
    "jasserver":"http://dnnlaurentvm1:8888",
    "environment":"DV910",
    "role":"*ALL"
    }
    

6.6 Understanding Text Media Object Attachments

The AIS Server provides a method to get and update the first text attachment stored for a particular media object structure key. The following two text media object services are available in the AIS_Client API:

  • gettext

  • updatetext

6.6.1 gettext Service

The URL for getting text media objects is:

http://<ais-server>:<port>/jderest/file/gettext

Only the first text media object is returned; it does not handle multiple text attachments. Only plain text is supported. While the original text media object is stored in HTML or RTF format (based on the settings on the JAS Server), the tags will be removed and the response will be in plain text with line breaks in Unicode format.

The following table describes the expected JSON input for the gettext service:

Field Value Description Example
token (String) The token you received when you executed a token request. "044TqjlQVSNHKvokvhWFKa8MYckPgG…"
moStructure (String) The Media Object Structure. "ABGT" or "GT0801A"
moKey (Array of Strings) The key to that media object structure. ["7"] or ["2015","283", "2"]
formName (String) The form where this media object is used. "P01012_W01012B"
version (String) The version of the app where this media object is used. "ZJDE0001"
deviceName (String) The device making the call to the service. "E1ADFApps" or "REST Client"

Example 6-24 gettext Service Input

{
    "token": "044TqjlQVSNHKvokvhWFKa8MYckPgGJdrd3CEDkzz2YjLQ=MDE5MDA2Nzg3NjEzOTA2MTY1MzIwMTkyMFNvYXBVSTEzOTk1ODA5MzQ0OTg=",
    "moStructure": "ABGT",
    "moKey": [
        "7"
    ],
    "formName": "P01012_W01012B",
    "version": "ZJDE0001",
    "deviceName": "RESTclient"
}

Example 6-25 gettext Service Response

{
   "text": "9.1.4.6 \\u000aFirst Line \\u000aSecond Line \\u000aThird Line \\u000aFourth Line \\u000aFifth line",
   "isRTF": false
}

6.6.2 Update Text Service

The URL for updating text media objects is:

http://<ais-server>:<port>/jderest/file/updatetext

Only plain text is supported.

The following table describes the expected JSON input for the updatetext service:

Field Value Description Example
token (String) The token you received when you executed a token request. "044TqjlQVSNHKvokvhWFKa8MYckPgG…"
moStructure (String) The media object structure. "ABGT" or "GT0801A"
moKey (Array of Strings) The key to the media object structure. ["7"] or ["2015","283", "2"]
formName (String) The form where this media object is used. "P01012_W01012B"
version (String) The version of the application where the media object is used. "ZJDE0001"
deviceName (String) The device making the call to the service. "RESTClient" or "E1ADFApps"
inputText (String) The text you are updating for the first text media object. "Update Text"
appendText (Boolean) A flag to indicate if the text should append to (true) or replace (false) the existing first text attachment. true or false

Example 6-26 Update Text Service Input

{
    "token": "044X9NgLP5VHqIW0zJcWseFjMtjrnZ35TUFmVV3NW9a9g4=MDE5MDA2NDY5MzQ1NjkzNDM1MjE3NjEyOFNvYXBVSTE0MDE3MTc4MDkzNTk=",
    "moStructure": "ABGT",
    "moKey": [
        "7"
    ],
    "formName": "P09E2011_W09E2011A",
    "version": "ZJDE0001",
    "inputText": "\nFirst Line \nSecond Line \nThird Line \nFourth Line \nFifth line",
    "appendText": false,
    "deviceName": "RESTclient"
}

Example 6-27 Update Text Service Response

{
    "updateTextStatus": "Success"
}

6.6.3 Text ADF Framework API

The Text ADF Framework API provides methods for managing text media objects from ADF applications. The same two methods described in the preceding sections, getText and updateText, are exposed in this API.

MediaObjectOperations Class

The following table describes the methods in the MediaObjectOperations class:

Return Method Description
MediaObjectGetTextResponse getTextMediaObject(LoginEnvironment loginEnv, MediaObjectGetTextRequest MediaObjectTextRequest) throws Exception Takes a MediaObjectGetTextRequest, calls the get text service, replaces unicode returns and line feeds with system line separator and returns a MediaObjectGetTextResponse with the resulting text attachment value.
MediaObjectUpdateTextResponse updateTextMediaObject(LoginEnvironment loginEnv, MeidaObjectUpdatedRequest MediaObjectUpdatedTextRequest) throws Exception Takes a MediaObjectUpdateTextRequest, calls the update text service and returns result in MediaObjectUpdateTextResponse

Example 6-28 Get Example

    public void getMediaObjectText()
    {
        MediaObjectGetTextRequest moGetText = new MediaObjectGetTextRequest(loginEnv);
        moGetText.setFormName(formName);
        moGetText.setVersion(version);
        moGetText.setMoStructure(moStructure);
        
        // Set media object key value
        moGetText.addMoKeyValue(moKey);
        
        try
        {
            MediaObjectGetTextResponse moResponse = MediaObjectOperations.getTextMediaObject(loginEnv, moGetText);
            
            setFirstText(moResponse.getText());
        }
        catch (JDERestServiceException e)
        {
            System.out.println(JDERestServiceProvider.handleServiceException(e));
        }
        catch (Exception e)
        {
            System.out.println(e);
        }
    }

Example 6-29 Append Example

    private void appendMediaObjectText()
    {
        MediaObjectUpdateTextRequest moAppendText = new MediaObjectUpdateTextRequest(loginEnv);
        moAppendText.setFormName(formName);
        moAppendText.setVersion(version);
        moAppendText.setMoStructure(moStructure);
        
        // Set media object key
        moAppendText.addMoKeyValue(moKey);
        moAppendText.setAppendText(true);
        moAppendText.setInputText(text);
        
        try
        {
            MediaObjectUpdateTextResponse moResponse = MediaObjectOperations.updateTextMediaObject(loginEnv, moAppendText);
        }
        catch (JDERestServiceException e)
        {
            System.out.println(JDERestServiceProvider.handleServiceException(e));
        }
        catch (Exception e)
        {
            System.out.println(e);
        }
    }

Example 6-30 Update Example

    public void updateMediaObjectText()
    {
        MediaObjectUpdateTextRequest moUpdateText = new MediaObjectUpdateTextRequest(loginEnv);
        moUpdateText.setFormName(formName);
        moUpdateText.setVersion(version);
        moUpdateText.setMoStructure(moStructure);
        
        // Set media object key value
        moUpdateText.addMoKeyValue(moKey);
        moUpdateText.setAppendText(false);
        moUpdateText.setInputText(getFirstText());
        
        try
        {
            MediaObjectUpdateTextResponse moResponse = MediaObjectOperations.updateTextMediaObject(loginEnv, moUpdateText);
        }
        catch (JDERestServiceException e)
        {
            System.out.println(JDERestServiceProvider.handleServiceException(e));
        }
        catch (Exception e)
        {
            System.out.println(e);
        }
    }

6.7 Understanding the Media Object API for Photo Media Object Attachments

You can incorporate photo attachments into Oracle ADF applications using the AIS_Client.jar, which contains a Media Object API that provides classes and methods that enable access to media objects from EnterpriseOne. It works in conjunction with the AIS Server and the MediaObjectRequest capability of the EnterpriseOne HTML Server.

MediaObjectOperations is an abstract class that contains all of the static methods needed to manage media objects. This section describes the following four main operations:

6.7.1 List


Method - getMediaObjectList
Description - Returns a list of Media Object details based on the information provided in the request.
Returns - MediaObjectListResponse
Parameters - LoginEnvironment, MediaObjectListRequest

MediaObjectListRequest

Field Type Description
moStructure String The Media Object structure ID (such as GT0801, GT48100).
moKey ArrayList <String> The set of key values, as strings, that is the key of the media object. The API will handle formatting into a bar delimited set. Use the JDEmfUtilities.convertMillisecondsToYMDString() method to pass dates.
formName String The application and form usually associated with this media object structure (e.g. P01012_W01012B). This is for security purposes. Security for media objects is based on the form being used.
version String The version of the application noted in the formName. This is for security purposes. Security for media objects is based on the form being used.
includeURLs boolean When true, the response will include the JAS URL for each file type media object.
includeData boolean When true, the response will include the Base64 encoded data for a 40 X 40 size of the image in the data field of the response.
moTypes ArrayList <String> Valid types are 1 and 5, which are the two file type media objects. Type 1 file attachments are from a Media Object Queue. Type 5 attachments are files uploaded individually to the EnterpriseOne HTML Server.
extensions ArrayList Use this field to further reduce the data set by indicating the extensions of the files you want to be included in the response (such as "jpg","gif","png","pdf").
thumbnailSize <String> int This field is available with the Tools 9.1 Update 5 release. Use this in conjunction with the includeData flag. When data is included in the response you can pass an integer value in this field to control the size of the thumbnail returned in the data field. A value of 0 will return the default size of 40x40. The maximum size is 200, any value over 200 will return images 200x200.

MediaObjectListResponse

Field Type Description
mediaObjects MediaObjectListItem [ } An array of media object list items.

MediaObjectListItem

Field Type Description
downloadUrl String When true, the response will include the JAS URL for each file type media object.
file String When true, the response will include the Base64 encoded data for any image file in the data field of the response. For text type media objects the text will be include in the data field of the response.
itemName String A user given name for the media object item. When viewing media objects on JAS this is the name shown directly under each media object item in the left panel of the MO control.
link String <unknown>
moType int Type 1 file attachments are from a Media Object Queue. Type 5 attachments are files uploaded individually to the JAS server.
queue String For type 1 file attachments from a Media Object Queue the name of the queue.
sequence int The sequence the number of that individual attachment in the set of attachments.
updateDate String The date that the media object was last updated.
updateHourOfDay int The hour that the media object was last updated.
updateMinuteOfHour int The minute that the media object was last updated.
updateSecondOfMinute int The second that the media object was last updated.
updateUserID String The user that last updated that media object.
hasValidTimestamp boolean Indicates if time stamp was valid.
isDefaultImage boolean Indicates if image is default image.
isMisc boolean <unknown>
isOLE boolean Is an OLE attachment.
isShortCut boolean <unknown>
isText boolean Is a text type attachment.
isUpdated boolean <unknown>
isURL boolean Is a URL type attachment.
data String For an image file this is the Base64 encoded string of the image data for a 40x40 size of the image.
thumbFileLocation String The location of the thumbnail (40x40) saved on the device. A file is written for each image that has Base64 data included. Files are only written if data is requested.

6.7.2 Download


Method - downloadMediaObject
Description - Downloads a full sized media object to a file on the device, based on the key information provided in the request.
Returns - MediaObjectDownloadResponse
Parameters - LoginEnvironment, MediaObjectDownloadRequest

MediaObjectDownloadRequest

Field Type Description
moStructure String The Media Object structure ID, for example GT0801, GT48100.
moKey ArrayList <String> The set of key values, as strings, that is the key of the media object. The API will handle formatting into a bar delimited set. Use the JDEmfUtilities.convertMillisecondsToYMDString() method to pass dates.
formName String The application and form usually associated with this media object structure, for example P01012_W01012B. This is for security purposes. Security for media objects is based on the form being used.
version String The version of the application noted in the formName. This is for security purposes. Security for media objects is based on the form being used.
downloadURL String The downloadURL provided in the list response. When this value is already known, provide it so the service will not do the extra work of getting the URL.
fileName String This will be the name of the file saved on the device file system. It is easiest (and uniqueness is guaranteed) to pass the file provided in the list response.
sequence int The sequence number of this individual file in the set of attachments.
height int When a value is passed in this field, the image will be scaled to this size before it is returned. If you provide only height, the width will be scaled to maintain the aspect ratio.
width int When a value is passed in this field, the image will be scaled to his size before it is returned. If you provide only width, the height will be scaled to maintain the aspect ratio.

FileAttachment

Field Type Description
fileName String The name of the file as stored in the database.
fileLocation String The location of the file saved to the device file system. This includes the "file://" prefix so it can be directly used in image tags in an amx page.
itemName String A string value the user may provide as the name of the attachment (if not supplied the file name will be used.)
sequence int The sequence number of this individual attachment.
thumbFileLocation String The file location of the thumbnail image (this value is not updated when the download method is called).
downloadUrl String The JAS URL of the file attachment (this value is not populated when the download method is called).

6.7.3 Upload


Method - uploadMediaObject
Description - Uploads a single file to the media object database based on key values provided in the request.
Returns - MediaObjectUploadResponse
Parameters - LoginEnvironment, MediaObjectUploadRequest

MediaObjectUploadRequest

Field Type Description
moStructure String The Media Object structure ID (such as GT0801, GT48100).
moKey ArrayList <String> The set of key values, as strings, that is the key of the media object. The API will handle formatting into a bar delimited set. Use the JDEmfUtilities.convertMillisecondsToYMDString() method to pass dates.
formName String The application and form usually associated with this media object structure (such as P01012_W01012B). This is for security purposes. Security for media objects is based on the form being used.
version String The version of the application noted in the formName. This is for security purposes. Security for media objects is based on the form being used.
file FileAttachment The resulting downloaded file with the name, fileLocation, sequence and itemName fields updated.

FileAttachment

Field Type Description
fileName String The name of the file as stored in the database. (This value is not required for upload.)
fileLocation String The location of the file saved to the device file system. This includes the "file://" prefix so it can be directly used in image tags in an amx page.
itemName String A descriptive name. If not passed, the filename will be used. The extension will be added automatically.
sequence int The sequence number of this individual attachment (this value is not required for upload).
thumbFileLocation String The file location of the thumbnail image (this value is not required for upload).
downloadUrl String The JAS URL of the file attachment (this value is not required for upload).

MediaObjectUploadResponse

Field Type Description
itemName String A user given name for the media object item. When viewing media objects on JAS, this is the name shown directly under each media object item in the left panel of the MO control. The extension will be added automatically. If not passed, the file name is used.
sequence int The sequence number of this individual attachment (assigned during the upload).

6.7.4 Delete


Method - deleteMediaObject
Description - Deletes the file in the media object database based on key values provided in the request. Deletes the file on the device file system also.
Returns - MediaObjectDeleteResponse
Parameters - LoginEnvironment, MediaObjectDeleteRequest

MediaObjectDeleteRequest

Field Type Description
moStructure String The Media Object structure ID (e.g. GT0801, GT48100).
moKey ArrayList <String> The set of key values, as strings, that is the key of the media object. The API will handle formatting into a bar delimited set. Use the JDEmfUtilities.convertMillisecondsToYMDString() method to pass dates.
formName String The application and form usually associated with this media object structure (e.g. P01012_W01012B). This is for security purposes. Security for media objects is based on the form being used.
version String The version of the application noted in the formName. This is for security purposes. Security for media objects is based on the form being used.
sequence int The sequence number of this individual file in the set of attachments.
fileLocation String The location of the file on the device file system.

MediaObjectDeleteResponse

Field Type Description
deleteStatus String The value 'Success' will be returned for successful deletes. Any other value is a failure.
error String In the case of failure details of the error will be included here.

6.7.5 Add Media Object URL

This section discusses adding a media object URL.

6.7.5.1 Add URL


Method - addUrlMediaObject
Description - Adds a media object of the type url.
Returns - MediaObjectAddUrlResponse
Parameters - LoginEnvironment, MediaObjectAddUrlRequest

MediaObjectAddURLRequest

Field Type Description
moStructure String The Media Object structure id (for example, GT0801, GT48100).
moKey ArrayList <String> The set of key values, as strings, that is the key of the media object. The API will handle formatting into a bar delimited set. Use the JDEmfUtilities.convertMillisecondsToYMDString() method to pass dates.
formName String The application and form usually associated with this media object structure (for example, P01012_W01012B). This is for security purposes. Security for media objects is based on the form being used.
version String The version of the application noted in the formName. This is for security purposes. Security for media objects is based on the form being used.
urlText String The text of the url (for example, www.oracle.com or http://www.oracle.com).

MediaObjectAddUrlResponse

Field Type Description
urlText String The text of the url (for example, www.oracle.com or http://www.oracle.com).
saveUrl String The url as it was saved in the media object table F00165.
sequence int The sequence number for the newly added url type media object.

Example 6-31 Add Media Object URL

    public void addMediaObjectURL() 
    {
        MediaObjectAddUrlRequest moAddUrlRequest = new MediaObjectAddUrlRequest(loginEnv);
        moAddUrlRequest.setFormName(formName);
        moAddUrlRequest.setVersion(version);        
        moAddUrlRequest.setMoStructure(moStructure);
        moAddUrlRequest.addMoKeyValue(moKey);
        moAddUrlRequest.setUrlText(moURL);
 
        try 
        {
            MediaObjectAddUrlResponse mediaObjectAddUrlResponse = MediaObjectOperations.addUrlMediaObject(loginEnv, moAddUrlRequest);
 
        }
        catch (JDERestServiceException e)
        {
            System.out.println(JDERestServiceProvider.handleServiceException(e));
        }
        catch (Exception e)
        {
            System.out.println(e);
        }
    }

6.8 Understanding Processing Options

Starting with EnterpriseOne Tools release 9.1.4.4, an AIS service is available for handling processing options.

The URI for the service is:

http://<AIS Server>:<port>/jderest/poservice

Example 6-32 ADF Code Retrieve PO Values

The input JSON is:

{
 "token": "044uZUG2Uk1Vd6hzmAhPfILitA2pVLDVKLOYdh4HR71D7s=MDE5MDA2ODM3NTQ3NzU4MDMwNTg2MzY4MFNvYXBVSTEzOTcwNTYxMTIxMTE=",

  "applicationName":"P01012",
  "version":"ZJDE0001",
  "deviceName":"RESTclient"

}

The response JSON is like this:

{  
   "application": "P01012",
   "version": "ZJDE0001",
   "processingOptions":    {
      "GoToSupplierMaster_5":       {
         "type": 1,
         "value": " "
      },
      "GoToCustomerMaster_6":       {
         "type": 1,
         "value": " "
      },
      "GoToCSMS_8":       {
         "type": 1,
         "value": " "
      },
      "HideTax_4":       {
         "type": 1,
         "value": " "
      },
      "SearchTypeDefault_7":       {
         "type": 2,
         "value": " "
      },
      "cTypeCode_11":       {
         "type": 1,
         "value": "A"
      }

   },
   "errors": ""
}

6.8.1 Using the AIS Service for Processing Options in ADF Application

You can call the service passing an application and version. You can obtain the version from the ADF application processing options, which specify the version of the EnterpriseOne application that the ADF application uses.

If you use this service, you must add AISClientCapability.PROCESSING_OPTION to the list of required capabilities in the about.properties. If you do not do this, you will receive an error at runtime. See Section 6.2, "Understanding AIS Server Capabilities" for more information.

Example 6-33 ADF Code Retrieve PO Values

Remember to inspect the "errors" element of the response in case an error was encountered when trying to fetch the processing options you requested.

There are six supported data types. These are based on the data item used in the Processing Option Design Aid for each option.

Type Code Type Constant Java Type JDE DD Type
1 STRING_TYPE String String
2 CHAR_TYPE String Character
9 BIG_DECIMAL_TYPE BIG Decimal Math Numeric
11 DATE_TYPE Date Date
15 INTEGER_TYPE Integer Integer
55 CALENDAR_TYPE Calendar Utime

You can get the type of the option before attempting to cast it, which is the recommended method. Or you can just cast it to the type you expect, because it is unlikely to change. The default is String, so you will always be able to get to a string version of the option value.

Example 6-34 ADF Code Retrieve PO Values

    private void retrievePOValues()
    {
        try
        {
            loginEnv.getRequiredCapabilities().add(AISClientCapability.PROCESSING_OPTION);
            ProcessingOptionRequest poRequest = new ProcessingOptionRequest(loginEnv);
            poRequest.setApplicationName("P01012");
            poRequest.setVersion("ZJDE0001");
            
            String response = JDERestServiceProvider.jdeRestServiceCall(loginEnv, poRequest, JDERestServiceProvider.POST_METHOD, JDERestServiceProvider.PO_SERVICE);
            ProcessingOptionsSet p01012POSet = loginEnv.getObjectMapper().readValue(response, ProcessingOptionsSet.class);
            
            if (p01012POSet != null)
            {
                String searchType = (String) p01012POSet.getOptionValue("SearchTypeDefault_7");
                String typeCode = (String) p01012POSet.getOptionValue("cTypeCode_11");
            }
        }
        catch (CapabilityException e)
        {
            System.out.println("Processing Option capability not supported");
        }
        catch (JDERestServiceException e)
        {
            System.out.println(JDERestServiceProvider.handleServiceException(e));
        }
        catch (Exception e)
        {
            System.out.println(e);
        }
    }

6.9 Understanding the Application Stack Service

The application stack is a service that enables interactive communication with applications running on the EnterpriseOne web client. By using the application stack service, you can perform form interconnects to receive data from the previous form. You can perform more complex interactions with applications that have cross-form transaction boundaries, for example where you do not want the header saved until the details are added and so forth. Also, with the application stack, you can implement a record reservation in ADF applications that corresponds to a record reservation in the web application.

The purpose of application stack processing is that it enables you to establish a session for a specific application and maintain that session across calls. So you initiate a session or "open it" with one service call, then you can have any number of service calls to "execute" actions against the currently running application. Finally, you "close" the session with a service call.

To accomplish this stateful model, some additional data is managed for each service call, including stack ID, state ID, and rid. Also, each request to execute actions against the running application must be sent with the formOID to ensure the form you are expecting is indeed the currently running form.

Note:

You can execute actions on only one form during a stack request. So if your request performs a form interconnect, you will have to submit a subsequent request to operate on the second form running after the interconnect.

6.9.1 Service Endpoint

The application stack service is exposed by the AIS Server at the endpoint:

http://<aishost>:<port>/jderest/appstack

6.9.2 Capability

The application stack capability is exposed in the default configuration as "applicationStack." You must add this to your required capability list in your ADF application using the AISClientCapability.APPLICATION_STACK constant before using this capability.

6.9.3 Prerequisite

The AIS Server must be configured to "Keep JAS Sessions Open" so that the session can be maintained across service calls.

6.9.4 JSON Example of an Application Stack Request

This section shows an example of JSON code that performs the following actions:

6.9.4.1 Open Application: Request and Response

Example 6-35 shows an example of the application stack request. It contains all of the other environment and credential information that is included in a form service request. After this information, it contains a single instance of a form service request called formRequest. You can use this to include any action you want to take on this original form, just like a normal form service request. Most important is the action, which is "open" in this case. This tells the EnterpriseOne web client to keep the form open so that you can interact with it on future requests.

So for this request with the Address Book (P01012), the search type is set to "E" to perform a "find" and retrieve the first five records.

Important:

The maxPageSize indicated in this originating request will be the max page size for all requests in this stack. If you do not specify a maxPageSize, it uses the default setting in JAS_INI (DBFetchLimitBeforeWarning).

Example 6-35 Open Application - Request

{
    "token": "044J57pHCCB3AzH7/W6Vetm0+yVG6pnKOPl823587SfY6o=MDE5MDA2MTYxOTE0NTE0NjE2OTEyNTg4OFNvYXBVSTE0MDEyMTA5MDE1MDM=",
    "action": "open",
    "formRequest": {
        "returnControlIDs": "54|1[19,20]",
        "maxPageSize": "5",
        "formName": "P01012_W01012B",
        "version": "ZJDE0001",
        "findOnEntry": "TRUE",
        "formInputs": [
            {
                "value": "E",
                "id": "2"
            }
        ]
    },
    "deviceName": "RESTclient"
}

Example 6-36 Open Application - Response

{
   "fs_P01012_W01012B":    {
      "title": "Work With Addresses",
      "data":       {
                … condensed….
      },
      "errors": [],
      "warnings": []
   },
   "stackId": 1,
   "stateId": 1,
   "rid": "e51b593df7a884ea",
   "currentApp": "P01012_W01012B_ZJDE0001",
   "sysErrors": []
}

The response contains the data (including the 5 rows, which are not shown), along with additional information used for all subsequent interactions with the open application.

6.9.4.2 Execute Actions on Application: Request and Response

Next, the JSON code should contain commands to select one of the records returned and access the row exit to Phones (through a form interconnect). With this service call, make sure to pass in the values for stack ID, state ID and rid from the last call, along with the token. Also, indicate an action of "execute," so it knows you are interacting with an open application.

This execute type request contains an actionRequest which can include returnControlIDs for the form you expect to end on and an array of formActions to execute on the form indicated by formOID.

Example 6-37 Execute Actions on Application - Request

{
    "token": "044DCcituJDHbxBhPcgOuhCb0Av/xnNiUFxqPTVD6hDfnU=MDE5MDA2MTc1NjYwMzYwMzk0MTE0OTY5NlNvYXBVSTE0MDEyMTkzOTIxMzA=",
    "stackId": 1,
    "stateId": 1,
    "rid": "e51b593df7a884ea",
    "action": "execute",
    "actionRequest": {
        "returnControlIDs": "32|7|1[28,29,66]",
        "maxPageSize": "4",
        "formOID": "W01012B",
        "formActions": [
            {
                ".type": "com.oracle.e1.jdemf.FormAction",
                "command": "SelectRow",
                "controlID": "1.0"
            },
            {
                ".type": "com.oracle.e1.jdemf.FormAction",
                "command": "DoAction",
                "controlID": "65"
            }
        ]
    },
    "deviceName": "RESTclient"
}

Example 6-38 Execute Actions on Application - Response

{
   "fs_P0115_W0115A":    {
      "title": "Phone Numbers",
      "data":       {
         
                ….condensed..
            "summary":             {
               "records": 3,
               "moreRecords": false
            }
         }
      },
      "errors": [],
      "warnings": []
   },
   "stackId": 1,
   "stateId": 2,
   "rid": "e51b593df7a884ea",
   "currentApp": "P0115_W0115A_ZJDE0001",
   "sysErrors": []
}

Notice that the state ID has increased after each service call. Also notice that the "currentApp" has changed, and the JSON is representing the Phones application.

6.9.4.3 Adding a Phone Number

Example 6-39 shows how to execute an additional action on this stack that adds a phone number. You can do this as many times as you want, incrementing the state ID each time. The action does not include saving the information; it only populates the grid.

Example 6-39 Adding a Phone Number - Request

{
    "token": "044DCcituJDHbxBhPcgOuhCb0Av/xnNiUFxqPTVD6hDfnU=MDE5MDA2MTc1NjYwMzYwMzk0MTE0OTY5NlNvYXBVSTE0MDEyMTkzOTIxMzA=",
    "stackId": 1,
    "stateId": 2,
    "rid": "e51b593df7a884ea",
    "action": "execute",
    "actionRequest": {
        "formOID": "W0115A",
        "formActions": [
            {
                "gridAction": {
                    "gridID": "1",
                    "gridRowInsertEvents": [
                        {
                            "gridColumnEvents": [
                                {
                                    "value": "720",
                                    "command": "SetGridCellValue",
                                    "columnID": "28"
                                },
                                {
                                    "value": "12345",
                                    "command": "SetGridCellValue",
                                    "columnID": "29"
                                },
                                {
                                    "value": "CAR",
                                    "command": "SetGridCellValue",
                                    "columnID": "27"
                                }
                            ]
                        }
                    ]
                }
            }
        ]
    },
    "deviceName": "RESTclient",
    "ssoEnabled": true
}

6.9.4.4 Execute Close Application: Request and Response

Lastly, the JSON code should contain commands to press the Save button and close the application stack. This saves all phone records that were added to the grid.

Example 6-40 Execute Close Application - Request

{
    "token": "044DCcituJDHbxBhPcgOuhCb0Av/xnNiUFxqPTVD6hDfnU=MDE5MDA2MTc1NjYwMzYwMzk0MTE0OTY5NlNvYXBVSTE0MDEyMTkzOTIxMzA=",
    "stackId": 1,
    "stateId": 3,
    "rid": "e51b593df7a884ea",
    "action": "close",
    "actionRequest": {
        "formOID": "W0115A",
        "formActions": [
            {
                "command": "DoAction",
                "controlID": "4"
            }
        ]
    },
    "deviceName": "RESTclient",
    "ssoEnabled": true
}

Example 6-41 Execute Close Application - Response

{
   "fs_P0115_W0115A":    {
      "title": "Phone Numbers",
      "data":       {
                 ….condensed…
            ],
            "summary":             {
               "records": 4,
               "moreRecords": false
            }                  
         }
      },
      "errors": [],
      "warnings": []
   },
   "stackId": 0,
   "stateId": 0,
   "rid": "",
   "currentApp": "P0115_W0115A_ZJDE0001",
   "sysErrors": []
}

When the stack is closed, the stack ID, state ID, and rid are cleared, indicating you can no longer interact with that stack.

6.9.4.5 ADF Application Example

The application manages the alternate addresses for the 0 contact of an address number. It lists the first 10 "E" type records in the Address Book, and allows the user to select a record where they can add, update, or delete alternate addresses. Notice that the framework handles all of the stack maintenance for you within the ApplicationStack object. You do not need to manually manage the rid, stack ID, or state ID in your ADF application. The API does that for you.

An ApplicationStack variable is defined in the main DC class. You should define one of these for each stack you want to maintain. For example:

ApplicationStack appStackAddress = new ApplicationStack();

Example 6-42 Open Application

When the ADF application opens, it retrieves the Address Book records and saves the response in a data control variable for the P01012_W01102B form.

    public void getABRecords()
    {
        // Retrieve a list of employees from Address Book (P01012)
        loginEnv.getRequiredCapabilities().add(AISClientCapability.APPLICATION_STACK);
        FormRequest formRequest = new FormRequest(loginEnv);
        formRequest.setFormName("P01012_W01012B");
        formRequest.setVersion("ZJDE0001");
        formRequest.setReturnControlIDs("54|1[19,20]");
        formRequest.setFormServiceAction("R");
        formRequest.setMaxPageSize("10");
        
        FSREvent formEvents = new FSREvent();
        formEvents.setFieldValue("54", "E");
        formEvents.doControlAction("15");       // Find button
        formRequest.addFSREvent(formEvents);
        
        try
        {
            // Open P01012_W01012B app
            String response = appStackAddress.open(loginEnv, formRequest);
            
            addressBookRecords = loginEnv.getObjectMapper().readValue(response, P01012_W01012B_FormParent.class);
        }
        catch (JDERestServiceException e)
        {
            System.out.println(JDERestServiceProvider.handleServiceException(e));
        }
        catch (Exception e)
        {
            System.out.println(e);
        }
    }

Example 6-43 Get ALT Address Records

When an Address Book record is selected in the ADF application, the ADF application performs a service call to perform the row exit on the open application. It checks to make sure the interconnect happened, and then performs a second interconnect to Work with Alternate Addresses form. Finally, it checks that it is on the addresses form and then deserializes the response to the data control variable for the addresses form. The Address Book application has a multi-select grid, and taking a row exit when multiple records are selected causes issues; therefore the action is to deselect all, and then select the correct one.

    public String goToAltAddress()
    {
        String nav = "";
        
        try
        {
            int rowIndex = getSelectedAddressBookRecord();
            if (rowIndex >= 0)
            {
                loginEnv.getRequiredCapabilities().add(AISClientCapability.SELECT_ALL_GRID_ROWS);
                ActionRequest getAddressAction = new ActionRequest();
                getAddressAction.setFormOID("W01012B");
                FSREvent selectEvent = new FSREvent();
                selectEvent.unselectAllGridRows(loginEnv, "1");
                selectEvent.selectRow("1", rowIndex);
                selectEvent.doControlAction("67");              // Select Who's Who row exit
                getAddressAction.addFSREvent(selectEvent);
                
                String response = appStackAddress.executeActions(loginEnv, getAddressAction);
                
                if (response != null)
                {
                    whosWho = loginEnv.getObjectMapper().readValue(response, P0111_W0111A_FormParent.class);
                
                    if (appStackAddress.getLastAppStackResponse().checkSuccess("P0111_W0111A"))
                    {
                        selectWhosWho();
                        if (appStackAddress.getLastAppStackResponse().checkSuccess("P01111_W01111E"))
                        {
                            nav = "to_Addresses";
                        }
                    }
                }
            }
        }
        catch (JDERestServiceException e)
        {
            System.out.println(JDERestServiceProvider.handleServiceException(e));
        }
        catch (Exception e)
        {
            System.out.println(e);
        }
 
        return nav;
    }
    
    public void selectWhosWho()
    {
        try
        {
            // Send another request to go to Alt Address
            ActionRequest selectAction = new ActionRequest();
            selectAction.setFormOID("W0111A");
            
            FSREvent findEvent = new FSREvent();
            findEvent.selectRow("1", 0);
            findEvent.doControlAction("148");
            selectAction.addFSREvent(findEvent);
            
            String response = appStackAddress.executeActions(loginEnv, selectAction);
            
            if ((response != null) && (appStackAddress.getLastAppStackResponse().checkSuccess("P01111_W01111E")))
            {
                altAddresses = loginEnv.getObjectMapper().readValue(response, P01111_W01111E_FormParent.class);
            }
        }
        catch (JDERestServiceException e)
        {
            System.out.println(JDERestServiceProvider.handleServiceException(e));
        }
        catch (Exception e)
        {
            System.out.println(e);
        }
    }

The user can then navigate to an individual address to change or delete it. They can also add a new one.

This method handles saving an existing address or adding a new one. It also handles any errors that were returned from the service.

Example 6-44 Save Address

    private String saveAddress(String formMode, int rowIndex)
    {
        String nav = "";
 
        try
        {
            loginEnv.getRequiredCapabilities().add(AISClientCapability.GRID);
            ActionRequest addAction = new ActionRequest();
            addAction.setFormOID("W01111E");
            FSREvent saveEvent = new FSREvent();
            GridAction gridAction = new GridAction(loginEnv);
            if (formMode.equals("A"))
            {
                GridRowInsertEvent gri = new GridRowInsertEvent();
                
                // Set column values
                gri.setGridColumnValue("34", newAddressRow.getAddressType());
                gri.setGridColumnValue("26", newAddressRow.getAddressLine1());
                gri.setGridColumnValue("22", newAddressRow.getCity());
                gri.setGridColumnValueDate("18", newAddressRow.getBeginDate(), loginEnv);
                
                // Add grid row
                gridAction.insertGridRow("1", gri);
            }
            else
            {
                GridRowUpdateEvent gru = new GridRowUpdateEvent();
                
                // Set column values
                gru.setGridColumnValue("34", currentAddressRow.getAddressType());
                gru.setGridColumnValue("26", currentAddressRow.getAddressLine1());
                gru.setGridColumnValue("22", currentAddressRow.getCity());
                
                // Update grid row
                gridAction.updateGridRow("1", rowIndex, gru);
            }
            
            // Add grid action to form events.
            saveEvent.addGridAction(gridAction);
            saveEvent.doControlAction("12");        // Press OK button
            addAction.addFSREvent(saveEvent);
            
            String response = appStackAddress.executeActions(loginEnv, addAction);
            
            if (response != null)
            {
                // After save, application returns to Who's Who.  Open Alt Address again to get updated list.
                if (appStackAddress.getLastAppStackResponse().checkSuccess("P0111_W0111A"))
                {
                    selectWhosWho();
                    if (appStackAddress.getLastAppStackResponse().checkSuccess("P01111_W01111E"))
                    {
                        nav = "__back";
                    }
                }
                else
                {
                    if (appStackAddress.getLastAppStackResponse().checkSuccess("P01111_W01111E"))
                    {
                        P01111_W01111E_FormParent tempW01111E = loginEnv.getObjectMapper().readValue(response, P01111_W01111E_FormParent.class);
                        
                        // Check for errors on form.
                        if (tempW01111E.getFs_P01111_W01111E().getErrors().length > 0)
                        {
                            displayFormErrors();
                        }
                    }
                }
            }
        }
        catch (JDERestServiceException e)
        {
            System.out.println(JDERestServiceProvider.handleServiceException(e));
        }
        catch (Exception e)
        {
            System.out.println(e);
        }
        
        return nav;
    }

Example 6-45 Delete Address

The following sample code shows an example of the method to delete the address. After deleting and saving, the EnterpriseOne form closes, so you have to open it again with the selectWhosWho method.

    public String deleteAddress(int rowIndex)
    {
        String nav = "";
        
        ActionRequest deleteAddress = new ActionRequest();
        deleteAddress.setFormOID("W01111E");
        FSREvent deleteEvent = new FSREvent();
        deleteEvent.selectRow("1", rowIndex);
        deleteEvent.doControlAction("41");      // Press Delete button
        deleteEvent.doControlAction("12");      // Press OK button
        deleteAddress.addFSREvent(deleteEvent);
        
        try
        {
            String response = appStackAddress.executeActions(loginEnv, deleteAddress);
            
            if (response != null)
            {
                if (appStackAddress.getLastAppStackResponse().checkSuccess("P0111_W0111A"))
                {
                    selectWhosWho();
                    if (appStackAddress.getLastAppStackResponse().checkSuccess("P01111_W01111E"))
                    {
                        nav = "__back";
                    }
                }
                else if (appStackAddress.getLastAppStackResponse().checkSuccess("P01012_W01012B"))
                {
                    nav = "to_AB";
                }
            }
        }
        catch (JDERestServiceException e)
        {
            System.out.println(JDERestServiceProvider.handleServiceException(e));
        }
        catch (Exception e)
        {
            System.out.println(e);
        }
        
        return nav;
    }

Example 6-46 Close App Stack

The following sample code shows an example of the method to close the address.

public void closeAppStackAddress()
    {
        try
        {
            appStackAddress.close(loginEnv);
        }
        catch (JDERestServiceException e)
        {
            System.out.println(JDERestServiceProvider.handleServiceException(e));
        }
        catch (Exception e)
        {
            System.out.println(e);
        }
    }

6.9.5 ApplicationStack Methods

The following table describes the ApplicationStack methods:

Modifier and Type Method Description
String open(LoginEnvironment loginEnvironment, FormRequest formRequest) Opens a form, allowing further interactions with subsequent service calls.
String executeActions(LoginEnvironment loginEnvironment, ActionRequest actionRequest) Executes actions on an already open form.
String close(LoginEnvironment loginEnvironment, ActionRequest actionRequest) Closes all applications in the application stack, after executing the actions requested.
String close () Closes all applications in the application stack, without doing any further actions.
ApplicationStackResponse getLastAppStackResponse() Returns the last response which includes the stack ID, state ID, rid and system errors.

6.9.6 ApplicationStackResponse Methods

The following table describes the ApplicationStackResponse methods:

Modifier and Type Method Description
boolean checkSuccess (String appForm) Returns true if the last response was for the appForm (for example P01012_W01012B) if the form does not match it returns false.

6.10 Understanding Jargon Labels

The labels used in an ADF application called from EnterpriseOne should be translated into the EnterpriseOne users' language, and should follow the jargon code defined on the EnterpriseOne task used to launch them.

In EnterpriseOne, the task to launch an ADF application has a Jargon field. The value in this Jargon field will be passed to the ADF application to fetch the text for field labels. In the EnterpriseOne data dictionary, a data item may have description overrides defined based on two key fields: Language and Jargon Code.

6.10.1 Service Endpoint

The jargon service is exposed by the AIS Server at the endpoint:

http://<aishost>:<port>/jderest/jargonservice

6.10.2 Capability

The jargon capability is exposed in the default configuration as "jargon." If your ADF application requires a certain capability, you must validate that AIS provides the capability.

6.10.3 Getting Jargon Labels to use in ADF Application

To get the correct labels to display in the ADF application, you must use the Jargon Service provided by AIS to fetch the overrides for each data item displayed on your application, based on the Jargon code that was sent when the application was launched by EnterpriseOne.The following steps explain how to get the label values and use them in your application pages.

Note:

The following steps describe only one way to accomplish the desired result; it is not required to use this exact method. The only requirement is that the labels shown in your application are translated and are based on the Jargon code defined in the EnterpriseOne task.

You should not have any hard coded label text or error message text or provide a translation bundle for your application.

To get the label values and use them in your application pages:

  1. In your main data control class for your ADF application/bounded task flow, create static values and a hash map to store all the labels you will be using.

  2. Create a default code in case the Jargon code does not get passed in (for example, when running outside of the container).

  3. Initialize the map with the default hard coded values for your field labels.

            private static final String DEFAULT_JARGON = "01";
        //AN8, ALPH,MLNM,ADD1,CTY1,ADDS,ADDZ,CTR
        private static final String ADDRESS_NUMBER = "Address Number";
        private static final String ALPH_NAME = "Name";
        private static final String MAIL_NAME = "Mailing Name";
        private static final String ADDDRESS = "Address";
        private static final String CITY = "City";
        private static final String STATE = "State";
        private static final String POSTAL = "Zip Code";
        private static final String COUNTRY = "Country";
     
        private HashMap<String, String> fieldLabels = new HashMap<String, String>() {
            {
                put("AN8", ADDRESS_NUMBER);
                put("ALPH", ALPH_NAME);
                put("MLNM", MAIL_NAME);
                put("ADD1", ADDDRESS);
                put("CTY1", CITY);
                put("ADDS", STATE);
                put("ADDZ", POSTAL);
                put("CTR", COUNTRY);
            }
        };
    
  4. Create a method to retrieve the override values from the AIS jargon service, and populate the hash map with those values.

        private void retriveJargonValues() {
                    //get the jargonCode from page flow scope
    string jargon code = (string) ADFContext.getCurrent().getPageFlowScope().get("jargonCode");
               //if no jargon, use default
            if (jargonCode == null || jargonCode != null && jargonCode.isEmpty()) {
     
                jargonCode = DEFAULT_JARGON;
            }
            try {  
          //get login environment, populate the request with DD items, call the jargon service
                LoginEnvironment le = E1AdfUtils.getLoginEnvironment(userBean);
                le.getRequiredCapabilities().add("AISClientCapability.JARGON);
                JargonRequest jargonReq = new JargonRequest(le, jargonCode);
                //AN8, ALPH,MLNM,ADD1,CTY1,ADDS,ADDZ,CTR
                jargonReq.addDataItem("AN8");
                jargonReq.addDataItem("ALPH");
                jargonReq.addDataItem("MLNM");
                jargonReq.addDataItem("ADD1");
                jargonReq.addDataItem("CTY1");
                jargonReq.addDataItem("ADDS");
                jargonReq.addDataItem("ADDZ");
                jargonReq.addDataItem("CTR");
                String response =
                    JDERestServiceProvider.jdeRestServiceCall(le, jargonReq, JDERestServiceProvider.POST_METHOD,
                                                              JDERestServiceProvider.JARGON_SERVICE);
                jargonResp = le.getObjectMapper().readValue(response, JargonResponse.class);
     
             //replace the default values in the hash map with the jargon values
                if (jargonResp != null) {
                    if (jargonResp.getRequestedItems() != null && jargonResp.getRequestedItems().size() > 0) {
                        for (JargonResponseItem item : jargonResp.getRequestedItems()) {
     
                            fieldLabels.put(item.getSzDict().trim().toUpperCase(), item.getRowDescription());
     
                        }
                    }
                }
            } catch (Exception e) {
                System.out.println(e);
            }
        }
    
  5. Call the new method inside your initialize method of your DC class.

    public void initialize() {
     
            String handshakeId = (String) ADFContext.getCurrent().getPageFlowScope().get("handshakeId");
            if (handshakeId == null || handshakeId != null && handshakeId.length() == 0) {
                userBean = new E1UserSessionBean(AIS_SERVER, USER_NAME, PASSWORD, ENVIRONMENT, ROLE, DEVICE, JAS_SERVER);
            } else {
                //initialize application for about properties, only do this when running in the container
                E1AdfUtils.intializeAppInstance("/com/oracle/e1/A01012/");
     
            }
            retriveJargonValues();
            retrievePOValues();
        }
    
  6. Create getters for each of the labels you have fetched. These will be exposed as elements by the data control so you can place the values on the page.

        public String getAn8Label() {
            return fieldLabels.get("AN8");
        }
     
        public String getAlphLabel() {
            return fieldLabels.get("ALPH");
        }
     
        public String getMlnmLabel() {
            return fieldLabels.get("MLNM");
        }
     
        public String getAdd1Label() {
            return fieldLabels.get("ADD1");
        }
     
        public String getCty1Label() {
            return fieldLabels.get("CTY1");
        }
     
        public String getAddsLabel() {
            return fieldLabels.get("ADDS");
        }
     
        public String getAddzLabel() {
            return fieldLabels.get("ADDZ");
        }
     
        public String getCtrLabel() {
            return fieldLabels.get("CTR");
        }
    
  7. On the page, drag the elements from the data control to the page, to create a data binding to the element and make the label value equal to the binding element input value.

            <af:panelLabelAndMessage label="#{bindings.an8Label.inputValue}" id="plam23">
                                                    <af:outputText value="#{bindings.selectedAddressNumber.inputValue}"
                                                                   id="ot13" inlineStyle="padding:5.0px;"/>
                                                </af:panelLabelAndMessage>
    

6.10.4 Order of Fetched Records

The following graphic illustrates the order in which the records are fetched when the Jargon Service runs, based on Jargon code passed in, users Language preference, and records that exist in the overrides table. This image is described in surrounding text.

6.10.5 JSON Example of a Jargon Service Request

This section shows an example of JSON code that performs the following actions:

6.10.5.1 Open Application: Request and Response

Example 6-47 JSON Request - Jargon Labels

 {
    "token": "044lVWt6GoyepCAyopvq9Sgx5Pb+LeWjhG505XntrmfJFw=MDE5MDEwNDMwMDM3NjU2MTM5OTExNDcyNWphdmFjbGllbnQxNDI0ODczNjM0NjQ0",
    "deviceName": "javaclient",
    "defaultSystemCode": "01",
    "requestedDataItems": [
        {
            "szDict": "AN8",
            "systemCode": "01"
        },
        {
            "szDict": "ALPH",
            "systemCode": null
        },
        {
            "szDict": "MCU",
            "systemCode": "40"
        }
    ]
}

Example 6-48 JSON Response - Retrieve Jargon Labels

{
    "requestedItems": [
        {
            "szDict": "AN8",
            "systemCode": " ",
            "language": "  ",
            "colTitle": "Address             \nNumber",
            "rowDescription": "Address Number"
        },
        {
            "szDict": "ALPH",
            "systemCode": " ",
            "language": "  ",
            "colTitle": "Alpha               \nName",
            "rowDescription": "Alpha Name"
        },
        {
            "szDict": "MCU",
            "systemCode": "40",
            "language": "  ",
            "colTitle": "Branch              \nPlant",
            "rowDescription": "Branch/Plant"
        }
    ]
}

6.11 Understanding Query Service

A single query object may be included in a form service request. A query object contains some top level parameters, including the match type and one or more condition objects. Each condition object contains a control id, and operator, and one or more query value objects. A query value has a content field, and a special value id.

Graphic is described in surrounding text.

Table 6-1

Parameter Description Values
Query

autoFind

Automatically click Find on the form to populate the grid records. You do not need to use event to press Find if you use autoFind.

true, false

matchType

If you want the records to match all (AND) or any (OR) of the conditions specified.

MATCH_ALL, MATCH_ANY

autoClear

If you want to clear all other fields on the form, for example, the default filter fields.

true, false

Condition

   

controlId

This condition is the control id to which the condition is applied. This is the field that you add to the query from the form when using the web client to create a query. It is either a filter field, or a grid column that is associated with the business view.

"28", "1[34]"

operator

This condition is the comparison operation to use with the query.

For all types:

BETWEEN, LIST, EQUAL, NOT_EQUAL, LESS, LESS_EQUAL, GREATER, GREATER_EQUAL

For strings:

STR_START_WITH, STR_END_WITH, STR_CONTAIN, STR_BLANK, STR_NOT_BLANK

content

This is either a literal value, which will be used in the comparison operation. Or, it relates to a special value id.

"23", "Joe", "2"

specialValueId

This is a special value, mostly for dates that may be today, or calculated dates from today. For calculated dates, the content field is used in the calculation.

LITERAL, TODAY, TODAY_;LUS_DAY, TODAY_MINUS_DAY, TODAY_PLUS_MONTH, TODAY_MINUS_MONTH, TODAY_PLUS_YEAR, tODAY_MINUS_YEAR


Example 6-49 Query - JSON Example

public void executeQuery()
{
    if (AISClientCapability.isCapabilityAvailable(loginEnv, AISClientCapability.QUERY))
    {
        FormRequest formRequest = new FormRequest(loginEnv);
        formRequest.setReturnControlIDs("350|360|41[116,118,122,123,124,125,129,130,131,132]");
        formRequest.setFormName("P42101_W42101C");
        formRequest.setVersion("ZJDE0001");
        formRequest.setFormServiceAction("R");
        formRequest.setMaxPageSize("100");
    
        try 
        {    
            Query query = new Query(loginEnv);
            query.setAutoFind(true);                // Automatically press find button (don't need to use form action to find).
            query.setMatchType(Query.MATCH_ALL);    // Perform an AND operation on all of the conditions.
            query.setAutoClear(false);              // Clear any existing filter values on the form.
                
            // Find all order lines where line number is 1.000,
            NumberCondition numCon = query.addNumberCondition("41[129]", NumericOperator.EQUAL());
            numCon.setValue("1.000");
                
            // requested date is within 2 years from today,
            DateCondition dateCon = query.addDateCondition("41[116]", DateOperator.GREATER());
            dateCon.setSpecialDateValue(DateSpecialValue.TODAY_MINUS_YEAR(), 2);
                
            // sold to is between 4242 and 4245,
            BetweenCondition betCon = query.addBetweenCondition("41[125]");
            betCon.setValues("4242", "4245");
                
            // and company is in list (00001, 00200).
            ListCondition listCon = query.addListCondition("360");
            listCon.addValue("00001");
            listCon.addValue("00200");
                
            // Add the query object to the request.
            formRequest.setQuery(query);
  
            // Execute form request.
            String response = JDERestServiceProvider.jdeRestServiceCall(loginEnv, 
                                                                        formRequest, 
                                                                        JDERestServiceProvider.POST_METHOD, 
                                                                        JDERestServiceProvider.FORM_SERVICE_URI);
            
            formParent = loginEnv.getObjectMapper().readValue(response, P42101_W42101C_FormParent.class);
    
            if (formParent != null)
            {
                // Process form service response.
            }
        } 
        catch (JDERestServiceException e) 
        {
            JDERestServiceProvider.handleServiceException(e);
        } 
        catch (Exception e) 
        {
            System.out.println(e);
        }
    }
    else
    {
        System.out.println("Query capability is not available.");
    }
}

6.12 Understanding Log Service

Starting with EnterpriseOne Tools release 9.1.4.6, an AIS service is available for adding messages to the AIS logs so that they are visible to system administrators for troubleshooting.

The URI for this service is:

http://<AISServer>:<port>/jderest/log

Example 6-50 JSON Request with token

{
   "token" : "044SgzFLFFN7O6HKpAc2qFb0fKZiV3ariuYuC7lKbv2WMY=MDIwMDA2LTI2NDA3MzE4NDcyODM0MDAyNjNTb2FwVUkxNDM1NzkyMjM2NjM0",
   "deviceName" : "SoapUI",
   "message" : "Test Message",
   "level" : "1"
}

Example 6-51 Resulting message in AIS log

01 Jul 2015 17:12:00,381[SEVERE][JDE][AIS]AIS LOG REQUEST: --Level SEVERE --Application: null--Application Version: null --User: jde --Device Name: SoapUI --Log Message: Test Message

Example 6-52 JSON Request without token

{
   "deviceName" : "SoapUI",
   "message" : "Test Message - No Token",
   "level" : "1"
}

Example 6-53 Resulting message in AIS log

01 Jul 2015 17:14:13,531[SEVERE][JDE][AIS]AIS LOG REQUEST: --Level SEVERE --Application: null--Application Version: null --User: null --Device Name: SoapUI --Log Message: Test Message - No Token

Example 6-54 ADF Code to log AIS message

if (AISClientCapability.isCapabilityAvailable(loginEnv, AISClientCapability.LOG))
{
    AISClientLogger.log(loginEnv, "Text that will be logged", AISClientLogger.SEVERE);
}

There are four possible log levels you can use:

  • "SEVERE

  • "WARN

  • "APP

  • "DEBUG

You may also send an exception along with the log request. The class of the exception will be included in the log.

AISClientLogger.log(loginEnv, "Text that will be logged", AISClientLogger.SEVERE, e);