9D731ExerciseHelpGuide.pdf
9D731ExerciseHelpGuide.pdf
Table of Contents
Introduction ___________________________________________________________________ 3
Introduction
This document lists overall tips when working with the ADE and sample output and tips for each
exercise. The tips are based on common errors that learners encounter when completing the
exercises.
Each exercise outlines the purpose of the exercise and lists the steps to complete the exercise.
The steps are quite detailed for the early exercises and become less detailed as you progress
through the course. After the initial exercises, if you are confident that you understand the topic
and the purpose of the exercise, attempt the exercises without following the steps. However, use
the recommended artifacts names.
When you need help, refer to the example in course book. Use this guide if you need help in
addition to the exercise steps. You can refer to the artifacts in the sample solutions or load the
solutions if required. The sample solutions are in the C:\LearnerResources folder on the image.
General Help
This section outlines some overall tips when using the IBM Cúram ADE for this course.
Area Tips
Modelling • Ensure that you save the model after making changes. This may seem obvious, but it is often
the cause of the problem.
• RSAD distinguishes between deleting an artifact from the model and deleting it from a
diagram. If you delete an artifact from a diagram, it still appears in the package. You may also
need to delete an association. For example, if an aggregation is defined in the wrong
direction, ensure that you delete it from the model and the diagram using CTRL+Del. Check
the Associations package to make sure that the association is deleted from the model. You
can also right-click the association in the Associations package to delete it from the model.
• If the model does not appear to reflect your changes, restart RSAD.
Builds • Many errors are caused by building in the wrong order. Follow the general build order shown
in the course book.
• If you need to go back and fix the model or code, stop Tomcat and StartServer.
• Performing builds out of sequence can lead to unpredictable results. If you are cannot find an
obvious error and are unsure of your build order, perform the above steps using clean builds.
This often resolves the error.
• Check the Debug perspective in Eclipse to ensure that you only have one instance of
StartServer and one instance of Tomcat running.
• Ensure that you get “build warnings 0” in the build generated. Some warnings may affect your
application.
• During a build client, you may get a message saying that it was not possible to write to
messages.jar. This is because Tomcat is still executing. Stop Tomcat and rebuild the client.
• If you load a solution and get the following error, perform a clean on the ServerWorkshop
project in Eclipse:
• If you cannot remove the CourseWorkshop folder to load a solution, start the Task Manager
and select Resource Monitor. Terminate the tnameserv.exe process:
UIM • It is easy to make mistakes when writing UIM. Therefore, copy sections of UIM from working
pages rather than writing it.
• To prevent mismatches between label names in the UIM and properties file, create a split
screen in the Eclipse editor and copy the label names between the files.
• XML syntax errors or non-conformance with the UIM schema will result in errors in the
Eclipse XML Editor, which are highlighted with red marks on the right of the edit panel. Select
the red mark to see the schema error message.
• The build client usually shows the line number of the incorrect line. You can see the line
numbers in the Eclipse XML editor by right-clicking the left grey margin of the XML Editor and
selecting Show Line Numbers.
Runtime • You may get an error on a page with nothing showing in the StartServer or Tomcat console. If
Errors
so, right-click the page and select View page source or View frame Source. The HTML file
may contain a reference to an error.
• Port in use:
o Check the Debug area to confirm that all projects are stopped. If Tomcat still won’t
start, run netstat –aon from a DOS window and see what is using port 9080. You
can then kill the process ID using the Task Manager
o If it still refuses to work, run a full build clean generated database followed by a build
clean client.
• An un-handled server exception occurred. Please contact your
administrator. Check the StartServer console to see the exception message.
• You may not have sufficient privileges to view this page. Ensure that you
preformed a build database and build client.
• The following message occurs if you navigate to a page that does not exist or when there are
runtime errors in your UIM:
Eclipse • Ensure that Eclipse is fully closed before you shut down the image, or end your session.
Otherwise, your workspace may become corrupted.
• You should become familiar with the Eclipse debugger. It is easy to use and handy for solving
coding errors.
• Use the Eclipse Editor Design view or Eclipse code completion (CTRL+Space) to see the
element and attribute options for each of the navigation file types. The Design view is useful
for selecting elements and attributes from the schema. However, you should always check
the Source view to ensure that no extra elements have been created.
General • You should use the artifact names suggested in the exercise steps, particularly the UIM page
names. This is because there are pre-defined navigation files that expect these names.
• Many of the exercises are like the examples in the course material. You should use the
course material as a reference. Sample solutions are available in the resources folder. You
can copy selected parts to your solution, or view the README file for replacing the workshop
with the complete solution.
Tips
• When you click IBM Cúram Social Program Management Supported Prerequisites, select the
maintenance level and select Detailed system requirements from the page below:
• When you select Proceed you will get the report for the detailed system requirements. Select
Supported Software. Select Development Tools.
• If you get an error when you run build database, make sure that you started the H2 Server. If the H2
Server is started, stop and start the server again.
• When you run StartServer, you should see the following message in console:
• When you run Tomcat, you should see the following message after 10 – 60 seconds:
• Check the Debug perspective to ensure that only one instance of Tomcat is running.
Tips
• Perform all modeling in the Models package of the Modeling (RSAD) perspective. The generators will
not find your modeling artifacts if they are defined in the wrong place.
• If you enter the wrong length for a domain definition, select Cúram from the Properties panel and edit
the Maximum_Size.
• If you enter the wrong name, right-click the item and select Refactor > Rename.
• When modeling an operation parameter, you must specify the ShadowType field whenever the Type
field contains an entity name. Do not specify a Shadow Type if the Type field does not refer to an entity.
(Remember, a Shadow Class is a key struct or details struct that is automatically created for an Entity
Class.)
• The first part of the build generated parses the model and reports errors and warnings. If there are
warnings, the build will still show BUILD SUCCESSFUL when it completes. However, the warnings may
prevent your exercise from working correctly. Always check the console to ensure that build generated
displays “0 warnings”.
• Have you refreshed Eclipse after the build generated? The Eclipse refresh brings in the generated
artifacts and compiles them.
• Ensure that you have created the serverworkshop.impl package in the correct source folder, namely,
components/core/source.
• Enter the following values when creating the new Java class using the New Class wizard:
Tips
• The following tip reduces errors caused by incorrect labels: In Eclipse, drag the tab for the property file
under the UIM file tab so that you have a split screen, as shown below. Copy and paste the labels
between the files.
• The FIELD element has a LABEL attribute and a LABEL element. Ensure that you have added the
LABEL attribute rather than the LABEL element to your UIM page.
• Verify that the names of the properties used in the source elements match the unique names of the
properties in the bean documentation.
• Ensure that the page parameter is called concernRoleIDParam. This is the name of the parameter that
is populated by the sending page.
• Ensure that you stop Tomcat before building the client. Otherwise, the messages.jar file cannot be
updated.
• Check that you do not have multiple instances of StartServer or Tomcat running.
• If you get the ‘Unhandled Server Exception’ message, look in the StartServer console for the stack
trace. For example, the following exception means that you did not add a record with a key of 101:
infrastructure:RUN_ID_RECORD_NOT_FOUND: Record not found.
Once you have entered data and clicked Save, you should see the read page, as in the following
example:
Tips
• Step 3: The input parameters and return type for the insertPerson façade operation are as follows:
• Step 6: Your insertPerson method may not appear when you select the Override/Implement methods.
If so, ensure that you have saved the model before performing the build generated and refreshed the
ServerWorkshop project in Eclipse.
• Step 7: The implementation of your insertPerson operation should look like this:
public PersonKey insertPerson(PersonDtls personDtls) throws AppException,
InformationalException {
serverworkshop.intf.Person personObj =
serverworkshop.fact.PersonFactory.newInstance();
personObj.insert(personDtls);
PersonKey personKey=new PersonKey();
personKey.concernRoleID=personDtls.concernRoleID;
return personKey;
}
• Before building the client, check for schema errors in your UIM file (indicated by red marks in editor).
• Ensure that you have not confused the NAME and PROPERTY attributes.
• Ensure that the names of the page parameter on the sending and receiving pages are the same.
• If you have copied the read page to create the Insert page, then make sure that you modified the
PAGE_ID attribute of the Insert page.
• Select View – Frame Source from the page to see if there are page errors.
When you select the ConcernRole ID, you should see the read page for the person.
Tips
• Add a new operation called readmulti to the Person entity. This new operation should be stereotyped as
<<readmulti>>. In the pop-up, select lastName from the New Key Struct Attributes list and click Finish.
This is the first entity operation where you must specify an input parameter. For other operations that
you modeled, such as insert(), the generators can determine the input and output structs.
• The implementation required by this exercise is like that shown in the Search example in the course
material.
• If you get a schema error in your search page, ensure that your ACTION_SET is defined as the first
element inside the CLUSTER.
• The UIM should be like the UIM in the example in the course manual.
Your modify page should allow you to edit all fields except the key field, ConcernRole ID:
When you select Save, you should see the read page with your modifications.
Tips
• On the modify page, the SERVER_INTERFACE for readPerson must have PHASE=”DISPLAY”. The
SERVER_INTERFACE for modifyPerson must have PHASE=”ACTION”.
• When an ACTION_SET is defined inside a CLUSTER or LIST element, it must be the first element.
Otherwise, you will get a schema error for the page.
• In your search page, ensure that the ACTION_CONTROL within the LIST_ROW_MENU is of type
ACTION.
• Ensure that the link to the modify page from your search page includes OPEN_MODAL=”true”.
• If you have difficulties implementing the UIM for the modify page, refer to the example in the course
material and refer to the sample solution.
• Step 12: For changes to PersonDemo_findPeople, locate the LIST element and add a new child
element, ACTION_SET of type LIST_ROW_MENU. Add an ACTION_CONTROL to the ACTION_SET,
setting its LABEL text to Edit.To link to new modify page follow next tips given below.
• Step 12: ACTION_CONTROL requires a LINK child element that specifies PersonDemo_modifyPerson
as the navigation target when it is clicked. In the IBM Cúram application, Edit pages are opened as
modal pages. You need to ensure that the target page is opened as a modal page. In turn, the LINK
requires a CONNECT child element that meets the following specifications:
i. SOURCE must specify the Concern Role ID attribute for the current Person.
ii. TARGET must specify the name of the parameter expected on the PersonDemo_modifyPerson
page.
Tips
Here are some of the questions that you need to address when designing your solution:
1. Design pages
• What will the pages look like?
2. Modeling
• You may find it useful to review earlier exercises and the PersonDemo solution to determine what
needs to be modeled.
• What domain definitions do you need?
• What entity do you need? What are its attributes and minimum operations?
• You will need a façade. What operations are required? What signatures do the operations require?
3. Server
• What code do you need to define in your façade class?
4. Client:
• What UIM pages are required?
• What server interfaces and phases does each page require?
Sample Design
Your read and modify pages should display the descriptions for the codes.
Tips
o Check that the Cúram properties tab has the correct code table name: It should match the
‘name’ attribute in the CTX file. Also check that the Maximum_Size is 0. For PERSON_TITLE,
these values will appear as follows:
• If the Title and Gender fields do not appear as drop-downs on the create page, ensure that you have
performed the necessary builds in the right order.
o build generated (followed by a refresh of the server project in Eclipse)
o build database
o build client
• Do you get an exception when you try to load your create page? If so, check the StartServer console
for the exception message. For example, this is the exception you will see if your code table name is
incorrect in the model:
Caused by: infrastructure:RUN_ID_RUNTIME: A runtime exception occurred:
No such code table 'CT_PersonTitle.CTX'..
• Ensure that you changed the package in the CTX file to serverworkshop.codetable.
• Note: You must use these exact names, as the generator will need to match them with the names
specified in the CTX files copied in step 1.
Tips
• If build database fails, review the new entry that you created in Person.dmx. Check that all
elements are present and formatted correctly. In addition, ensure that the concernRoleID is unique.
• You do not need to change datamanager_config.xml because it is configured to load all DMX files from
the data/test folder.
Part A
WorkshopHome.tab
DefaultApp PersonDemo_home.uim
DefaultApp.app WorkshopSection.sec
WorkshopSectionShortcuts.ssp
PersonDemo_home.uim
CT_APPLICATION_CODE.ctx PersonDemo_findPeople.uim
PersonDemo_createPerson.uim
PersonDemo_home.uim
Part B
If your solution works correctly, your search page and read page should open in separate tabs:
Part C
If your solution works correctly, your Person tab should display an actions menu:
Part D
If your solution works correctly, your Person tab should include a navigation bar with two
navigation tabs:
Part E
If your solution works correctly, your Person tab should have the person’s name as the tab name
and contain a context panel:
Part F
If your solution works correctly, when you edit the name fields, your changes should be reflected
in the context panel without having to refresh the page:
Tips
Part C
• Open PersonHomeMenu.mnu in Eclipse, select Design view, right-click menu-bar, and select Add
Child – menu-item. Add the following attribute-value pairs to the new menu-item:
Attribute Value
Id ModifyPerson
page-id PersonDemo_modifyPerson
Title MenuItem.Title.Person.Edit
open-as modal
• Create another menu-item child element beneath menu-bar and configure it with the following attributes
and values:
Attribute Value
Id DeletePerson
page-id PersonDemo_modifyPerson
Title MenuItem.Title.Person.Delete
open-as modal
• Note that this second menu-item is cosmetic. It does not take the user to a delete page, just to the
same PersonDemo_modifyPerson page as the first menu-item.
Part D
• Right-click nodes and select Add Child – navigation-page. Configure the new child element to have
the following attributes and values:
Attribute Value
page-id PersonDemo_readPerson
Id PersonHome
Title PersonHome.title
• Right-click nodes again and add another child navigation-page element with the following:
Attribute Value
page-id PersonDemo_dummy
Id PersonDummy
Title PersonDummy.title
Part E
• Perform a build client to build the new UIM file. The provided UIM file assumes that you have
used the attribute names recommended so far. If you get UIM build errors, change the names in the
UIM file to suit your bean doc.
<tc:tab-config
xmlns:tc="http://www.curamsoftware.com/curam/util/client/tab-config"
id="Person">
• Your navigation files are validated against their respective schemas when you perform a build
inserttabconfiguration. However, the validation will not discover references to artifacts that do
not exist. Such errors will only be discovered at runtime and usually generate an exception message in
the page or StartServer console.
• You will get build errors in Part E if your operation and attribute names do not match those expected by
PersonDemo_details.uim. Verify that the operation and attribute names in PersonDemo_details.uim
match the names in the generated bean documentation.
Tips
• Ensure that the message text in the PersonDemo.xml message file is on one line.
• If you do not see your message on the create page, rebuild the client. Ensure that Tomcat is not
running when building the client.
If your solution works correctly, you should get the following results:
Part B
If your solution works correctly, you should see the three mandatory fields. You will get an error
message if the mandatory fields are not entered.
Part C
If your solution works correctly, you should see you error message when the date of birth or
registration date is incorrect. In addition, the record will not be added to the database.
Tips
Part A
• The Minimum_Size and Pattern_Match options for PERSON_NAME should be modeled as follows:
Part B
• The mandatory fields are defined for the argument to insertPerson and must specify the exact attribute
names:
• If your fields do not display as mandatory on the create page, ensure that you have built the client.
Part C
• In components/core/message, open the PersonDemo.xml message file and add a new message entry
as follows:
<message name="DOB_MUST_NOT_BE_AFTER_CURRENT_DATE">
<locale country="US" language="en">The date of birth must NOT be after today's
date.</locale>
</message>
• Perform the following steps to change the Java code and test your changes:
o Stop StartServer and Tomcat
o Change the code and save to recompile
o StartServer and Tomcat
o Refresh the browser
• Your code for validating the date of birth will look like this:
if (personDtls.dateOfBirth.after(Date.getCurrentDate())) {
PERSONDEMO.DOB_MUST_NOT_BE_AFTER_CURRENT_DATE).arg(personDtls.dateOfBirth);
TransactionInfo.getInformationalManager().addInformationalMsg(
localisableString, "",
InformationalElement.InformationalType.kError);
}
• If you get the following message, ensure that you built the client when you changed a message:
If your solution works correctly, you should see the following in the JUnit panel:
Tips
• To run JUnit from Eclipse, you can right-click the class or method from the package explorer
perspective and select Run As – JUnit Test. From the JUnit perspective, you can select the following
icon to re-run tests:
personDtls.concernRoleID = 123L;
personDtls.firstName = "Jane";
personDtls.lastName = "Doe";
personDtls = person.readPerson(personKey);
} catch (Exception e) {
e.printStackTrace();
Assert.fail();
}
}
• If you remove fail() from the catch block, JUnit will assume that the test has passed, even though there
was an exception thrown.
• CuramServerTestJUnit4 creates a transaction for the test and rolls it back at the end. Therefore, you
will not see any changes to the underlying tables after testing.
• Note that the OOTB PersonTitle code table does not have Java identifiers defined. If you want to define
this field, just set the actual code.
If your client tracing is active, you should get output like this in your Tomcat console:
If your server tracing is working, you get output like this in your StartServer console:
When you run your class in debug mode, you output will look like this:
Tips
• When tracing on the client, you may see messages specifying that your page is not found, as shown
below. However, these are not errors and can be ignored.
• There are several entries in Application.prx that begin with curam.trace. Ensure that you change the
entry called ‘curam.trace’.
• Ensure that you changed the <value> element rather than the <default-value> element for curam.trace:
<property dynamic="true" name="curam.trace">
<type>STRING</type>
<value>trace_ultra_verbose</value>
<default-value>trace_verbose</default-value>
• If your server trace does not appearing, ensure that you entered a valid value for curam.trace,
performed a build insertproperties, and restarted StartServer.
• When tracing on the server, you will see messages in your StartServer console stating that pages are
not found. These are not errors and can be ignored.
• You may want to turn off tracing when you are finished, as it will flag exceptions in later exercises.
Tips
2. Create a struct called PersonCount that contains an attribute called counter, based on domain
definition COUNT, to hold the number of people.
3. Add an operation with the appropriate stereotype (ns) to the Person entity called countPeople. This
operation should return PersonCount. Define the following SQL for this method:
SELECT count(*) INTO :counter FROM person;
4. Add a new operation called countPeople to your facade class, which returns the PersonCount
struct.
• Ensure that the SQL query is defined for the entity operation as follows. You must have ‘;’ at the end of
the query and the semicolon in front of ‘counter’.
return personObj.countPeople();
}
Tips
• Alternatively, you can model FindPeopleDetails and specify List in the return type to generate
FindPeopleDetailsList.
• If you need to delete an aggregation (if it is defined in the wrong direction), ensure that you delete it
from the model and the diagram using CTRL+Del. Check the Associations package within your
MaintainPerson to ensure that the association is deleted from the model. You can also right-click the
association in the Associations package to delete it from the model.
return dtlslist;
}
• If you are get errors while building the client, ensure that the attribute names in the UIM match those in
FindPeopleDetails, which, in turn, should match the attribute names in the Person entity. If you used
different attribute names in the Person entity, do one of the following:
After you have entered data for a person you should see the generated ID on the read page as in
the following example:
Tips
• To change a domain definition, select the artefact under <<domain_definition>> and select the type:
• Ensure that you have selected the Pre_Data_Access option for the insert() operation on the entity.
• The code for your preinsert() operation in the Person class should look like this:
protected void preinsert(PersonDtls details) throws AppException,
InformationalException {
details.concernRoleID=curam.util.type.UniqueID.nextUniqueID("PERSON");
• Note that the line personObj.insert(personDtls) calls the preinsert operation, which adds the generated
concernRoleID to the personDtls struct. This makes it available to the insertPerson() operation.
• If the Person entity is not generated correctly in the new package, then perform a build clean
generated.
• If you specified the concernRoleID as a mandatory field in insertPerson operation, you need to remove
it.
• The UIM for your create page should no longer include a FIELD element for concernRoleID. The LINK
element should pass the generated concernRoleID to the read page as follows:
<LINK PAGE_ID="PersonDemo_readPerson">
<CONNECT>
<SOURCE PROPERTY="personKey$concernRoleID" NAME="InsertPersonBean" />
<TARGET PROPERTY="concernRoleIDParam" NAME="PAGE" />
</CONNECT>
</LINK>
The read page list the concernRole ID for the related person:
Tips
Modeling
• There are several ways to model the solution. You can write a handcrafted SQL query by using
<<nsmulti>>, or use <<readmulti>>, <<nsreadmulti>>, or <<nkreadmulti>>. This solution uses
<<nkreadmulti>> to return all records.
• The realAllPeople operation orders the returned records:
• Two structs are modeled to return the concernRole ID and full name only to the client page:
• Alternatively, you can model RelatedPersonDetails and specify List in the return type to generate
RelatedPersonDetailsList.
Server Coding
• The façade operation can be written as follows:
public RelatedPersonDetailsList getRelatedPeople() throws AppException, InformationalException {
serverworkshop.entity.intf.Person personObj =
serverworkshop.entity.fact.PersonFactory.newInstance();
Client Development
• The create page uses the INITIAL element and HIDDEN_PROPERTY:
• If you do not see the Help icon , ensure that you set the following in curam-config.xml and build
client:
Tips
Modeling
• Create a new struct that includes isAdult and the PersonDtls struct.
Server Coding
• The façade operation can be written as follows:
public PersonDisplayDetails readPerson(PersonKey personKey) throws
AppException, InformationalException {
serverworkshop.entity.intf.Person personObj =
serverworkshop.entity.fact.PersonFactory.newInstance();
return personDetails;
}
Client Development
• The read page contains the conditional cluster as follows. Note that the value for the field in the
conditional cluster can be any hard-coded value:
<CLUSTER TITLE="Cluster.Title.Adult">
<CONDITION>
<IS_TRUE PROPERTY="isAdult" NAME="ReadPersonBean" />
</CONDITION>
<FIELD LABEL="Field.Label.Adult">
<CONNECT>
<SOURCE PROPERTY="Field.Value.Adult" NAME="TEXT" />
</CONNECT>
</FIELD>
</CLUSTER>
• When you regenerate your Bean Doc, you’ll notice that the full name for each attribute is updated to
reflect the aggregated attributes. If you used the full name rather than the recommended unique name
in your read page, you will get errors. Update the UIM properties with the unique names.
Tips
Modeling
• Your modelling should look like this:
Server Coding
• You will need to create the following server artifacts:
o MaintainCase.java: Containing the implementation of the façade operations.
o Case.java: If you want to generate the caseID from a preinsert()
o Update KeyServer.dmx with an entry for the CASE keyset
o CT_CaseType.ctx with the case type codes.
• The façade operation to insert a case and to list cases simply call the entity operation:
public void insertCase(CaseDtls caseDtls) throws AppException, InformationalException {
serverworkshop.entity.intf.Case caseObj =
serverworkshop.entity.fact.CaseFactory.newInstance();
caseObj.insert(caseDtls);
Client Development
• You will need to create the following UI artifacts:
• If you use build uimgen to create uim pages, make sure that the following environment variable is set
first:
ANT_ARGS=-Djava.jvmargs="-Xmx512m"