0% found this document useful (0 votes)
18 views48 pages

9D731ExerciseGuide PDF

The IBM Cúram SPM for Developers (ADE) 7.X Exercise Workbook provides a comprehensive guide for developers to learn and implement various exercises related to the Cúram Social Program Management Platform. The workbook includes exercises on accessing product documentation, setting up the development environment, modeling application objects, and implementing business logic. Each exercise is structured to enhance understanding and practical skills in using the Cúram platform effectively.

Uploaded by

tcskumar8034
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views48 pages

9D731ExerciseGuide PDF

The IBM Cúram SPM for Developers (ADE) 7.X Exercise Workbook provides a comprehensive guide for developers to learn and implement various exercises related to the Cúram Social Program Management Platform. The workbook includes exercises on accessing product documentation, setting up the development environment, modeling application objects, and implementing business logic. Each exercise is structured to enhance understanding and practical skills in using the Cúram platform effectively.

Uploaded by

tcskumar8034
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 48

IBM Cúram SPM for Developers (ADE) 7.

9D73G – Exercise Workbook


ERC 1.0
Published: 1-Jul-19

© Copyright IBM Corporation 2019


Course materials may not be reproduced in whole or in part without the prior written permission of IBM.
IBM Cúram SPM for Developers (ADE) 7.X – Exercise Workbook
_________________________________________________________________________________________________

Table of Contents

Exercise 1 – Access Product Documentation ________________________________________ 3

Exercise 2 – Access the ADE _____________________________________________________ 5

Exercise 3 – Read a Person (Server Side)___________________________________________ 9

Exercise 4 – Read a Person (Client Side) __________________________________________ 16

Exercise 5 – Add a Create Page _________________________________________________ 21

Exercise 6 – Add a Search Page _________________________________________________ 23

Exercise 7 – Add a Modify Page _________________________________________________ 25

Exercise 8 – Case Study: Design _________________________________________________ 27

Exercise 9 – Implement Code Tables ______________________________________________ 28

Exercise 10 – Import and Export Data _____________________________________________ 29

Exercise 11 – Configure Application Navigation _____________________________________ 30

Exercise 12 – Add Exception Handling ____________________________________________ 35

Exercise 13 – Implement Modeled and Server-Side Validations _________________________ 37

Exercise 14 – Perform Testing and Tracing _________________________________________ 40

Exercise 15 – Implement the Non-Standard Stereotype _______________________________ 42

Exercise 16 – Use Assignment and Aggregation _____________________________________ 43

Exercise 17 – Add Packages, Exit Points, and Unique IDs _____________________________ 44

Exercise 18 – Add a Select List and Online Help (Optional) ____________________________ 46

Exercise 19 – Add a Conditional Cluster (Optional) ___________________________________ 47

Exercise 20 – Case Study: Implementation _________________________________________ 48

© Copyright IBM Corporation 2019 2


IBM Cúram SPM for Developers (ADE) 7.X – Exercise Workbook
_________________________________________________________________________________________________

Exercise 1 – Access Product Documentation


The purpose of this exercise is to learn how to access the training image and access product
documentation.

1. Enter the password ‘system’ to login to the Cúram image.

2. The training image contains a standard Cúram development environment consisting of


Cúram software –the Social Program Management Platform and optional modules – and
supporting software. The training image provides desktop shortcuts for convenience, which
are grouped as follows:

Product
Documentation

Servers

Workshop IDEs and


build windows.

Full Cúram IDEs


and build windows

Browser

© Copyright IBM Corporation 2019 3


IBM Cúram SPM for Developers (ADE) 7.X – Exercise Workbook
_________________________________________________________________________________________________

3. Double-click the Knowledge Center shortcut.

4. From the Table of Contents select the most recent version of Cúram Social Program
Management. The landing page is displayed.

5. Browse the following links from the Getting started panel:

• Getting started – Review the high-level tasks explained on the page.

• Product overview – Review the IBM Cúram Social Program Management overview.

• Release Notes – Review the release notes if you have access.

6. Notice that the main guides are listed in the Common tasks panel of the Knowledge Center.

7. Select the Table of contents. The documentation is grouped by task, such as developing,
configuring, and troubleshooting. Documentation for modules, such as Provider Management
and Universal Access, are listed separately.

8. Expand the Developing link from the main table of contents.

• Select Cúram Server Developer and view the contents list.

• Note that development guides are also available for technologies such as REST
APIs, CER Rules, and Workflow.

9. Expand the Samples link from the main table of contents. Select the Cúram accelerators
link. This section describes sample applications and how to build them.

10. From the main table of contents, identify the guides for Universal Access.

11. Search for the following topic ‘logging OR Log4j’.

© Copyright IBM Corporation 2019 4


IBM Cúram SPM for Developers (ADE) 7.X – Exercise Workbook
_________________________________________________________________________________________________

Exercise 2 – Access the ADE


The purpose of this exercise is to become familiar with the project folder structure and
development tools in the Cúram development environment. You will also learn how to build and
deploy the Workshop application.

ADE Setup

1. You can access the product documentation from the Knowledge Center or from PDFs.

2. To access the PDFs, select the Product Guides (PDF) desktop shortcut. Locate the
following guide:

• CuramDevelopmentEnvironmentInstallationGuide_PDF

3. Go to ‘Chapter 1: Planning the installation’.

i. Review the section called ‘Overview of the installation steps’ to see the main steps of
the installation.

ii. Open IBM Cúram Social Program Management Supported Prerequisites in the
‘Related information’ section. Select Detailed system requirements. Determine the
latest version of Eclipse that is supported.

4. Review the ‘Cúram Development Environment’ section of the installation document.

Project Structure

5. Open the following file: CuramServerDeveloperGuide_PDF. Review the following sections:

• Application directory structure.

• Cúram application build structure.

6. Identify the folder structure for full Cúram:

• Navigate to C:\IBM\Curam\Development.

• Browse the CuramSDEJ and CuramCDEJ folders. These projects contain the code
for the ADE, also referred to as the infrastructure.

• Open the EJBServer folder. Open the components\core folder. Note the standard
folders for development artifacts within this folder, such as data and message.

© Copyright IBM Corporation 2019 5


IBM Cúram SPM for Developers (ADE) 7.X – Exercise Workbook
_________________________________________________________________________________________________

7. Click the Workshop Eclipse desktop shortcut to open the IDE for the lightweight Workshop
project.

• Note the four projects.

• Expand the ServerWorkshop project to determine the components and development


folders. Note the standard folders. See the folders in the components\core folder.

• Expand the CuramClientWorkshop project. Note the folder structure.

Build the Workshop

8. From Windows Explorer, navigate to C:\IBM\CourseWorkshop. Open setEnvironment.bat in


C:\IBM\CourseWorkshop to see where the project names and folders are defined. Do not
change the file.

9. Open the Workshop Server desktop shortcut. This opens a command prompt at the
following file-system location: C:\IBM\CourseWorkshop\ServerWorkshop.

10. Enter build clean generated to process the model and server artifacts. You should get
BUILD SUCCESSFUL.

11. Review the log on the screen or in the ServerWorkshop\buildlogs folder.

12. Navigate to the ServerWorkshop\build folder to see some of the outputs.

13. From the Workshop Eclipse, refresh (F5) the ServerWorkshop project to bring in the
generated artifacts and to compile the Java files.

14. Double-click the H2 Server desktop shortcut. Note that you will only need to start the
database server once for your development session. You can minimize the DOS window, but
do not close it as the this will terminate the server.

15. From the Workshop Server command window enter build database. You should get
BUILD SUCCESSFUL.

16. Review the log on the screen or in the buildlogs folder.

