ObjectExtender User's Guide and Reference

Creating departments

To create departments, we will add another button with the label, New. This will create a new department that is placed into the variable part. Do the following:

  1. Add a Push Button part to the Window part.
  2. Label the push button: New.
  3. Connect the push button's clicked event to the create action of the TstDepartmentHome1 part.
  4. Connect the normal result of the action, the newly created department, to the self attribute of the TstDepartment1 .

To create new departments, you will need to add a Text part, and a label, Department, for the department attribute. After you have added the Text part and label for department, connect the Text part's object attribute to the department attribute of the TstDepartment1 variable.

Test the view as follows:

  1. Click the Test button.
  2. Click New on the TstDepartmentView.
  3. Type the name of a new department: Philosophy.
  4. Type a room number for the department: 101.
  5. Click Save.
  6. Close the view.
  7. Open the view again to verify that the new department has been added.

    As before, if we create the department (click New) without saving it (click Save), the department will not be added because the transaction would not have been committed.


Figure pgs1crea not displayed.

The next step is to get the list of departments to refresh each time we add or change a department. Also, we should ensure that the department itself cannot be changed when we are editing a department. This is because the department is the attribute we defined as the object identifier (OID) in the Map Browser, and it is the effective key of the department business object. Changing the key of a business object is not permitted once an object has been persisted because it means we will no longer be able to retrieve it from the data store.

To ensure that the department's key cannot be changed for an existing department do the following:

To get the List part to refresh, we can do the following:


Figure pgs1refr not displayed.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]