org.opengts.db.tables
Class DeviceGroup

java.lang.Object
  extended by org.opengts.dbtools.DBRecord<RT>
      extended by org.opengts.db.AccountRecord<RT>
          extended by org.opengts.db.GroupRecord<DeviceGroup>
              extended by org.opengts.db.tables.DeviceGroup

public class DeviceGroup
extends GroupRecord<DeviceGroup>


Nested Class Summary
static class DeviceGroup.Key
           
 
Nested classes/interfaces inherited from class org.opengts.db.GroupRecord
GroupRecord.GroupKey<RT extends DBRecord>
 
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 DEVICE_GROUP_ALL
           
static java.lang.String DEVICE_GROUP_NONE
           
static java.lang.String FLD_allowNotify
           
static java.lang.String FLD_groupType
           
static java.lang.String FLD_notifyEmail
           
static java.lang.String FLD_workOrderID
           
static OrderedSet<java.lang.String> GROUP_LIST_ALL
           
static OrderedSet<java.lang.String> GROUP_LIST_EMPTY
           
static java.lang.String OPTCOLS_RuleNotification
           
static java.lang.String OPTCOLS_WorkOrderInfo
           
static DBField[] RuleNotification
           
static DBField[] WorkOrderInfo
           
 
Fields inherited from class org.opengts.db.GroupRecord
FLD_groupID
 
Fields inherited from class org.opengts.db.AccountRecord
FLD_accountID, FLD_displayName, FLD_isActive, FLD_notes
 
Fields inherited from class org.opengts.dbtools.DBRecord
errorDescription, excludedUpdateFields, FLD_creationMillis, FLD_creationTime, FLD_description, FLD_lastUpdateAccount, FLD_lastUpdateTime, FLD_lastUpdateUser, hasError, ID_SIZE, isValidating, lastSQLException, NOTIFY_GROUP, PSEUDO_FIELD_CHAR, tempProps
 
Constructor Summary
DeviceGroup()
           
DeviceGroup(DeviceGroup.Key key)
           
 
Method Summary
protected static DBSelect _getDeviceListSelect(java.lang.String acctId, java.lang.String groupId, long limit)
           
 void addDeviceToDeviceGroup(Device device)
           
 void addDeviceToDeviceGroup(java.lang.String deviceID)
           
static void addDeviceToDeviceGroup(java.lang.String accountID, java.lang.String groupID, java.lang.String deviceID)
           
static long countOldEvents(Account account, java.lang.String groupID, long oldTimeSec, boolean log)
          Returns count of events in this DeviceGroup.
Note: Will return -1 if EventData table is InnoDB.
 long countOldEvents(long oldTimeSec, boolean log)
          Returns count of events in this DeviceGroup.
Note: Will return -1 if EventData table is InnoDB.
static DeviceGroup createNewDeviceGroup(Account account, java.lang.String groupID)
           
static long deleteOldEvents(Account account, java.lang.String groupID, long oldTimeSec, boolean log)
          Delete events prior to the specified time.
Note: Will return -1 if EventData table is InnoDB.
 long deleteOldEvents(long oldTimeSec, boolean log)
          Delete events prior to the specified time.
Note: Will return -1 if EventData table is InnoDB.
static boolean exists(java.lang.String acctID, java.lang.String groupID)
           
static boolean exists(java.lang.String acctID, java.lang.String groupID, java.lang.String deviceID)
           
 boolean getAllowNotify()
          Returns true if this DeviceGroup allows notifications
 boolean getAllowNotify(boolean checkAccount)
          Returns true if this DeviceGroup allows notifications
 long getDeviceCount()
           
static DeviceGroup getDeviceGroup(Account account, java.lang.String groupId)
           
static DeviceGroup getDeviceGroup(Account account, java.lang.String groupId, boolean createOK)
           
static java.lang.String GetDeviceGroupAllTitle(Account account, java.util.Locale loc)
           
static OrderedSet<java.lang.String> getDeviceGroups(DBSelect<DeviceGroup> dsel, boolean includeAll)
           
