|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.is.jrf.CompoundPrimaryKeyColumnSpec
This implementer of ColumnSpec holds multiple AbstractColumnSpec subclass instances that make up the primary key for a table.
Field Summary | |
protected static java.lang.Class |
s_class
|
Fields inherited from interface com.is.jrf.JRFConstants |
CURRENT_DATE, CURRENT_TIMESTAMP, DEFAULT_TO_EMPTY_STRING, DEFAULT_TO_FALSE, DEFAULT_TO_NOW, DEFAULT_TO_NULL, DEFAULT_TO_ONE, DEFAULT_TO_TODAY, DEFAULT_TO_TRUE, DEFAULT_TO_ZERO, EQUALS, NATURAL_PRIMARY_KEY, NO_POST_FIND, NOT_EQUALS, OPTIMISTIC_LOCK, REQUIRED, SEQUENCED_PRIMARY_KEY, SUBTYPE_IDENTIFIER, UNIQUE |
Constructor Summary | |
CompoundPrimaryKeyColumnSpec()
Constructor for the CompoundPrimaryKeyColumnSpec object use the method addColumnSpec(...) in conjunction with this. |
|
CompoundPrimaryKeyColumnSpec(ColumnSpec columnOne,
ColumnSpec columnTwo)
Constructor for the CompoundPrimaryKeyColumnSpec object |
|
CompoundPrimaryKeyColumnSpec(ColumnSpec columnOne,
ColumnSpec columnTwo,
ColumnSpec columnThree)
Constructor for the CompoundPrimaryKeyColumnSpec object |
|
CompoundPrimaryKeyColumnSpec(ColumnSpec columnOne,
ColumnSpec columnTwo,
ColumnSpec columnThree,
ColumnSpec columnFour)
Constructor for the CompoundPrimaryKeyColumnSpec object |
|
CompoundPrimaryKeyColumnSpec(ColumnSpec columnOne,
ColumnSpec columnTwo,
ColumnSpec columnThree,
ColumnSpec columnFour,
ColumnSpec columnFive)
Constructor for the CompoundPrimaryKeyColumnSpec object |
|
CompoundPrimaryKeyColumnSpec(ColumnSpec columnOne,
ColumnSpec columnTwo,
ColumnSpec columnThree,
ColumnSpec columnFour,
ColumnSpec columnFive,
ColumnSpec columnSix)
Constructor for the CompoundPrimaryKeyColumnSpec object |
Method Summary | |
void |
addColumnSpec(ColumnSpec aColumnSpec)
Adds a feature to the ColumnSpec attribute of the CompoundPrimaryKeyColumnSpec object |
java.lang.String |
buildNameValuePair(java.lang.Object pkOrPersistentObject,
java.lang.String separator,
java.lang.String tableName,
DatabasePolicy dbPolicy)
Build a string that represents a name/value pair |
java.lang.String |
buildWhereClause(java.lang.Object aPO,
java.lang.String separator,
java.lang.String tableName,
DatabasePolicy dbPolicy)
Build a compound where clause (without the WHERE). |
java.lang.String |
columnDefinitionString(DatabasePolicy dbPolicy)
Return something like "id INTEGER, code VARCHAR(999)" for use in a CREATE TABLE statement. |
void |
copyAttribute(PersistentObject aPO1,
PersistentObject aPO2)
This is an override of the method in ColumnSpec. |
void |
copyColumnValueToPersistentObject(JDBCHelper helper,
PersistentObject aPO)
Ask each of my ColumnSpec instances to get the appropriate column from the helper and stick it into the PersistentObject. |
void |
decodeToPersistentObject(java.lang.String aString,
PersistentObject aPO)
The String parameter must have been encoded with the encodeFromPersistentObject(...) method. |
java.lang.String |
encodeFromPersistentObject(PersistentObject aPO)
Convert the attribute for this object to a String that can be unconverted later by the decodeToPersistentObject(...) method. |
java.lang.String |
formatForSql(java.lang.Object obj,
DatabasePolicy dbPolicy)
Description of the Method |
java.lang.Class |
getColumnClass()
Gets the ColumnClass attribute of the CompoundPrimaryKeyColumnSpec object |
java.lang.String |
getColumnName()
Return the column names of my children. |
java.lang.Object |
getColumnValueFrom(JDBCHelper helper)
Gets the ColumnValueFrom attribute of the CompoundPrimaryKeyColumnSpec object |
java.lang.Object |
getDefault()
Gets the Default attribute of the CompoundPrimaryKeyColumnSpec object |
java.lang.String |
getFullyQualifiedColumnName(java.lang.String tableAlias)
Return the column names (qualified with their table name/alias) of my children. |
java.lang.String |
getGetter()
Gets the Getter attribute of the CompoundPrimaryKeyColumnSpec object |
java.lang.String |
getSetter()
Gets the Setter attribute of the CompoundPrimaryKeyColumnSpec object |
java.lang.String |
getSqlValueFrom(PersistentObject aPO,
DatabasePolicy dbPolicy)
Return the SQL values of my children with a comma between each. |
java.lang.Object |
getValueFrom(PersistentObject aPO)
Gets the ValueFrom attribute of the CompoundPrimaryKeyColumnSpec object |
boolean |
isNaturalPrimaryKey()
Gets the NaturalPrimaryKey attribute of the CompoundPrimaryKeyColumnSpec object |
boolean |
isOptimisticLock()
Gets the OptimisticLock attribute of the CompoundPrimaryKeyColumnSpec object |
boolean |
isPrimaryKey()
Gets the PrimaryKey attribute of the CompoundPrimaryKeyColumnSpec object |
boolean |
isRequired()
Gets the Required attribute of the CompoundPrimaryKeyColumnSpec object |
boolean |
isSequencedPrimaryKey()
Gets the SequencedPrimaryKey attribute of the CompoundPrimaryKeyColumnSpec object |
boolean |
isSubtypeIdentifier()
Gets the SubtypeIdentifier attribute of the CompoundPrimaryKeyColumnSpec object |
boolean |
isUnique()
Gets the Unique attribute of the CompoundPrimaryKeyColumnSpec object |
void |
setRequired(boolean b)
Sets the Required attribute of the CompoundPrimaryKeyColumnSpec object |
void |
setValueTo(java.lang.Object aValue,
PersistentObject aPO)
Sets the ValueTo attribute of the CompoundPrimaryKeyColumnSpec object |
java.lang.Object |
validateRequired(PersistentObject aPO)
Make sure the PersistentObject object has these attributes. |
void |
validateUnique(PersistentObject aPO,
JDBCHelper helper,
ColumnSpec pkColumnSpec,
DatabasePolicy dbPolicy,
java.lang.String tableName)
If this is a unique column (or columns), make sure the value doesn't already exist. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static java.lang.Class s_class
Constructor Detail |
public CompoundPrimaryKeyColumnSpec()
public CompoundPrimaryKeyColumnSpec(ColumnSpec columnOne, ColumnSpec columnTwo)
columnOne
- a ColumnSpeccolumnTwo
- a ColumnSpecpublic CompoundPrimaryKeyColumnSpec(ColumnSpec columnOne, ColumnSpec columnTwo, ColumnSpec columnThree)
columnOne
- a ColumnSpeccolumnTwo
- a ColumnSpeccolumnThree
- a ColumnSpecpublic CompoundPrimaryKeyColumnSpec(ColumnSpec columnOne, ColumnSpec columnTwo, ColumnSpec columnThree, ColumnSpec columnFour)
columnOne
- a ColumnSpeccolumnTwo
- a ColumnSpeccolumnThree
- a ColumnSpeccolumnFour
- a ColumnSpecpublic CompoundPrimaryKeyColumnSpec(ColumnSpec columnOne, ColumnSpec columnTwo, ColumnSpec columnThree, ColumnSpec columnFour, ColumnSpec columnFive)
columnOne
- a ColumnSpeccolumnTwo
- a ColumnSpeccolumnThree
- a ColumnSpeccolumnFour
- a ColumnSpeccolumnFive
- a ColumnSpecpublic CompoundPrimaryKeyColumnSpec(ColumnSpec columnOne, ColumnSpec columnTwo, ColumnSpec columnThree, ColumnSpec columnFour, ColumnSpec columnFive, ColumnSpec columnSix)
columnOne
- a ColumnSpeccolumnTwo
- a ColumnSpeccolumnThree
- a ColumnSpeccolumnFour
- a ColumnSpeccolumnFive
- a ColumnSpeccolumnSix
- a ColumnSpecMethod Detail |
public void addColumnSpec(ColumnSpec aColumnSpec)
aColumnSpec
- The feature to be added to the ColumnSpec attributepublic void copyColumnValueToPersistentObject(JDBCHelper helper, PersistentObject aPO) throws java.sql.SQLException
copyColumnValueToPersistentObject
in interface ColumnSpec
helper
- a value of type 'JDBCHelper'aPO
- a value of type 'PersistentObject'java.sql.SQLException
- if an error occurspublic java.lang.String encodeFromPersistentObject(PersistentObject aPO)
encodeFromPersistentObject
in interface ColumnSpec
aPO
- a value of type 'PersistentObject'public void decodeToPersistentObject(java.lang.String aString, PersistentObject aPO)
decodeToPersistentObject
in interface ColumnSpec
aString
- a value of type 'String'aPO
- a value of type 'PersistentObject'public void copyAttribute(PersistentObject aPO1, PersistentObject aPO2)
copyAttribute
in interface ColumnSpec
aPO1
- a value of type 'PersistentObject'aPO2
- a value of type 'PersistentObject'public java.lang.String buildWhereClause(java.lang.Object aPO, java.lang.String separator, java.lang.String tableName, DatabasePolicy dbPolicy)
buildWhereClause
in interface ColumnSpec
aPO
- a value of type 'PersistentObject'separator
- a value of type 'String'tableName
- a value of type 'String'dbPolicy
- a value of type 'DatabasePolicy'public java.lang.Object validateRequired(PersistentObject aPO) throws MissingAttributeException
validateRequired
in interface ColumnSpec
aPO
- a value of type 'PersistentObject'MissingAttributeException
- if an error occurspublic java.lang.String getFullyQualifiedColumnName(java.lang.String tableAlias)
getFullyQualifiedColumnName
in interface ColumnSpec
tableAlias
- a value of type 'String'public java.lang.String getColumnName()
getColumnName
in interface ColumnSpec
public java.lang.String getSqlValueFrom(PersistentObject aPO, DatabasePolicy dbPolicy)
getSqlValueFrom
in interface ColumnSpec
aPO
- a value of type 'PersistentObject'dbPolicy
- a value of type 'DatabasePolicy'public java.lang.String columnDefinitionString(DatabasePolicy dbPolicy)
columnDefinitionString
in interface ColumnSpec
dbPolicy
- a value of type 'DatabasePolicy'public void validateUnique(PersistentObject aPO, JDBCHelper helper, ColumnSpec pkColumnSpec, DatabasePolicy dbPolicy, java.lang.String tableName) throws DuplicateRowException
validateUnique
in interface ColumnSpec
aPO
- a value of type 'PersistentObject'helper
- a value of type 'JDBCHelper'pkColumnSpec
- a value of type 'ColumnSpec'dbPolicy
- a value of type 'DatabasePolicy'tableName
- a value of type 'String'DuplicateRowException
- if an error occurspublic java.lang.String buildNameValuePair(java.lang.Object pkOrPersistentObject, java.lang.String separator, java.lang.String tableName, DatabasePolicy dbPolicy)
buildNameValuePair
in interface ColumnSpec
pkOrPersistentObject
- a primary key value or a PersistentObjectseparator
- usually "="tableName
- name of the tabledbPolicy
- a value of type 'DatabasePolicy'public void setValueTo(java.lang.Object aValue, PersistentObject aPO)
setValueTo
in interface ColumnSpec
aValue
- The new ValueTo valueaPO
- The new ValueTo valuepublic java.lang.Object getValueFrom(PersistentObject aPO)
getValueFrom
in interface ColumnSpec
aPO
- Description of Parameterpublic java.lang.String formatForSql(java.lang.Object obj, DatabasePolicy dbPolicy)
formatForSql
in interface ColumnSpec
obj
- Description of ParameterdbPolicy
- Description of Parameterpublic java.lang.Object getColumnValueFrom(JDBCHelper helper) throws java.sql.SQLException
getColumnValueFrom
in interface ColumnSpec
helper
- a JDBCHelperjava.sql.SQLException
- If SQLException is thrown by the JDBC driver.public java.lang.Class getColumnClass()
getColumnClass
in interface ColumnSpec
public java.lang.String getGetter()
getGetter
in interface ColumnSpec
public java.lang.String getSetter()
getSetter
in interface ColumnSpec
public boolean isRequired()
isRequired
in interface ColumnSpec
public boolean isSequencedPrimaryKey()
isSequencedPrimaryKey
in interface ColumnSpec
public boolean isNaturalPrimaryKey()
isNaturalPrimaryKey
in interface ColumnSpec
public boolean isSubtypeIdentifier()
isSubtypeIdentifier
in interface ColumnSpec
public boolean isPrimaryKey()
isPrimaryKey
in interface ColumnSpec
public boolean isUnique()
isUnique
in interface ColumnSpec
public java.lang.Object getDefault()
getDefault
in interface ColumnSpec
public boolean isOptimisticLock()
isOptimisticLock
in interface ColumnSpec
public void setRequired(boolean b)
setRequired
in interface ColumnSpec
b
- The new Required value
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |