public final class RelationInfo
extends java.lang.Object
Property data is stored in a map whose keys are the local DMO's property names, and whose values are the pairings of local and foreign property names, and whether case is ignored when comparing the property values (for character property types only).
Instances of this class are created at database initialization (read from the dmo index file). The information stored within these instances is used to construct HQL query statements for the following purposes:
It is also used to null out foreign records referenced by a DMO, when the foreign record is deleted.
AssociationSyncher
,
AbstractJoin
,
ForeignNuller
Modifier and Type | Class and Description |
---|---|
private static class |
RelationInfo.PropertyData
Container object for data which defines a local/foreign property pair.
|
Modifier and Type | Field and Description |
---|---|
private java.lang.Class<? extends Record> |
foreignClass
Foreign (referent) DMO implementation class
|
private java.lang.Class<? extends DataModelObject> |
foreignIface
Foreign (referent) DMO interface
|
private java.lang.String |
foreignSchema
Foreign (referent) schema name
|
private java.lang.Class<? extends Record> |
localClass
Local (referring) DMO implementation class
|
private java.lang.Class<? extends DataModelObject> |
localIface
Local (referring) DMO interface
|
private java.util.Map<java.lang.String,RelationInfo.PropertyData> |
properties
Common properties which define legacy foreign key
|
private boolean |
unique
Is relation uniquely constrained at the local table?
|
Constructor and Description |
---|
RelationInfo(java.lang.Class<? extends DataModelObject> localIface,
java.lang.Class<? extends Record> localClass,
java.lang.Class<? extends DataModelObject> foreignIface,
java.lang.Class<? extends Record> foreignClass,
java.lang.String foreignSchema)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addPropertyData(java.lang.String localName,
java.lang.String foreignName,
boolean caseSensitive)
Add a pair of properties which, alone or in combination with other pairs, define the legacy
key between related database tables.
|
java.util.Iterator<java.lang.String> |
foreignProperties()
Get an iterator on all of the legacy key property names for the foreign
(referent) DMO.
|
java.lang.String |
getForeignAlias()
Get the alias of the foreign (referent) DMO, which is its unqualified
interface name with the first letter lowercased.
|
java.lang.Class<? extends Record> |
getForeignClass()
Get the implementation class of the foreign (referent) DMO.
|
java.lang.String |
getForeignClassName()
Get the unqualified name of the foreign (referent) DMO's implementation
class.
|
java.lang.Class<? extends DataModelObject> |
getForeignInterface()
Get the interface of the foreign (referent) DMO.
|
java.lang.String |
getForeignInterfaceName()
Get the unqualified name of the foreign (referent) DMO's interface.
|
java.util.Set<java.lang.String> |
getForeignProperties()
Get the set of all of the legacy key property names for the foreign
(referent) DMO.
|
java.lang.String |
getForeignSchema()
Get the name of the foreign class' schema.
|
java.lang.String |
getLocalAlias()
Get the alias of the local (referring) DMO, which is its unqualified
interface name with the first letter lowercased.
|
java.lang.Class<? extends Record> |
getLocalClass()
Get the implementation class of the local (referring) DMO.
|
java.lang.String |
getLocalClassName()
Get the unqualified name of the local (referring) DMO's implementation
class.
|
java.lang.Class<? extends DataModelObject> |
getLocalInterface()
Get the interface of the local (referring) DMO.
|
java.lang.String |
getLocalInterfaceName()
Get the unqualified name of the local (referring) DMO's interface.
|
java.util.Set<java.lang.String> |
getLocalProperties()
Get the set all of the legacy key property names for the local
(referring) DMO.
|
boolean |
isIgnoreCase(java.lang.String property)
Indicate whether the pair of properties indexed by the specified, local property name are
recorded as case insensitive properties.
|
boolean |
isUnique()
Indicate whether the relation described by this object is uniquely
constrained on the local side.
|
java.util.Iterator<java.lang.String> |
localProperties()
Get an iterator on all of the legacy key property names for the local
(referring) DMO.
|
(package private) void |
setUnique()
Record the fact that the relation described by this object is uniquely
constrained on the local side.
|
private final java.lang.Class<? extends DataModelObject> localIface
private final java.lang.Class<? extends Record> localClass
private final java.lang.Class<? extends DataModelObject> foreignIface
private final java.lang.Class<? extends Record> foreignClass
private final java.lang.String foreignSchema
private final java.util.Map<java.lang.String,RelationInfo.PropertyData> properties
private boolean unique
public RelationInfo(java.lang.Class<? extends DataModelObject> localIface, java.lang.Class<? extends Record> localClass, java.lang.Class<? extends DataModelObject> foreignIface, java.lang.Class<? extends Record> foreignClass, java.lang.String foreignSchema)
localIface
- Local (referring) DMO interface.localClass
- Local (referring) DMO implementation class.foreignIface
- Foreign (referent) DMO interface.foreignClass
- Foreign (referent) DMO implementation class.public void addPropertyData(java.lang.String localName, java.lang.String foreignName, boolean caseSensitive)
localName
- Name of the local DMO's property.foreignName
- Name of the foreign DMO's related property.caseSensitive
- true
if comparisons of these properties must take case into account, else
false
(meaningful for character properties only).public boolean isIgnoreCase(java.lang.String property)
property
- Name of property in the local DMO class.true
if property
represents a case insensitive, character property.public java.lang.Class<? extends DataModelObject> getLocalInterface()
public java.lang.Class<? extends Record> getLocalClass()
public java.lang.String getLocalAlias()
public java.lang.String getLocalInterfaceName()
public java.lang.String getLocalClassName()
public java.lang.Class<? extends DataModelObject> getForeignInterface()
public java.lang.Class<? extends Record> getForeignClass()
public java.lang.String getForeignAlias()
public java.lang.String getForeignInterfaceName()
public java.lang.String getForeignClassName()
public java.lang.String getForeignSchema()
public java.util.Iterator<java.lang.String> foreignProperties()
public java.util.Set<java.lang.String> getForeignProperties()
public java.util.Iterator<java.lang.String> localProperties()
public java.util.Set<java.lang.String> getLocalProperties()
public boolean isUnique()
true
if the relation with the foreign DMO is
one-to-one; false
if it is many-to-one.void setUnique()