Setting a target path

Next we extend the target path. We need to extend the target path to ensure the form item value is processed by the Marshaller attached to the Pod-Container. The Marshaller is configured to process a number of specific target paths. Example 7.3 shows how to extend the target path in the correct format.

Figure 1. Setting the target path
038      String targetPathExt = 
039        "choice/" + field.getID() + "/selected-options";
040      Path targetPath = 
041        field.getBinding().getTargetPath().extendPath(targetPathExt);
042      fieldBuilder.setTargetPath(targetPath);
Note: The PodFiltersRenderer passes an Id value to the Renderer it invokes. The Id is the concatenation of a podID and filterID in the format podID/filterID. The Id value is retrieved by the called renderer using the getID() method. That renderer will use the Id to uniquely identify itself.
Figure 2. Format of a Pod filter target path
 choice/ podId
          /
          filterId
           /selected-options 
          /option-value
           |--1--| 
          --2--|
          ---3----|
           --------4-------| 
          -----5------|

The extended target path is broken in to what are known as steps which are divided by the '/' character. Each step in our target path is defined below.

Table 1. Target Path break down
Step Description
1 This acts as the marker for the marshal. The 'choice' text indicates that this field is to be processed by the Pod-Container.
2 Contains the unique identifier (as specified in the PodType codetable) for the Pod to which the filter is attached. E.g. PT9001
3 Contains the unique identifier for the filter attached to the Pod. This Id is created when the PodFilter is constructed in the PodLoader.
4 The selected-options step indicates that this is a filter. Knowing this, the infrastructure will process the form values as a Pod filter.
5 The option-value step is optional and is used to uniquely identify selections in multi-select filters. E.g a checkbox filter can select more than 1 value, so each option gets an option-value step to distinguish it from it's siblings.

In our code extract in Example 7.3 we have extended the target path using the id passed from the PodFiltersRenderer to map our text input form item. At runtime its value will be...

Figure 3. Format of a target path for My Favourite Movies Pod text filter
choice/PT9001/title/selections