Guara uses a special object, called Outcome, to convey the execution result from a Module.
Outcomes may be returned from all methods executed by Modules.
The Outcome object holds enough information to determine which template
the RenderScreen valve should render.
The code, module and method are matched to determine the template name.
Is there is no match, the default template is returned
If there is not outcome, or outcome is Outcome.UNKNOWN, the template set o RunData is used.
Example configuration:
There are three reserved codes:
Outcome Code | Method Name | Template Rendered |
---|---|---|
UNKNOWN | n/a | template defined on RunData |
SUCCESS | n/a | screens/test/outcome/Sucess.vm |
SUCCESS | doX | screens/test/outcome/SucessWhenDoX.vm |
SUCCESS | doY | screens/test/outcome/Default.vm |
ERROR | n/a | screens/test/outcome/Error.vm |
MyCode | n/a | screens/test/outcome/MyTemplate.vm |
every other code | n/a | screens/test/outcome/Default.vm |
The nice thing about this approach is that the user may configure the same valve (RenderScreen) with
different template mappings on different pipelines.
This should enable the programmer to reuse the same
action Module and send different types of content without having to hard code this logic on the module.
(Example: hole page using the default pipeline or just a chunck using the ajax pipeline)