This sample shows how to profile enable an xml variable and personalize it in the portlet "edit" customizer.
This is useful when the xml is a complex piece of data which needs to be modified on a per user basis.
In our sample the profile xml is the data for a select drop down builder. This xml stores the name of cities and its zip as name value pairs.
"< location origin="provided" >< label > WTC< /label >< code > 97204< /code >< /location >"
The portlet only has one UI which is the select drop down
The customizer is basically a "list" builder which lets you choose between several cities so that when you click on Save Data and and OK the select drop down box will be updated with the new list of cities. This UI is very convenient as it lets you do "Remove all" and "Add all" if the user is interested in doing so.
The Save method in the customizer sets the value of the profiled xml so that it is passed back to the portlet.
Since the List builder only returns a list of cities "City1", "Oregon City Line" that is not sufficient as the zip code is also needed.
Thus the save method uses the Websphere Portlet Factory's IXml API to build an xml with the proper name value pairs (as shown above).
Once the user adds a new city to the list as shown below and clicks "Save Data" and "OK" ...
This is how the portlet looks like as expected