StatusThis document is in DRAFT. IntroductionRedbox 1.6.1 introduced the ability to react to record changes, in particular, by sending template-based email notifications. This how-to describes the vanilla configuration with the goal of helping you write your own custom configuration. This feature requires at least the following technical skills:
This how-to currently pertains to ReDBox 1.6.1. A future version of ReDBox will bring in further improvements. BackgroundThis feature is composed of 3 discrete steps:
Starting with Version 1.6.1Key files
Vanilla ConfigurationCriteria configuration is simply defined as: { "query":"workflow_id=\"dmpt\"" } This specifies that we are interested in all records with the workflow name equal to "dmpt". Defining the query requires the third and fourth skill outlined above. Please take note that the current date and time consideration is automatically appended to the query and that the "create_timestamp" field is required for the query to successfully execute. Email configuration is defined as: { "host":"${smtp.host}", "port":"25", "username":"${admin.email}", "password":"", "tls":"true", "ssl":"true", "from":"${admin.email}", "to":"$piEmail", "subject":"New ReDBox record added: '$title'", "body":"Dear User,\n\nThis is a notification of a newly created record: '$title' on $createTime. \n\n ${server.url.base}$viewId/detail/$oid \n\nCheers,\nEmailNotifier", "vars":[ "$oid", "$title", "$createTime", "$viewId", "$piEmail" ], "mapping": { "$oid":"id", "$title":"dc_title", "$createTime":"create_timestamp", "$viewId":"viewId", "$piEmail":"locrel:rth.foaf:Person.foaf:email" } } Below is a table explaining the configuration values. Please take note that system variables are different from user-defined variables by the ${} that encloses system variable names.
Customising the configurationStep 1Make sure highlighted configuration below is present in your system-config.json. "houseKeeping": { "config": { "quartzConfig": "${fascinator.home}/quartz.properties", "desktop": true, "frequency": "3600", "jobs": [ { "name": "alerts-poll", "type": "external", "url": "http://localhost:${jetty.port}/redbox/default/hkjobs/alerts.script", "timing": "0 0/15 * * * ?" }, { "name": "transitionWorkflow", "type": "external", "url": "http://localhost:${jetty.port}/redbox/default/hkjobs/transitionWorkflow.ajax", "timing": "0 0/15 * * * ?" } , { "name": "process-set-notifyNewRecords", "type": "external", "url": "http://localhost:${jetty.port}/redbox/default/process/launch.script?processingSet=notifyNewRecords", "timing": "0 0/15 * * * ?" } ] } } Step 2Design a criteria of your records. You will need the third and fourth skills outlined above. You will need to specify a valid SOLR query. You may want to test the query using the Solr admin interface if you have access. Once you are satisfied, update the "query" property of criteria configuration, making sure that it is properly escaped. Step 3Modify the email configuration. Please note that as of 1.6.1. only one email can be sent out per email configuration. If you need to manually process a particular set of records, just specify their record IDs in the criteria configuration, using the "includeList" array. On the next process execution, the records are included in the processing as if these satisfied the criteria. The "includeList" is also auto-populated when an exception occurs while a processing record. When the record is successfully processed, its ID is removed from the "includeList". Starting with Version 1.7:Key files
Vanilla ConfigurationThe main processing configuration contains an array of criteria configuration in the form of a JSON objects, identified by the "id" property. The order of the entries is important. The following example snippet configures notifications when there are newly submitted records and when there are newly approved records.
As with 1.6.1, the criteria configuration is specified in the "config" entry file entry. You will need to design a valid Solr query to retrieve the set of records you are interested in. Email configuration Email configuration now has support for multiple emails to be sent per record processed. The following snippet contains configuration for each of the search criteria above. However, one of the config blocks, "notifyApproval" contains configuration to send 2 emails per record, with different set of content and/or recipients.
Below is a table explaining the configuration values. Please take note that system variables are different from user-defined variables by the ${} that encloses system variable names.
Customising the configurationStep 1As with 1.6.1, make sure highlighted configuration below is present in your system-config.json. "houseKeeping": { "config": { "quartzConfig": "${fascinator.home}/quartz.properties", "desktop": true, "frequency": "3600", "jobs": [ { "name": "alerts-poll", "type": "external", "url": "http://localhost:${jetty.port}/redbox/default/hkjobs/alerts.script", "timing": "0 0/15 * * * ?" }, { "name": "transitionWorkflow", "type": "external", "url": "http://localhost:${jetty.port}/redbox/default/hkjobs/transitionWorkflow.ajax", "timing": "0 0/15 * * * ?" } , { "name": "process-set-notifyNewRecords", "type": "external", "url": "http://localhost:${jetty.port}/redbox/default/process/launch.script?processingSet=notifyNewRecords", "timing": "0 0/15 * * * ?" } ] } } Step 2Design a criteria of your records. You will need the third and fourth skills outlined above. You will need to specify a valid SOLR query. You may want to test the query using the Solr admin interface if you have access. Once you are satisfied, update the "query" property of criteria configuration, making sure that it is properly escaped. If you need to manually process a particular set of records, just specify their record IDs in the criteria configuration, using the "includeList" array. On the next process execution, the records are included in the processing as if these satisfied the criteria. The "includeList" is also auto-populated when an exception occurs while a processing record. When the record is successfully processed, its ID is removed from the "includeList". |
Documentation > HOW-TO >