Beruflich Dokumente
Kultur Dokumente
Copyright 2004
Pegasystems Inc., Cambridge, MA
All rights reserved.
This document and the software describe products and services of Pegasystems Inc. It
may contain trade secrets and proprietary information. This information should not be
disclosed to third parties unless otherwise provided for by a contract or business
agreement with Pegasystems. This document and the software are protected by federal
copyright law, international laws, and/or applicable treaties.
This document is current as of the date of publication only. Changes in the document
may be made from time to time at the discretion of Pegasystems. This document remains
the property of Pegasystems and must be returned to it upon request. This document does
not imply any commitment to offer or deliver the products or services provided.
This document may include references to Pegasystems product features that have not
been licensed by your company. If you have questions about whether a particular
capability is included in your installation, please consult your Pegasystems service
consultant.
Other brand or product names are trademarks of their respective holders.
The PegaSample-IntSvcs RuleSet provides sample applications that the sample services
and connectors use. The JSR-94 service sample makes the PegaRULES sample
application named AutoClaim available to an external JSR-94 client application.
AutoClaim is a simple application for processing automobile insurance claims. The
sample JSR-94 client application sends claim objects to the AutoClaim application for
processing through the sample JSR-94 service.
This document describes how the AutoClaim application was created by using the Java
Class (For Java Properties) option in the Create Import Rules Wizard. The wizard
created the PegaRULES class and property rules that implement the data model from the
Java classes that create claim objects. In addition, the wizard creates Java wrapper classes
that implement the PRObjectWrapper interface of the Clipboard Java API. The JSR-94
service sample uses the generated Java wrapper classes to manipulate the claim (Java)
objects that the sample JSR-94 client application submits to the AutoClaim application.
For information about JSR-94 services and the JSR-94 service sample, see Building JSR94 Services. This document is on the Integration Services page of the Pegasystems
Support Network.
This document contains the following sections:
Claim
Damage
Vehicle
The classes make up an insurance claim object that describes the damage to a
policyholders vehicle. The PegaSample-04-01_JSR94ServiceApps.zip file contains both
the class files and their Java source files so that you can examine the code.
For example:
C:\Tomcat4-1-27\webapps\prweb\ext\classes
C:\Tomcat4-1-27\webapps\prweb\ext\lib
The first step is to put your classes in the ext\classes directory or your .jar in the ext\lib
directory. The directory and subdirectory structure in the classes directory must reflect
the Java package name of the classes. For example, if you are using the AutoClaim Java
classes as a training exercise, copy the Claim, Damage, and Vehicle Java class files into
the following directory:
contextroot\ext\classes\com\pega\pegarules\sample\service\jsr94\
client
When running the wizard, you specify the top-level, fully-qualified Java class as the class
to be imported. Be sure that you copy all the Java classes in the Java package into the
ext\classes directory. If you are using a class file located in a .jar, be sure that the Java
package name is specified as
Run the Create Import Rules Wizard to Create the Data Model
To create the data model that represents the Java classes, complete the following steps:
1.
Create a rule of type Rule-Obj-Class to serve as the container for the data model.
The base class rule must have the following characteristics:
The base PegaRULES class rule for the Java classes in the
AutoClaim sample application is SampleJavaBase-. If you are using the
AutoClaim Java classes as a training exercise, create a new class rule that inherits
from SampleJavaBase-.
2.
Verify that you put the source files in the proper place. A .jar file must be located
in the ext\lib directory. A Java class file must be in the ext\classes directory in a
subdirectory that reflects the Java package name of the classes.
3.
Display your Dashboard. Under Accelerators and Wizards, select Create Import
Rules.
4.
In the Enter Rule Info window, complete the fields as shown in Figure 1:
Field
Value
Source Datatype
Base Class
Ruleset
Version
5.
Click Next.
6.
In the Initial Parameters window, enter the fully-qualified Java class name of the
Java object that will be passed in by the JSR-94 client, and then click Next. For
example, com.pega.pegarules.sample.autoclaim.Claim is the correct package
name and class for the AutoClaim Java class.
The Import Wizard parses the Java class and then displays the names of the
parameters that are defined in that Java class. For example, Figure 3 shows the Fields
form for the Claim class for the AutoClaim example. The fields in the list are the
variables defined in the Claim class.
7.
In the Fields window, select the properties for which you want the Import Wizard
to create Process Commander Java properties, and then click Next.
Note: If you select properties that refer to other Java classes, the classes and their
parameters are also included in the data model in the rulebase. In this example,
damageDetails is a variable that refers to an object of class Damage, and
vehicleDetails is a variable that refers to an object of class Vehicle.
If you select damageDetails and vehicleDetails, the Create Import Rules Wizard
generates the PegaRULES class rules and properties for the Damage and Vehicle
classes without prompting you to select additional fields.
The Import Wizard begins the processing by converting the pertinent information
from the Java classes into an XML Schema Definition (XSD) file.
8.
If you want to save the interim XSD file, enter a name and location for it and
then click Next.
If you do not want to save the interim XSD file, click Next.
The Import Wizard continues generating the Process Commander class rules, Process
Commander properties, and Java wrapper classes. When the wizard is finished, it
displays the results.
9.
In the View Results window, examine the list of generated items and then write
them down for future reference.
The class and property rules implement the data model described in the Java classes
Claim, Damage, and Vehicle. An additional property was then manually created for the
Vehicle class: age. The value of the age property is calculated with an expression rule
(Rule-Obj-Expressions). Incoming claim objects provide values for the year, make, and
model of the vehicle. The expression rule calculates the age of a vehicle by subtracting
the value in the year property from the value of the current year.
The following are the three Java classes that implement the PRObjectWrapper interface
of the Clipboard Java API:
ClaimPRPCWrapper
DamagePRPCWrapper
VehiclePRPCWrapper
These Java wrapper classes provide you with a standard way to access Java objects as
clipboard pages from within PegaRULES. The service activity in the JSR-94 service
example uses these wrapper classes to manipulate the Claim objects that the SubmitClaim
client application sends.
Consider the wrapper classes as a template or starting point. As a Java programmer, you
can alter the generated wrapper classes as necessary to implement your application.
For information about the PRObjectWrapper interface, see the PegaRULES Process
Commander Javadocs, located on your installation CD.