Customization Properties<
Plug-ins can customize certain aspects of the HTML forms for submitting jobs or how the files generated by the CPF for structured results. For example the sections to group fields on the forms or the URL to the style document to be used in KML documents.
Defining Customization Properties
The customization properties can be defined using an optional properties map bean in the ca.bc.gov.open.cpf.plug-in.sf.xml file.
The map can contain a default entry, or an entry for each business application name. The value for each entry is a map of the customization properties. If the property is not specified for a business application then the value from the default entry is used.
Example Plug-in Customization Properties
<util:map id="properties"> <entry key="default"> <map> <entry key="kmlPlaceMarkNameAttribute</b>></em> value="fieldA</b>></em> /> </map> </entry> <entry key="demo"> <map> <entry key="kmlPlaceMarkNameAttribute</b>></em> value="fieldB</b>></em> /> </map> </entry> </util:map>
Customization properties can also be set by adding a config property for a business application using the admin web application.
- Open the CPF modules admin page.
- Click on the name of the module in the table, this will open the module view page.
- Click the Business Applications tab to view the list of business applications.
- Click on the name of the business application in the table, this will open the business application view page.
- Click the Config Properties tab to view the current properties.
- Click the id of a property to view it and then click Edit to change the value or click Add to add a new property.
Form Customization Properties
The following customization properties are used to define the sections to group fields on the forms and the default values for fields on the job submission forms.
Name | Type | Description |
---|---|---|
formSectionsOpen formSectionsOpenInstant formSectionsOpenSingle formSectionsOpenMultiple |
List<String> | The list of section names that are open on the job submission forms, all other sections will be closed by default. The open sections can be specified for all forms using formSectionsOpen or for a specific form using formSectionsOpenInstant, formSectionsOpenSingle, or formSectionsOpenMultiple. If not specified the open sections will be applicationParameters, inputData, and resultFormat. **Example Form Open Sections Customization** ```xml ``` |
formSectionsMap formSectionsMapInstant formSectionsMapSingle formSectionsMapMultiple |
List<String> | This property is used to customize the sections and the fields in each section that appear on the job submission forms. The section field can be specified for all forms formSectionsMap or for a specific form formSectionsMapInstant, formSectionsMapSingle, formSectionsMapMultiple. The property is a map where the key on the entry is the name of the section and the value is a list of the field names. Section names should be in lowerCamelCase notation. The titles on the sections are converted to capitalized words from the section name (e.g. Lower Camel Case). Fields not applicable for a form will not be displayed. Any business application parameters not listed will be put into the applicationParameters section. Any CPF parameters not listed will be in the sections shown below.
|
inputDataContentType or inputDataFileExtension | String | The default value shown on forms for Input Data Content Type which is the MIME type or file extension of the input data specified by an inputData or inputDataUrl parameter. |
srid | int | The default value shown on forms for Srid which is the EPSG coordinate system code of the source geometry. |
resultDataContentType or resutDataFileExtension | String | The default value shown on forms for Result Data Content Type which is the MIME type or file extension of the result data specified by an resutData or resutDataUrl parameter. |
resultSrid | int | The default value shown on forms for Result Coordinate System which is the EPSG coordinate system code used for the result geometry. |
resultNumAxis | int | The default value shown on forms for Result Num Axis which is the number of coordinate axis in the result geometry (e.g. 2 for 2D or 3 for 3D). |
resultScaleFactorXy | double | The default value shown on forms for Result Scale Factor Xy which is the scale factor to apply the x, y coordinates. The scale factor is 1 / minimum unit. For example if the minimum unit was 1mm (0.001) the scale factor is 1000 (1 / 0.001). |
resultScaleFactorZ | double | The default value shown on forms for Result Scale Factor Z which is the scale factor to apply the z coordinates. The scale factor is 1 / minimum unit. For example if the minimum unit was 1mm (0.001) the scale factor is 1000 (1 / 0.001). |
Result File Customization Properties
The following customization properties are supported.
Name | Type | Description |
---|---|---|
kmlDocumentName | String | The text to use as the name of the KML Document. NOTE: Don't use on a per result basis. |
kmlDocumentDescription | String | The text to use as the description of the KML Document. NOTE: Don't use on a per result basis. |
kmlStyle | String | A list of one or more KML Style tags containing a custom style for the whole document. NOTE: Don't use on a per result basis. External styles should be preferred. |
kmlPlacemarkDescription | String | The text to use as the description of the KML Placemark created for each result. |
kmlPlaceMarkNameAttribute | String | The name result attribute to use as the Name of the KML Placemark created for each result. |
kmlSnippet | String | The text to use as the snippet of the KML Placemark created for each result. |
kmlStyleUrl | String | The text to use as the styleUrl of the KML Placemark created for each result. |
kmlWriteNulls | boolean | Flag indicating if attributes will null values are to be included in the KML document. By default attributes with null values are NOT included in the extended data. If true then the attribute will be included as a <value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" /> tag. |
kmlLookAtRange | double | The range to include in the look at element. If omitted then it will be calculated from the geometry. The calculation for points always returns 1000. |
kmlLookAtMinRange | double | The minimum value for the range to include in the look at element. This value is used if the kmlLookAtRange or calculated range is less than this value. |
kmlLookAtMaxRange | double | The maximum value for the range to include in the look at element. This value is used if the kmlLookAtRange or calculated range is greater than this value. |
See the kml reference guide for details on how to use the KML attributes.
Result file customization properties can also be specified on a plug-in class or on the result object for plug-ins that return a list of results. This allows the property to be calculated for each result. For example the kmlStyleUrl may vary based on the type of result. The following example show the optional method that must be implemented for plug-ins that wish to define per result configuration properties.
Example Plug-in Result Customization Properties
public Map<String,Object> getCustomizationProperties() { Map<String,Object> properties = new HashMap<>(); properties.put("propertyName", "propertyValue"); String styleId = "demo"; /** Calculated from some field on object */ properties.put("kmlStyleUrl", "http://gov.bc.ca/kmlStyle.kml#" + styleId); return properties; }