static OrderedSet<java.lang.String> getDeviceGroupsForAccount(java.lang.String acctId, boolean includeAll)
           
static java.util.Collection<java.lang.String> getDeviceGroupsForDevice(java.lang.String acctId, java.lang.String deviceId)
           
static java.util.Collection<java.lang.String> getDeviceGroupsForDevice(java.lang.String acctId, java.lang.String deviceId, boolean inclAll)
           
static OrderedSet<java.lang.String> getDeviceIDsForGroup(java.lang.String acctId, java.lang.String groupId, User userAuth, boolean inclInactv)
           
static OrderedSet<java.lang.String> getDeviceIDsForGroup(java.lang.String acctId, java.lang.String groupId, User userAuth, boolean inclInactv, long limit)
           
 OrderedSet<java.lang.String> getDevices(User userAuth, boolean inclInactv)
           
static DBFactory<DeviceGroup> getFactory()
           
 int getGroupType()
           
 java.lang.String getMapLegend()
           
static int getMaximumNotifyEmailLength()
          Gets the maximum Notify Email length
 java.lang.String getNotifyEmail()
          Gets the Notification Email address
static java.lang.String getTableDescription(java.util.Locale loc)
           
static java.lang.String[] GetTitles(java.util.Locale loc)
           
 java.lang.String getWorkOrderID()
           
 boolean isDeviceInDeviceGroup(Device device)
           
 boolean isDeviceInDeviceGroup(java.lang.String deviceID)
           
static boolean isDeviceInDeviceGroup(java.lang.String acctID, java.lang.String groupID, java.lang.String deviceID)
           
static void main(java.lang.String[] argv)
           
 void removeDeviceFromDeviceGroup(Device device)
           
 void removeDeviceFromDeviceGroup(java.lang.String deviceID)
           
static void removeDeviceFromDeviceGroup(java.lang.String accountID, java.lang.String groupID, java.lang.String deviceID)
           
 void setAllowNotify(boolean v)
          Sets the "Allow Notification" state for this DeviceGroup
 void setCreationDefaultValues()
          Override to set default values
 void setGroupType(int v)
           
 void setMapLegend(java.lang.String legend)
           
 void setNotifyEmail(java.lang.String v)
          Sets the Notification Email address
 void setWorkOrderID(java.lang.String v)
           
static boolean supportsNotification()
          Returns true if this DeviceGroup record supports the "allowNotify" field
static java.lang.String TABLE_NAME()
           
 java.lang.String toString()
          Returns a String representation of the DBRecordKey for this DBRecord
 
Methods inherited from class org.opengts.db.GroupRecord
getDeviceGroup, getGroupDescription, getGroupID, hasGroup, newField_groupID, newField_groupID, setDeviceGroup, setGroupID
 
Methods inherited from class org.opengts.db.AccountRecord
createSystemAdminAccount, getAccount, getAccountDescription, getAccountID, getDisplayName, getFilteredID, getFilteredID, getIsActive, getNotes, GetSimpleLocalString, getSystemAdminAccount, getSystemAdminAccountID, hasAccount, hasSystemAdminAccountID, isAccountManager, isActive, isSystemAdmin, isSystemAdmin, isSystemAdminAccountID, isValidID, newField_accountID, newField_accountID, newField_displayName, newField_displayName, newField_isActive, newField_isActive, newField_notes, newField_notes, setAccount, setDisplayName, setIsActive, setNotes, setRuntimeDefaultValues
 
Methods inherited from class org.opengts.dbtools.DBRecord
_getFactory, _reload, addChangedNotification, addExcludedUpdateFields, adjustStringLength_1, adjustStringLength, appendFieldValues, clearChanged, clearError, clearExcludedUpdateFields, clearLastCaughtSQLException, equals, excludeFieldFromUpdate, excludeFieldFromUpdate, fireChangeNotification, geKeyValue, getCreationDateTime, getCreationMillis, getCreationTime, GetCurrentAccount, GetCurrentUser, getDefaultFieldValueKey, getDescription, getErrorDescription, getFactory, getFactory, getField, getFieldBoolean, getFieldDateTime, getFieldDouble, getFieldFloat, getFieldInt, getFieldLong, getFieldName, getFieldString, getFieldValue, getFieldValue, getFieldValue, getFieldValue, getFieldValue, getFieldValue, getFieldValue, getFieldValue, getFieldValue, getKeyValue, getLastCaughtSQLException, getLastUpdateAccount, getLastUpdateTime, getLastUpdateTime, getLastUpdateUser, getNextGroup, getOptionalFieldValue, getOptionalFieldValue, getOptionalFieldValue, getOptionalFieldValue, getOptionalFieldValue, getOptionalFieldValue, getOptionalFieldValue, getOptionalFieldValue, getOptionalFieldValue, getRecordCount, getRecordCount, getRecordCount, getRecordCount, getRecordCount, getRecordKey, getRecords, getRecords, getTemporaryProperties, getValue, getVirtual, hasChanged, hasError, hasField, hasFieldValue, hasOptionalFieldValue, hasTemporaryProperties, insert, isFieldUnsigned, isLastCaughtSQLExceptionErrorCode, isOkToReload, isOkToSave, isValidating, isVirtual, lock, lockRead, lockWrite, newField_creationMillis, newField_creationTime, newField_creationTime, newField_description, newField_description, newField_lastUpdateAccount, newField_lastUpdateAccount, newField_lastUpdateTime, newField_lastUpdateUser, newField_lastUpdateUser, printXML, printXML, printXML, printXML, printXML, printXML, recordDidInsert, recordDidUpdate, recordWillInsert, recordWillUpdate, reload, reload, removeChangedNotification, save, select, select, select, setAllFieldValues, setAllFieldValues, setAllFieldValues, setAllFieldValues, setChanged, setChanged, setCreationMillis, setCreationTime, SetCurrentAccount, SetCurrentUser, setDescription, setError, setError, setFieldValue, setFieldValue, setFieldValue, setFieldValue, setFieldValue, setFieldValue, setFieldValue, setIgnoreInvalidFields, setKeyValue, setLastCaughtSQLException, setLastUpdateAccount, setLastUpdateTime, setLastUpdateUser, setOptionalFieldValue, setOptionalFieldValue, setOptionalFieldValue, setOptionalFieldValue, setOptionalFieldValue, setOptionalFieldValue, setOptionalFieldValue, setOptionalFieldValue, setValidating, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setVirtual, toXML, toXML, toXML, toXML, toXML, unlock, update, update, update
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEVICE_GROUP_ALL

public static final java.lang.String DEVICE_GROUP_ALL
See Also:
Constant Field Values

DEVICE_GROUP_NONE

public static final java.lang.String DEVICE_GROUP_NONE
See Also:
Constant Field Values

GROUP_LIST_ALL

public static final OrderedSet<java.lang.String> GROUP_LIST_ALL

GROUP_LIST_EMPTY

public static final OrderedSet<java.lang.String> GROUP_LIST_EMPTY

OPTCOLS_WorkOrderInfo

public static final java.lang.String OPTCOLS_WorkOrderInfo
See Also:
Constant Field Values

OPTCOLS_RuleNotification

public static final java.lang.String OPTCOLS_RuleNotification
See Also:
Constant Field Values

_TABLE_NAME

public static final java.lang.String _TABLE_NAME
See Also:
Constant Field Values

FLD_groupType

public static final java.lang.String FLD_groupType
See Also:
Constant Field Values

FLD_allowNotify

public static final java.lang.String FLD_allowNotify
See Also:
Constant Field Values

FLD_notifyEmail

public static final java.lang.String FLD_notifyEmail
See Also:
Constant Field Values

RuleNotification

public static final DBField[] RuleNotification

FLD_workOrderID

public static final java.lang.String FLD_workOrderID
See Also:
Constant Field Values

WorkOrderInfo

public static final DBField[] WorkOrderInfo
Constructor Detail

DeviceGroup

public DeviceGroup()

DeviceGroup

public DeviceGroup(DeviceGroup.Key key)
Method Detail

GetTitles

public static java.lang.String[] GetTitles(java.util.Locale loc)

GetDeviceGroupAllTitle

public static java.lang.String GetDeviceGroupAllTitle(Account account,
                                                      java.util.Locale loc)

TABLE_NAME

public static java.lang.String TABLE_NAME()

getFactory

public static DBFactory<DeviceGroup> getFactory()

getTableDescription

public static java.lang.String getTableDescription(java.util.Locale loc)

getGroupType

public int getGroupType()

setGroupType

public void setGroupType(int v)

supportsNotification

public static boolean supportsNotification()
Returns true if this DeviceGroup record supports the "allowNotify" field

Returns:
True if this DeviceGroup record supports the "allowNotify" field

getAllowNotify

public boolean getAllowNotify()
Returns true if this DeviceGroup allows notifications

Returns:
True if this DeviceGroup allows notifications

setAllowNotify

public void setAllowNotify(boolean v)
Sets the "Allow Notification" state for this DeviceGroup

Parameters:
v - The "Allow Notification" state for this DeviceGroup

getAllowNotify

public boolean getAllowNotify(boolean checkAccount)
Returns true if this DeviceGroup allows notifications

Parameters:
checkAccount - True to also check Account
Returns:
True if this DeviceGroup allows notifications

getNotifyEmail

public java.lang.String getNotifyEmail()
Gets the Notification Email address

Returns:
The Notification Email Address

setNotifyEmail

public void setNotifyEmail(java.lang.String v)
Sets the Notification Email address

Parameters:
v - The Notification Email Address

getMaximumNotifyEmailLength

public static int getMaximumNotifyEmailLength()
Gets the maximum Notify Email length


getWorkOrderID

public java.lang.String getWorkOrderID()

setWorkOrderID

public void setWorkOrderID(java.lang.String v)

setMapLegend

public void setMapLegend(java.lang.String legend)

getMapLegend

public java.lang.String getMapLegend()

toString

public java.lang.String toString()
Description copied from class: DBRecord
Returns a String representation of the DBRecordKey for this DBRecord

Overrides:
toString in class DBRecord<DeviceGroup>
Returns:
A String representation of the DBRecordKey for this DBRecord

setCreationDefaultValues

public void setCreationDefaultValues()
Description copied from class: DBRecord
Override to set default values

Overrides:
setCreationDefaultValues in class DBRecord<DeviceGroup>

isDeviceInDeviceGroup

public boolean isDeviceInDeviceGroup(java.lang.String deviceID)

isDeviceInDeviceGroup

public boolean isDeviceInDeviceGroup(Device device)

addDeviceToDeviceGroup

public void addDeviceToDeviceGroup(java.lang.String deviceID)
                            throws DBException
Throws:
DBException

addDeviceToDeviceGroup

public void addDeviceToDeviceGroup(Device device)
                            throws DBException
Throws:
DBException

removeDeviceFromDeviceGroup

public void removeDeviceFromDeviceGroup(java.lang.String deviceID)
                                 throws DBException
Throws:
DBException

removeDeviceFromDeviceGroup

public void removeDeviceFromDeviceGroup(Device device)
                                 throws DBException
Throws:
DBException

countOldEvents

public long countOldEvents(long oldTimeSec,
                           boolean log)
                    throws DBException
Returns count of events in this DeviceGroup.
Note: Will return -1 if EventData table is InnoDB.

Throws:
DBException

countOldEvents

public static long countOldEvents(Account account,
                                  java.lang.String groupID,
                                  long oldTimeSec,
                                  boolean log)
                           throws DBException
Returns count of events in this DeviceGroup.
Note: Will return -1 if EventData table is InnoDB.

Throws:
DBException

deleteOldEvents

public long deleteOldEvents(long oldTimeSec,
                            boolean log)
                     throws DBException
Delete events prior to the specified time.
Note: Will return -1 if EventData table is InnoDB. Old events will still be deleted, however it will still go through the motions of attempting to delete events, event if the range is empty.

Parameters:
oldTimeSec - The timestamp before which events will be deleted
log - True to display log
Returns:
The number of events deleted
Throws:
DBException

deleteOldEvents

public static long deleteOldEvents(Account account,
                                   java.lang.String groupID,
                                   long oldTimeSec,
                                   boolean log)
                            throws DBException
Delete events prior to the specified time.
Note: Will return -1 if EventData table is InnoDB. Old events will still be deleted, however it will still go through the motions of attempting to delete events, event if the range is empty.

Parameters:
account - The account
groupID - The group-id
oldTimeSec - The timestamp before which events will be deleted
log - True to display log
Returns:
The number of events deleted
Throws:
DBException

exists

public static boolean exists(java.lang.String acctID,
                             java.lang.String groupID)
                      throws DBException
Throws:
DBException

exists

public static boolean exists(java.lang.String acctID,
                             java.lang.String groupID,
                             java.lang.String deviceID)
                      throws DBException
Throws:
DBException

isDeviceInDeviceGroup

public static boolean isDeviceInDeviceGroup(java.lang.String acctID,
                                            java.lang.String groupID,
                                            java.lang.String deviceID)

addDeviceToDeviceGroup

public static void addDeviceToDeviceGroup(java.lang.String accountID,
                                          java.lang.String groupID,
                                          java.lang.String deviceID)
                                   throws DBException
Throws:
DBException

removeDeviceFromDeviceGroup

public static void removeDeviceFromDeviceGroup(java.lang.String accountID,
                                               java.lang.String groupID,
                                               java.lang.String deviceID)
                                        throws DBException
Throws:
DBException

getDeviceGroup

public static DeviceGroup getDeviceGroup(Account account,
                                         java.lang.String groupId)
                                  throws DBException
Throws:
DBException

getDeviceGroup

public static DeviceGroup getDeviceGroup(Account account,
                                         java.lang.String groupId,
                                         boolean createOK)
                                  throws DBException
Throws:
DBException

createNewDeviceGroup

public static DeviceGroup createNewDeviceGroup(Account account,
                                               java.lang.String groupID)
                                        throws DBException
Throws:
DBException

_getDeviceListSelect

protected static DBSelect _getDeviceListSelect(java.lang.String acctId,
                                               java.lang.String groupId,
                                               long limit)

getDeviceCount

public long getDeviceCount()

getDevices

public OrderedSet<java.lang.String> getDevices(User userAuth,
                                               boolean inclInactv)
                                        throws DBException
Throws:
DBException

getDeviceIDsForGroup

public static OrderedSet<java.lang.String> getDeviceIDsForGroup(java.lang.String acctId,
                                                                java.lang.String groupId,
                                                                User userAuth,
                                                                boolean inclInactv)
                                                         throws DBException
Throws:
DBException

getDeviceIDsForGroup

public static OrderedSet<java.lang.String> getDeviceIDsForGroup(java.lang.String acctId,
                                                                java.lang.String groupId,
                                                                User userAuth,
                                                                boolean inclInactv,
                                                                long limit)
                                                         throws DBException
Throws:
DBException

getDeviceGroupsForAccount

public static OrderedSet<java.lang.String> getDeviceGroupsForAccount(java.lang.String acctId,
                                                                     boolean includeAll)
                                                              throws DBException
Throws:
DBException

getDeviceGroups

public static OrderedSet<java.lang.String> getDeviceGroups(DBSelect<DeviceGroup> dsel,
                                                           boolean includeAll)
                                                    throws DBException
Throws:
DBException

getDeviceGroupsForDevice

public static java.util.Collection<java.lang.String> getDeviceGroupsForDevice(java.lang.String acctId,
                                                                              java.lang.String deviceId)
                                                                       throws DBException
Throws:
DBException

getDeviceGroupsForDevice

public static java.util.Collection<java.lang.String> getDeviceGroupsForDevice(java.lang.String acctId,
                                                                              java.lang.String deviceId,
                                                                              boolean inclAll)
                                                                       throws DBException
Throws:
DBException

main

public static void main(java.lang.String[] argv)