The following is a list of properties that must be entered when creating new users:

The following properties are optional:

In Motorprise, the following properties are inherited from the parent organization when the user is created:

We used the MultiUserAddFormHandler component to create the group registration pages. The MultiUserAddFormHandler allows us to create new users, assign them to an organization, and assign roles to them.

Once the admin chooses the business unit, he or she clicks the Create Multiple Users link to start adding multiple users. First, the admin must enter the number of users he or she wants to create. The relevant code of this page, create_multiple_users.jsp, is as follows:

<dsp:setvalue bean="MultiUserAddFormHandler.clear" value=""/>

<table border=0 cellpadding=0 cellspacing=0 width=800>
    <tr valign=top>
    <td width=55><dsp:img src="../images/d.gif" hspace="27"/></td>

    <%--  main content area --%>
    <td valign="top" width=745>
    <dsp:form action="create_users2.jsp" method="post">
    <input type="hidden" name="b2bOp" value="add">
...

    <tr>
        <td>Create <dsp:input bean="MultiUserAddFormHandler.count"
          maxlength="1"
          size="1" type="text" value=""/> users.
        <p>
        <input type="submit" value="Create users">
        </td>
      </tr>

As shown in the above code, the admin enters the number of users to create and we initialize MultiUserAddFormHandler.count with it. We also use this variable in the next page, looping through it to provide the input fields to enter this number of users.

Once the admin submits the above page (create_multiple_users.jsp), he or she is directed to create_users2.jsp to enter information of all the users to create. We used the MultiUserAddFormHandler to create a user array based on the MultiUserAddFormHandler.count variable. The code below shows how we loop through MultiUserAddFormHandler.count, accessing each user in the MultiUserAddFormHandler.users array to provide input fields to set each user’s properties:

<dsp:form action="create_multiple_users.jsp" method="post">

  <dsp:input bean="MultiUserAddFormHandler.confirmPassword" type="hidden"
    value="true"/>
  <dsp:input bean="MultiUserAddFormHandler.createErrorURL" type="hidden"
    value="create_users2.jsp"/>
  <dsp:input bean="MultiUserAddFormHandler.createSuccessURL" type="hidden"
    value="create_users3.jsp"/>
  <dsp:input bean="MultiUserAddFormHandler.organizationId" beanvalue=
    "Profile.currentOrganization.repositoryid" type="hidden"/>
  <dsp:input bean="MultiUserAddFormHandler.value.member" type="hidden"
    value="true"/>

  <table border=0 cellpadding=4 width=100%>
    <tr><td><dsp:img src="../images/d.gif" vspace="0"/></td></tr>
    <tr valign=top>
      <td colspan=2><span class=big>Company Administration</span><br><span
        class=little></span></td>
    </tr>
    <tr><td><dsp:img src="../images/d.gif" vspace="0"/></td></tr>

    <tr valign=top>
      <td colspan=2>
      <table width=100% cellpadding=3 cellspacing=0 border=0>
        <tr><td class=box-top>&nbsp;Create New Users</td></tr></table>
      </td>
    </tr>
    <tr><td><dsp:img src="../images/d.gif" vspace="0"/></td></tr>

     <!--Display all the users--!>
     <dsp:droplet name="/atg/dynamo/droplet/For">
      <dsp:param bean="MultiUserAddFormHandler.count" name="howMany"/>
       <dsp:oparam name="output">
         <tr>
           <td align=right><span class=smallb>User <dsp:valueof
             param="count"/>
             </span></td>
         </tr>
         <tr>
           <td align=right><span class=smallb>Name</span></td>
           <td width=75%><dsp:input bean=
             "MultiUserAddFormHandler.users[param:index].value.firstName"
             size="15" type="text" required="<%=true%>"/>
            <dsp:input bean=
             "MultiUserAddFormHandler.users[param:index].value.middleName"
                size="4" type="text"/>
            <dsp:input bean=
              "MultiUserAddFormHandler.users[param:index].value.lastName"
                size="15" type="text" required="<%=true%>"/></td>
         </tr>
         <tr>
           <td align=right><span class=smallb>Login</span></td>
           <td><dsp:input bean=
             "MultiUserAddFormHandler.users[param:index].value.login"
              size="30"
               type="text"/></td>
         </tr>
         <tr>
           <td align=right><span class=smallb>Password</span></td>
           <td><dsp:input bean=
             "MultiUserAddFormHandler.users[param:index].value.Password"
              size="30"
               type="password" value=""/></td>
         </tr>
         <tr>
           <td align=right><span class=smallb>Confirm</span></td>
           <td>
             <dsp:input bean=
               "MultiUserAddFormHandler.users[param:index].
                value.CONFIRMPASSWORD"
                size="30" type="password" value=""/>
           </td>
         </tr>
         <tr>
           <td align=right><span class=smallb>Email</span></td>
           <td><dsp:input bean=
            "MultiUserAddFormHandler.users[param:index].value.email"
              size="30"
               type="text"/></td>
         </tr>
         <tr valign=top>
           <td align=right><span class=smallb>Role</span></td>
           <td>

                <%/* Check if the roleIds already exist.  This property will not
                 be set when the page is displayed for the first time.  In this
                 case, display all the roles as unchecked boxes.  If this property
                 is set, that means this page has been displayed already and that
                 an error has occured.  In this case, each role in the
                 currentOrganization is traversed to see if any of their ids exist
                 in the roleIds property and if so, display that role as a checked
                 box. */ %>

                <dsp:droplet name="IsEmpty">
                <dsp:param bean=
                  "MultiUserAddFormHandler.users[param:index].roleIds"
                  name="value"/>
                <dsp:oparam name="true">

                <%/* List organization roles, allowing admin to check off
                     roles for each new user */%>
                   <dsp:droplet name="ForEach">
                   <dsp:param bean=
                    "Profile.currentOrganization.relativeRoles"
                     name="array"/>
                   <dsp:param name="elementName" value="role"/>
                   <dsp:param name="indexName" value="roleIndex"/>
                   <dsp:oparam name="output">

                      <dsp:input bean=
                      "MultiUserAddFormHandler.users[param:index].roleIds"
                        paramvalue="role.repositoryId" type="checkbox" />
                        <dsp:valueof param="role.name">No name
                      </dsp:valueof>
                   </BR>
                   </dsp:oparam>
                   </dsp:droplet>
               </dsp:oparam>

               <dsp:oparam name="false">

                   <dsp:droplet name="ForEach">
                   <dsp:param bean="Profile.currentOrganization.
                    relativeRoles"
                     name="array"/>
                   <dsp:param name="elementName" value="role"/>
                   <dsp:param name="indexName" value="roleIndex"/>
                   <dsp:oparam name="output">

                      <dsp:droplet name="ArrayIncludesValue">
                      <dsp:param bean=
                      "MultiUserAddFormHandler.users[param:index].roleIds"
                        name="array"/>
                      <dsp:param name="value" param="role.repositoryId"/>
                      <dsp:oparam name="true">
                        <dsp:input bean=
                      "MultiUserAddFormHandler.users[param:index].roleIds"
                          paramvalue="role.repositoryId" type="checkbox"
                          checked="<%=true%>"/>  <dsp:valueof param=
                          "role.name">No
                          name</dsp:valueof>
                      </dsp:oparam>
                      <dsp:oparam name="false">
                           <dsp:input bean=
                      "MultiUserAddFormHandler.users[param:index].roleIds"
                         paramvalue="role.repositoryId" type="checkbox" />
                      <dsp:valueof param="role.name">No name</dsp:valueof>
                      </dsp:oparam>
                      </dsp:droplet>
                    </br>
                    </dsp:oparam>
                    </dsp:droplet>

                    </dsp:oparam>
                    </dsp:droplet>
           </td>
         </tr>
         <tr>
           <td align=right><span class=smallb>Language</span></td>
           <td><dsp:select bean=
             "MultiUserAddFormHandler.users[param:index].value.locale">
                 <dsp:option value="en_US"/>English
                 <dsp:option value="de_DE"/> German
               </dsp:select></td>
         </tr>

         <tr>
           <td colspan=2><hr size=1 color="#666666"></td>
         </tr>
         <tr><td><dsp:img src="../images/d.gif" vspace="6"/></td></tr>
       </dsp:oparam>
     </dsp:droplet>
     <tr>
       <td></td>
       <td><b><dsp:input bean="MultiUserAddFormHandler.create"
         type="submit"
         value=" Save "/> &nbsp;
                <input type="submit" value=" Cancel " ></td>
     </tr>
     <%--  End of add new user action --%>

</table>

</dsp:form>
Setting Single-Value Properties

The code above shows how we set a property value that is a single value in the user profile, such as a first name. We used the format MultiUserAddFormHandler.users[param:index].value.propertyName. Here, index is a numeric value that indicates the current user in the array of users being created. For example, MultiUserAddFormHandler.users[0].value.firstName sets the firstName of the first user.

For example, if the MultiUserAddFormHandler.count property is set to 10, then the users[ ] array has 10 entries and we can set the properties for 10 users during the same form submission.

The create operation is invoked by a submit button that submits to MultiUserAddFormHandler.create. Administrators can also use the group registration pages to register a single user.

Setting Properties That are Arrays, Lists, or Maps of Other Items

If a property is an array, a list, or a map of other items, we must set it differently, because we cannot assign a repository item from a Web page. To set properties that are arrays, lists, or maps of other items, we used an ID to refer to an item that already exists. We set the special sub-property called repositoryIds of the property.

For example, the roles property of useris a map, so we set it like this:

<dsp:input type="checkbox" value="role0001"
   bean="MultiUserAddFormHandler.users[0].value.roles.repositoryIds"/>
<dsp:input type="checkbox" value="role0002"
   bean="MultiUserAddFormHandler.users[0].value.roles.repositoryIds"/>

In the above code, repository items of type role with IDs role001 and role002 exist in the repository. We set these role IDs as the repositoryIds sub-property of the roles property of the user, which is the map, and the form handler automatically retrieves the corresponding repository items and adds them to the map.


Copyright © 1997, 2012 Oracle and/or its affiliates. All rights reserved. Legal Notices