Enable custom extension attributes for Profiles 

Extend the Profiles application by adding custom extension attributes.


Before starting


To edit configuration files, use the wsadmin client. See Starting the wsadmin client for information about how to start the wsadmin command-line tool.


About this task


In addition to different attribute layouts, Profiles supports extension attributes for every profile type. Because all profiles share one schema, an extension attribute, such as customers, has the same semantic meaning for all profile types. However, you can choose to associate a particular attribute with a profile based on profile type. The user interface configuration, including display characteristics and whether an attribute can be edited, is also configurable for extension attributes based on profile type.

You can enable custom extension attributes by adding them to the My Profile page. The attributes that display on the My Profile page are specified using the profiles-config.xml file located in the <was_profile_root>config/cells<cell_name>/nodes/<node-name>/LotusConnections-config directory. Although changes to profiles-config.xml should generally be made using wsadmin client scripting, there are no wsadmin commands to modify the profilesDataModel, so you can make changes to the profilesDataModel using a text editor.

There are three child elements under the profileDataModel element that correspond to the three sections in the My Profile page in Profiles: jobInformation, contactInformation, and associatedInformation. The order in which the attributes display in the file reflects the order in which they display in the form. This correspondence means that you can easily reorder the attributes without needing to modify any JSP files.

The extension attributes that you define are always included as links in the output of the Profiles API unless you specify otherwise in the profiles-config.xml file, as described in step 7 below. For more information about retrieving Profiles extensions through the API, see Retrieve profile extension data.


Procedure


To add a custom extension attribute to the My Profile page, perform the following steps.

  1. From the dmgr host:

      cd $DMGR_PROFILE/bin
      ./wsadmin.sh -jython
      execfile("profilesAdmin.py")

      If prompted to specify a service to connect to, type 1 to pick the first node in the list. Most commands can run on any node. If the command writes or reads information to or from a file using a local file path, pick the node where the file is stored.

  2. Check out the Profiles configuration files:

      ProfilesConfigService.checkOutConfig("<working_directory>", "<cell_name>")where:

      • <working_directory> is the temporary working directory to which the configuration XML and XSD files are copied and are stored while you make changes to them. Use forward slashes (/) to separate directories in the file path, even if you are using the Microsoft Windows operating system.

          Note: AIX and Linux only: The directory must grant write permissions or the command does not complete successfully.

      • <cell_name> is the name of the WAS cell hosting the Profiles application. This argument is required. It is also case-sensitive, so type it with care. If you do not know the cell name, you can determine it by typing the following command in the wsadmin command processor: print AdminControl.getCell()

      For example:

      • AIX or Linux:

          ProfilesConfigService.checkOutConfig("/opt/prof/temp","foo01Cell01")

      • Microsoft Windows:

          ProfilesConfigService.checkOutConfig("c:/prof/temp","foo01Cell01")

  • Save a copy of the profiles-config.xml file.

  • Open the file in a text editor.

  • To define the extension attribute, add it to the <profileExtensionAttributes> element under <profileDataModels> as follows:

      <profileDataModels> 
      <profileExtensionAttributes> <simpleAttribute extensionId="property1" length="64"/> <simpleAttribute extensionId="property2" length="64"/> <simpleAttribute extensionId="property3" length="64"/> </profileExtensionAttributes> <profileDataModel> ... </profileDataModel> ... </profileDataModels>

      For example:

      <profileDataModels>
      <profileExtensionAttributes> ... <simpleAttribute extensionId="spokenLang" length="64" /> <simpleAttribute extensionId="TechExperience" length="64" /> <simpleAttribute extensionId="officeAddress" length="64" /> <simpleAttribute extensionId="homeAddress" length="64" /> </profileExtensionAttributes> </profileDataModels>

  • To display the extension attribute, you need to associate it with a profile type. To do this, add the following line of code as a child element under the relevant profileType element, and under the appropriate page section, jobInformation, contactInformation, or associatedInformation:

      <extensionAttribute showLabel="true" editable="true" extensionIdRef="extension_attribute_name"/>

      The following table displays the XML attributes associated with the extensionAttribute element.

      Table 1. XML attributes associated with extensionAttribute

      Attribute Description
      editable Specifies if the extension attribute can be edited by users. This attribute takes a Boolean value.
      showLabel Specifies whether to display a label for the extension attribute in the user interface. The attribute takes a Boolean value.
      hideIfEmpty Specifies whether to hide the attribute if it does not have a value. This attribute takes a Boolean value.
      link This attribute takes a Boolean value.
      extensionIdRef The ID of the extension. This ID is associated with the property key in the resource file. This attribute takes a string value.
      labelKey Specifies the referenced key name of the label. This attribute takes a string value.
      bundleIdRef Specifies the referenced bundle ID of the label. This attribute takes a string value.
      prependHtml Specifies the HTML code prefixed to the value. This attribute takes a string value.
      appendHtml Specifies the HTML code appended to the value. This attribute takes a string value.

      For example, to display the officeAddress and homeAddress extension attributes in the Contact Information section of the page:

    <layoutConfiguration>
    <profileLayout profileType="student"> <contactInformation> <extensionAttribute  showLabel="true"  editable="true"  extensionIdRef="officeAddress"/> <extensionAttribute  showLabel="true"  editable="true"  extensionIdRef="homeAddress" /> <extensionAttribute  showLabel="true"  editable="true"  extensionIdRef="property1"  labelKey="label.contactInformation.property1"  bundleIdRef="customRes" />   ... </contactInformation> </profileLayout> </layoutConfiguration>

    7. To label the extension attribute, you need to add a resource string to the Profiles application. For more information, see Add custom strings for widgets and other specified scenarios.

    Extension attributes are included in the output of the Profiles API by default. To prevent extension attributes from being included in the API, you need to define which attributes should not be output for each profile type. To do this, add the following line of code in the <apiConfiguration> section as a child element of the <apiModel> element for the relevant profileType.

        <hiddenApiExtensionAttribute extensionIdRef="extension-id"/>

        For example, to prevent the homeAddress extension attribute from appearing in API output for the default profile type, use this configuration:

        <apiConfiguration>
        <apiModel profileType="default"> <hiddenApiExtensionAttribute extensionIdRef="homeAddress"/> ... </apiModel> </apiConfiguration>

    8. After making changes, check the configuration files back in, and do so during the same wsadmin session in which you checked them out for the changes to take effect. See Apply property changes in Profiles for information about how to save and apply your changes.


    Parent topic

    Add custom extension attributes for Profiles

    Related tasks
    Apply property changes in Profiles
    Add custom strings for widgets and other specified scenarios

    Related reference
    Retrieve profile extension data

    +

    Search Tips   |   Advanced Search