/** * INTERNAL: * Return a Map of any foreign keys defined within the the MapKey * @return */ public Map<DatabaseField, DatabaseField> getForeignKeyFieldsForMapKey(){ return getSourceToTargetKeyFields(); }
/** * INTERNAL: * Return a Map of any foreign keys defined within the the MapKey * @return */ public Map<DatabaseField, DatabaseField> getForeignKeyFieldsForMapKey(){ return getSourceToTargetKeyFields(); }
/** * INTERNAL: * Return a Map of any foreign keys defined within the the MapKey * @return */ public Map<DatabaseField, DatabaseField> getForeignKeyFieldsForMapKey(){ return getSourceToTargetKeyFields(); }
/** * INTERNAL: * Return source key fields for translation by an AggregateObjectMapping */ @Override public Collection getFieldsForTranslationInAggregate() { return getSourceToTargetKeyFields().keySet(); }
/** * INTERNAL: * Return source key fields for translation by an AggregateObjectMapping */ @Override public Collection getFieldsForTranslationInAggregate() { return getSourceToTargetKeyFields().keySet(); }
public Object getAttributeValueFromObject(Object object) { Map sourceToTargetKeyFields = ((OneToOneMapping)object).getSourceToTargetKeyFields(); List associations = new ArrayList(sourceToTargetKeyFields.size()); Iterator iterator = sourceToTargetKeyFields.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry entry = (Map.Entry)iterator.next(); associations.add(new Association(entry.getKey(), entry.getValue())); } return associations; }
public Object getAttributeValueFromObject(Object object) { Map sourceToTargetKeyFields = ((OneToOneMapping)object).getSourceToTargetKeyFields(); List associations = new ArrayList(sourceToTargetKeyFields.size()); Iterator iterator = sourceToTargetKeyFields.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry entry = (Map.Entry)iterator.next(); associations.add(new Association(entry.getKey(), entry.getValue())); } return associations; }
@Override public Object getAttributeValueFromObject(Object object) { Map sourceToTargetKeyFields = ((OneToOneMapping)object).getSourceToTargetKeyFields(); List associations = new ArrayList(sourceToTargetKeyFields.size()); Iterator iterator = sourceToTargetKeyFields.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry entry = (Map.Entry)iterator.next(); associations.add(new Association(entry.getKey(), entry.getValue())); } return associations; }
/** * Return the appropriate map that maps the "foreign keys" * to the "primary keys". */ protected Map getForeignKeysToPrimaryKeys() { if (this.isForeignKeyRelationship()) { return this.getSourceToTargetKeyFields(); } else { return this.getTargetToSourceKeyFields(); } }
/** * Return the appropriate hashtable that maps the "foreign keys" * to the "primary keys". */ protected Map getForeignKeysToPrimaryKeys() { if (this.isForeignKeyRelationship()) { return this.getSourceToTargetKeyFields(); } else { return this.getTargetToSourceKeyFields(); } }
private void addForeignKeyFieldToSourceTargetTable(OneToOneMapping mapping) { if (!mapping.isForeignKeyRelationship()) { return; } addForeignMappingFkConstraint(mapping.getSourceToTargetKeyFields()); }
/** * Return the appropriate map that maps the "foreign keys" * to the "primary keys". */ protected Map getForeignKeysToPrimaryKeys() { if (this.isForeignKeyRelationship()) { return this.getSourceToTargetKeyFields(); } else { return this.getTargetToSourceKeyFields(); } }
/** * INTERNAL: * Rehash any map based on fields. * This is used to clone descriptors for aggregates, which hammer field names, * it is probably better not to hammer the field name and this should be refactored. */ public void rehashFieldDependancies(AbstractSession session) { setSourceToTargetKeyFields(Helper.rehashMap(getSourceToTargetKeyFields())); }
public void setAttributeValueInObject(Object object, Object value) { OneToOneMapping mapping = (OneToOneMapping)object; List associations = (List)value; mapping.setSourceToTargetKeyFields(new HashMap(associations.size() + 1)); mapping.setTargetToSourceKeyFields(new HashMap(associations.size() + 1)); Iterator iterator = associations.iterator(); while (iterator.hasNext()) { Association association = (Association)iterator.next(); mapping.getSourceToTargetKeyFields().put((DatabaseField)association.getKey(), (DatabaseField)association.getValue()); mapping.getTargetToSourceKeyFields().put((DatabaseField)association.getValue(), (DatabaseField)association.getKey()); } } });
/** * INTERNAL: * Need to set the field type for the foreign key fields for a map key, as the fields are not contained in any descriptor. */ public void postInitializeMapKey(MappedKeyMapContainerPolicy policy) { for (DatabaseField foreignKey : getSourceToTargetKeyFields().keySet()) { if (foreignKey.getType() == null) { foreignKey.setType(getFieldClassification(foreignKey)); } } }
/** * INTERNAL: * Extract the fields for the Map key from the object to use in a query */ public Map extractIdentityFieldsForQuery(Object object, AbstractSession session){ Map keyFields = new HashMap(); for (int index = 0; index < getForeignKeyFields().size(); index++) { DatabaseField targetRelationField = getForeignKeyFields().elementAt(index); DatabaseField targetKey = getSourceToTargetKeyFields().get(targetRelationField); Object value = getReferenceDescriptor().getObjectBuilder().extractValueFromObjectForField(object, targetKey, session); keyFields.put(targetRelationField, value); } return keyFields; }
/** * INTERNAL: * Need to set the field type for the foreign key fields for a map key, as the fields are not contained in any descriptor. */ public void postInitializeMapKey(MappedKeyMapContainerPolicy policy) { for (DatabaseField foreignKey : getSourceToTargetKeyFields().keySet()) { if (foreignKey.getType() == null) { foreignKey.setType(getFieldClassification(foreignKey)); } } }
/** * INTERNAL: * Prepare a cascade locking policy. */ @Override public void prepareCascadeLockingPolicy() { CascadeLockingPolicy policy = new CascadeLockingPolicy(getDescriptor(), getReferenceDescriptor()); policy.setQueryKeyFields(getSourceToTargetKeyFields(), ! isForeignKeyRelationship()); getReferenceDescriptor().addCascadeLockingPolicy(policy); }
/** * INTERNAL: * Prepare a cascade locking policy. */ @Override public void prepareCascadeLockingPolicy() { CascadeLockingPolicy policy = new CascadeLockingPolicy(getDescriptor(), getReferenceDescriptor()); policy.setQueryKeyFields(getSourceToTargetKeyFields(), ! isForeignKeyRelationship()); getReferenceDescriptor().addCascadeLockingPolicy(policy); }
/** * INTERNAL: * Prepare a cascade locking policy. */ public void prepareCascadeLockingPolicy() { CascadeLockingPolicy policy = new CascadeLockingPolicy(getDescriptor(), getReferenceDescriptor()); policy.setQueryKeyFields(getSourceToTargetKeyFields(), ! isForeignKeyRelationship()); getReferenceDescriptor().addCascadeLockingPolicy(policy); }