public abstract class BOAlarmStatusManager extends java.lang.Object implements DatabaseConnectionProviderI
BOs
monitored by specific Alarm
instances,
including the date when the specific Alarm
instance should trigger
for a given BO
.
This implementation keeps the state information in a special database table.
The table is accessed directly via SQL for performance and because the MyTISM
object handling is not necessary here.
This class and its subclasses should only be needed and accessed by other
alarm system classes.Modifier and Type | Class and Description |
---|---|
static class |
BOAlarmStatusManager.Batch
This class creates and caches a database connection and several statements
for improved performance in cases where more than one
BOAlarmStatus
need to be adjusted. |
static class |
BOAlarmStatusManager.BOAlarmStatusIterator |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NAME_BAS_TABLE |
static java.lang.String |
NAME_COL_ACTIVE |
static java.lang.String |
NAME_COL_ALARM |
static java.lang.String |
NAME_COL_ALARMBOT |
static java.lang.String |
NAME_COL_AUFGETRETENERFEHLER |
static java.lang.String |
NAME_COL_BO |
static java.lang.String |
NAME_COL_BOT |
static java.lang.String |
NAME_COL_CREA |
static java.lang.String |
NAME_COL_DATUMSTART |
static java.lang.String |
NAME_COL_LMOD |
Constructor and Description |
---|
BOAlarmStatusManager(BOLoaderI _bol,
DatabaseConnectionProviderI _connectionProvider,
SchemaI _schema) |
Modifier and Type | Method and Description |
---|---|
void |
addState(BOAlarmStatus bas)
Adds the given
BOAlarmStatus to the database. |
void |
addState(BOAlarmStatus bas,
BOAlarmStatusManager.Batch _batch) |
abstract java.lang.Class |
getAlarmClass() |
BOLoaderI |
getBOLoader() |
java.sql.Connection |
getConnection() |
long[] |
getExistingStatesForAlarm(java.lang.Long alarmId)
Queries and returns the ids of all BOs for which the
Alarm with the given id has any trigger status memorized. |
BOAlarmStatusManager.BOAlarmStatusIterator |
getNextUpcomingStates() |
static java.lang.String |
getSQL(java.lang.String what,
java.lang.Long alarmId)
Helper method to create an SQL clause in a consistent manner for getting a defined set of states.
|
static java.lang.String |
getSQL(java.lang.String what,
java.lang.Long alarmId,
java.lang.Long boId) |
static java.lang.String |
getSQL(java.lang.String what,
java.lang.Long alarmId,
java.lang.Long boId,
boolean nullBOIdWanted) |
static java.lang.String |
getSQL(java.lang.String what,
java.lang.Long alarmId,
java.lang.Long boId,
boolean nullBOIdWanted,
boolean alsoPendingOnes) |
static java.lang.String |
getSQL(java.lang.String what,
java.lang.Long alarmId,
java.lang.Long boId,
boolean nullBOIdWanted,
boolean alsoPendingOnes,
boolean alsoDoneOnes) |
static java.lang.String |
getSQL(java.lang.String what,
java.lang.Long alarmId,
java.lang.Long boId,
boolean nullBOIdWanted,
boolean alsoPendingOnes,
boolean alsoDoneOnes,
boolean alsoDeactivatedOnes) |
static java.lang.String |
getSQL(java.lang.String what,
java.lang.Long alarmId,
java.lang.Long boId,
boolean nullBOIdWanted,
boolean alsoPendingOnes,
boolean alsoDoneOnes,
boolean alsoDeactivatedOnes,
boolean alsoInvalidOnes) |
static java.lang.String |
getSQL(java.lang.String what,
java.lang.Long alarmId,
java.lang.Long boId,
boolean nullBOIdWanted,
boolean alsoPendingOnes,
boolean alsoDoneOnes,
boolean alsoDeactivatedOnes,
boolean alsoInvalidOnes,
java.lang.String orderBy) |
BOAlarmStatus |
getState(java.lang.Long alarmId,
java.lang.Long boId) |
BOAlarmStatusManager.BOAlarmStatusIterator |
getStatesForAlarm(java.lang.Long alarmId) |
BOAlarmStatusManager.BOAlarmStatusIterator |
getStatesForBO(java.lang.Long boId) |
void |
initTable()
Creates the table for the states if it does not already exist.
|
abstract BOAlarmStatus |
newState(BOMonitoringAlarmI alarm,
BO bo,
java.util.Date datumStart,
java.lang.Boolean active)
Alternate version of method if the
BO is already available. |
abstract BOAlarmStatus |
newState(java.lang.Long alarmId,
java.lang.Long idBO,
java.lang.Long idBOT,
java.util.Date datumStart,
java.lang.Boolean active,
java.lang.String aufgetretenerfehler) |
void |
removeAllStatesForAlarm(java.lang.Long alarmId)
Removes all
BOAlarmStatus records for the alarm with the given id from the database at once. |
void |
removeState(BOAlarmStatus bas)
Removes the given
BOAlarmStatus from the database. |
void |
removeState(BOAlarmStatus bas,
BOAlarmStatusManager.Batch _batch) |
void |
updateState(BOAlarmStatus bas)
Updates the data of the given
BOAlarmStatus in the database. |
void |
updateState(BOAlarmStatus bas,
BOAlarmStatusManager.Batch _batch) |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
wantsConnectionsClosed
public static final java.lang.String NAME_BAS_TABLE
public static final java.lang.String NAME_COL_ALARM
public static final java.lang.String NAME_COL_ALARMBOT
public static final java.lang.String NAME_COL_BO
public static final java.lang.String NAME_COL_BOT
public static final java.lang.String NAME_COL_DATUMSTART
public static final java.lang.String NAME_COL_ACTIVE
public static final java.lang.String NAME_COL_CREA
public static final java.lang.String NAME_COL_LMOD
public static final java.lang.String NAME_COL_AUFGETRETENERFEHLER
public BOAlarmStatusManager(BOLoaderI _bol, DatabaseConnectionProviderI _connectionProvider, SchemaI _schema)
public BOLoaderI getBOLoader()
public void initTable() throws BOAlarmStatusManagerStorageException
public java.sql.Connection getConnection()
getConnection
in interface DatabaseConnectionProviderI
public abstract BOAlarmStatus newState(java.lang.Long alarmId, java.lang.Long idBO, java.lang.Long idBOT, java.util.Date datumStart, java.lang.Boolean active, java.lang.String aufgetretenerfehler)
BOAlarmStatus
instance that is fit for the correct BOAlarmStatusManager
subclasspublic abstract BOAlarmStatus newState(BOMonitoringAlarmI alarm, BO bo, java.util.Date datumStart, java.lang.Boolean active)
BO
is already available.public abstract java.lang.Class getAlarmClass()
public void addState(BOAlarmStatus bas) throws BOAlarmStatusManagerStorageException
BOAlarmStatus
to the database.public void addState(BOAlarmStatus bas, BOAlarmStatusManager.Batch _batch) throws BOAlarmStatusManagerStorageException
public void updateState(BOAlarmStatus bas) throws BOAlarmStatusManagerStorageException
BOAlarmStatus
in the database.public void updateState(BOAlarmStatus bas, BOAlarmStatusManager.Batch _batch) throws BOAlarmStatusManagerStorageException
public void removeState(BOAlarmStatus bas) throws BOAlarmStatusManagerStorageException
BOAlarmStatus
from the database.public void removeState(BOAlarmStatus bas, BOAlarmStatusManager.Batch _batch) throws BOAlarmStatusManagerStorageException
public void removeAllStatesForAlarm(java.lang.Long alarmId)
BOAlarmStatus
records for the alarm with the given id from the database at once.public static java.lang.String getSQL(java.lang.String what, java.lang.Long alarmId)
what
- what to do, the part before the "FROM", like "SELECT *" or "DELETE"public static java.lang.String getSQL(java.lang.String what, java.lang.Long alarmId, java.lang.Long boId)
public static java.lang.String getSQL(java.lang.String what, java.lang.Long alarmId, java.lang.Long boId, boolean nullBOIdWanted)
public static java.lang.String getSQL(java.lang.String what, java.lang.Long alarmId, java.lang.Long boId, boolean nullBOIdWanted, boolean alsoPendingOnes)
public static java.lang.String getSQL(java.lang.String what, java.lang.Long alarmId, java.lang.Long boId, boolean nullBOIdWanted, boolean alsoPendingOnes, boolean alsoDoneOnes)
public static java.lang.String getSQL(java.lang.String what, java.lang.Long alarmId, java.lang.Long boId, boolean nullBOIdWanted, boolean alsoPendingOnes, boolean alsoDoneOnes, boolean alsoDeactivatedOnes)
public static java.lang.String getSQL(java.lang.String what, java.lang.Long alarmId, java.lang.Long boId, boolean nullBOIdWanted, boolean alsoPendingOnes, boolean alsoDoneOnes, boolean alsoDeactivatedOnes, boolean alsoInvalidOnes)
public static java.lang.String getSQL(java.lang.String what, java.lang.Long alarmId, java.lang.Long boId, boolean nullBOIdWanted, boolean alsoPendingOnes, boolean alsoDoneOnes, boolean alsoDeactivatedOnes, boolean alsoInvalidOnes, java.lang.String orderBy)
public BOAlarmStatus getState(java.lang.Long alarmId, java.lang.Long boId)
BOAlarmStatus
for the alarm with the given id and the BO
with the given id if one
exists or null otherwisepublic long[] getExistingStatesForAlarm(java.lang.Long alarmId)
Alarm
with the given id has any trigger status memorized.
Used (only) when initializing the status values for an Alarm
.alarmId
- the id of the Alarm
whose status values should be
queriedAlarm
with the given id has any status memorized. The
list is sorted ascending by BO id (which is important since the list
is used to do a binary search in, which requires this).public BOAlarmStatusManager.BOAlarmStatusIterator getStatesForAlarm(java.lang.Long alarmId)
BOAlarmStatusManager.BOAlarmStatusIterator
instance which provides all states for the alarm with the given idpublic BOAlarmStatusManager.BOAlarmStatusIterator getStatesForBO(java.lang.Long boId)
BOAlarmStatusManager.BOAlarmStatusIterator
instance which provides all states of any alarm associated
with the BO
with the given idpublic BOAlarmStatusManager.BOAlarmStatusIterator getNextUpcomingStates()
BOAlarmStatusManager.BOAlarmStatusIterator
instance which provides all states of any alarm of the alarm
class this manager is responsible for which are supposed to be triggered nextCopyright © 2000-2025 OAshi S.à r.l. All Rights Reserved.