17. Open the Workshop Client desktop shortcut.

18. Enter build clean client to process the UIM pages. You should get BUILD
SUCCESSFUL.

19. Review the log on the screen or in the buildlogs folder.

© Copyright IBM Corporation 2019 6


IBM Cúram SPM for Developers (ADE) 7.X – Exercise Workbook
_________________________________________________________________________________________________

20. From the Workshop Eclipse, refresh (F5) the CuramClientWorkshop project to bring in the
updated artifacts.

Deploy the Workshop

21. From the Workshop Eclipse, expand the components/core/source source package. In the
default package you’ll see a class called StartServer. Right click this class and choose Run
as – Java application from the menu. You can also run this class from the Run menu:

22. Open the Debug perspective . You will see an entry in the Debug window
for the StartServer application you just started. Verify that this application has not terminated
and that the last entry in the console window for this application says, ‘Server Started’.
Always ensure that only one instance of StartServer is running at any time.

23. Click (once) the Tomcat icon in Eclipse to start the servlet container:

24. Wait until you see the message ‘INFO: Server startup in xx ms’. Always ensure that only one
instance of Tomcat is running at any time

25. Start the browser. Select the Workshop link on the favorites bar to load the application home
page.

26. The Workshop skeleton application is now built and deployed. The application does not do
very much at present. In subsequent exercises, you will add features to this skeleton
application.

© Copyright IBM Corporation 2019 7


IBM Cúram SPM for Developers (ADE) 7.X – Exercise Workbook
_________________________________________________________________________________________________

27. When you are finished, you can stop StartServer and Tomcat by terminating them in the
Debug perspective. Alternatively, when you exit Eclipse, StartServer and Tomcat are
terminated when you exit Eclipse.

© Copyright IBM Corporation 2019 8


IBM Cúram SPM for Developers (ADE) 7.X – Exercise Workbook
_________________________________________________________________________________________________

Exercise 3 – Read a Person (Server Side)


The purpose of this exercise is to begin modeling your application by using the IBM Cúram SPM
Modeling Plug-In for Rational Software Architect Designer (RSAD), formerly referred to as
Rational Software Architect (RSA). In the second part of the exercise, you will write the
implementation code.

Model the Objects

1. Double-click the RSAD – Workshop desktop shortcut.

2. From the Project Explorer panel next to the working set WorkshopModeling, click the >
symbol to view the ServerWorkshop project.

3. Expand the Models folder. Expand the ServerWorkshop resource within the Models folder.

4. You should see a resource called ServerWorkshop with a stereotype of <<package>>. This is
a package within the model. The ServerWorkshop package currently contains basic domain
definitions that are required for later exercises.

5. Developers use RSAD packages to organize artifacts and can define any package structure
they like. Within the existing ServerWorkshop package, add a new package as follows:

• Select the ServerWorkshop package, right-click it and select Add Class – Package
from the context menu. Name the new package MaintainPerson.

© Copyright IBM Corporation 2019 9


IBM Cúram SPM for Developers (ADE) 7.X – Exercise Workbook
_________________________________________________________________________________________________

6. Within this new package, create a child package called ‘Domain Definitions’. Add the
following domain definitions to this package:

Domain Defined as…


CONCERN_ROLE_ID SVR_INT64

PERSON_NAME SVR_STRING<30>

DATE_OF_BIRTH SVR_DATE

PERSON_ADDRESS SVR_STRING<50>

PERSON_GENDER SVR_STRING<30>

PERSON_TITLE SVR_STRING<30>

Hint: Follow these guidelines to create a new domain definition:

i. Right-click the Domain Definitions package you created. Select Add Class –
Domain Definition.

ii. In the dialog box, enter the name of the new domain definition.

iii. Click Select Type to bring up a search dialog box.

iv. In the Select an Element field, enter the first few characters of the underlying type.
For example, enter SVR to see all currently known definitions starting with those
letters.

v. Select the appropriate type and click OK.

vi. Depending on the type you may need to provide a value in the Max Size field, which
is specified in the table above in the < > brackets.

vii. Click Finish.

7. Right-click the MaintainPerson package and select Add Class – Package. The new
package should be called Entity.

8. Right click the new Entity package and select Add Class – Entity. The name of the entity is
‘Person’.

© Copyright IBM Corporation 2019 10


IBM Cúram SPM for Developers (ADE) 7.X – Exercise Workbook
_________________________________________________________________________________________________

9. Right-click the Person entity. Add the following attributes:

Attribute Type Domain Def


concernRoleID Key CONCERN_ROLE_ID

firstName Details PERSON_NAME

lastName Details PERSON_NAME

title Details PERSON_TITLE

gender Details PERSON_GENDER

dateOfBirth Details DATE_OF_BIRTH

address Details PERSON_ADDRESS

10. Add a standard read operation to the new entity: right-click the entity and select Add
Operation – Read. Leave the name of the operation as read().

11. The next step is to create a new façade: right-click the MaintainPerson package and add a
new facade class called MaintainPerson.

12. For now, you need one operation for the new facade class.

• Create a <<default>> operation called readPerson.

