Page History
...
isReportSupported
returns a Boolean value indicating if the notification can include a report. The directory notifier returns true, because reports can be replaced in a directory, but a notification may not support reports. This method is called when creating job editors to determine if the reporting section is shown for this type of notification.sendNotification
is called after a job runs and is responsible for the notification. The three parameters are as follows:Parameter Type Description notifierData
iNotifierData This instance contains the configuration for the notification of the job just run. jobMetaData
Map<String, String> This map contains information about the job execution. The keys in the map correspond to entries in the NotificationPropertyEnum.
For example, to get the data and time of the execution, you would code:
“jobMetaData.get(NotificationPropertyEnum.DATE_TIME.getTag())
” iReportGeneratornotificationInfo
”
NOTE: The keys are the tag of the enum entries, so ensure that getTag() is called when accessing jobMetaData.
notificationInfo
iReportGenerator Used to generate the report and access any DDL or sync script output.
Implement a viewer contribution
Each notifier can be configured for a job in DB Change Manager.
The notifier enables a user to select a target directory in which to put results. The email notifier that is supplied with the application enables users to select the email template that will be used to generate the message as well as the addresses of those who will receive it.
In order to add a directory field to the job editor, you write a class that implements the interface named com.idera.change.notifications.api.INotifierViewerContribution.
- Create a new class named “DirectoryNotifierViewerContribution” and follow the same steps you used to create the DirectoryNotifier class. The exception to this process is that you need to leave the Superclass parameter set to “java.lang.Object”, as well as adding the interface INotifierViewerContribution to the list of implemented interfaces.
Specify setup constants
The notifier only allows users to select a directory in which reports and outcomes are written whenever jobs are executed.
The DirectoryNotifierConstants class is a small constants class that stores the property name for storage and retrieval purposes.
- Create a new class named DirectoryNotifierConstants.
- Enter the following code for the class definition:
/**
* Constantsforthisnetworksharenotifier
*/
publicfinalclassDirectoryNotifierConstants
{
//Overviewfilename publicstatisfinalString OVERVIEW_FILE_NAME=“outcome.txt”;
//PersistedJobSettingsKey publicstatisfinalSTringTARGET_DIRECTORY=“directorynotifier.targetdir”;
/**
* Constantutilityclasscannotbeinstantiated
*/
privateDirectoryNotifierConstants()
{
}
}