unShelvedAE.pnl
The code has been implemented having in mind the concept of MVVM. The unShelvedAE.pnl contains references to widgets, widget attributes, filter objects, and calls to functions that are specified in the unShelvedAE.ctl script where most of the logic resides. The main purpose of the unShelvedAE.pnl is to display the information related to the blocked alarms, masked alarms, and masked events which is populated in the table. The filter’s textboxes are initialized with the character “*” which is the wildcard character. The unShelvedAE.pnl panel also reacts to changes from the triggerEvent function implemented in the control script. In this case, the table is updated when the alarmEventChange event is triggered and listened by the uiConnect function when live mode is active. If manual mode is active, there is a call to uiDisconnect, so the table in the panel is not updated unless the ‘Refresh’ button, which is now visible, is clicked.
unShelvedAE_Filter.ctl
The filter script contains the class unShelvedAE_Filter that is used as a link between the unShelvedAE.pnl and unShelvedAE.ctl. The user introduces the values in the text boxes widgets from the panel and are processed in the script to produce the result. The filter class is very simple. It contains private variables, a constructor with the parameters that must be introduced to create a new filter object, and the getters to extract such information.
unShelvedAE.ctl
The unShelvedAE.ctl is where most of the logic of the implementation resides. In this case, it might be worth to explain each function individually:
- unShelvedAE_getTableInfo: The values for each column of the table (alias, type, system, timestamp, application, description, nature, device comments) are returned for a given filter object specified as input parameter. All the logic in the script is directly or indirectly call within this function.
- unShelved_getRemote: It checks if there are remote systems (distributed systems) defined or not. In case that there is any, the input for the query call is modified to obtain the correct results.
- unShelvedAE_getBlockedAlarms, unShelvedAE_getMaskedAlarms, unShelvedAE_getMaskedEvents: They perform the query calls for the blocked alarms, masked alarms, and masked events (they check different datapoint elements with different conditions) and return the results of the dpQuery calls.
- unShelvedAE_getDpsBlockedAlarms, unShelvedAE_getDpsMaskedAlarms, unShelvedAE_getDpsMaskedEvents: Using the results from the queries as inputs, they return the datapoints and types associated to the blocked alarms, masked alarms, and masked events.
- unShelvedAE_getFieldsFromDps: In this function, the filter object and the datapoints are introduced as input parameters to obtain the values that will be passed to unShelvedAE_getTableInfo. The true filtering process, i.e., the discrimination of values that should or should not be displayed on the table, it is done in this function. In particular, the text values of the filters are compared against the wildcard character ‘*’ and the field value extracted for each datapoint being processed. The result of this process are the outputs that have not been discarded on the filtering process.
- unShelvedAE_getFormattedComments: It simply returns the comments in a user friendly and readable way.
- unShelvedAE_setDynamicRemoteSystems: It performs a dpQueryConnectSingle to the list of distributed systems in the distributed control and calls the function unShelvedAE_alarmEventTrigger that will trigger the event alarmEventChange. This function is used to automatically refresh the table of the unShelvedAE.pnl panel when live mode is active in case that there is a change in the distributed system configuration (or in case that the Distribution Manager starts/stops running).
- unShelvedAE_setDynamicTable: It simply calls the functions that perform the dpQueryConnectSingle for shelved alarms and events in case that there is some change, i.e., alarms and events change from masked/unmasked or blocked/unblocked for local and remote systems. This function is used to automatically refresh the table of the unShelvedAE.pnl when live mode is on.
- unShelvedAE_connectBlockedAlarms, unShelvedAE_connectMaskedAlarms, unShelvedAE_connectMaskedEvents: They perform the query single connect calls for the blocked alarms, masked alarms and masked events. They make a call to the unShelvedAE_alarmEventTrigger to trigger the event alarmEventChange in case that the has been some changes in the datapoints corresponding to shelved alarms and events.
- unShelvedAE_alarmEventTrigger: It is a callback function used to trigger the alarmEventChange event.