Sie sind auf Seite 1von 10

The AutoClaim Sample Application

PegaRULES Process Commander Integration Services

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.

This document is the property of:


Pegasystems Inc.
101 Main Street
Cambridge, MA 02142-1590
(617) 374-9600, fax: (617) 374-9620
www.pega.com
PegaRULES Process Commander
Document: AutoClaim Sample Application
Software Version: 04.01
Posting Date: May 2004

The AutoClaim Sample Application

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:

The Source Java Classes

The Create Import Rules Wizard

The AutoClaim Rules and Java Wrapper Classes

The AutoClaim Sample Application

The Source Java Classes


The PegaRULES AutoClaim sample application and the JSR-94 sample client
application, SubmitClaim, are based on the same set of Java classes:

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.

The AutoClaim Sample Application

The Create Import Rules Wizard


The AutoClaim application was created by using the Create Import Rules Wizard.
Specifically, the wizard imported the Java class named Claim into the base class rule
named SampleJavaBase-. The Claim class contains a variable that refers to an object of
the Damage Java class and a variable that refers to an object of the Vehicle Java class.
Therefore, the Create Import Rules Wizard created a class rule for each of the Java
classes and a property rule of mode Java Property for each of the variables specified in all
three Java classes.
The following section describes how to use the Java Class (For Java Properties) option
in the Create Import Rules Wizard to implement a data model for an application in the
PegaRULEs rulebase. The procedures use the AutoClaim application as an example.
If you want to import the AutoClaim Java classes as a training exercise, download the
PegaSample-04-01_JSR94ServiceApps.zip file from the Integration Services section of
the PDN:
http://pegasupport.pega.com/PDN/docs/intsvcs.asp
Then unzip the file.

Put the Java Classes or JAR File in the Correct Directory


The Create Import Rules Wizard can process a Java class file if the class file is located in
one of the following two places:

The PegaRULES Process Commander classes directory

In a .jar that is located in the PegaRULES Process Commander lib directory

The classes and lib directories are in the following locations:


contextroot\ext\classes
contextroot\ext\lib

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

The AutoClaim Sample Application

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:

Abstract. The name must end with a dash (-) character.


Inherits from Embed-Java- .

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.

The AutoClaim Sample Application

4.

In the Enter Rule Info window, complete the fields as shown in Figure 1:

Field

Value

Source Datatype

Select Java Class (for Java Properties)

Base Class

Select the Process Commander class rule that you


created in step 1.
For example, SampleJavaBase- was the base class
for the AutoClaim application.

Ruleset

Select the appropriate RuleSet.


For example, PegaSample-IntSvcs was the RuleSet
for the AutoClaim application.

Version

Select the appropriate version number for the


RuleSet.
For example, 04-01-01 was the appropriate RuleSet
version for the AutoClaim application.

Figure 1. Fields in the Enter Rule Info Window


For example, Figure 2 shows the Enter Rule Info form for the AutoClaim sample
application.

Figure 2. Enter Rule Info Form for the AutoClaim Application

The AutoClaim Sample Application

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.

Figure 3. Fields Form for the Java Claim Class

The AutoClaim Sample Application

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.

In the Processing Parameters window, do one of the following:

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.

Where Are the Java Wrapper Classes?


When the Create Import Rules Wizard generates the Java wrapper classes, it creates
Java source files first and then generates class files from the source files. The source
files for the wrapper classes are in the following directory:
\contextroot\ext\src
The Java wrapper class files are in the ext\classes directory in a subdirectory that
represents the Java package name of the Java class files that were imported. The Java
wrapper classes for the AutoClaim application are located in the following directory:
\contextroot\ext\classes\com\pega\pegarules\sample\service\jsr94\client

The AutoClaim Sample Application

The AutoClaim Rules and Java Wrapper Classes


When the Create Import Rules Wizard imported the AutoClaim Java classes, it created
the following rules and Java classes:

Three class rules

Three page models

Twelve property rules

One expression rule

Three Java wrapper classes

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.

Das könnte Ihnen auch gefallen