• The readPerson operation requires one parameter of type PersonKey and a return
parameter of type PersonDtls. (Select the appropriate shadow types.

13. Right-click the MaintainPerson package and create a new Class Diagram called
MaintainPerson. Drag your entity and facade objects to the new Class Diagram. Notice the
difference in the context menu, depending on whether you right-click the object in the class
diagram or Project Explorer.

14. Ensure that you save your work. Have you noticed that elements within the RSAD or Eclipse
IDE have an asterisk next to them if they need to be saved?

15. Your modeling should look like this:

© Copyright IBM Corporation 2019 11


IBM Cúram SPM for Developers (ADE) 7.X – Exercise Workbook
_________________________________________________________________________________________________

Note: To delete an entry from the model right click the artifact in the Package Explorer view
and select Delete from Model. You may also right-click the artifact in the diagram panel and
delete the artifact from the diagram only or from the diagram and model.

16. Open the Workshop Server DOS window and perform build generated. This Ant
target processes the model and generates the relevant application code. Once your build has
finished you should see BUILD SUCCESSFUL. Scroll up the screen to ensure that there
were 0 warnings:

17. Go to the following directory to see the generated packages and Java files:
C:\IBM\CourseWorkshop\ServerWorkshop\build\svr\gen\serverworkshop.

© Copyright IBM Corporation 2019 12


IBM Cúram SPM for Developers (ADE) 7.X – Exercise Workbook
_________________________________________________________________________________________________

i. Find the classes that were generated in to the intf, base, and fact packages for your
entity. Open the classes to understand how they are related.

ii. Find the classes that were generated in to the intf, base, and fact packages for your
façade. Open the classes to understand how they are related.

18. Ensure that the H2 Server is started.

19. In the Workshop Server command window that you opened in a previous step, type build
database to create the application database. Again, ensure that you see the BUILD
SUCCESSFUL message when the build is finished.

20. Select the H2 Console desktop shortcut. Connect to the H2 Console with the following
values: Saved Settings=Workshop, Username=h2admin, and Password=h2admin. Expand
the H2ADMIN folder and check that the PERSON table was created.

21. Disconnect from the H2 console when you are finished. Otherwise, you may get an MVCC
error the next time you run StartServer.

Implement the Business Logic

22. Select the Workshop shortcut to open the Eclipse IDE where you will write the
implementation code.

23. Refresh the ServerWorkshop project. The refresh loads the generated artifacts into the
Eclipse workspace. You will review the generated files later in the exercise. Select the
Problems view at the bottom of the screen. You should see two errors, as shown below:

Double-click the first error to see the offending line in MaintainPersonFactory.java. The
generators have created a factory class MaintainPersonFactory that extends MaintainPerson
in the impl package. However, you have not created your handcrafted class MaintainPerson
in the impl package yet, hence the errors.

© Copyright IBM Corporation 2019 13


IBM Cúram SPM for Developers (ADE) 7.X – Exercise Workbook
_________________________________________________________________________________________________

24. You are now ready to write some hand-crafted code in Eclipse:

i. From the ServerWorkshop project, right-click the components/core/source Java


source folder, and select New – Package. Create a package called
serverworkshop.impl.

ii. Right-click the serverworkshop.impl package and select New – Class.

iii. On the New Class dialog, enter the name ‘MaintainPerson’.

iv. All classes except the factory class should be abstract. Select the abstract option in
the Modifiers section.

v. Use the Browse button to select the MaintainPerson class from the
serverworkshop.base package as the superclass. Start typing MaintainPerson
and select MaintainPerson from serverworkshop.base when it appears.

vi. If selected, deselect the option to create the main method () and select the Inherited
abstract methods option.

vii. Click the Finish button.

25. You should now have the stub of a MaintainPerson class with one method defined, namely,
readPerson.

26. In the body of the readPerson method, replace the return null; statement with code to
create a new instance of the Person object interface, call the read method for the entity, and
return the struct.

27. Save and compile the code by pressing Ctrl–S. You are now ready to run the application.

28. Run StartServer.

29. You now have a running server application, which allows you to read Person records. In the
next exercise, you will learn how to write a client to test your server-side functionality.

Review the Generated Artifacts


The generators create many files, both intermediate and final files. This section asks you to look
at the main files, particularly the files that are generated for the class hierarchy.

30. The generators add files to folders to the build folder. From the ServerWorkshop project in
Eclipse, select build/svr/gen.

31. Open the serverworkshop package. View the generated (shadow) structs:

© Copyright IBM Corporation 2019 14


IBM Cúram SPM for Developers (ADE) 7.X – Exercise Workbook
_________________________________________________________________________________________________

• Open the struct folder.

• Open PersonDtls.java, which was generated for the Dtls shadow struct.

32. View the files that were generated for the Person entity:

• In the serverworkshop package, open the intf package. Open Person.java. See the
method signatures that are generated for different types of read methods.

• In the serverworkshop.base package, open Person.java. Note that this file contains
the implementation of the stereotype entity methods you modeled.

• In the serverworkshop.fact package, open PersonFactory.java. Note that the


factory class extends Person.java in the base package. See how the newInstance()
method is defined.

• From the ServerWorkshop project folder, open the build folder. Open the
datamanager folder. This folder is created when you run 'build database'. Open
CreateTables.sql. This file is created from the entities that you modelled and from
infrastructure entities. Locate the DDL to create the Person table. SetupDatabase.sql
is used to set up indexes and populate tables. Locate the entry that defines an index
for the Person table.

33. View the files that were generated for the MaintainPerson facade:

• In the serverworkshop package, open the intf package. Open MaintainPerson.java.


See the method signature that was generated for the operation you modeled.

• In the serverworkshop.base package, open MaintainPerson.java. Note that this file


simple implements the interface.

• In the serverworkshop.fact package, open MaintainPersonFactory.java. Note that


the factory class extends MaintainPerson.java in the impl package. See how the
newInstance() method is defined.

© Copyright IBM Corporation 2019 15


IBM Cúram SPM for Developers (ADE) 7.X – Exercise Workbook
_________________________________________________________________________________________________

Exercise 4 – Read a Person (Client Side)


The purpose of this exercise is to create a screen that will allow you to read a record from the
database. The screen will call the server-side read functionality that you developed in the
previous exercise.

1. Copy the skeleton client page:

• From C:\LearnerResources\CourseWorkshopResources\CuramClientWorkshop,
copy PersonDemo_readPerson.uim and PersonDemo_readPerson.properties to
C:\IBM\CourseWorkshop\CuramClientWorkshop\components\core\PersonDemo.

• PersonDemo_readPerson.uim simply contains a PAGE element that references the


UIM schema.

2. Refresh the client project CuramClientWorkshop in Eclipse to bring in the files you copied in
the previous step. Open the file PersonDemo_ readPerson.properties file in Eclipse. This file
contains the text for the labels and titles that you will use in the corresponding UIM file. Add
the following properties:
Page.Title=Display a person’s details

Cluster.Title.PersonDetails=Person Details

Field.Label.ConcernRoleID=ConcernRole ID

Field.Label.FirstName=First Name

Field.Label.LastName=Last Name

Field.Label.Title=Title

Field.Label.Gender=Gender

Field.Label.DateOfBirth=Date Of Birth

Field.Label.Address=Address

3. Add a title to the page:

i. A tab at the end of the Eclipse window for the UIM file shows two views. When writing
UIM, you can use the Design view or Source view of the XML editor. You can use
code completion (CTRL+Space) when using the Source view:

© Copyright IBM Corporation 2019 16


IBM Cúram SPM for Developers (ADE) 7.X – Exercise Workbook
_________________________________________________________________________________________________

ii. In the design view of the read Person page, right click the PAGE element and add a
PAGE_TITLE child.

iii. The PAGE_TITLE element is added with a CONNECT child element. Right-click the
CONNECT element and add a SOURCE child element. Set the NAME to be TEXT
and the property Page.Title.

iv. Save your changes.

4. Your page will need to connect to the readPerson functionality that you created earlier.
Double-click the desktop shortcut labeled Workshop Client.

i. Perform build beandoc in the Workshop Client build window to see which server
functions are available.

ii. Refresh the client project in Eclipse. Right-click the index.html file in the build\bean-
doc directory of your client project and select Open With – Web Browser. This is a
HTML document view of the ServerAccessBeans.xml file.

5. Return to the PersonDemo_readPerson.uim file. Add a SERVER_INTERFACE element to


the PAGE and set the OPERATION and CLASS attributes to match what is listed in the
ServerAccessBeans.xml file. Use the Copy options associated with each value in the HTML
file. Finally, choose a suitable value for the NAME attribute, for example, ReadPersonBean.
The NAME attribute is used to refer to the interface within the UIM file. Ensure that the
PHASE attribute is defined correctly.

6. Add a PAGE_PARAMETER called concernRoleIDParam to your UIM page.

7. Add a page level CONNECT after the PAGE_PARAMETER. Define a SOURCE element to
read the PAGE_PARAMETER and a TARGET element to populate the concernRoleID of the
above SERVER_INTERFACE, which you can copy from the HTML Bean Doc. This should
now look like this:
<PAGE_PARAMETER NAME="concernRoleIDParam" />

<CONNECT>

<SOURCE NAME="PAGE" PROPERTY="concernRoleIDParam" />

<TARGET NAME="ReadPersonBean" PROPERTY="personKey$concernRoleID" />

</CONNECT>

Note that the prefix, personKey, comes from the name of the input parameter. You might
have specified a different name for the input parameter in your model.

© Copyright IBM Corporation 2019 17


IBM Cúram SPM for Developers (ADE) 7.X – Exercise Workbook
_________________________________________________________________________________________________

8. Add a CLUSTER child element to the PAGE element. Add a TITLE attribute to the CLUSTER
and source the title by referencing the appropriate entry in the properties file.

9. Add a FIELD element to the CLUSTER. Add a LABEL attribute to the FIELD and set the label
using the name of the concernRoleID property from the properties file. Add a CONNECT
element to the FIELD. Add a SOURCE element to the CONNECT. Set the NAME attribute
and the PROPERTY attribute to the matching property from the bean documentation.

10. Repeat the previous step for the other fields to appear on the page. You might want to use
the Source view in the XML Editor and copy the FIELD elements. Your cluster should look
something like this:
<CLUSTER TITLE="Cluster.Title.PersonDetails">

<FIELD LABEL="Field.Label.ConcernRoleID">

<CONNECT>

<SOURCE PROPERTY="result$concernRoleID" NAME="ReadPersonBean" />

</CONNECT>

</FIELD>

<!-- other fields -->

</CLUSTER>

11. You have now created an XML (UIM) file that has the following basic structure, excluding
other child elements and attributes: a PAGE with a PAGE_TITLE, a SERVER_INTERFACE,
PAGE_PARAMETER, CONNECT, and a CLUSTER:
<PAGE>

<PAGE_TITLE/>

<SERVER_INTERFACE/>

<PAGE_PARAMETER/>

<CONNECT/>

<CLUSTER/>

</PAGE>

12. Perform build client and resolve any build errors. The following tips may be useful when
fixing UIM errors:

© Copyright IBM Corporation 2019 18


IBM Cúram SPM for Developers (ADE) 7.X – Exercise Workbook
_________________________________________________________________________________________________

i. XML syntax errors, or non-conformance with the UIM schema, result in errors in the
Eclipse XML Editor. The incorrect lines are highlighted with red marks on the right of
the edit panel.

ii. The build client usually shows the line number of the incorrect line. If you cannot see
the line numbers in the Eclipse XML editor, right-clicking the left grey margin of the
XML Editor and selecting Show Line Numbers.

13. In Eclipse, refresh the CuramClientWorkshop project to load the generated artifacts.

14. You need to add a test record to test the read page. Open the browser and select H2
Console from the links toolbar. Log into the H2 Console with the following values: Saved
Settings=Workshop, Username=h2admin, and Password=h2admin. Expand the H2ADMIN
folder and locate the PERSON table. Insert some test data using an SQL insert statement, for
example:
insert into person (CONCERNROLEID, FIRSTNAME, LASTNAME, TITLE,
GENDER, DATEOFBIRTH, ADDRESS) values (101, 'John', 'Doe', 'Mr',
'Male', '1964-09-12', 'New York City')

Note: You must set the concernRoleID to 101, as this value is expected by the page that calls
the read page.

15. Disconnect from the H2 console.

16. Ensure that StartServer and Tomcat is running.

17. Load the application home page.

18. Click the Read Person Demo link, which opens a popup page to display the test record you
added. Don’t worry if the page does not look good. UIM pages in an IBM Cúram SPM
application are tied to navigation and do not display correctly without the correct navigation in
place. Navigation is covered later in the course.

Review the Generated Artifacts


The purpose of this section is look at some of the files that are generated by build client. The
client generator creates a lot of files. It is not always clear what the purposes of these files are.
However, you will rarely need to look at them.

19. In Eclipse, open the ServerWorkshop folder. Open the build\svr\gen package. Open the client
package. Open ServerAccessBeans.xml.

© Copyright IBM Corporation 2019 19


IBM Cúram SPM for Developers (ADE) 7.X – Exercise Workbook
_________________________________________________________________________________________________

20. In Eclipse, open the CuramClientWorkshop project folder. Open the build folder.

21. Open the texthelpers folder. Locate the text helper for the read operation. The client uses text
helpers to interact with server-side operations.

22. In the CuramClientWorkshop project folder, open the WebContent folder. Open jsps and pe.
Open PersonDemo_readPerson.jspx to see the jsp that the generators created from the UIM.

23. In the WebContent folder, open WEB-INF. Open struts-config.xml. Open web.xml. Web.xml is
used by Tomcat (and other web containers) to determine which servlets exist. web.xml points
to struts-config.xml.

© Copyright IBM Corporation 2019 20


IBM Cúram SPM for Developers (ADE) 7.X – Exercise Workbook
_________________________________________________________________________________________________

Exercise 5 – Add a Create Page


The purpose of this exercise is to add functionality that allows you to insert a person’s details, link
from the create page to the read page, and display the details of the person you just inserted.

Server Development

1. Return to the ServerWorkshop model in RSAD.

2. Add an <<insert>> operation to the Person entity.

3. Add a façade operation called insertPerson to the façade. The operation should receive a
PersonDtls struct and return a PersonKey struct.

4. Save the model. Perform build generated.

5. Refresh the ServerWorkshop project.

6. Open your MaintainPerson impl class and use the Override/Implement methods option
under the Source option of the right-click menu, which should indicate the new insertPerson
method.

7. Write the code for the method. The code will need to create an instance of the Person
interface (just as you did in the readPerson method), insert the details, and return a
PersonKey containing the correct concernRoleID. Note that you can use the concernRoleID
from the PersonDtls parameter to populate PersonKey.

Client Development

8. Rebuild the bean documentation to pick up the latest version of ServerAccessBeans.xml that
was generated on the server side.

9. In the CuramClientWorkshop project under components/core/PersonDemo, create a new file


called PersonDemo_createPerson.uim. Create an associated properties file.

10. Add the PAGE element and the xsi:noNamespaceSchemaLocation, xmlns:xsi and PAGE_ID.
Hint – Why not copy this information from an existing page?

11. Add some entries to the properties file for the title of the page, cluster, and field labels.

12. Add a SERVER_INTERFACE to the PAGE, which will call the insertPerson function and
ensure that it is called at the appropriate time or PHASE.

© Copyright IBM Corporation 2019 21


IBM Cúram SPM for Developers (ADE) 7.X – Exercise Workbook
_________________________________________________________________________________________________

13. You should add a PAGE_TITLE, CLUSTER, and FIELDs to the PAGE, which should be
similar to the PersonDemo_readPerson page. However, the FIELD elements in the create
page should contain TARGET elements rather than SOURCE elements.

14. Add an ACTION_SET to the cluster.

i. The ACTION_SET should display the following buttons at the bottom of the page only
and in the center: Save and Cancel.

ii. Set the TYPE for each ACTION_CONTROL element.

iii. Add a LINK element to your Save ACTION_CONTROL, which links to your read
person page. The LINK should pass the concernRoleID that was input by the user to
a page parameter that is accessed by the read page.

15. Finally, you need to amend the PersonDemo_readPersonPage. On the PAGE element,
remove the POPUP_PAGE=TRUE. This was added initially to allow the read person to work,
but should be removed to prevent unusual display errors.

16. Save your files and perform the necessary build.

17. Test your new functionality by creating a new Person. To do this, expand the shortcuts on the
left-hand side and select Register – Person. Add a person, ensuring that the Concern Role
ID is non-zero and unique. Do not use 101 because you have already added a record with
that ID. Click the Save button. You should see your Read Person page.

© Copyright IBM Corporation 2019 22


IBM Cúram SPM for Developers (ADE) 7.X – Exercise Workbook
_________________________________________________________________________________________________

Exercise 6 – Add a Search Page


The purpose of this exercise is to allow the user to search the Person table by last name.

Server Development

1. From RSAD, add a new operation called readmulti to the Person entity. This new operation
should be stereotyped as <<readmulti>>. The readmulti should read by lastName.

2. Do you see that the new struct that has been created? It would be worth renaming this struct
to something more descriptive. Right-click the new struct and select Refactor – Rename.
Change the name to PersonByLastNameKey for example. Leave the checkbox Update
References to the renamed element selected, so that the reference is updated in the entity
operation.

3. Notice that you did not specify what the new method should return. The generators will
automatically create the correct return class based on the operation’s stereotype. Modeling a
<<readmulti>> operation on the entity will result in the generators creating a new struct
named [entityname]DtlsList.

4. Add a new default operation to the MaintainPerson façade class called searchByLastName.

5. Add the appropriate input parameter type and return type for the façade operation.

6. Generate the code.

7. Write the implementation code for the new method.

Client Development

The UIM for the search page that is in the course manual is provided as a reference. You can
copy the relevant UIM, which should speed up the exercise.

8. From C:\LearnerResources\CourseWorkshopResources\CuramClientWorkshop, copy


BankAccount_searchAccountByType.uim and
BankAccount_searchAccountByType.properties to
C:\IBM\CourseWorkshop\CuramClientWorkshop\components\core\PersonDemo.

9. Rename the UIM and property files to PersonDemo_findPeople.

10. Refresh the client project CuramClientWorkshop in Eclipse to bring in the files.

© Copyright IBM Corporation 2019 23


IBM Cúram SPM for Developers (ADE) 7.X – Exercise Workbook
_________________________________________________________________________________________________

11. Recreate the Bean Doc.

12. Update the UIM and properties file as necessary. (Don’t forget to update the PAGE_ID).

13. Make the necessary changes to display the number of records that are found.

14. Build your client application.

15. To test your application, open the Shortcuts Panel and select Search – Find People. Ensure
that the hyperlink works. Ensure that the Reset button works.

© Copyright IBM Corporation 2019 24


IBM Cúram SPM for Developers (ADE) 7.X – Exercise Workbook
_________________________________________________________________________________________________

Exercise 7 – Add a Modify Page


In this exercise, you will develop server and client functionality that allows the user to modify the
details of a Person. You will allow users to access the modify page from the list that is displayed
by the Search page.

Server Development

1. Add a <<modify>> method to the Person entity. The generator will add the parameters and
return type for this stereotype to the operation.

2. Add an operation called modifyPerson to the MaintainPerson façade. The operation should
receive a PersonDtls struct and return a PersonKey struct.

3. Save your changes and build.

4. Write the code for the modifyPerson method. Notice that the modify operation of the entity
requires two input parameters of type PersonKey and PersonDtls. You will have to create a
new PersonKey struct and set the value of concernRoleID before you pass it to the modify
operation as the first parameter.

Client Development

A modify page contains a read function and a modify function. Therefore, you will find it useful to
reuse UIM from your read and create pages. One approach is to get the read function working
first and then add UIM for the modify function.

5. Rebuild the Bean Doc to pick up the new façade operation.

6. Create a new page called PersonDemo_modifyPerson.

7. Define server interfaces to call the readPerson operation and the modifyPerson operation.
Set the PHASE attribute for each of SERVER_INTERFACE element to the appropriate value.

8. Display the record to the user. Allow the user to edit each field except the ConcernRoleID
(key field). However, you must pass the ConcernRoleID to the modifyPerson operation.

9. Your page should have both Save and Cancel buttons. Once the user clicks the Save button,
the system should navigate to the PersonDemo_readPerson page after saving their changes.
There is no need to provide a LINK element in the ACTION_CONTROL for Cancel.

10. For reference, your Modify page should roughly have the following structure:

© Copyright IBM Corporation 2019 25


IBM Cúram SPM for Developers (ADE) 7.X – Exercise Workbook
_________________________________________________________________________________________________

<PAGE ...> <!-- usual declarations -->


<PAGE_TITLE> ... </PAGE_TITLE>
<PAGE_PARAMETER ... />
<SERVER_INTERFACE ... /> <!-- read person -->
<SERVER_INTERFACE ... /> <!-- modify person -->
<CONNECT> ... </CONNECT> <!-- read method key -->
<CONNECT> ... </CONNECT> <!-- modify method key -->
<CLUSTER>
<ACTION_SET ... >
<ACTION_CONTROL ... > <!-- save button -->
<LINK ... >
<CONNECT>
<SOURCE ... />
<TARGET ... />
</CONNECT>
</LINK>
</ACTION_CONTROL>
<ACTION_CONTROL ... /> <!-- cancel button -->
</ACTION_SET>

<FIELD ... >


<CONNECT> <!-- read values --></CONNECT>
<CONNECT> <!-- modify values NOT ConcernRoleID --></CONNECT>
</FIELD>
</CLUSTER>
</PAGE>

11. Change the PersonDemo_findPeople page to that an Action menu is displayed in the list (you
will need to define the type of the action set to be LIST_ROW_MENU). The label should be
set to ‘Edit’. When the user selects Edit, they should see the PersonDemo_modifyPerson
page. Ensure that the Modify page is opened in a modal dialog and ensure that the page
parameter is passed to the Modify page.

12. Build the client and redeploy. Test your changes to ensure that they work as expected.

© Copyright IBM Corporation 2019 26


IBM Cúram SPM for Developers (ADE) 7.X – Exercise Workbook
_________________________________________________________________________________________________

Exercise 8 – Case Study: Design


The purpose of this case study is to add a feature to the Person Demo application to allow the
user to manage cases for a person.

Requirements

Once a Person makes a claim for a program, a case is created for them on the system to store
the claim details. Examples of cases include Unemployment Assistance, Cash Assistance, and
Food Stamps. Add features to your demo application to allow multiple cases to be stored for each
Person and displayed in a list page. The user should be able to create and list the cases.

To Do

1. Design the server-side artifacts:

• Consider the domain definitions, entity class, structs, and BPOs that are required.

• Determine the class(es) and methods required.

2. Design the client-side artifacts:

• Consider the pages that are required and how they will link together.

• For each page determine the server interface(s) and phase.

Draw a diagram showing the connection between the pages and the tables. Show what you need
to develop in each layer, from presentation to persistence.

This is a paper and pencil exercise. Later in the course you will design additional features and
implement your solution.

© Copyright IBM Corporation 2019 27


IBM Cúram SPM for Developers (ADE) 7.X – Exercise Workbook
_________________________________________________________________________________________________

Exercise 9 – Implement Code Tables


The purpose of this exercise is to allow the user to select the person’s title and gender from code
tables.

1. Go to C:\IBM\Curam\Development\EJBServer\components\core\codetable and copy the


following files to C:\IBM\CourseWorkshop\ServerWorkshop\components\core\codetable:

• CT_PersonTitle.ctx

• CT_Gender.ctx

2. Edit both of these files to change the package from curam.codetable to


serverworkshop.codetable.

3. Do a build ctgen and look in the


C:\IBM\CourseWorkshop\ServerWorkshop\build\svr\codetable directory. You should see the
generated Java and SQL files.

4. Open RSAD. Locate the Domain Definitions package within our ServerWorkshop package.
Previously, you defined gender and title attributes of type PERSON_GENDER and
PERSON_TITLE, respectively. You now need to link the domain definitions to the code table
definitions on the database:

• The PERSON_GENDER and PERSON_TITLE domain definitions should now be based


on CODETABLE_CODE. To change the type to CODETABLE_CODE:

o Select the domain definition. Then select the Properties tab.

o From the properties tab select Attributes.

o Select Type and then select -> to change the underlying type.

• The maximum size of the domain definitions should be 0.

• Associate the domain definition with the appropriate code table.

5. Perform the necessary builds and refresh the Eclipse projects.

6. Test your changes. The Title and Gender fields should now display the descriptions from the
CTX files. Verify this on the Register Person page, the Read Person page, and the Modify
Person page.

© Copyright IBM Corporation 2019 28


IBM Cúram SPM for Developers (ADE) 7.X – Exercise Workbook
_________________________________________________________________________________________________

Exercise 10 – Import and Export Data


The purpose of this exercise is to extract test data to a DMX file, add another record to the DMX
file, and import the updated DMX file to the database. The Data Manager is used to export and
import the test data.

1. Add test records using the Register person page.

2. Run the build target to extract your data.

3. Copy the extracted data in Person.dmx to the components/core/data/test directory.

4. Open Person.dmx using a text editor or Eclipse. Observe that each row element contains a
name attribute for each of the database columns.

5. Copy one of the rows by selecting all the lines for a row element, including <row> and </row>.
Change some of the attribute values. The concernRoleID is a primary key and must be
changed to a unique value. Save your changes.

6. Open ServerWorkshop/project/config/datamanager_config.xml. Check that there is a target


called test that is defined as illustrated in the below example. Note that you do not need to
change this file.
<target name="test">
<entry base="basedir" name="build/datamanager/data/test/"
type="dmx" />
</target>

7. Perform a build database. The database generator copies all DMX files from
components/core/data/test into the build folder specified in the test target specified above.
The Data Manager then imports the data from these files into the database tables. Ensure
that the build database returns BUILD SUCCESSFUL.

8. Run your application and perform a search to see the test records that were imported.

© Copyright IBM Corporation 2019 29


IBM Cúram SPM for Developers (ADE) 7.X – Exercise Workbook
_________________________________________________________________________________________________

Exercise 11 – Configure Application Navigation


The purpose of this exercise is to configure a new tab, a tab Actions menu, a page navigation
menu, and a page-context panel. Initially, you will interpret the existing navigation.

Part A – Interpret the Existing Navigation

Navigate the provided application navigation configuration. Complete the diagram below and
connect the files to show the relationship between them.

1. Open the H2 console and connect to the Workshop database schema.


2. View the records in the USERS table.
3. All User records have the same APPLICATIONCODE value. What is it?
4. Disconnect the H2 console session. Open the ServerWorkshop project in Eclipse.
5. Look under components/core/tab and find the app file with a name corresponding to the
APPLICATIONCODE value that you just noted.
6. This app file references just one section. What is it called? Open the sec file with that name
and see what it contains.
7. Open the tab file referenced by the sec file. Which UIM page does it reference?
8. Open the ssp file. What groups does it contain? Which UIM pages does it provide links to?
9. What is the home page for the user?

© Copyright IBM Corporation 2019 30


IBM Cúram SPM for Developers (ADE) 7.X – Exercise Workbook
_________________________________________________________________________________________________

Part B – Add Tabs

Add two tabs, one for Person and one for Search, as shown below:

1. Copy the skeleton files Person.tab and Person.properties from


C:\LearnerResources\CourseWorkshopResources\ServerWorkshop into the following
location under the ServerWorkshop project: components/core/tab/Workshop.

2. Open Person.tab in Eclipse, select Design view, right-click the tab-config element, and
select Add Child – context. Now add a tab-name attribute to the context with the value
Details.Name.Person. Also add a tab-title attribute with the value Details.Title.Person.

3. Add a navigation element as a child of tab-config. Add a page-id attribute with the value
PersonDemo_readPerson. For the time being, you don’t need to reference a separate
Navigation configuration.

4. Add a page-param element as a child of tab-config. Add a name attribute with the value
concernRoleIDParam.

5. Now return to the WorkshopSection.sec file, right-click the section element, and add a tab
child element. Set its ID attribute to be Person.

6. The Search page currently opens in the WorkshopHome tab. It is preferable to open search
pages in their own tab. Copy the FindPeople.tab and FindPeople.properties files from the
C:\LearnerResources\CourseWorkshopResources\ServerWorkshop to the following location
under the ServerWorkshop project: components/core/tab/Workshop. Update the
WorkshopSection.sec file to include the FindPeople tab.

7. Save your changes and perform the necessary build. Restart your server and Tomcat. Open
a new browser window and visit the Workshop home page. Open the Find People page and
search for a Person record. Click the resulting Person to open the Read Person page. It
should now display inside the separate Person tab.

© Copyright IBM Corporation 2019 31


IBM Cúram SPM for Developers (ADE) 7.X – Exercise Workbook
_________________________________________________________________________________________________

Part C – Add a Tab Actions Menu

Add a tab actions menu as shown below:

1. Copy the skeleton files PersonHomeMenu.mnu and PersonHomeMenu.properties from


C:\LearnerResources\CourseWorkshopResources\ServerWorkshop into the following
location under the ServerWorkshop project: components/core/tab/Workshop.

2. Update PersonHomeMenu.mnu so that both menu items link to the modify page (the Delete
option is cosmetic). The modify page should be opened as a modal page.

3. Update Person.tab so that it loads PersonHomeMenu.mnu.

4. Save your changes and perform the necessary build. Test the functionality of the Edit Person
link to ensure that it works as expected.

© Copyright IBM Corporation 2019 32


IBM Cúram SPM for Developers (ADE) 7.X – Exercise Workbook
_________________________________________________________________________________________________

Part D – Add a Tab Navigation bar

Add a navigation bar with links to two pages, as shown below:

1. Copy the skeleton files PersonNavigation.nav and PersonNavigation.properties from


C:\LearnerResources\CourseWorkshopResources\ServerWorkshop into
components/core/tab/Workshop.

2. Add links in PersonNavigation.nav to the following pages:

i. PersonDemo_readPerson

ii. PersonDemo_dummy

3. As you have just referred to a new UIM file PersonDummy, you need to provide this file to
prevent the application from throwing an exception at runtime. Look in
C:\LearnerResources\CourseWorkshopResources\CúramClientWorkshop and copy
PersonDemo_dummy.uim and PersonDemo_dummy.properties into
CúramClientWorkshop/components/core/PersonDemo.

4. Update the Person.tab file to reference to the .nav file instead of PersonDemo_readPerson..
You should now replace the page-id attribute with the id attribute to reference the new
PersonNavigation file.

5. Save your changes and perform the necessary builds. Test your navigation.

© Copyright IBM Corporation 2019 33


IBM Cúram SPM for Developers (ADE) 7.X – Exercise Workbook
_________________________________________________________________________________________________

Part E – Add a Context Panel

Display a context panel for the tab, as shown below. Note that the tab name reflects the instance
of the tab. The context page is provided.

1. Copy PersonDemo_details.uim and PersonDemo_details.properties from


C:\LearnerResources\CourseWorkshopResources\CúramClientWorkshop to
CúramClientWorkshop/components/core/PersonDemo. Open the UIM page. Check that the
page type is defined as a context (details) page.

2. Open Person.tab and add a new context element to the tab-config element. There is already
a context element within the tab-config, but do not delete it. Specify a tab-name attribute for
your new context element with the same value as the existing context element. In addition,
specify a page-id attribute with the value PersonDemo_details.

3. Now remove the old context element to make your new one unique.

4. Save your changes and perform the necessary builds.

5. Visit the Person tab: Has the text on the Person tab changed since the previous exercise? It
should now display the first and last names of the Person in a panel above the Person Details
and Dummy Details navigation tabs, which you created in the last exercise.

Part F – Refresh the Context Page (Optional)

Modify a person’s first name or last name. What name does the context panel display? Make the
necessary changes to ensure that the context panel is updated when you modify a person.

© Copyright IBM Corporation 2019 34


IBM Cúram SPM for Developers (ADE) 7.X – Exercise Workbook
_________________________________________________________________________________________________

Exercise 12 – Add Exception Handling


When a user attempts to insert a record with the same primary key as an entry in the Person
table, Cúram displays an unhandled server exception by default. The purpose of this exercise is
to catch the exception and return a meaningful message to the user in the language that they
work in.

Client Testing

1. Attempt to add a Person with a ConcernRole ID that is already used. You should see the
default exception as shown below. Check the StartServer console and note the SQL
exception that is thrown.

Server Development

Add exception handling to present a meaningful message to the user.

2. Add the following message to the PersonDemo.xml message file, which is in your core
component.

<message name="ERR_DUPLICATE_KEY">
<locale country="US" language="en">Concern Role ID (%1n) is already
defined. Please choose another ID.</locale>
</message>

3. Perform the necessary build command to create the message catalog, properties files, and
build messages.jar file. Check the following folder for the generated output:
C:\CourseWorkshop\ServerWorkshop\build\svr\message\gen\serverworkshop\message

4. Add exception handling to your insertPerson method. Catch the DuplicateRecordException,


and throw an AppException with your message.

© Copyright IBM Corporation 2019 35


IBM Cúram SPM for Developers (ADE) 7.X – Exercise Workbook
_________________________________________________________________________________________________

5. Build the client. The build client is necessary because the client requires information to
display the localized message using the message name.

6. Test your new exception-handling functionality by adding a person with the ConcernRole ID
that you used earlier. Ensure that the person is not added to the table.

© Copyright IBM Corporation 2019 36


IBM Cúram SPM for Developers (ADE) 7.X – Exercise Workbook
_________________________________________________________________________________________________

Exercise 13 – Implement Modeled and Server-Side


Validations
The purpose of this group of exercises is to perform different types of validation. You will
implement modeled validation, define mandatory fields, and implement server validation using the
Informational Manager.

Part A – Add Validations for a Domain Definition

In this exercise, you will specify validations for a domain definition and view the messages that
result from infrastructure validations.

1. Define the following validations for the PERSON_NAME domain definition:

i. Set the Minimum_Size to 3.

ii. Enter the following pattern match (there are no spaces between the symbols):
^[A-Z]{1}[^A-Z]*
This pattern ensures that a name must begin with an uppercase letter and have no
uppercase letters in the rest of the name.

2. Save your model and perform the necessary builds.

3. Visit the page for inserting new person details and perform the following tests by entering the
appropriate data and clicking the Save button:

i. To test the Cúram infrastructure validations, enter a badly-formatted date for the
dateOfBirth field, for example, 12/2001.

ii. Perform the following steps to test your model-specified validations:

• Enter a name with less than 3 characters.

• Enter a name that does not begin with an uppercase letter.

© Copyright IBM Corporation 2019 37


IBM Cúram SPM for Developers (ADE) 7.X – Exercise Workbook
_________________________________________________________________________________________________

Part B – Add Mandatory Fields

In this exercise, you will learn how to specify mandatory fields.

1. Specify the following fields as mandatory: first name, last name, and date of birth.

2. Perform the necessary builds.

3. Visit the page for inserting new person details. Ensure that the fields are marked as required
fields (red asterisk) and that empty values are not accepted.

© Copyright IBM Corporation 2019 38


IBM Cúram SPM for Developers (ADE) 7.X – Exercise Workbook
_________________________________________________________________________________________________

Part C – Implement Server Validation

In this exercise, you will write code to validate the input fields for the create page and return
appropriate validation messages.

1. Add a domain definition called REG_DATE, which is based on SVR_DATE. Add an attribute
called registrationDate to the Person entity, which is based on REG_DATE.

2. Add the following messages to the PersonDemo.xml message catalog (you can add
parameters to the messages if you wish):

• The date of birth must not be after today's date.


• The registration date must not be before the date of birth or after today’s date.

3. Save the model and perform the necessary builds.

4. Add code to the insertPerson operation to perform the following checks:

i. Check whether the person’s date of birth is after the current date. If it is, add a
LocalisableString message to the InformationalManager. The error type should be
InformationalElement.InformationalType.kError. You can use the following code to
check whether the condition is met:
if (personDtls.dateOfBirth.after(Date.getCurrentDate()))

ii. Add a message to the InformationalManager if the registration date is before the date
of birth or after the current date. The error type should be
InformationalElement.InformationalType.kError.

5. Roll-back the transaction if either of the errors occur.

6. Add the new field to the Create Person page.

7. Test your validations. Try entering a date of birth that comes after the current date. Also,
enter a registration date that is before the date of birth or after the current date. Check that
your code works, that is, that the dates do not break the validation rules. Check that the
record was not added to the database, that is, the transaction was rolled back. Add a valid
record. Ensure that it is added to the database.

© Copyright IBM Corporation 2019 39


IBM Cúram SPM for Developers (ADE) 7.X – Exercise Workbook
_________________________________________________________________________________________________

Exercise 14 – Perform Testing and Tracing


The purpose of the first part of this exercise is to write a JUnit test case to test the insertPerson
operation for MaintainPerson. The purpose of the second part is to perform tracing and use the
Eclipse debugger.

Part A – Write a JUnit test for MaintainPerson (Optional)

1. In the Java perspective in Eclipse, right-click the components/core/source folder, select


New Package, and enter ‘serverworkshop.test’.

2. Copy CuramServerTestJUnit4.java from


C:\LearnerResources\CourseWorkshopResources\ServerWorkshop to
C:\IBM\CourseWorkshop\ServerWorkshop\components\core\source\serverworkshop\test

3. Refresh ServerWorkshop in Eclipse to see CuramServerTestJUnit4.

4. Right-click the serverworkshop.test package and select New – JUnit Test Case. Enter the
following:

i. Select New JUnit 4 test.

ii. Name = TestMaintainPerson

iii. Superclass = CuramServerTestJUnit4

iv. Class under test = MaintainPerson (the class in the impl package).

v. Select Next.

vi. Select insertPerson

5. Within the testInsertPerson method, add a try { } catch block to catch any exceptions, print
the stacktrace, and call the fail() method.

6. Call the insertPerson method of the MaintainPerson class with your PersonDtls struct, which
contains test data.

7. Read the record you added and compare the results to what you expected, for example:

Assert.assertEquals("Wrong Name", "Jim", personDtls.firstName);

8. Right click the method in the Package Explorer outline view and select Run As – JUnit Test.
You should see a green bar.

© Copyright IBM Corporation 2019 40


IBM Cúram SPM for Developers (ADE) 7.X – Exercise Workbook
_________________________________________________________________________________________________

9. Try creating a false assertion. In other words, if the person you created in the test was called
“Smith”, check that the name returned from the read was “Jones”. What happened to your
test?

10. Once the test has completed, open the H2 interface and look at the records on the Person
table. Can you see the person inserted as a result of this test? Why not?

Part B – Perform tracing and debugging

The purpose of this exercise is to perform tracing using the features provided by the Cúram ADE.

1. Enable client-side tracing. Start your application and register a person to see a client-side
trace on the console.

2. Stop the Server and Tomcat. Enable server-side tracing: set curam.trace to
trace_ultra_verbose. Restart the server. Start your application and create a person to see the
server-trace messages on the console.

3. You can turn off client and server tracing to keep the logs clear. Turn on tracing when you
need to debug.

4. Debug TestMaintainPerson:

i. Add a break point on the test after the call to insert person. To insert a break point,
right-click the shaded border to the left of the line of code and select Toggle
Breakpoint.

ii. Run your test in debug mode by selecting TestMaintainPerson from the following
Eclipse icon:

iii. The code will stop at the breakpoint and the Debug perspective will appear. From the
Debug perspective, you can step through the code using F5 and view the contents of
the variables.

© Copyright IBM Corporation 2019 41


IBM Cúram SPM for Developers (ADE) 7.X – Exercise Workbook
_________________________________________________________________________________________________

Exercise 15 – Implement the Non-Standard


Stereotype
In this exercise, you will display the number of people in the Person table on the Person home
page.

Server Development

1. Add an <<ns>> operation to the Person entity called countPeople. The <<ns>> operation
should define the following SQL to count the number of people on the database. Consider
any structs that are needed.

• SELECT count(*) INTO :counter FROM person;

2. Add a new operation called countPeople to your facade class, which calls the <<ns>>
operation. Update your Java implementation for the facade class to invoke the entity method.

Client Development

3. Update PersonDemo_home.uim to read the result from countPeople.

4. Test your changes by creating a new Person in your application and ensuring that the count
on the home page is incremented.

© Copyright IBM Corporation 2019 42


IBM Cúram SPM for Developers (ADE) 7.X – Exercise Workbook
_________________________________________________________________________________________________

Exercise 16 – Use Assignment and Aggregation


This exercise uses the Assignment and Aggregation constructs. The searchByLastName BPO
returns a list of details, containing all attributes, for each matching person. Modify
searchByLastName to return the concernRole ID, first name, and title attributes only for matching
people.

1. Model a new struct called FindPeopleDetails which contains the attributes you want to return.

2. Define another struct called FindPeopleDetailsList which aggregates FindPeopleDetails.

3. Ensure that the searchByLastName operation for the MaintainPerson façade returns
FindPeopleDetailsList instead of PersonDtlsList.

4. Regenerate the code.

5. Update the searchByLastName operation in your MaintainPerson impl class:

i. Update the signature.

ii. The entity search operation returns a list of records in the PersonDtlsList struct. You
need to copy the data from the PersonDtlsList struct to your FindPeopleDetailsList
struct. Is there a quick way to do this?

6. Make any necessary changes to the client page.

7. Test your changes by performing a search, which should operate as it did before.

© Copyright IBM Corporation 2019 43


IBM Cúram SPM for Developers (ADE) 7.X – Exercise Workbook
_________________________________________________________________________________________________

Exercise 17 – Add Packages, Exit Points, and


Unique IDs
In this exercise, you will refactor your application so that the primary key value for the Person
entity is generated automatically in an exit point. You will implement the exit point in an
implementation class for the Person entity, which will be in a separate code package.

Server Development

1. Configure a new Keyset to provide the sequence of IDs to be used to populate the
concernRoleID field on the database:

i. Open KeyServer.dmx, which can be found in the ServerWorkshop under


components/core/data/test.

ii. Locate the <row> element with a keySetCode attribute set to DEFAULT, copy the
entire <row>, and paste it as a new <row>. Update the keySetCode of the pasted
<row> to PERSON. Change the value for “human readable” to 1.

iii. Save your changes and perform a build database.

2. Create a domain definition called INTERNAL_ID of type SVR_INT64. Modify


CONCERN_ROLE_ID so that it is based on INTERNAL_ID.

3. Set the code package for the MaintainPerson – Entity package to ‘entity’.

4. Set ‘Pre_Data_Access’ to ‘1 - yes' for the insert operation for the Person entity.

5. Perform build clean generated. When you refresh ServerWorkshop in Eclipse there will
be several errors, as the Person entity is now in a new package. Correct these errors. For
example, the following code block will need to be replaced with the code underneath it:

Correct code:

© Copyright IBM Corporation 2019 44


IBM Cúram SPM for Developers (ADE) 7.X – Exercise Workbook
_________________________________________________________________________________________________

6. Since you specified an exit point, you must provide an implementation for Person.java in the
serverworkshop.entity.impl package. Add a new class Person that extends the base Person
class. Your package structure should now look like this:

7. Person.java should contain a preinsert() method, where you should set the concernRoleID
value from the keyset created earlier. As you are not using the full IBM Cúram application,
curam.core.impl.UniqueID will not be available. You should instead use the static utility
method curam.util.type.UniqueID.nextUniqueID(“PERSON”) to get your value, where
PERSON is the name of the new keyset.

8. Return to the MaintainPerson class. Add code after the call to the insert method to extract the
concernRoleID from the details and return the value to the client.

Client Development

1. Update PersonDemo_createPerson.uim so that it reads the generated concernRoleID from


the insertPerson operation and passes it to the Read Person page. The user should no
longer be able to enter the concernRoleID.

2. Build and test the client.

© Copyright IBM Corporation 2019 45


IBM Cúram SPM for Developers (ADE) 7.X – Exercise Workbook
_________________________________________________________________________________________________

Exercise 18 – Add a Select List and Online Help


(Optional)
The purpose of this exercise is to update the Create Person page to allow the user to select a
related person from a list of last names returned from the server. If you have time, you can
display the full names to the user and list the names in order of last name. In addition, you will
add online help to the Create Person page.

Server Development

Note that there are several ways to implement a solution on the server side.

1. Add a new attribute called relatedPersonID to the Person entity. This attribute should be
based on the CONCERN_ROLE_ID domain definition.

2. Model entity and façade operations to return a list of people from the Person table. Model
structs if required.

3. Write the business logic for the façade operation to return the list of names to the Create
page.

Client Development

4. Add the relatedPerson field to the Create Person page:

i. The user should see a list of people’s names from the database.

ii. The user selects a name from the single-select list. Force the user to select a name
by making the first entry blank.

iii. Pass the hidden property (concern role ID) to the insert server interface.

5. Add online help to the Create Person page for the page description, buttons, and fields.

6. Update the Read Person page to display the concern role ID of the related person.

7. Perform the necessary builds.

8. Test your pages.

© Copyright IBM Corporation 2019 46


IBM Cúram SPM for Developers (ADE) 7.X – Exercise Workbook
_________________________________________________________________________________________________

Exercise 19 – Add a Conditional Cluster (Optional)


Display a cluster on the person read page when the person is an adult (when they are 18 or
older).

Server Development

1. Add a new domain definition called IS_ADULT based on the SVR_BOOLEAN type.

2. Make the necessary changes to the model to pass a Boolean attribute, called isAdult, to the
person read page. You do not want to store this value on the Person table.

3. In your code for readPerson, set the value of isAdult to true if the person is 18 or greater. You
can use the sample code in the following file to calculate the age:
C:\LearnerResources\CourseWorkshopResources\ServerWorkshop\
CalculateAgeMethod.java

4. Note: You will see an error in your TestMaintainPerson class. Correct the code to use the
new struct that is returned by readPerson.

Client Development

5. And a new cluster to the read person page. The cluster should include one field that sources
text from the properties file. Add a condition element to the cluster so that the cluster is
displayed when the attribute isAdult is true.

6. Build and test your code.

© Copyright IBM Corporation 2019 47


IBM Cúram SPM for Developers (ADE) 7.X – Exercise Workbook
_________________________________________________________________________________________________

Exercise 20 – Case Study: Implementation


The purpose of this exercise is to review the design of the case study you completed in an earlier
exercise, design additional features, and implement your design.

Define the following claim types in a Code Table:


• Unemployment Assistance
• Cash Assistance
• Food Stamps
• Disability
• Training

Design the necessary entity and process classes to provide the functionality. When considering
where this information will be presented, you should replace the Dummy page referenced by the
Dummy tab that you set up in the Configure Application Navigation exercise.

An additional feature that you may want to consider for your application is the generation of
unique primary keys in your code, rather than relying on a user to enter one.

Note

The steps for this exercise are deliberately vague, which is intended to encourage you to consider
the required solution logically. There are many possible solutions that meet the exercise
requirements. However, you should begin by implementing a minimum viable solution.

Optional Extras

If you have time, you can add additional features, for example:

• Make the case type a required field.

• Write some JUnit tests to test your code, for example, to ensure that the insert and list
work as expected.

• Add an attribute called caseStatus, which can be Pending, Approved, and Closed.

• Add the following attributes: dateRegistered and comments.

• Allow the case to be approved.

© Copyright IBM Corporation 2019 48

You might also like