Documentation Center

IPublishPostProcessPlugin - DitaDeliveryExtendConditionMetadata

Converts the condition set used during publishing into a JSON format and extracts the conditions remaining in the XML content files and stores the used condition names and values in the corresponding metadata files. It also stores a unique list of all condition names and values encountered in the publication and the range and type of the condition name in the publication metadata file. If no condition set was set during publishing, one is generated from the unique list of all condition names and values.

Plugin Input

Plugin configuration parameters
ParameterRequiredDefault valueAllowed valuesDescription
ObjectTypesToProcessYespage, toc, indexWhich type of objects in the __packages.xml should be parsed to look for conditions. Multiple types need to be separated with ", " (comma+space).
ConvertValuesForAttributesNoconditionValid attribute namesThe attribute names that contain a condition and need to be read from the XML
Input expected in the context.Items collection
Item KeyRequiredDefault valueItem Value TypeDescription
TransportPackageRootDirectoryYesstringThe root transport package folder (typically ...\Data\Publish\Data\[RANDOMFOLDERNAME]\work\TP).
ExtendedOverallPackageObjectFilePathYesstringFile path of the XML that contains an overview of all the files that need to be transported to Dynamic Delivery (typically full file path to __packages.xml).
Changes made to the file system:
  • The JSON metadata files corresponding to the object types provided are extended with the condition name/values found in their corresponding XML content files. The values found are put in conditionsused.generated.value.
  • The JSON metadata file of the publication is extended with a unique list of all condition name/values encountered by the previous step. The values found are put in conditionsused.generated.value.
  • If the publish
    • has a condition set defined, it is converted to a JSON format and added to the JSON publication metadata file. The condition set is put in conditionset.generated.value and the value of conditionsetactive.generated.value is set to true to indicate a condition set was applied during publishing.
    • does not have a condition set defined, a condition set is generated based on the unique list of all condition name/values encountered in the XML content. The generated condition set is put in conditionset.generated.value and the value of conditionsetactive.generated.value is set to false to indicate a condition set was applied during publishing.
  • The Json metadata file of the publication is also extended with the type and range of all condition names encountered. This information is put in conditionmetadata.generated.value.

Values set in the context as a result: None.

Values set in the context.Items collection as a result: None.

plugin name="ISHDITADELIVERYEXTENDCONDITIONMETADATA" example


<plugin name="ISHDITADELIVERYEXTENDCONDITIONMETADATA" handler="DitaDeliveryExtendConditionMetadata">
  <description>Extracts remaining conditional attributes from the content, disassembles them, and saves the resulting condition name/values
     in the corresponding JSON metadata files. It also builds a unique list of all found condition names and values and enriches the condition set
     (a.k.a product definition) used during publishing and saves them to the publication JSON metadata file.
  </description>
  <initialize>
     <parameters>
         <parameter name="ObjectTypesToProcess">page, index, toc</parameter>
      </parameters>
  </initialize>
</plugin>

Example of an extended publication metadata file.


{
  "publication_meta": {
    "properties": {
      "ishlogicalref.object.id": 346492,
      "ishversionref.object.id": 346494,
      "ishlngref.object.id": 1683795,
      "ishref.object.value": "GUID-EB2E82F1-1C76-4032-815C-4E717140A081",
      "ishtype.object.value": "ISHPublication",
      "FTITLE.logical.value": "Publication MP660",
      ...
      "conditionsetactive.generated.value": "true",			
      "conditionsused.generated.value": "{\"MODEL\":[\"330\"],\"GPRS\":[\"Y\"],\"LOUDSPEAKER\":[\"Y\"],\"GAMES\":[\"SNAKE\",\"WATERRAPIDS\",\"DJ\"]}",			
      "conditionset.generated.value": "{\"GAMES\":[\"DJ\",\"SNAKE\",\"WATERRAPIDS\"],\"GPRS\":[\"Y\"],\"LOUDSPEAKER\":[\"Y\"],\"MODEL\":[\"330\"]}",			
      "conditionmetadata.generated.value": "{\"MODEL\":{\"datatype\":\"Text\",\"range\":false},\"GPRS\":{\"datatype\":\"Text\",\"range\":false},
            \"LOUDSPEAKER\":{\"datatype\":\"Text\",\"range\":false},\"GAMES\":{\"datatype\":\"Text\",\"range\":false}}"
    }
  }
}		
			

Example of an extended publication schema file


{
  "publication_meta": {
    "properties": {
      "ishlogicalref.object.id": {
        "type": "integer",
        "searchable": "no"
      },
      "ishversionref.object.id": {
        "type": "integer",
        "searchable": "no"
      },
      "ishlngref.object.id": {
        "type": "integer",
        "searchable": "no"
      },
      "ishref.object.value": {
        "type": "string",
        "searchable": "no"
      },
      "ishtype.object.value": {
        "type": "string",
        "searchable": "no"
      },
      "FTITLE.logical.value": {
        "type": "string",
        "searchable": "no"
      },
      ...
      "conditionsetactive.generated.value": {	
        "type": "string",				
        "searchable": "no"			
      },			
      "conditionsused.generated.value": {	
        "type": "string",				
        "searchable": "no"			
      },			
      "conditionset.generated.value": {	
        "type": "string",				
        "searchable": "no"			
      },			
      "conditionmetadata.generated.value": {				
        "type": "string",				
        "searchable": "no"			
      }
    }
  }
}
     

Example of an extended page metadata file.


{
  "page_meta": {
    "properties": {
      "ishlogicalref.object.id": 164167,
      "ishversionref.object.id": 164168,
      "ishlngref.object.id": 164171,
      "ishref.object.value": "GUID-0EDBAC80-8997-45CA-8578-E8AAB7EE0B6E",
      "ishtype.object.value": "ISHModule",
      "FTITLE.logical.value": "gprs",
      ...
      "conditionsused.generated.value": "{\"GPRS\":[\"Y\"]}"
    }
  }
}		
			

Plugin flow

DitaDeliveryExtendConditionMetadata does the following:
  • Every content file in the __packages.xml that matches the given ObjectTypesToProcess is loaded as XML in memory, parsed, and the attribute values of attributes matching the or ExtractValuesForAttributes parameters are gathered.
  • All the found conditions are parsed and broken down into used condition names and values. They are kept in a list of conditionname - conditionvalue combinations.
  • The found condition names and values are then saved as a string containing a JSON object in the conditionsused.generated.value property in the corresponding JSON metadata file and the appropriate metadata schema file is extended as well.
  • A unique list of all found condition names and values for all processed object types is built and saved as a string containing a JSON object in the conditionsused.generated.value property in the publication JSON metadata file and the publication metadata schema file is extended as well.
  • If the publication output has a product definition:
    • The product definition is loaded from the file specified in the ConditionsFile property of the context.
    • The product definition is converted to JSON and saved in the conditionset.generated.value property in the publication JSON metadata file and the publication metadata schema file is extended as well.
  • If the publication output has no product definition (meaning all conditional content was kept):
    • A product definition (features/feature) is created from the unique list of all found condition names and values for all processed object types.
    • The created product definition is saved in the conditionset.generated.value property in the publication JSON metadata file and the publication metadata schema file is extended as well.
  • The type and range of the condition names encountered is looked up in the ISHCONDITIONMANAGEMENT file and added to the conditionmetadata.generated.value property in the publication JSON metadata file and the publication metadata schema file is extended as well.