|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.opengts.dbtools.DBRecordKey<gDBR>
public abstract class DBRecordKey<gDBR extends DBRecord>
DBRecordKey
represents the SQL table key for a DBRecord.
Field Summary | |
---|---|
static java.lang.String |
FLD_autoIndex
|
Constructor Summary | |
---|---|
protected |
DBRecordKey()
Default Constructor |
Method Summary | |
---|---|
protected void |
_delete(java.lang.String altIndexName,
int whereKeyType)
Deletes the record corresponding to the Primary Key of thie DBRecordKey. |
protected void |
_deleteDependencies()
|
protected boolean |
_exists(java.lang.String altIndexName,
int whereKeyType)
Returns true if the specified key attribute exists in the table |
gDBR |
_getDBRecord(boolean reload,
java.lang.String... fldNames)
Gets the DBRecord associated with this key |
protected java.lang.String |
_getWhereClause(java.lang.String altIndexName,
int whereKeyType)
Return the 'WHERE' clause for this key [CHECK] |
void |
altIndexDelete(java.lang.String indexName)
Deletes the record corresponding to the Alternate Key of thie DBRecordKey. WARNING: If the alternate key is not unique, calling this method when the alternate key fields are blank may cause more records to be deleted than is intended. |
boolean |
altIndexExists(java.lang.String indexName)
Returns true if the full Alternate Key exists in the table |
void |
delete()
Deletes the record corresponding to the Primary Key of thie DBRecordKey. |
void |
delete(boolean delDeps)
Deletes the record corresponding to the Primary Key of thie DBRecordKey. |
boolean |
equals(java.lang.Object other)
Returns true if this object is equivilent to the specified object |
boolean |
exists()
Returns true if the full Primary Key exists in the table |
boolean |
exists(boolean fullKeyOnly)
Returns true if the full (or partial) Primary Key exists in the table |
boolean |
exists(int whereKeyType)
Returns true if the partial Primary Key exists in the table |
static java.lang.String |
FilterID(java.lang.String text)
Filters an ID String, convertering all letters to lowercase and removing invalid characters |
protected DBField[] |
getAltKeyFields(java.lang.String indexName)
|
gDBR |
getDBRecord()
Gets the DBRecord associated with this key |
gDBR |
getDBRecord(boolean reload)
Gets the DBRecord associated with this key |
gDBR |
getDBRecord(boolean reload,
java.lang.String... fldNames)
Gets the DBRecord associated with this key |
abstract DBFactory<gDBR> |
getFactory()
Gets the DBFactory for this DBRecoedKey |
DBField |
getField(java.lang.String fldName)
|
DBField[] |
getFields()
|
java.lang.Object |
getFieldValue(java.lang.String fldName)
|
java.lang.String |
getFieldValueAsString(java.lang.String fldName)
See DBFieldValues#getFieldValueAsString(String) |
DBFieldValues |
getFieldValues()
Return a DBFieldValues instance for this DBRecordKey |
DBField[] |
getKeyFields()
|
java.lang.Object |
getKeyValue(java.lang.String fldName)
|
java.lang.String |
getKeyValueAsString(java.lang.String fldName)
See DBFieldValues#getFieldValueAsString(String) |
DBFieldValues |
getKeyValues()
Return a DBFieldValues instance for this DBRecordKey, which contains only key field values |
java.util.Set<java.lang.String> |
getTaggedFieldNames()
Returns a set of tagged field names, or null if no tagged fields have been set. |
java.lang.String |
getTranslatedTableName()
Gets the table name for this DBSelect |
java.lang.String |
getUntranslatedTableName()
|
gDBR |
getVirtualDBRecord(ServiceRequest servReq)
Gets a virtual DBRecord from the specified remote service |
java.lang.String |
getWhereClause(int whereKeyType)
Gets the 'WHERE' clause for this key |
boolean |
hasFieldValue(java.lang.String fldName)
|
boolean |
hasKeyValue(java.lang.String fldName)
|
boolean |
hasTaggedFields()
Returns true if any tagged field names have been defined |
boolean |
isFullKey()
Returns true if this key fully defines all key fields |
boolean |
isPartialKey()
Returns !isFullKey() |
boolean |
isTaggedFieldName(java.lang.String fldName)
Returns true if the specified field name is in the 'tagged' list, false otherwise. |
static boolean |
isValidIDChar(char ch)
Returns true if the specified character is a valid character to use in an ID |
boolean |
parentsExist()
Returns true if the parent records in their respective parent tables exist. |
static void |
printXML(java.io.PrintStream out,
DBRecordKey... dbrk)
Encodes the specified DBRecordKyes into XML and writes it to a specified PrintStream |
static void |
printXML(java.io.PrintWriter out,
DBRecordKey... dbrk)
Encodes the specified DBRecordKyes into XML and writes it to a specified PrintWriter |
void |
printXML(java.io.PrintWriter out,
int indent)
Encodes this DBRecordKey into XML and writes it to a specified PrintWriter |
void |
printXML(java.io.PrintWriter out,
int indent,
int sequence)
Encodes this DBRecordKey into XML and writes it to a specified PrintWriter |
void |
printXML(java.io.PrintWriter out,
int indent,
int sequence,
boolean soapXML)
Encodes this DBRecordKey into XML and writes it to a specified PrintWriter |
boolean |
setFieldValue(java.lang.String fldName,
boolean val)
|
boolean |
setFieldValue(java.lang.String fldName,
double val)
|
boolean |
setFieldValue(java.lang.String fldName,
int val)
|
boolean |
setFieldValue(java.lang.String fldName,
long val)
|
boolean |
setFieldValue(java.lang.String fldName,
java.lang.Object val)
|
boolean |
setKeyValue(java.lang.String fldName,
boolean val)
|
boolean |
setKeyValue(java.lang.String fldName,
double val)
|
boolean |
setKeyValue(java.lang.String fldName,
int val)
|
boolean |
setKeyValue(java.lang.String fldName,
long val)
|
boolean |
setKeyValue(java.lang.String fldName,
java.lang.Object val)
|
void |
setTaggedFieldNames(java.util.Set<java.lang.String> taggedFields)
Sets a list of 'tagged' data fields. |
java.lang.String |
toString()
Returns a string representation of this object |
java.lang.StringBuffer |
toXML(java.lang.StringBuffer sb,
int indent)
Encodes this DBRecordKey into XML |
java.lang.StringBuffer |
toXML(java.lang.StringBuffer sb,
int indent,
int sequence)
Encodes this DBRecordKey into XML |
java.lang.StringBuffer |
toXML(java.lang.StringBuffer sb,
int indent,
int sequence,
boolean soapXML)
Encodes this DBRecordKey into XML |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String FLD_autoIndex
Constructor Detail |
---|
protected DBRecordKey()
Method Detail |
---|
public abstract DBFactory<gDBR> getFactory()
public java.lang.String getUntranslatedTableName()
DBFactory.getUntranslatedTableName()
public java.lang.String getTranslatedTableName()
public DBField[] getFields()
DBFactory.getFields()
public DBField getField(java.lang.String fldName)
DBFactory.getField(String)
public DBField[] getKeyFields()
DBFactory.getKeyFields()
protected DBField[] getAltKeyFields(java.lang.String indexName)
DBFactory.getAlternateIndex(String)
public java.util.Set<java.lang.String> getTaggedFieldNames()
public void setTaggedFieldNames(java.util.Set<java.lang.String> taggedFields)
taggedFields
- A set of 'tagged' data fields.public boolean hasTaggedFields()
public boolean isTaggedFieldName(java.lang.String fldName)
fldName
- The field name
public boolean isFullKey()
public boolean isPartialKey()
isFullKey()
public DBFieldValues getKeyValues()
public boolean hasKeyValue(java.lang.String fldName)
DBFieldValues.hasFieldValue(String)
public java.lang.Object getKeyValue(java.lang.String fldName)
DBFieldValues.getFieldValue(java.lang.String)
public java.lang.String getKeyValueAsString(java.lang.String fldName)
public boolean setKeyValue(java.lang.String fldName, java.lang.Object val)
DBFieldValues.setFieldValue(String,Object)
public boolean setKeyValue(java.lang.String fldName, boolean val)
DBFieldValues.setFieldValue(String,boolean)
public boolean setKeyValue(java.lang.String fldName, int val)
DBFieldValues.setFieldValue(String,int)
public boolean setKeyValue(java.lang.String fldName, long val)
DBFieldValues.setFieldValue(String,long)
public boolean setKeyValue(java.lang.String fldName, double val)
DBFieldValues.setFieldValue(String,double)
public DBFieldValues getFieldValues()
public boolean hasFieldValue(java.lang.String fldName)
DBFieldValues.hasFieldValue(String)
public java.lang.Object getFieldValue(java.lang.String fldName)
DBFieldValues.getFieldValue(java.lang.String)
public java.lang.String getFieldValueAsString(java.lang.String fldName)
public boolean setFieldValue(java.lang.String fldName, java.lang.Object val)
DBFieldValues.setFieldValue(String,Object)
public boolean setFieldValue(java.lang.String fldName, boolean val)
DBFieldValues.setFieldValue(String,boolean)
public boolean setFieldValue(java.lang.String fldName, int val)
DBFieldValues.setFieldValue(String,int)
public boolean setFieldValue(java.lang.String fldName, long val)
DBFieldValues.setFieldValue(String,long)
public boolean setFieldValue(java.lang.String fldName, double val)
DBFieldValues.setFieldValue(String,double)
public boolean exists() throws DBException
DBException
public boolean exists(int whereKeyType) throws DBException
DBException
public boolean exists(boolean fullKeyOnly) throws DBException
fullKeyOnly
- True to test for existence of the full Primary Key, false to
allow testing for existance of a partial primary key.
DBException
public boolean altIndexExists(java.lang.String indexName) throws DBException
DBException
protected boolean _exists(java.lang.String altIndexName, int whereKeyType) throws java.sql.SQLException, DBException
altIndexName
- The alternate index name, or null to use the primary indexwhereKeyType
- The partial key match type
java.sql.SQLException
DBException
public boolean parentsExist() throws DBException
DBException
public void delete() throws DBException
DBException
public void delete(boolean delDeps) throws DBException
delDeps
- True to also delete dependent children records
DBException
public void altIndexDelete(java.lang.String indexName) throws DBException
indexName
- The alternate index name (defaults to DBProvider.DEFAULT_ALT_INDEX_NAME
)
DBException
protected void _delete(java.lang.String altIndexName, int whereKeyType) throws java.sql.SQLException, DBException
altIndexName
- The alternate index name, or null to delete the primary indexwhereKeyType
- WHERE key type: Full, PartialFirst, PartialAll
java.sql.SQLException
DBException
protected void _deleteDependencies() throws DBException
DBException
public java.lang.String getWhereClause(int whereKeyType) throws DBException
whereKeyType
- The where key type. One of the constants from DBWhere
DBException
- If a database exception occursprotected java.lang.String _getWhereClause(java.lang.String altIndexName, int whereKeyType) throws DBException
altIndexName
- The alternate index name. If null or blank, uses
primary keys insteadwhereKeyType
- The where key type. One of the constants from DBWhere
DBException
public gDBR getDBRecord()
public gDBR getDBRecord(boolean reload)
reload
- If the record should be reloaded before it is returned
public gDBR getDBRecord(boolean reload, java.lang.String... fldNames)
reload
- If the record should be reloaded before it is returnedfldNames
- The specific field-names to reload (null to reload all)
public gDBR _getDBRecord(boolean reload, java.lang.String... fldNames) throws DBException
reload
- If the record should be reloaded before it is returnedfldNames
- The specific field-names to reload (null to reload all)
DBException
public gDBR getVirtualDBRecord(ServiceRequest servReq) throws DBException
servReq
- The remote web service
DBException
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
other
- The other object
other
is the same class and all fields and
field values are the samepublic java.lang.String toString()
toString
in class java.lang.Object
public static void printXML(java.io.PrintStream out, DBRecordKey... dbrk)
out
- The PrintStreamdbrk
- The list of DBRecordKeyspublic static void printXML(java.io.PrintWriter out, DBRecordKey... dbrk)
out
- The PrintWriterdbrk
- The list of DBRecordKeyspublic void printXML(java.io.PrintWriter out, int indent)
out
- The PrintWriterindent
- The number of spaces to indentpublic void printXML(java.io.PrintWriter out, int indent, int sequence)
out
- The PrintWriterindent
- The number of spaces to indentsequence
- Optional sequence valuepublic void printXML(java.io.PrintWriter out, int indent, int sequence, boolean soapXML)
out
- The PrintWriterindent
- The number of spaces to indentsequence
- Optional sequence valuesoapXML
- True for SOAP XMLpublic java.lang.StringBuffer toXML(java.lang.StringBuffer sb, int indent)
sb
- The StringBuffer to which the DBRecord XML is writenindent
- The number of spaces to indent
public java.lang.StringBuffer toXML(java.lang.StringBuffer sb, int indent, int sequence)
sb
- The StringBuffer to which the DBRecord XML is writenindent
- The number of spaces to indentsequence
- An optional record sequence number
public java.lang.StringBuffer toXML(java.lang.StringBuffer sb, int indent, int sequence, boolean soapXML)
sb
- The StringBuffer to which the DBRecord XML is writenindent
- The number of spaces to indentsequence
- An optional record sequence numbersoapXML
- True for SOAP XML
public static boolean isValidIDChar(char ch)
ch
- The character
public static java.lang.String FilterID(java.lang.String text)
text
- The ID String to filter
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |