Add user parameters

You can add user parameters to the Generate Output dialog.

If your output processing conductor file requires inputs from the user, such as determining which cover page to use for the PDF file, you can customize the Generate Output dialog so that users can specify this information when they generate output, such as:

  • Document ID
  • Delivery scope: Public, Partner only, Internal
  • Publication Date

The preprocessors.xml file contains user parameters that you can customize. Each field in the Generate Output dialog is associated with a user parameter defined in the preprocessor. When a user selects an output type, CCMS Output Generator looks up the preprocessor associated with this output type, retrieves any user parameters, and displays them in the Generate Output dialog. The values the user enters or selects pass to the Ant conductor file during output generation.

To add user parameters:

  1. Open the preprocessors.xml file that contains %OutputGenDir%/conf/client/preprocessors.xml.
  2. Under the <system> element for the preprocessor, create a <user> element.
    To add user parameters for the dita2pdf.custom output type, locate the dita2pdf.custom preprocessor in the preprocessors.xml file and add a <user> element.
    <preprocessor 
          name="dita2pdf.custom" 
          class="com.ixiasoft.outputgenerator.preprocessor.AntProcessor">
       <parameters>
          <system>
             <parameter name="buildfile" value="/conductor-client.xml" />  
             <parameter name="target" value="dita2pdfwrapper" />
             <parameter name="clean" value="job_postprocess" /> 
          </system>  
          <user>
             <!-- Enter user parameters here -->
          </user>    
       </parameters>
    </preprocessor> 
  3. Under the <user> element, create a <parameter> element for the parameter you want to define.

    The <parameter> element has the following structure:

    <user>
       <parameter label="param_label" name="param_name" mandatory="true|false" 
                  type="param_type" format="param_format" tooltip="param_tooltip"/>
    </user>

    The following table describes the <parameter> attributes:

    Table 1. Parameter attributes

    Attribute/ Element

    Description

    Values

    label

    Label displayed in the Generate Output dialog

    Any sequence of characters

    Note: Optional attribute. If you do not specify the label, the value of the name attribute displays in the dialog.

    name

    Parameter name passed to the Ant conductor file during output generation

    Any sequence of characters, without spaces

    Note: Parameter is accessed in the Ant conductor file:
    outgen.job.userparam.name
     

    mandatory

    Determines whether users must enter a value for this parameter during output generation

    Parameter either set to false or true

    • false does not require users to enter a value
    • true disables the Create button until the user specifies a value for all mandatory parameters

    type

    Parameter value type can be one of the following:

    list

    Lists options and includes checkboxes. Specify the options with the <value> element.

    choice

    Lists options and includes combo box. Specify the options with the <value> element.

    string

    Accepts any string in a text parameter.

    date

    Lists date, with the default current date. For dates, you also need to specify the format attribute.

    integer

    Provides user ability to enter an integer.

    index-list

    Lists options and includes checkboxes, based on the content of the index.

    The name attribute must match an index in the Index Definition document. This can be useful to generate options dynamically, without having to hard code them in the preprocessors file.

    index-choice

    Lists options and includes combo box, based on the content of the index.

    The name attribute must match an index in the Index Definition document. This can be useful to generate options dynamically, without having to hard code them in the preprocessors file.

    format

    For date parameters, this attribute is mandatory and specifies the format of dates entered by users.

    For other parameters, this attribute is optional and validates that the value entered by users corresponds to a specific pattern.

    Lists date parameters in a format as follows:
    • format="yyyy-MM-dd": 2001-07-04
    • format="MMM d, yyyy": Jul 4, 2001
    • format="d MMM yyyy": 4 Jul 2001

    The entered value must correspond to the Java data format.

    For other parameters, enter a regular expression; for example, the following format would accept input such as 2.3.009:
    format="[0-9][.][0-9][.][0-9]{3}"

    tooltip

    Tool tip displayed when the user moves the mouse pointer over the field in the Generate Output dialog.

    Optional parameter, allows any sequence of characters.

    <value> element

    For parameters of type list and choice, you also need to create a <value> element to specify the options in the Generate Output dialog, as follows:

    <parameter label="Available to:" name="classification" mandatory="true" type="choice">
       <value name="Public" _default="true">Public</value>
       <value name="Partner">Partner Only</value>
       <value name="Internal>Acme Internal</value>
    </parameter>

    where:

    • name is the value of the parameter that is passed to the Ant conductor file when the output is generated.
    • _default="true" designates the default selection. If you do not specify a default selection in a choice type, the first <value> element in the list is used as default.

    The string entered as the content of the <value> elements displays in the Generate Output dialog.

    The following code shows the user parameter definition used to display a sample Generate Output dialog.
    <user>
       <parameter label="Document Identifier" name="doc.id" mandatory="true" 
                  type="string"/>
       <parameter label="Available to:" name="classification" mandatory="true" 
                  type="choice">
          <value name="Public" _default="true">Public</value>
          <value name="Partner">Partner Only</value>
          <value name="Internal">Acme Internal</value>
       </parameter>
       <parameter label="Publication Date" name="doc.pubdate" mandatory="true" 
                  type="date" format="YYYY-MM-DD"/>
    </user>    
  4. When you are done, save and close preprocessors.xml.
  5. Restart the CCMS Output Generator service to apply your changes.
    The Generate Output dialog now includes the user parameters you provided.
  6. Optional: Add any additional parameters by repeating the process.
    Sample additional parameters
    <user>
       <-- Example of a string parameter -->
       <parameter label="Sample text field" name="text.field" mandatory="false" 
                  type="string"/>
    
       <-- Example of an integer parameter -->
       <parameter label="Sample integer field" name="integer.field" 
                  mandatory="false" type="integer"/>
    
       <-- Example of text field with validation -->
       <parameter label="Sample text field with validation" name="text.field2" 
                  mandatory="false" type="string" 
                  format="[0-9]*[.][0-9]*[.][0-9]{3}" tooltip="2.3.009"/>
    
       <-- Example of date field -->   
       <parameter label="Sample date" name="date" mandatory="false" type="date" 
                  format="yyyy-MM-dd" tooltip="Format is yyyy-mm-dd"/>
    
       <-- Example of sample list --> 
       <parameter label="Sample list" name="list" mandatory="false" type="list">
          <value name="item1">Item 1</value>
          <value name="item2">Item 2</value>
       </parameter>
    
       <-- Example of sample choice parameter --> 
       <parameter label="Sample choice" name="choice" mandatory="false" 
                  type="choice">
          <value name="value1" _default="true">Value 1</value>
          <value name="value2">Value 2</value>
       </parameter>
    
       <-- Example of sample index-list parameter -->
       <parameter label="Sample index-list (using audience)" name="audience" 
                  mandatory="false" type="index-list"/>
    
       <-- Example of sample index-choice parameter -->
       <parameter label="Sample index-choice (using platform)" name="platform" 
                  mandatory="false" type="index-choice"/>
    </user>