8.5. Inheritance Algorithm

When a child flow inherits from it's parent, essentially what happens is that the parent and child are merged together to create a new flow. There are rules for every element in the Web Flow definition language that govern how that particular element is merged.

There are two types of elements: mergeable and non-mergeable. Mergeable elements will always attempt to merge together if the elements are similar. Non-mergeable elements in a parent or child flow will always be contained in the resulting flow intact. They will not be modified as part of the merge process.

[Note]Note
Paths to external resources in the parent flow should be absolute. Relative paths will break when the two flows are merged unless the parent and child flow are in the same directory. Once merged, all relative paths in the parent flow will become relative to the child flow.

Mergeable Elements

If the elements are of the same type and their keyed attribute are identical, the content of the parent element will be merged with the child element. The merge algorithm will continue to merge each sub-element of the merging parent and child. Otherwise the parent element is added as a new element to the child.

In most cases, elements from a parent flow that are added will be added after elements in the child flow. Exceptions to this rule include action elements (evaluate, render and set) which will be added at the beginning. This allows for the results of parent actions to be used by child actions.

Mergeable elements are:

  • action-state: id

  • attribute: name

  • decision-state: id

  • end-state: id

  • flow: always merges

  • if: test

  • on-end: always merges

  • on-entry: always merges

  • on-exit: always merges

  • on-render: always merges

  • on-start: always merges

  • input: name

  • output: name

  • secured: attributes

  • subflow-state: id

  • transition: on and on-exception

  • view-state: id

Non-mergeable Elements

Non-mergeable elements are:

  • bean-import

  • evaluate

  • exception-handler

  • persistence-context

  • render

  • set

  • var