The customization is recognized in the result view of a local and server advanced design
search. You can customize the result view by displaying the criterion that was used to constitute
the search result. But you can also display any other element. There is no link between the criteria
from which the result was found and the elements that can be added to the result view.
About this task
Before you can customize the result view, you must have instantiated the
com.ibm.pdp.maf.rpp.mafAdvancedSearchPattern extension point and coded the Java
class that implements each instantiation.
You can then customize the result views of the local and server advanced design searches. These
views have two display modes: the hierarchical mode and the column mode (flat mode).
Procedure
- You can customize the result view in hierarchical mode by displaying the element that caused
the instance to be found between parentheses after the instance name. To do so, you can enter the
parameter StringBuilder decoration in the accept method of the
Java class that implements the extension point.
public boolean accept(Object radicalElement, Map<String, Object> parameters,
StringBuilder decoration)
- You can customize the result view in flat mode by displaying each additional element in a
dedicated column. A sort is available on all the columns.
Note: Moreover, you can also specify the parameter StringBuilder decoration, as in
a hierarchical display.
- To add a column, you must enter the following elements after the class
parameter in the extension point instantiation of the plugin.xml file:
- columnId: Column identifier.
- header: Column header. It can be converted.
The following line shows the insertion of a COBOL Program ID column in the
result view of an advanced design search on Programs:
<mafAdvancedSearchPatternColumn
columnId="program.pgmID" header="COBOL Program ID"/>
The following code shows how the line is added to the extension
point:
<extension
point="com.ibm.pdp.maf.rpp.mafAdvancedSearchPattern">
<mafAdvancedSearchPattern
id="programByPgmID"
description="List of Programs by their COBOL Program ID"
designType="pacprogram"
kind="STRING"
class="sample.ProgramByPgmID">
<mafAdvancedSearchPatternColumn
columnId="program.pgmID" header="COBOL Program ID"/>
</mafAdvancedSearchPattern>
</extension>
- Indicate the column in the Java class that implements the instantiation of the extension point.
You must add the following method:
public String getColumnText(Object radicalElement, String columnId) {
if (!(radicalElement instanceof Program))
return "";
Program program = (Program) radicalElement;
if ("program.pgmID".equals(columnId)) {
return program.getProgramId();
}
return "";
}
Results
The decoration and the new column are displayed in the result view.