9D731ExerciseGuide PDF
9D731ExerciseGuide PDF
Table of Contents
Product
Documentation
Servers
Browser
4. From the Table of Contents select the most recent version of Cúram Social Program
Management. The landing page is displayed.
• Product overview – Review the IBM Cúram Social Program Management overview.
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.
• 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.
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
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.
Project Structure
• 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.
7. Click the Workshop Eclipse desktop shortcut to open the IDE for the lightweight Workshop
project.
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.
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.
18. Enter build clean client to process the UIM pages. You should get BUILD
SUCCESSFUL.
20. From the Workshop Eclipse, refresh (F5) the CuramClientWorkshop project to bring in the
updated artifacts.
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.
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.
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.
6. Within this new package, create a child package called ‘Domain Definitions’. Add the
following domain definitions to this package:
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>
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.
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.
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.
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’.
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.
• 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?
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.
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.
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.
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.
24. You are now ready to write some hand-crafted code in Eclipse:
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.
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.
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.
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:
• 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.
• 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:
• From C:\LearnerResources\CourseWorkshopResources\CuramClientWorkshop,
copy PersonDemo_readPerson.uim and PersonDemo_readPerson.properties to
C:\IBM\CourseWorkshop\CuramClientWorkshop\components\core\PersonDemo.
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
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:
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.
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.
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>
</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.
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>
</CONNECT>
</FIELD>
</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:
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.
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.
19. In Eclipse, open the ServerWorkshop folder. Open the build\svr\gen package. Open the client
package. Open ServerAccessBeans.xml.
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.
Server Development
3. Add a façade operation called insertPerson to the façade. The operation should receive a
PersonDtls struct and return a PersonKey struct.
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.
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.
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.
i. The ACTION_SET should display the following buttons at the bottom of the page only
and in the center: Save and Cancel.
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.
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.
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.
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.
10. Refresh the client project CuramClientWorkshop in Eclipse to bring in the files.
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.
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.
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.
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.
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:
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.
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
• Consider the domain definitions, entity class, structs, and BPOs that are required.
• Consider the pages that are required and how they will link together.
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.
• CT_PersonTitle.ctx
• CT_Gender.ctx
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:
o Select Type and then select -> to change the underlying type.
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.
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.
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.
Navigate the provided application navigation configuration. Complete the diagram below and
connect the files to show the relationship between them.
Add two tabs, one for Person and one for Search, as shown below:
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.
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.
4. Save your changes and perform the necessary build. Test the functionality of the Edit Person
link to ensure that it works as expected.
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.
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.
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.
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.
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.
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
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
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.
In this exercise, you will specify validations for a domain definition and view the messages that
result from infrastructure validations.
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.
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.
1. Specify the following fields as mandatory: first name, last name, and date of birth.
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.
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):
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.
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.
4. Right-click the serverworkshop.test package and select New – JUnit Test Case. Enter the
following:
iv. Class under test = MaintainPerson (the class in the impl package).
v. Select Next.
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:
8. Right click the method in the Package Explorer outline view and select Run As – JUnit Test.
You should see a green bar.
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?
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.
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.
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
4. Test your changes by creating a new Person in your application and ensuring that the count
on the home page is incremented.
1. Model a new struct called FindPeopleDetails which contains the attributes you want to return.
3. Ensure that the searchByLastName operation for the MaintainPerson façade returns
FindPeopleDetailsList instead of PersonDtlsList.
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?
7. Test your changes by performing a search, which should operate as it did before.
Server Development
1. Configure a new Keyset to provide the sequence of IDs to be used to populate the
concernRoleID field on the database:
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.
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:
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
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
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.
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.
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:
• 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.