Notice
This page is still under construction
Setting up the workflow
For setting up a workflow in which a simple report is generated, first a couple of files need to be edited or added. These are:
- Moduledescriptor.xml (not always necessary)
- (Module instance, eg. Create_Report.xml)
- ModuleInstanceDescriptors.xml
- (Workflow, eg. Report.xml)
- WorkflowDescriptors.xml
- TaskrunDialog.xml
Moduledescriptor
Make sure the report class is registered. This can be done in the file "\SystemConfigFiles\Moduledescriptors.xml". It is possible that this class is already registered.
<moduleDescriptor id="Reports"> <description>Reports</description> <className>nl.wldelft.fews.system.plugin.report.ReportController</className> </moduleDescriptor>
The ID we give to the class is "Reports"
Set-up report module instance
For each report we want FEWS to generate, a separate module instance is created. Each module instance for reporting is saved in the folder "ModuleConfigFiles". In this example we create the file "Create_Report.xml". We start with the next lines:
<?xml version="1.0" encoding="UTF-8"?> <reports version="1.0" xmlns="http://www.wldelft.nl/fews" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.wldelft.nl/fews http://fews.wldelft.nl/schemas/version1.0/reports.xsd"> <declarations> <templateDir>d:\FEWS\FEWS_SA\report\</templateDir> <reportsRootDir>d:\FEWS\FEWS_SA_sa\report\</reportsRootDir> <sendToLocalFileSystem>true</sendToLocalFileSystem> </declarations> <report> <template>template.htm</template> <outputFileName>report.html</outputFileName> </report> </reports>
Later we will expand this module instance.
Register the module instance
The module instance, that creates our simple report, needs to be registered with the other module instances. Therefore the following lines are added to the file "\RegionConfigFile\ModuleInstanceDescriptors.xml":
<moduleInstanceDescriptor id="Create_Report"> <moduleId>Reports</moduleId> </moduleInstanceDescriptor>
ID
- Notice that ModuleId refers to the ID of the Report class we registered in "\SystemConfigFiles\Moduledescriptors.xml"
- Notice that the moduleInstanceDescriptor ID is the same as the name of the file that contains the settings for the module instance, in our example: "\ModuleConfigFiles\Create_Report.xml"
Workflow for creating the report
For creating the report we will here set up a seperate workflow. Therefore we create a file in the folder "WorkflowFiles", which we call "Report.xml". The file contains the following lines:
<?xml version="1.0" encoding="UTF-8"?> <workflow xmlns="http://www.wldelft.nl/fews" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.wldelft.nl/fews http://fews.wldelft.nl/schemas/version1.0/workflow.xsd" version="1.1"> <!--report--> <activity> <runIndependent>true</runIndependent> <moduleInstanceId>Create_Report</moduleInstanceId> </activity> </workflow>
ID
Notice that ModuleInstanceId refers to the name of the file that contains the module instance (ModuleConfigFiles\Create_Report.xml!
Register the new workflow
The new workflow in the file "WorkflowFiles\report.xml" needs to be registered in the file "RegionConfigFiles\WorkflowDescriptors.xml":
<workflowDescriptor id="report" forecast="false" visible="true" autoApprove="false"> <description>Creates web reports</description> </workflowDescriptor>
ID
Notice that the WorkflowDescriptor Id is the same as the file which contains the workflow! In this case it is "report", which is the same as the file "\WorkflowFiles\report.xml"!
Adding the workflow to the list of tasks
To be able to run the workflow manually, it needs to be registered as a task. Therefor in the file "Taskrundialog.xml" in the folder "DisplayConfigFiles" the following information is added:
<simpleTask name="MakeReport" workflowId="report"> <relativePeriod unit="hour" start="-24" end="0"/> </simpleTask>
The name, which appears in the tasklist is "MakeReport".
ID
Notice that the WorkflowId is the same as the file which contains the workflow! In this case it is "report", which is the same as the file "\WorkflowFiles\report.xml"!