public abstract class CSItem extends CSDatabaseItem
This class manages item content (CSItemContent
) and state (CSState
) information.
The exists()
, get()
, update()
and delete()
methods
which form the bulk of the API are provided by this class, but their implementations are overridden by derived
classes.
Modifier and Type | Field and Description |
---|---|
static int |
ACCESS_GRANTED
A valid value that can be set by the query methods to indicate the status of retrieved/updated data.
|
static int |
DOES_NOT_EXIST
A valid value that can be set by the query methods to indicate the status of retrieved/updated data.
|
static int |
EMPTY
A valid value that can be set by the query methods to indicate the status of retrieved/updated data.
|
static int |
EXISTS
A valid value that can be set by the query methods to indicate the status of retrieved/updated data.
|
static int |
SECURE_ACCESS_DENIED
A valid value that can be set by the query methods to indicate the status of retrieved/updated data.
|
static int |
SECURE_ACCESS_GRANTED
A valid value that can be set by the query methods to indicate the status of retrieved/updated data.
|
static java.lang.String |
UPDATE_ACTION_INSERTED
A valid value for the last updated action.
|
static java.lang.String |
UPDATE_ACTION_UPDATED
A valid value for the last updated action.
|
LEVEL_ALL, LEVEL_ALL_PLUS_RELATED, LEVEL_DETAIL, LEVEL_ID, LEVEL_SUMMARY
Constructor and Description |
---|
CSItem()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
delete()
Deletes this item from the database.
|
boolean |
equals(java.lang.Object obj)
Checks whether this item is equal to another item.
|
boolean |
exist()
Checks to see whether this item exists on the database.
|
void |
get()
Retrieves the details of this item from the database.
|
int |
getID()
Gets the ID of the item to be used as key information.
|
int |
getStatus()
Gets the status value of this item.
|
int |
hashCode() |
java.lang.String |
jsonString(java.lang.String str) |
java.lang.String |
serialiseWithTypes(java.util.Hashtable obj,
java.util.Hashtable typedef) |
void |
setID(int nID)
Sets the item ID to be used as key information.
|
void |
setStatus(int nStatus)
Sets the status value of this item.
|
java.lang.String |
toString()
Returns the details of this object as a string.
|
void |
unset()
Unsets all the fields to their initialised state.
|
void |
update()
Updates the contents of this item on the database.
|
clearRecordedGatewayMessages, clone, count, getCache, getCachingEnabled, getDatabaseVersion, getDatabaseVersion, getDebugOutput, getDetailLevel, getPreview, getPropertyFile, getPropertyFileExtension, getPropertyFilePathname, getRecordedGatewayMessages, getRecordGatewayMessages, getSendGatewayMessages, getUseCache, setDebugOutput, setDetailLevel, setPreview, setPropertyFile, setRecordGatewayMessages, setSendGatewayMessages, setUseCache
public static final int EXISTS
EXISTS
is used by the exist
method to indicate that an item matching the supplied
key information exists on the database. Use the getStatus
method provided to access the
status for a CSItem
-derived class.public static final int DOES_NOT_EXIST
DOES_NOT_EXIST
is used by the exist
method to indicate that no item matching the
supplied key information exists on the database. Use the getStatus
method provided to access
the status for a CSItem
-derived class.public static final int ACCESS_GRANTED
ACCESS_GRANTED
is used to indicate that the query was processed successfully. Use the
getStatus
method provided to access the status for a CSItem
-derived class.public static final int SECURE_ACCESS_GRANTED
SECURE_ACCESS_GRANTED
is used to indicate that a query on a secure item was processed successfully
i.e. access was given. Use the getStatus
method provided to access the status for a
CSItem
-derived class.public static final int SECURE_ACCESS_DENIED
SECURE_ACCESS_DENIED
is used to indicate that a query on a secure item was unsuccessful i.e.
access was not given. Use the getStatus
method provided to access the status for a
CSItem
-derived class.public static final int EMPTY
EMPTY
may be used to indicate that this item has been populated with default data. Use the
getStatus
method provided to access the status for a CSItem
-derived class.public static final java.lang.String UPDATE_ACTION_INSERTED
update
was called.public static final java.lang.String UPDATE_ACTION_UPDATED
update
was called.public void setStatus(int nStatus)
Valid values are :
CSItem.EXISTS
- an item matching the supplied key information exists on the database
CSItem.DOES_NOT_EXIST
- an item matching the supplied key information does not exist on the
database
CSItem.ACCESS_GRANTED
- the query method completed successfully
CSItem.SECURE_ACCESS_GRANTED
- the query method was given access to a secured item
CSItem.SECURE_ACCESS_DENIED
- the query method was not given access to a secured item
nStatus
- an integer which will represent this item's status.public int getStatus()
public void unset()
public void setID(int nID)
setID
followed by a call to get
will return details of the item with the specified
item ID.
nID
- the item's ID to be used as key information.public int getID()
public boolean exist() throws CSException
set
methods.
exist
in class CSDatabaseItem
true
if the item exists on the database.CSDatabaseException
- if there are problems accessing the database.CSParameterException
- if an invalid combination of parameters (key values) have been specified via the set
methods.CSException
- the base class for exceptions thrown by this method.public void get() throws CSException
getXXX()
methods.
get
in class CSDatabaseItem
CSDatabaseException
- if there are problems accessing the database.CSNotFoundException
- if the specified item cannot be found on the database.CSParameterException
- if an invalid combination of key information has been supplied.CSSecurityException
- if security has been breached.CSException
- the base class for exceptions thrown by this method.public void update() throws CSException
update
in class CSDatabaseItem
CSDatabaseException
- if there are problems accessing the database.CSNotFoundException
- if the specified item cannot be found on the database.CSParameterException
- if an invalid combination of key information has been supplied.CSException
- the base class for exceptions thrown by this method.public void delete() throws CSException
delete
in class CSDatabaseItem
CSDatabaseException
- if there are problems accessing the database.CSNotFoundException
- if the specified item cannot be found on the database.CSParameterException
- if an invalid combination of key information has been supplied.CSException
- the base class for exceptions thrown by this method.public java.lang.String toString()
toString
in class CSDatabaseItem
public boolean equals(java.lang.Object obj)
CSItemContent
object will be compared and the objects deemed to be equal if this matches - key information specified via the
set
methods is ignored and so may be different. Note that the key data used for searching is not
tested for equality.
equals
in class CSDatabaseItem
obj
- the object with which to compare this item.false
if this item's data differs from that of the supplied object obj
.public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String serialiseWithTypes(java.util.Hashtable obj, java.util.Hashtable typedef) throws CSDatabaseException
CSDatabaseException
public java.lang.String jsonString(java.lang.String str)
Copyright © 2022 Goss Interactive Ltd. All Rights Reserved.