Sie sind auf Seite 1von 11

A guide to

Create a Component Interface and


Program the CI in Java.

By
Krishna Kishor K
Venkateshwara Rao
Objectives:

• To create a CI for an existing component.


• Use that CI with JAVA for exposing and updating
existing rows of data and to create new rows of
data.

Let us take the example of a component W_K_JAV_CI, which contains three pages.
1.Personal information of the employee,
2.Official information of the employee and
3.Passport information of the employee.

Here is a view of the component.


Now a CI has to be created, for the above shown component.
Go to File new Component Interface, as shown in the window below.

As soon as you select new CI, a window appears asking for the component, which you
want to expose. Mention your component name there. In this case it is W_K_JAV_CI.
When you select the component and press OK, one more window opens, asking whether
you want all the properties of the component to be exposed or not.
As exposing all the properties is not required here, better to select NO.

Now a CI window appears on the screen as shown below.

Mainly it has two windows. One shows the CI, other shows the underlying component.

Component window shows the all records on which component is based, and also shows
the search records separately.

CI window shows Get keys, Find keys, create Keys, Properties and default methods.
Note: If you want to see “Create keys” and “Create” method, then you have to give ADD
permissions to the component, in the “component properties”.

Now the records in Component window can be opened, and the fields to be exposed can
be just dragged in to the CI window from the Component window.

Now save your CI. Here the name is W_K_JV_CI.


Now you have to give security to your CI. Giving security is nothing but giving access
permissions.
For giving the security, go to

PeopleTools Security Permissions and Roles Permission list

Select the suitable Permission List, and then add your CI to the CI list. Then press, “Edit”
and give full access permission to your CI.
Note: You may not be having permissions to do this, in this case “Edit” button will not be active.
Contact your PSAdmin for this.
Now you have to build JAVA APIs, this is an interface for the JAVA program you are
going to write.
APIs contain the Interface classes required for Java program to run.

For example,
IWKJVCI.java contains the Interface IWKJVCI. This interface contains all the function
declarations.
WKJVCI.java contains WKJVCI class. WKJVCI class extends IWKJVCI class and
implements all function definitions.
Both IWKJVCI.java and WKJVCI.java are created during building APIs.

To build APIs
Go to Build PeopleSoft APIs from Application designer.
A window “Build PS API bindings” appears, select “JAVA classes” check box.
Under “Select APIs to build”, select the following.
CompIntfc. <CI name>
CompIntfc. <CI name>Collection
PeopleSoft.CompintfcCollection
PeopleSoft.Property
PeopleSoft.PropertyList
PeopleSoft.PSMessage
PeopleSoft.PSMessageCollection
PeopleSoft.RegionalSettings
PeopleSoft.Session
PeopleSoft.TraceSettings and press OK.
By default these APIs will be built in the directory

<PSHOME>\web\psjoa

Now we have to write the Java program for accessing the component through CI.
Instead of writing the program from scratch, you can use the JAVA template provided by
PS.

To Generate a JAVA template


Right click in the CI window select “Generate JAVA template”.
It will be generated in “ ~\LOCALS~1\Temp\<CI name>. java “
Now go to <PSHOME>\web\psjoa\PeopleSoft\Generated\CompIntfc, where your APIs
are generated, and put your JAVA template in to that directory.

Set the System variables.


Now before compiling APIs and your program, you have to set the system variables
“classpath” and “path” in your system properties.
Go to System properties advanced environmental variables.
If under “system variables” there is no variable called “classpath”, create one.
Add following paths to the “classpath”.

1. <PSHOME>\web\psjoa [where your APIs and Java program is present.]

2. <PSHOME>\web\psjoa\psjoa.jar [which contains all the class definitions]

Add the following string to system variable “path”.

<Java installed Dir>:\j2sdk1.4.2_03\bin

This can help you to run Java programs from any directory. This gives the path of Java
compiler.

If any of the properties of CI (fields of the component) is an integer, then include “import
java.math.BigDecimal”at the starting of your program.
For ex: if W_EMPID is an integer field, then the function “setWempid ();” expects a
BigDecimal.
Therefore a statement “oWKJvCi.setWempid (str WEmpid);” in the generated Java
template, should be changed in to “oWKJvCi.setWempid (new java.math.BigDecimal
(str WEmpid));”
Setting CI modes.

When the java template is generated, setGetHistoryItems setInteractiveMode and


setEditHistoryItems are set to “False” and SetGetHistoryItems will be set to “True”.
If you want your business logic to be fired then and there, you have to set
setInteractiveMode as True. If you want to edit the history items, you have to set
setEditHistoryItems as True.

Now compile your APIs and Java program, in command prompt.


You ca use following commands.

1. cd <PSHOME>\web\psjoa\PeopleSoft\Generated\CompIntfc

2. <PSHOME>\web\psjoa\PeopleSoft\Generated\CompIntfc:\>javac *.java

To execute the Java program, you can use following command.

<PSHOME>\web\psjoa\PeopleSoft\Generated\CompIntfc:\>java <filename>

When the program executes, it asks for Application server machine name, Application
server port number, user id and password.
Application server machine name, Application server port number can be got from the
file,

<PS_HOME>\appserv\<domain name>\appserv.cfg (in the server).

The automatically generated Java template gets data from the database, using “Get”
function. Similarly we can use, “Set” and “Create” functions to update existing rows and
create new rows respectively.
Now you can enhance your Java program by including GUIs, using Java Swings.
Here is how sample execution of the program in Command prompt.
With a little modification to the generated Java template, following functionality is
achieved.
Here is the output using Java Swings (GUIs)
(program name has been changed as SwingDemo.java)

Das könnte Ihnen auch gefallen