ATG Page Developer’s Guide

Modifying Properties that Refer to Items by repositoryId

When a RepositoryFormHandler uses a value dictionary, it adds the sub-property repositoryId to all multi-valued properties. This property references other items and their property values so you can update a collection of items using their IDs.

A form might use a RepositoryFormHandler to update user information, such as access controls provided through user roles and organizational groups. For example, you might want to enable an administration user to edit a user profile roles property, which holds a set of ID objects that reference role items. Each user profile has a property called currentOrganization, which maintains the sub-property relativeRoles. Because a user can have more than one role, relativeRoles is a set of role ID objects that designate user responsibilities and access requirements.

This form is designed to add the current organization to a user’s profile so the user acquires some of the roles associated with that organization. The form performs these tasks:

Accesses the contents of the current organization’s relativeRoles property so the form user can select one or more roles.

Saves the selected roles to a user profile’s roles property.

In order to implement this form, a ForEach servlet bean iterates through the currentOrganizationrelativeRoles property and presents each role ID it finds as a name in the form page, through a selection box:

In this example, a dsp:option tag is generated for each role in the relativeRoles property. The option value is the ID of the role repository item.

The form user selects several roles; on form submission, the MyRepositoryFormHandler.values.roles.repositoryIds contains the list of repositoryIds checked by the user. These are used to update the user’s roles property.