I am trying to develop a module which would need a reference to a database connection and also the Alarm Journal. I manage to find the the DatasourceRecord in the SDK, which seems to be what I need to have access to the database connection, however I could not find anything about Alarm Journal settings. I can see in the raw settings viewer that there is a table called ALARMJOURNALSETTINGS, but I could not find the related class (AlarmJournalSettingsRecord?) in the javadoc.
So, how I can I access that information. Should I query the internal the dabase my-self? Or is that information not supposed to be accessed?
Yes, I doubt you actually want to do anything with the settings records. You can query the alarm journal through the AlarmJournalManager, by passing the profile name and an AlarmFilter, which you can build with the AlarmFilterBuilder.
If you need to directly access the database where the journal is stored, though, I’m not sure there is a public way to figure that out. What are you trying to do?
Also, in regards to referencing database connections, almost everything should go through the DatasourceManager, instead of using the settings records.
Well, I am building a module that will need to store its own settings. The settings I am trying to store is a database connection and an alarm journal profile. I need the database connection to possibly store my own data (not to access directly tables). I also need the alarm journal profile to create an AlarmFilter. I could store the name of the alarm journal, but then I am exposed to the user renaming the journal and breaking my module without knowing it.
In the ignition programmers guide, there is an example on how to store a related record in a persistent record. This example shows how to store a reference to the DatasourceRecord. I was just thinking I could do the same for the Alarm Journal, but it does not seems JournalSettings is in the public API.
I guess I am really after an answer to the following question:
o How can I store a reference to an alarm journal without having a staled configuration if the user decide to change the alarm journal name? Obviously this could apply to anything that has only the name exposed in the API.
For example the DatasourceManager allow to retrieve a a Connection based on id as well as the name, and the DatasourceRecord is available in the SDK (Altough in that case, I would prefer to retrieve the id from the Datasource interface, rather than from the DatasourceRecord). Why is this not available on the AlarmManager? I would think a method getAlarmJournalProfiles, returning an interface similar to the Datasource interface would be usefull.