final class ForeignResolver
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private Database |
database
The associated database
|
private java.util.List |
fieldRefs
Field references used to retrieve query substitution values
|
private java.lang.String |
hql
HQL query statement
|
private RelationInfo |
info
Information about the primary/foreign key relation
|
private boolean |
inverse
Does resolver walk the foreign key association from the foreign end?
|
private static java.util.logging.Logger |
LOG
Logger
|
Constructor and Description |
---|
ForeignResolver(RelationInfo info,
RecordBuffer buffer,
boolean inverse)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
private void |
createFieldRefs(java.lang.Class dmoIface,
java.util.Iterator propIter)
Construct one
FieldReference object for each legacy key
property which will be used as a query substitution parameter during
record resolution. |
private java.lang.String |
generateHQL(RelationInfo info)
Generate the HQL statement which will be used for record resolution,
using the information stored in the relation descriptor.
|
private java.lang.Object[] |
getArguments(Persistable dmo)
Get the current values of all legacy key properties for this relation,
from the given record.
|
(package private) RelationInfo |
getInfo()
Get the descriptor object which contains information about the relation
associated with this resolver.
|
(package private) java.io.Serializable |
resolveForeign(RecordBuffer buffer)
Resolve a foreign record using the values of one or more legacy key
properties in
buffer 's current record. |
(package private) java.util.List |
resolveLocal(RecordBuffer buffer)
Resolve zero or more records which refer via foreign key association to
the record currently stored in
buffer , using the values
of one or more legacy key properties in that record. |
private static final java.util.logging.Logger LOG
private final RelationInfo info
private final java.lang.String hql
private final java.util.List fieldRefs
private final boolean inverse
private final Database database
ForeignResolver(RelationInfo info, RecordBuffer buffer, boolean inverse)
info
- Descriptor of the relation between the local and foreign DMOs.buffer
- A record buffer which represents the "local" (i.e., refering)
DMO if inverse
is false
, or which
represents the foreign (i.e., referent) DMO if
inverse
is true
.inverse
- true
to construct an object which resolves the
"local" (i.e., refering) DMO(s) given a foreign (i.e.,
referent) DMO; false
to construct an object
which resolves the foreign DMO given a local DMO.java.io.Serializable resolveForeign(RecordBuffer buffer) throws PersistenceException
buffer
's current record.buffer
- The record buffer containing the current, local record for
which a related, foreign record must be found.buffer
's
current record, or null
if none was found.PersistenceException
- if any error occurs querying the foreign record from the
database.java.lang.IllegalStateException
- if the current record in the buffer is null
, or
if this object has been configured to retrieve the record for
the inverse, foreign key association.java.util.List resolveLocal(RecordBuffer buffer) throws PersistenceException
buffer
, using the values
of one or more legacy key properties in that record.buffer
- The record buffer containing the current, foreign record for
which one or more related, "local" records must be found.buffer
's current record.PersistenceException
- if any error occurs querying the database.java.lang.IllegalStateException
- if the current record in the buffer is null
, or
if this object has not been configured to retrieve the record
for the inverse, foreign key association..RelationInfo getInfo()
private java.lang.Object[] getArguments(Persistable dmo)
dmo
- Record currently stored in the record buffer.private java.lang.String generateHQL(RelationInfo info)
info
- Relation descriptor.private void createFieldRefs(java.lang.Class dmoIface, java.util.Iterator propIter)
FieldReference
object for each legacy key
property which will be used as a query substitution parameter during
record resolution. Store these objects in a list for later access.dmoIface
- Business interface which the field references will invoke to
retrieve property values.propIter
- Iterator on the names of those DMO properties which form the
legacy foreign key.