Interpreting the Code for the Component Interface SDK Sample (Java)
The following discussion refers to the Java sample program, sdk_bus_exp.java. (The code has been edited for length.) It explains the runtime options shown above.
-
Import all the required classes:
The code example shows how to import the required classes:
package sdk_bus_exp; import java.io.*; import java.util.*; import psft.pt8.joa.*; import PeopleSoft.Generated.CompIntfc.*; public class sdk_bus_exp { ..... -
Declare all the required objects.
Only one active period and one active detail record are possible at any time. Users are prompted to select the needed values if they are not active.
Collection Object Level Item Object for Collection oSdkBusExpCollection
Root (SDK_BUS_EXP)
oSdkBusExp
oSdkBusExpPerCollection
Level 1 (SDK_BUS_EXP_PER)
oSdkBusExpPer
oSdkBusExpDtlCollection
Level 2 (SDK_BUS_EXP_PER_DTL)
oSdkBusExpDtl
In addition, the CompIntfPropInfoCollection object is used to access the structure of a component interface. It is not specific to a component interface.
-
Declare the PeopleSoft session object.
-
Connect to the application server.
-
Instantiate the component interface.
-
Perform a Get or Create to access the component interface.
You must provide the keys to access the record that you want to modify.
-
Use the appropriate methods to access the component interface properties.
There are standard methods and user-defined methods defined for the session, the component interface, and the component interface collections.
The executeMethod function is used to invoke a method specified as a function parameter (nMethodIn).
The component interface Java SDK sample has 25 options:
| SDK Option | Where Executed |
|---|---|
|
1 through 5 |
On the component interface. |
|
6 through 15 |
SDK_BUS_EXP_PER collection. |
|
16 through 25 |
SDK_BUS_EXP_DTL collection |
Options 1 through 4 and options 6 through 25 are similar in behavior to those described in the product documentation for PeopleCode API Reference for a component Interface and its collections.
Option 5, InsertBusExpDtlDefaults, is the user-defined method of the SDK_BUS_EXP component interface. This method is defined in PeopleCode inside the component interface definition.
The logic used in the corresponding options of these collections is identical.
This is the main method. It performs such functions as starting the session, getting the component interface, and disconnecting:
public static final void main(String[] args)System.out.println(" ");
System.out.println("\t 1) Sign In ");
System.out.println("\t q) Quit ");
System.out.println(" ");
System.out.print("Command to execute (1, q) [1]: ");
charTemp = readCharacter();
switch (charTemp) {case 'q':case 'Q':.....
disconnectFromAppServer();
return;
default:
getConnectParameters();
if (connectToAppServer()) {
oSdkBusExp = (ISdkBusExp) oSession.getCompIntfc(m_strCIName);
while (getKeyType()) {
methodInt = selectMethod();
while (methodInt != 0) {
executeMethod(methodInt);
if (methodInt == 2) {
methodInt = 0;
} else {
methodInt = selectMethod();
.....