|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.opengts.dbtools.DBRecord<RT> org.opengts.db.AccountRecord<Rule> org.opengts.rule.tables.Rule
public class Rule
Nested Class Summary | |
---|---|
static class |
Rule.Key
|
static class |
Rule.TriggerReset
BorderCrossing enabled state enumeration |
Nested classes/interfaces inherited from class org.opengts.db.AccountRecord |
---|
AccountRecord.AccountKey<RT extends DBRecord> |
Nested classes/interfaces inherited from class org.opengts.dbtools.DBRecord |
---|
DBRecord.DBChangeListener |
Field Summary | |
---|---|
static java.lang.String |
_TABLE_NAME
|
static java.lang.String |
FLD_actionMask
|
static java.lang.String |
FLD_cannedActions
|
static java.lang.String |
FLD_description
|
static java.lang.String |
FLD_emailSubject
|
static java.lang.String |
FLD_emailText
|
static java.lang.String |
FLD_isActive
|
static java.lang.String |
FLD_isCronRule
|
static java.lang.String |
FLD_minNotifyAge
|
static java.lang.String |
FLD_notifyEmail
|
static java.lang.String |
FLD_priority
|
static java.lang.String |
FLD_ruleDisable
|
static java.lang.String |
FLD_ruleEnable
|
static java.lang.String |
FLD_ruleID
|
static java.lang.String |
FLD_ruleTag
|
static java.lang.String |
FLD_selector
|
static java.lang.String |
FLD_sendCommand
|
static java.lang.String |
FLD_smsText
|
static java.lang.String |
FLD_triggerReset
|
static java.lang.String |
FLD_useEmailWrapper
|
static java.lang.String |
SYSADMIN_RULE_E
|
static java.lang.String |
SYSADMIN_RULE_S
|
static java.lang.String |
SYSTEM_RULE_PREFIX
|
Fields inherited from class org.opengts.db.AccountRecord |
---|
FLD_accountID, FLD_displayName, FLD_notes |
Fields inherited from class org.opengts.dbtools.DBRecord |
---|
errorDescription, excludedUpdateFields, FLD_creationMillis, FLD_creationTime, FLD_lastUpdateAccount, FLD_lastUpdateTime, FLD_lastUpdateUser, hasError, ID_SIZE, isValidating, lastSQLException, NOTIFY_GROUP, PSEUDO_FIELD_CHAR, tempProps |
Constructor Summary | |
---|---|
Rule()
|
|
Rule(Rule.Key key)
|
Method Summary | |
---|---|
static boolean |
checkSelectorSyntax(java.lang.String selector)
|
boolean |
clearRuleListEntries()
Clear RuleList entries for this rule (internal use only) |
static java.lang.String |
CreateDefaultSmsText(java.lang.String emailSubj,
java.lang.String emailBody,
java.lang.String smsText)
Gets the default SMS text to send to the recipient. |
static Rule |
createNewRule(Account account,
java.lang.String ruleID)
|
boolean |
elapsedMinimumNotifyAge(Account account)
Returns true if the minimum notification age has elapsed, or if there are no minimum notification age limitations. |
boolean |
elapsedMinimumNotifyAge(Device device)
Returns true if the minimum notification age has elapsed, or if there are no minimum notification age limitations. |
boolean |
elapsedMinimumNotifyAge(EventData event)
Returns true if the minimum notification age has elapsed, or if there are no minimum notification age limitations. |
static boolean |
exists(java.lang.String acctID,
java.lang.String ruleID)
|
int |
getActionMask()
Gets the "actionMask" field value |
int |
getActionMask(boolean checkSysRule)
Gets the ActionMask of this rule, or the referring SysAdmin rule if applicable |
static java.util.Collection<java.lang.String> |
getAllRuleIDs(java.lang.String acctId,
boolean inclSysRules)
|
java.lang.String |
getCannedActions()
Gets the "cannedActions" field value |
java.lang.String |
getCannedActions(boolean checkSysRule)
Gets the CannedActions of this rule, or the referring SysAdmin rule if applicable |
java.lang.String |
getDefaultSmsText(boolean checkSysRule)
Gets the default SMS text to send to the recipient. |
java.lang.String |
getDescription()
Returns the description of this Rule |
java.lang.String |
getDescription(boolean checkSysRule)
Gets the description of this rule, or the referring SysAdmin rule if applicable |
java.lang.String |
getEmailSubject()
Gets the notification text used for the EMail "subject" |
java.lang.String |
getEmailSubject(boolean checkSysRule)
Gets the EmailSubject of this rule, or the referring SysAdmin rule if applicable |
java.lang.String |
getEmailText()
Gets the notification text used for the EMail "body" |
java.lang.String |
getEmailText(boolean checkSysRule)
Gets the EmailText of this rule, or the referring SysAdmin rule if applicable |
static org.opengts.rule.event.EventSelector |
getEventSelector()
|
static DBFactory<Rule> |
getFactory()
|
boolean |
getIsCronRule()
Gets the "isCronRule" field value |
boolean |
getIsCronRule(boolean checkSysRule)
Gets the "isCronRule" state of this rule, or the referring SysAdmin rule if applicable |
static int |
getMaximumNotifyEmailLength()
Gets the maximum Notify Email length |
long |
getMinNotifyAge()
Gets the minimum notification age |
java.lang.String |
getNotifyEmail()
Gets the "notifyEmail" field value |
int |
getPriority()
Gets the "priority" field value (EXPERIMENTAL - not used in production) |
int |
getPriority(boolean checkSysRule)
Gets the Priority of this rule, or the referring SysAdmin rule if applicable |
static Rule |
getRule(Account account,
java.lang.String ruleId)
|
static Rule |
getRule(Account account,
java.lang.String ruleId,
boolean create)
|
static Rule |
getRule(java.lang.String accountID,
java.lang.String ruleId)
|
java.lang.String |
getRuleDisable()
Gets the "ruleDisable" field value (EXPERIMENTAL - not used in production) |
java.lang.String |
getRuleDisable(boolean checkSysRule)
Gets the RuleDisable of this rule, or the referring SysAdmin rule if applicable |
java.lang.String |
getRuleEnable()
Gets the "ruleEnable" field value (EXPERIMENTAL - not used in production) |
java.lang.String |
getRuleEnable(boolean checkSysRule)
Gets the RuleEnable of this rule, or the referring SysAdmin rule if applicable |
java.lang.String |
getRuleID()
Gets the "ruleID" field value |
static java.util.Collection<java.lang.String> |
getRuleIDs(java.lang.String acctId,
boolean activeOnly,
boolean inclCronRules,
boolean inclSysRules)
|
java.lang.String |
getRuleTag()
Gets the "ruleTag" field value |
java.lang.String |
getRuleTag(boolean checkSysRule)
Gets the RuleTag of this rule, or the referring SysAdmin rule if applicable |
java.lang.String |
getSelector()
Gets the "selector" field value |
java.lang.String |
getSelector(boolean checkSysRule)
Gets the Selector of this rule, or the referring SysAdmin rule if applicable |
static org.opengts.rule.selector.Selector.Result |
getSelectorResult(java.lang.String selector,
Account account)
|
static org.opengts.rule.selector.Selector.Result |
getSelectorResult(java.lang.String selector,
Device device)
|
static org.opengts.rule.selector.Selector.Result |
getSelectorResult(java.lang.String selector,
EventData evdb)
|
java.lang.String |
getSendCommand()
Gets the "sendCommand" field value (EXPERIMENTAL - not used in production) |
java.lang.String |
getSendCommand(boolean checkSysRule)
Gets the SendCommand of this rule, or the referring SysAdmin rule if applicable |
java.lang.String |
getSmsText()
Gets the text used for SMS message notification |
java.lang.String |
getSmsText(boolean checkSysRule)
Gets the SmsText of this rule, or the referring SysAdmin rule if applicable |
Rule |
getSysRuleFromSelector()
Returns the SystemAdmin rule for this selector, or null if this rule does not refer to a system rule |
static java.lang.String |
GetSysRuleIDFromSelector(java.lang.String sel)
|
static java.util.Map<java.lang.String,java.lang.String> |
getSystemAdminRuleIDMap(boolean inclCronRules)
|
static java.lang.String |
getTableDescription(java.util.Locale loc)
Returns the description of this table |
int |
getTriggerReset()
Gets the "triggerReset" field value |
boolean |
getUseEmailWrapper()
Gets the "useEmailWrapper" field value (EXPERIMENTAL) |
boolean |
getUseEmailWrapper(boolean checkSysRule)
Gets the UseEmailWrapper of this rule, or the referring SysAdmin rule if applicable |
boolean |
hasCannedActions()
Returns true if this rule has non-blank "cannedActions" |
boolean |
hasRuleTag()
Returns true if this rule has a non-blank "ruleTag" |
boolean |
hasSelector()
Returns true if this rule has a non-blank "selector" |
static boolean |
isSelectorMatch(java.lang.String selector,
Account account)
|
static boolean |
isSelectorMatch(java.lang.String selector,
Device device)
|
static boolean |
isSelectorMatch(java.lang.String selector,
EventData evdb)
|
static boolean |
isSystemAdminRuleID(java.lang.String ruleID)
Returns true if the specified rule is a system-wide/syste-admin rule (EXPERIMENTAL - currently returns 'false') |
static java.lang.StringBuffer |
listRule(Rule rule,
int indent,
java.lang.StringBuffer sb)
|
static java.lang.StringBuffer |
listRule(java.lang.String accountID,
java.lang.String ruleID,
java.lang.String ruleTag,
int indent,
java.lang.StringBuffer sb)
|
static java.lang.StringBuffer |
listRules(java.lang.String accountID,
java.util.Collection<java.lang.String> ruleList,
java.lang.String ruleTag,
int indent,
java.lang.StringBuffer sb)
|
static java.lang.StringBuffer |
listRules(java.lang.String accountID,
java.lang.String ruleTag,
int indent,
java.lang.StringBuffer sb)
|
static void |
main(java.lang.String[] args)
|
boolean |
resetActiveRuleTrigger()
Returns true if the active RuleTrigger should be reset. |
void |
setActionMask(int v)
Sets the "actionMask" field value |
void |
setCannedActions(java.lang.String v)
Sets the "cannedActions" field value |
void |
setCreationDefaultValues()
Override to set the default field values when creating a new record |
void |
setEmailSubject(java.lang.String v)
Sets the notification text used for the EMail "subject" |
void |
setEmailText(java.lang.String v)
Sets the notification text used for the EMail "body" |
void |
setIsCronRule(boolean v)
Sets the "isCronRule" field value |
void |
setMinNotifyAge(long v)
Sets the minimum notification age |
void |
setNotifyEmail(java.lang.String v)
Sets the "notifyEmail" field value |
void |
setPriority(int v)
Sets the "priority" field value (EXPERIMENTAL - not used in production) |
void |
setRuleDisable(java.lang.String v)
Sets the "ruleDisable" field value (EXPERIMENTAL - not used in production) |
void |
setRuleEnable(java.lang.String v)
Sets the "ruleEnable" field value (EXPERIMENTAL - not used in production) |
void |
setRuleTag(java.lang.String v)
Sets the "ruleTag" field value |
void |
setSelector(java.lang.String v)
Sets the "selector" field value |
void |
setSendCommand(java.lang.String v)
Sets the "sendCommand" field value (EXPERIMENTAL - not used in production) |
void |
setSingleDeviceRuleListEntry(java.lang.String deviceID,
int statusCode)
set RuleList device/codes (internal use only) |
void |
setSingleGroupRuleListEntry(java.lang.String groupID,
int statusCode)
Set RuleList group/codes (internal use only) |
void |
setSmsText(java.lang.String v)
Sets the text used for SMS message notification |
boolean |
setSystemRuleSettings()
If this rule delegates to a sysadmin rule, then sets various system-rule settings from the delegated sysadmin rule, otherwie does nothing. |
void |
setTriggerReset(boolean v)
Sets the "triggerReset" field value |
void |
setTriggerReset(int v)
Sets the "triggerReset" field value |
void |
setTriggerReset(Rule.TriggerReset v)
Sets the "triggerReset" field value |
void |
setUseEmailWrapper(boolean v)
Sets the "useEmailWrapper" field value (EXPERIMENTAL) |
static java.lang.String |
TABLE_NAME()
|
java.lang.String |
toString()
Gets the String representation of this instance |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String SYSTEM_RULE_PREFIX
public static final java.lang.String SYSADMIN_RULE_S
public static final java.lang.String SYSADMIN_RULE_E
public static final java.lang.String _TABLE_NAME
public static final java.lang.String FLD_ruleID
public static final java.lang.String FLD_isCronRule
public static final java.lang.String FLD_ruleTag
public static final java.lang.String FLD_selector
public static final java.lang.String FLD_actionMask
public static final java.lang.String FLD_cannedActions
public static final java.lang.String FLD_priority
public static final java.lang.String FLD_minNotifyAge
public static final java.lang.String FLD_triggerReset
public static final java.lang.String FLD_notifyEmail
public static final java.lang.String FLD_emailSubject
public static final java.lang.String FLD_emailText
public static final java.lang.String FLD_smsText
public static final java.lang.String FLD_useEmailWrapper
public static final java.lang.String FLD_ruleDisable
public static final java.lang.String FLD_ruleEnable
public static final java.lang.String FLD_sendCommand
public static final java.lang.String FLD_description
public static final java.lang.String FLD_isActive
Constructor Detail |
---|
public Rule()
public Rule(Rule.Key key)
Method Detail |
---|
public static java.lang.String GetSysRuleIDFromSelector(java.lang.String sel)
public static java.lang.String TABLE_NAME()
public static DBFactory<Rule> getFactory()
public static java.lang.String getTableDescription(java.util.Locale loc)
public java.lang.String getRuleID()
public static boolean isSystemAdminRuleID(java.lang.String ruleID)
ruleID
- The rule-id to test
public Rule getSysRuleFromSelector()
public java.lang.String getDescription()
getDescription
in class DBRecord<Rule>
public java.lang.String getDescription(boolean checkSysRule)
checkSysRule
- True to return the SysAdmin description if applicable
public boolean getIsCronRule()
public void setIsCronRule(boolean v)
v
- The "isCronRule" field value to setpublic boolean getIsCronRule(boolean checkSysRule)
checkSysRule
- True to return the SysAdmin "isCronRule" state if applicable
public boolean hasRuleTag()
public java.lang.String getRuleTag()
public void setRuleTag(java.lang.String v)
v
- The "ruleTag" field value to setpublic java.lang.String getRuleTag(boolean checkSysRule)
checkSysRule
- True to return the SysAdmin RuleTag if applicable
public boolean setSystemRuleSettings()
public boolean hasSelector()
public java.lang.String getSelector()
public void setSelector(java.lang.String v)
v
- The "selector" field value to setpublic java.lang.String getSelector(boolean checkSysRule)
checkSysRule
- True to return the SysAdmin Selector if applicable
public int getActionMask()
public void setActionMask(int v)
v
- The "actionMask" field value to setpublic int getActionMask(boolean checkSysRule)
checkSysRule
- True to return the SysAdmin ActionMask if applicable
public boolean hasCannedActions()
public java.lang.String getCannedActions()
public void setCannedActions(java.lang.String v)
v
- The "cannedActions" field value to setpublic java.lang.String getCannedActions(boolean checkSysRule)
checkSysRule
- True to return the SysAdmin CannedActions if applicable
public int getPriority()
public void setPriority(int v)
v
- The "priority" field value to setpublic int getPriority(boolean checkSysRule)
checkSysRule
- True to return the SysAdmin Priority if applicable
public long getMinNotifyAge()
public void setMinNotifyAge(long v)
v
- The minimum notification agepublic boolean elapsedMinimumNotifyAge(Account account)
account
- The account to test for prior notifications
public boolean elapsedMinimumNotifyAge(Device device)
device
- The device to test for prior notifications
public boolean elapsedMinimumNotifyAge(EventData event)
event
- The event instance containing the device to test for prior notifications
public int getTriggerReset()
public void setTriggerReset(int v)
v
- The "triggerReset" field value to setpublic void setTriggerReset(Rule.TriggerReset v)
v
- The "triggerReset" field value to setpublic void setTriggerReset(boolean v)
v
- The "triggerReset" field value to setpublic boolean resetActiveRuleTrigger()
public java.lang.String getNotifyEmail()
public void setNotifyEmail(java.lang.String v)
v
- The "notifyEmail" field value to setpublic static int getMaximumNotifyEmailLength()
public java.lang.String getEmailSubject()
public void setEmailSubject(java.lang.String v)
v
- The notification text to use for the EMail "subject"public java.lang.String getEmailSubject(boolean checkSysRule)
checkSysRule
- True to return the SysAdmin EmailSubject if applicable
public java.lang.String getEmailText()
public void setEmailText(java.lang.String v)
v
- The notification text to use for the EMail "body"public java.lang.String getEmailText(boolean checkSysRule)
checkSysRule
- True to return the SysAdmin EmailText if applicable
public java.lang.String getSmsText()
public void setSmsText(java.lang.String v)
v
- The text to use for SMS message notificationpublic java.lang.String getSmsText(boolean checkSysRule)
checkSysRule
- True to return the SysAdmin SmsText if applicable
public static java.lang.String CreateDefaultSmsText(java.lang.String emailSubj, java.lang.String emailBody, java.lang.String smsText)
public java.lang.String getDefaultSmsText(boolean checkSysRule)
public boolean getUseEmailWrapper()
public void setUseEmailWrapper(boolean v)
v
- The "useEmailWrapper" field value to setpublic boolean getUseEmailWrapper(boolean checkSysRule)
checkSysRule
- True to return the SysAdmin UseEmailWrapper if applicable
public java.lang.String getRuleDisable()
public void setRuleDisable(java.lang.String v)
v
- The "ruleDisable" field value to setpublic java.lang.String getRuleDisable(boolean checkSysRule)
checkSysRule
- True to return the SysAdmin RuleDisable if applicable
public java.lang.String getRuleEnable()
public void setRuleEnable(java.lang.String v)
v
- The "ruleEnable" field value to setpublic java.lang.String getRuleEnable(boolean checkSysRule)
checkSysRule
- True to return the SysAdmin RuleEnable if applicable
public java.lang.String getSendCommand()
public void setSendCommand(java.lang.String v)
v
- The "sendCommand" field value to setpublic java.lang.String getSendCommand(boolean checkSysRule)
checkSysRule
- True to return the SysAdmin SendCommand if applicable
public java.lang.String toString()
toString
in class DBRecord<Rule>
public void setCreationDefaultValues()
setCreationDefaultValues
in class DBRecord<Rule>
public static org.opengts.rule.event.EventSelector getEventSelector()
public static boolean checkSelectorSyntax(java.lang.String selector)
public static org.opengts.rule.selector.Selector.Result getSelectorResult(java.lang.String selector, EventData evdb) throws org.opengts.rule.selector.ParserException
org.opengts.rule.selector.ParserException
public static boolean isSelectorMatch(java.lang.String selector, EventData evdb) throws org.opengts.rule.selector.ParserException
org.opengts.rule.selector.ParserException
public static org.opengts.rule.selector.Selector.Result getSelectorResult(java.lang.String selector, Device device) throws org.opengts.rule.selector.ParserException
org.opengts.rule.selector.ParserException
public static boolean isSelectorMatch(java.lang.String selector, Device device) throws org.opengts.rule.selector.ParserException
org.opengts.rule.selector.ParserException
public static org.opengts.rule.selector.Selector.Result getSelectorResult(java.lang.String selector, Account account) throws org.opengts.rule.selector.ParserException
org.opengts.rule.selector.ParserException
public static boolean isSelectorMatch(java.lang.String selector, Account account) throws org.opengts.rule.selector.ParserException
org.opengts.rule.selector.ParserException
public static boolean exists(java.lang.String acctID, java.lang.String ruleID) throws DBException
DBException
public static Rule getRule(java.lang.String accountID, java.lang.String ruleId) throws DBException
DBException
public static Rule getRule(Account account, java.lang.String ruleId) throws DBException
DBException
public static Rule getRule(Account account, java.lang.String ruleId, boolean create) throws DBException
DBException
public static Rule createNewRule(Account account, java.lang.String ruleID) throws DBException
DBException
public static java.util.Collection<java.lang.String> getRuleIDs(java.lang.String acctId, boolean activeOnly, boolean inclCronRules, boolean inclSysRules) throws DBException
DBException
public static java.util.Collection<java.lang.String> getAllRuleIDs(java.lang.String acctId, boolean inclSysRules) throws DBException
DBException
public static java.util.Map<java.lang.String,java.lang.String> getSystemAdminRuleIDMap(boolean inclCronRules) throws DBException
DBException
public static java.lang.StringBuffer listRule(Rule rule, int indent, java.lang.StringBuffer sb) throws DBException
DBException
public static java.lang.StringBuffer listRule(java.lang.String accountID, java.lang.String ruleID, java.lang.String ruleTag, int indent, java.lang.StringBuffer sb) throws DBException
DBException
public static java.lang.StringBuffer listRules(java.lang.String accountID, java.util.Collection<java.lang.String> ruleList, java.lang.String ruleTag, int indent, java.lang.StringBuffer sb) throws DBException
DBException
public static java.lang.StringBuffer listRules(java.lang.String accountID, java.lang.String ruleTag, int indent, java.lang.StringBuffer sb) throws DBException
DBException
public boolean clearRuleListEntries()
public void setSingleDeviceRuleListEntry(java.lang.String deviceID, int statusCode)
public void setSingleGroupRuleListEntry(java.lang.String groupID, int statusCode)
public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |