org.opengts.extra.tables
Class PendingCommands

java.lang.Object
  extended by org.opengts.dbtools.DBRecord<RT>
      extended by org.opengts.db.AccountRecord<RT>
          extended by org.opengts.db.DeviceRecord<PendingCommands>
              extended by org.opengts.extra.tables.PendingCommands

public class PendingCommands
extends DeviceRecord<PendingCommands>


Nested Class Summary
static class PendingCommands.Key
           
 
Nested classes/interfaces inherited from class org.opengts.db.DeviceRecord
DeviceRecord.DeviceKey<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 int ACKRESP_FAILED
           
static int ACKRESP_SUCCESS
           
static int ACKRESP_WAITING
           
static int DELAFTER_ACK
           
static int DELAFTER_FAILURE
           
static int DELAFTER_NEVER
           
static int DELAFTER_SUCCESS
           
static java.lang.String FLD_ackResponse
           
static java.lang.String FLD_ackTime
           
static java.lang.String FLD_commandArgs
           
static java.lang.String FLD_commandID
           
static java.lang.String FLD_commandType
           
static java.lang.String FLD_deleteAfter
           
static java.lang.String FLD_queueTime
           
static java.lang.String FLD_sendState
           
static java.lang.String FLD_sendTime
           
static int SENDSTATE_FAILED
           
static int SENDSTATE_PENDING
           
static int SENDSTATE_SUCCESS
           
 
Fields inherited from class org.opengts.db.DeviceRecord
FLD_deviceID
 
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
PendingCommands()
           
PendingCommands(PendingCommands.Key key)
           
 
Method Summary
 boolean deletePendingCommand()
           
static boolean deletePendingCommands(java.lang.String acctId, java.lang.String devId, int sendState)
           
static boolean deletePendingCommands(java.lang.String acctId, java.lang.String devId, int sendState, long queueTime)
           
 int getAckResponse()
           
 long getAckTime()
           
 java.lang.String[] getCommandArgs_array()
           
 java.lang.String getCommandArgs()
           
 java.lang.String getCommandID()
           
 java.lang.String getCommandType()
           
 int getDeleteAfter()
           
static DBFactory<PendingCommands> getFactory()
           
static PendingCommands[] getPendingCommands(Device dev)
           
static PendingCommands[] getPendingCommands(java.lang.String acctId, java.lang.String devId)
           
 long getQueueTime()
           
 int getSendState()
           
 long getSendTime()
           
static java.lang.String getTableDescription(java.util.Locale loc)
           
static boolean insertCommand(Device dev, java.lang.String cmdType, java.lang.String cmdID, java.lang.String[] cmdArgs)
           
protected static boolean insertCommand(java.lang.String acctId, java.lang.String devId, java.lang.String cmdType, java.lang.String cmdID, java.lang.String[] cmdArgs)
           
 boolean isDeleteAfterAck()
           
 boolean isDeleteAfterSendFailure()
           
 boolean isDeleteAfterSendSuccess()
           
 boolean isNeverDelete()
           
 boolean isSendStatePending()
           
static void main(java.lang.String[] args)
           
 boolean sendCommand()
          This method sends commands through the normal DCS command dispatcher
 void setAckResponse(int v)
           
 void setAckTime(long v)
           
 void setCommandArgs_array(java.lang.String[] v)
           
 void setCommandArgs(java.lang.String v)
           
 void setCommandID(java.lang.String v)
           
 boolean setCommandSent(boolean success, long sendTime)
          Sets this PendingCommands state to sent 'success'/'failed', or deletes the command if indicated by the record.
 void setCommandType(java.lang.String v)
           
 void setDeleteAfter(int v)
           
 void setQueueTime(long v)
           
 void setSendState(int v)
           
 void setSendTime(long v)
           
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.DeviceRecord
getDevice, getDeviceDescription, getDeviceID, getDeviceVIN, hasDevice, newField_deviceID, newField_deviceID, newField_deviceID, newField_deviceID, setDevice, setDeviceID
 
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, setCreationDefaultValues, 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

SENDSTATE_PENDING

public static final int SENDSTATE_PENDING
See Also:
Constant Field Values

SENDSTATE_SUCCESS

public static final int SENDSTATE_SUCCESS
See Also:
Constant Field Values

SENDSTATE_FAILED

public static final int SENDSTATE_FAILED
See Also:
Constant Field Values

DELAFTER_NEVER

public static final int DELAFTER_NEVER
See Also:
Constant Field Values

DELAFTER_SUCCESS

public static final int DELAFTER_SUCCESS
See Also:
Constant Field Values

DELAFTER_FAILURE

public static final int DELAFTER_FAILURE
See Also:
Constant Field Values

DELAFTER_ACK

public static final int DELAFTER_ACK
See Also:
Constant Field Values

ACKRESP_WAITING

public static final int ACKRESP_WAITING
See Also:
Constant Field Values

ACKRESP_SUCCESS

public static final int ACKRESP_SUCCESS
See Also:
Constant Field Values

ACKRESP_FAILED

public static final int ACKRESP_FAILED
See Also:
Constant Field Values

_TABLE_NAME

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

FLD_queueTime

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

FLD_sendState

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

FLD_commandType

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

FLD_commandID

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

FLD_commandArgs

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

FLD_sendTime

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

FLD_deleteAfter

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

FLD_ackTime

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

FLD_ackResponse

public static final java.lang.String FLD_ackResponse
See Also:
Constant Field Values
Constructor Detail

PendingCommands

public PendingCommands()

PendingCommands

public PendingCommands(PendingCommands.Key key)
Method Detail

TABLE_NAME

public static java.lang.String TABLE_NAME()

getFactory

public static DBFactory<PendingCommands> getFactory()

getTableDescription

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

getQueueTime

public long getQueueTime()

setQueueTime

public void setQueueTime(long v)

getSendState

public int getSendState()

setSendState

public void setSendState(int v)

isSendStatePending

public boolean isSendStatePending()

getCommandType

public java.lang.String getCommandType()

setCommandType

public void setCommandType(java.lang.String v)

getCommandID

public java.lang.String getCommandID()

setCommandID

public void setCommandID(java.lang.String v)

getCommandArgs

public java.lang.String getCommandArgs()

setCommandArgs

public void setCommandArgs(java.lang.String v)

getCommandArgs_array

public java.lang.String[] getCommandArgs_array()

setCommandArgs_array

public void setCommandArgs_array(java.lang.String[] v)

getSendTime

public long getSendTime()

setSendTime

public void setSendTime(long v)

getDeleteAfter

public int getDeleteAfter()

setDeleteAfter

public void setDeleteAfter(int v)

isNeverDelete

public boolean isNeverDelete()

isDeleteAfterSendSuccess

public boolean isDeleteAfterSendSuccess()

isDeleteAfterSendFailure

public boolean isDeleteAfterSendFailure()

isDeleteAfterAck

public boolean isDeleteAfterAck()

deletePendingCommand

public boolean deletePendingCommand()

getAckTime

public long getAckTime()

setAckTime

public void setAckTime(long v)

getAckResponse

public int getAckResponse()

setAckResponse

public void setAckResponse(int v)

setCommandSent

public boolean setCommandSent(boolean success,
                              long sendTime)
Sets this PendingCommands state to sent 'success'/'failed', or deletes the command if indicated by the record.

Parameters:
success - True to indicate success, false to indicate failure
sendTime - The time the command was sent (or 0 to indicate current time)
Returns:
True if this PendingCommands record was deleted, false otherwise

sendCommand

public boolean sendCommand()
This method sends commands through the normal DCS command dispatcher

Returns:
True if the command was successful, false otherwise

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<PendingCommands>
Returns:
A String representation of the DBRecordKey for this DBRecord

deletePendingCommands

public static boolean deletePendingCommands(java.lang.String acctId,
                                            java.lang.String devId,
                                            int sendState)
                                     throws DBException
Throws:
DBException

deletePendingCommands

public static boolean deletePendingCommands(java.lang.String acctId,
                                            java.lang.String devId,
                                            int sendState,
                                            long queueTime)
                                     throws DBException
Throws:
DBException

getPendingCommands

public static PendingCommands[] getPendingCommands(Device dev)
                                            throws DBException
Throws:
DBException

getPendingCommands

public static PendingCommands[] getPendingCommands(java.lang.String acctId,
                                                   java.lang.String devId)
                                            throws DBException
Throws:
DBException

insertCommand

public static boolean insertCommand(Device dev,
                                    java.lang.String cmdType,
                                    java.lang.String cmdID,
                                    java.lang.String[] cmdArgs)
                             throws DBException
Throws:
DBException

insertCommand

protected static boolean insertCommand(java.lang.String acctId,
                                       java.lang.String devId,
                                       java.lang.String cmdType,
                                       java.lang.String cmdID,
                                       java.lang.String[] cmdArgs)
                                throws DBException
Throws:
DBException

main

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