Purpose: Variable one to one mappings are used to represent a pointer references between a java object and an implementer of an interface. This mapping is usually represented by a single pointer (stored in an instance variable) between the source and target objects. In the relational database tables, these mappings are normally implemented using a foreign key and a type code.
| Modifier and Type | Field and Description |
|---|---|
| protected Map | |
| protected DatabaseField | |
| protected Map | typeIndicatorNameTranslation
parallel table typeIndicatorTranslation used prior to initialization to avoid type indicators on Mapping Workbench |
| protected Map |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | addClassIndicator(Class<?> implementer, Object typeIndicator)
PUBLIC: Add a type indicator conversion to this mapping. |
| public void | |
| public void | addForeignQueryKeyName(DatabaseField sourceForeignKeyField, String targetQueryKeyName)
PUBLIC: A foreign key from the source table and abstract query key from the interface descriptor are added to the mapping. |
| public void | addForeignQueryKeyName(String sourceForeignKeyFieldName, String targetQueryKeyName)
PUBLIC: A foreign key from the source table and abstract query key from the interface descriptor are added to the mapping. |
| public void | addTargetForeignQueryKeyName(String targetForeignQueryKeyName, String sourcePrimaryKeyFieldName)
PUBLIC: Define the target foreign key relationship in the Variable 1-1 mapping. |
| protected Object | batchedValueFromRow(AbstractRecord row, ObjectLevelReadQuery query, CacheKey parentCacheKey)
Overrides org. |
| public Object | clone()
Overrides org. |
| protected Vector | collectFields()
Overrides org. |
| protected boolean | compareObjectsWithoutPrivateOwned(Object firstObject, Object secondObject, AbstractSession session)
Overrides org. |
| public void | convertClassNamesToClasses(ClassLoader
TODO classLoader)Overrides org. |
| public Vector | |
| public ClassDescriptor | getDescriptorForTarget(Object targetObject, AbstractSession session)
Overrides org. |
| public Class | getFieldClassification(DatabaseField fieldToClassify)
Overrides org. |
| public Vector | |
| protected Object | getImplementorForType(Object type, AbstractSession session)
INTERNAL: Return the implementor for a specified type |
| protected Object | getPrimaryKeyForObject(Object object, AbstractSession session)
Overrides org. |
| public Vector | getSourceToTargetQueryKeyFieldAssociations()
PUBLIC: Return a collection of the field to query key associations. |
| public Map | getSourceToTargetQueryKeyNames()
INTERNAL: Returns the source keys to target keys fields association. |
| public DatabaseField | |
| public String | |
| protected Object | |
| public Map | getTypeIndicatorNameTranslation()
INTERNAL: Return the typeIndicatorName translation Used by the Mapping Workbench to avoid classpath dependencies |
| public Map | |
| public void | initialize(AbstractSession session)
Overrides org. |
| protected void | initializeForeignKeys(AbstractSession session)
INTERNAL: The foreign key names and their primary keys are converted to DatabaseField and stored. |
| public void | initializeSelectionCriteria(AbstractSession session)
INTERNAL: Selection criteria is created with source foreign keys and target keys. |
| public boolean | isRelationalMapping()
Overrides org. |
| public boolean | |
| public void | preInitialize(AbstractSession session)
Overrides org. |
| public void | rehashFieldDependancies(AbstractSession session)
Overrides org. |
| public void | setClassIndicatorAssociations(Vector<E> classIndicatorAssociations)
PUBLIC: Set the class indicator associations. |
| public void | setForeignKeyFieldNames(Vector<E> fieldNames)
PUBLIC: Return the foreign key field names associated with the mapping. |
| public void | setForeignQueryKeyName(String sourceForeignKeyFieldName, String targetQueryKeyName)
PUBLIC: A foreign key from the source table and abstract query key from the interface descriptor are added to the mapping. |
| public void | setSourceToTargetQueryKeyFieldAssociations(Vector<E> sourceToTargetQueryKeyFieldAssociations)
PUBLIC: Set a collection of the source to target query key/field associations. |
| protected void | setSourceToTargetQueryKeyFields(Map<K, V> sourceToTargetQueryKeyNames)
INTERNAL: Set the source keys to target keys fields association. |
| public void | setTypeField(DatabaseField typeField)
INTERNAL: This method set the typeField of the mapping to the parameter field |
| public void | setTypeFieldName(String typeFieldName)
PUBLIC: This method sets the name of the typeField of the mapping. |
| protected void | setTypeIndicatorNameTranslation(Map<K, V> translations)
INTERNAL: For avoiding classpath dependencies on the Mapping Workbench |
| protected void | setTypeIndicatorTranslation(Map<K, V> translations)
INTERNAL: Set the typeIndicatorTranslations hashtable to the new Hashtable translations |
| public Object | valueFromObject(Object
TODO object, DatabaseField TODO field, AbstractSession TODO session)Overrides org. |
| public Object | valueFromRow(AbstractRecord row, JoinedAttributeManager joinManager, ObjectBuildingQuery sourceQuery, CacheKey cacheKey, AbstractSession executionSession, boolean isTargetProtected, Boolean[] wasCacheUsed)
Overrides org. |
| protected void | writeFromNullObjectIntoRow(AbstractRecord record)
INTERNAL: Get a value from the object and set that in the respective field of the row. |
| public void | writeFromObjectIntoRow(Object object, AbstractRecord record, AbstractSession session, DatabaseMapping.
Overrides org. |
| public void | writeFromObjectIntoRowForShallowInsert(Object object, AbstractRecord record, AbstractSession session)
Overrides org. |
| public void | writeFromObjectIntoRowForShallowInsertWithChangeRecord(ChangeRecord changeRecord, AbstractRecord record, AbstractSession session)
INTERNAL:
This row is built for shallow insert which happens in case of bidirectional inserts.
|
| public void | writeFromObjectIntoRowForUpdateAfterShallowInsert(Object object, AbstractRecord row, AbstractSession session, DatabaseTable table)
Overrides org. |
| public void | writeFromObjectIntoRowForWhereClause(ObjectLevelModifyQuery query, AbstractRecord record)
Overrides org. |
| public void | writeFromObjectIntoRowWithChangeRecord(ChangeRecord changeRecord, AbstractRecord record, AbstractSession session, DatabaseMapping.
Overrides org. |
| public void | writeInsertFieldsIntoRow(AbstractRecord record, AbstractSession session)
Overrides org. |
| sourceToTargetQueryKeyNames | back to summary |
|---|---|
| protected Map<K, V> sourceToTargetQueryKeyNames | |
| typeField | back to summary |
|---|---|
| protected DatabaseField typeField | |
| typeIndicatorNameTranslation | back to summary |
|---|---|
| protected Map<K, V> typeIndicatorNameTranslation parallel table typeIndicatorTranslation used prior to initialization to avoid type indicators on Mapping Workbench | |
| typeIndicatorTranslation | back to summary |
|---|---|
| protected Map<K, V> typeIndicatorTranslation | |
| VariableOneToOneMapping | back to summary |
|---|---|
| public VariableOneToOneMapping() PUBLIC: Default constructor. | |
| addClassIndicator | back to summary |
|---|---|
| public void addClassIndicator(Class<?> implementer, Object typeIndicator) PUBLIC: Add a type indicator conversion to this mapping. | |
| addClassNameIndicator | back to summary |
|---|---|
| public void addClassNameIndicator(String className, Object typeIndicator) INTERNAL: Add indicators by classname. For use by the Mapping Workbench to avoid classpath dependencies | |
| addForeignQueryKeyName | back to summary |
|---|---|
| public void addForeignQueryKeyName(DatabaseField sourceForeignKeyField, String targetQueryKeyName) PUBLIC: A foreign key from the source table and abstract query key from the interface descriptor are added to the mapping. This method is used if there are multiple foreign keys. | |
| addForeignQueryKeyName | back to summary |
|---|---|
| public void addForeignQueryKeyName(String sourceForeignKeyFieldName, String targetQueryKeyName) PUBLIC: A foreign key from the source table and abstract query key from the interface descriptor are added to the mapping. This method is used if there are multiple foreign keys. | |
| addTargetForeignQueryKeyName | back to summary |
|---|---|
| public void addTargetForeignQueryKeyName(String targetForeignQueryKeyName, String sourcePrimaryKeyFieldName) PUBLIC: Define the target foreign key relationship in the Variable 1-1 mapping. This method is used for composite target foreign key relationships, that is the target object's table has multiple foreign key fields to the source object's primary key fields. Both the target foreign key query name and the source primary key field name must be specified. The distinction between a foreign key and target foreign key is that the variable 1-1 mapping will not populate the target foreign key value when written (because it is in the target table). Normally 1-1's are through foreign keys but in bi-directional 1-1's the back reference will be a target foreign key. In obscure composite legacy data models a 1-1 may consist of a foreign key part and a target foreign key part, in this case both method will be called with the correct parts. | |
| batchedValueFromRow | back to summary |
|---|---|
| protected Object batchedValueFromRow(AbstractRecord row, ObjectLevelReadQuery query, CacheKey parentCacheKey) Overrides org. INTERNAL: Possible for future development, not currently supported. Retrieve the value through using batch reading. This executes a single query to read the target for all of the objects and stores the result of the batch query in the original query to allow the other objects to share the results.
| |
| clone | back to summary |
|---|---|
| public Object clone() Overrides org. INTERNAL: This methods clones all the fields and ensures that each collection refers to the same clones.
| |
| collectFields | back to summary |
|---|---|
| protected Vector Overrides org. INTERNAL: Return all the fields populated by this mapping.
| |
| compareObjectsWithoutPrivateOwned | back to summary |
|---|---|
| protected boolean compareObjectsWithoutPrivateOwned(Object firstObject, Object secondObject, AbstractSession session) Overrides org. INTERNAL: Compare the references of the two objects are the same, not the objects themselves. Used for independent relationships. This is used for testing and validation purposes. Must get separate fields for the objects because we may be adding a different class to the attribute because of the interface
| |
| convertClassNamesToClasses | back to summary |
|---|---|
| public void convertClassNamesToClasses(ClassLoader classLoader) Overrides org. INTERNAL: Convert all the class-name-based settings in this mapping to actual class-based settings. This method is used when converting a project that has been built with class names to a project with classes.
| |
| getClassIndicatorAssociations | back to summary |
|---|---|
| public Vector INTERNAL: Return the class indicator associations for XML. List of class-name/value associations. | |
| getDescriptorForTarget | back to summary |
|---|---|
| public ClassDescriptor getDescriptorForTarget(Object targetObject, AbstractSession session) Overrides org. INTERNAL: Return a descriptor for the target of this mapping For normal ObjectReferenceMappings, we return the reference descriptor. For a VariableOneToOneMapping, the reference descriptor is often a descriptor for an interface and does not contain adequate information. As a result, we look up the descriptor for the specific class we are looking for Bug 2612571
| |
| getFieldClassification | back to summary |
|---|---|
| public Class Overrides org. INTERNAL: Return the classification for the field contained in the mapping. This is used to convert the row value to a consistent java value.
| |
| getForeignKeyFieldNames | back to summary |
|---|---|
| public Vector PUBLIC: Return the foreign key field names associated with the mapping. These are only the source fields that are writable. | |
| getImplementorForType | back to summary |
|---|---|
| protected Object getImplementorForType(Object type, AbstractSession session) INTERNAL: Return the implementor for a specified type | |
| getPrimaryKeyForObject | back to summary |
|---|---|
| protected Object getPrimaryKeyForObject(Object object, AbstractSession session) Overrides org. INTERNAL:
| |
| getSourceToTargetQueryKeyFieldAssociations | back to summary |
|---|---|
| public Vector PUBLIC: Return a collection of the field to query key associations. | |
| getSourceToTargetQueryKeyNames | back to summary |
|---|---|
| public Map INTERNAL: Returns the source keys to target keys fields association. | |
| getTypeField | back to summary |
|---|---|
| public DatabaseField getTypeField() | |
| getTypeFieldName | back to summary |
|---|---|
| public String getTypeFieldName() PUBLIC: This method returns the name of the typeField of the mapping. The type field is used to store the type of object the relationship is referencing. | |
| getTypeForImplementor | back to summary |
|---|---|
| protected Object getTypeForImplementor(Class<?> implementor) INTERNAL: Return the type for a specified implementor | |
| getTypeIndicatorNameTranslation | back to summary |
|---|---|
| public Map INTERNAL: Return the typeIndicatorName translation Used by the Mapping Workbench to avoid classpath dependencies | |
| getTypeIndicatorTranslation | back to summary |
|---|---|
| public Map INTERNAL: Return the type indicators. | |
| initialize | back to summary |
|---|---|
| public void initialize(AbstractSession session) Overrides org. INTERNAL: Initialize the mapping.
| |
| initializeForeignKeys | back to summary |
|---|---|
| protected void initializeForeignKeys(AbstractSession session) INTERNAL: The foreign key names and their primary keys are converted to DatabaseField and stored. | |
| initializeSelectionCriteria | back to summary |
|---|---|
| public void initializeSelectionCriteria(AbstractSession session) INTERNAL: Selection criteria is created with source foreign keys and target keys. This criteria is then used to read target records from the table. | |
| isRelationalMapping | back to summary |
|---|---|
| public boolean isRelationalMapping() Overrides org. INTERNAL:
| |
| isVariableOneToOneMapping | back to summary |
|---|---|
| public boolean isVariableOneToOneMapping() Overrides org. INTERNAL:
| |
| preInitialize | back to summary |
|---|---|
| public void preInitialize(AbstractSession session) throws DescriptorException Overrides org. INTERNAL: Set the type field classification through searching the indicators hashtable.
| |
| rehashFieldDependancies | back to summary |
|---|---|
| public void rehashFieldDependancies(AbstractSession session) Overrides org. INTERNAL: Rehash any maps based on fields. This is used to clone descriptors for aggregates, which hammer field names.
| |
| setClassIndicatorAssociations | back to summary |
|---|---|
| public void setClassIndicatorAssociations(Vector<E> classIndicatorAssociations) PUBLIC: Set the class indicator associations. | |
| setForeignKeyFieldNames | back to summary |
|---|---|
| public void setForeignKeyFieldNames(Vector<E> fieldNames) PUBLIC: Return the foreign key field names associated with the mapping. These are only the source fields that are writable. | |
| setForeignQueryKeyName | back to summary |
|---|---|
| public void setForeignQueryKeyName(String sourceForeignKeyFieldName, String targetQueryKeyName) PUBLIC: A foreign key from the source table and abstract query key from the interface descriptor are added to the mapping. This method is used if foreign key is not composite. | |
| setSourceToTargetQueryKeyFieldAssociations | back to summary |
|---|---|
| public void setSourceToTargetQueryKeyFieldAssociations(Vector<E> sourceToTargetQueryKeyFieldAssociations) PUBLIC: Set a collection of the source to target query key/field associations. | |
| setSourceToTargetQueryKeyFields | back to summary |
|---|---|
| protected void setSourceToTargetQueryKeyFields(Map<K, V> sourceToTargetQueryKeyNames) INTERNAL: Set the source keys to target keys fields association. | |
| setTypeField | back to summary |
|---|---|
| public void setTypeField(DatabaseField typeField) INTERNAL: This method set the typeField of the mapping to the parameter field | |
| setTypeFieldName | back to summary |
|---|---|
| public void setTypeFieldName(String typeFieldName) PUBLIC: This method sets the name of the typeField of the mapping. The type field is used to store the type of object the relationship is referencing. | |
| setTypeIndicatorNameTranslation | back to summary |
|---|---|
| protected void setTypeIndicatorNameTranslation(Map<K, V> translations) INTERNAL: For avoiding classpath dependencies on the Mapping Workbench | |
| setTypeIndicatorTranslation | back to summary |
|---|---|
| protected void setTypeIndicatorTranslation(Map<K, V> translations) INTERNAL: Set the typeIndicatorTranslations hashtable to the new Hashtable translations | |
| valueFromObject | back to summary |
|---|---|
| public Object valueFromObject(Object object, DatabaseField field, AbstractSession session) Overrides org. INTERNAL: Get a value from the object and set that in the respective field of the row.
| |
| valueFromRow | back to summary |
|---|---|
| public Object valueFromRow(AbstractRecord row, JoinedAttributeManager joinManager, ObjectBuildingQuery sourceQuery, CacheKey cacheKey, AbstractSession executionSession, boolean isTargetProtected, Boolean[] wasCacheUsed) throws DatabaseException Overrides org. INTERNAL: Return the value of the field from the row or a value holder on the query to obtain the object. Check for batch + aggregation reading.
| |
| writeFromNullObjectIntoRow | back to summary |
|---|---|
| protected void writeFromNullObjectIntoRow(AbstractRecord record) INTERNAL: Get a value from the object and set that in the respective field of the row. | |
| writeFromObjectIntoRow | back to summary |
|---|---|
| public void writeFromObjectIntoRow(Object object, AbstractRecord record, AbstractSession session, DatabaseMapping. Overrides org. INTERNAL: Get a value from the object and set that in the respective field of the row. If the mapping id target foreign key, you must only write the type into the roe, the rest will be updated when the object itself is written
| |
| writeFromObjectIntoRowForShallowInsert | back to summary |
|---|---|
| public void writeFromObjectIntoRowForShallowInsert(Object object, AbstractRecord record, AbstractSession session) Overrides org. INTERNAL: This row is built for shallow insert which happens in case of bidirectional inserts. The foreign keys must be set to null to avoid constraints.
| |
| writeFromObjectIntoRowForShallowInsertWithChangeRecord | back to summary |
|---|---|
| public void writeFromObjectIntoRowForShallowInsertWithChangeRecord(ChangeRecord changeRecord, AbstractRecord record, AbstractSession session) INTERNAL: This row is built for shallow insert which happens in case of bidirectional inserts. The foreign keys must be set to null to avoid constraints.
| |
| writeFromObjectIntoRowForUpdateAfterShallowInsert | back to summary |
|---|---|
| public void writeFromObjectIntoRowForUpdateAfterShallowInsert(Object object, AbstractRecord row, AbstractSession session, DatabaseTable table) Overrides org. INTERNAL: This row is built for update after shallow insert which happens in case of bidirectional inserts. It contains the foreign keys with non null values that were set to null for shallow insert. If mapping overrides writeFromObjectIntoRowForShallowInsert method it must override this one, too.
| |
| writeFromObjectIntoRowForWhereClause | back to summary |
|---|---|
| public void writeFromObjectIntoRowForWhereClause(ObjectLevelModifyQuery query, AbstractRecord record) Overrides org. INTERNAL: Get a value from the object and set that in the respective field of the row.
| |
| writeFromObjectIntoRowWithChangeRecord | back to summary |
|---|---|
| public void writeFromObjectIntoRowWithChangeRecord(ChangeRecord changeRecord, AbstractRecord record, AbstractSession session, DatabaseMapping. Overrides org. INTERNAL: Get a value from the object and set that in the respective field of the row. If the mapping id target foreign key, you must only write the type into the roe, the rest will be updated when the object itself is written
| |
| writeInsertFieldsIntoRow | back to summary |
|---|---|
| public void writeInsertFieldsIntoRow(AbstractRecord record, AbstractSession session) Overrides org. INTERNAL: Write fields needed for insert into the template for with null values.
| |