/** * Return all the fields mapped by the mapping. */ protected Vector collectFields() { if (isForeignKeyRelationship()) { if (this.getForeignKeyGroupingElement() != null) { Vector fields = new Vector(1); fields.addElement(this.getForeignKeyGroupingElement()); return fields; } else { return NO_FIELDS; } } else { return NO_FIELDS; } }
/** * Return all the fields mapped by the mapping. */ @Override protected Vector collectFields() { if (isForeignKeyRelationship()) { if (this.getForeignKeyGroupingElement() != null) { Vector fields = new Vector(1); fields.addElement(this.getForeignKeyGroupingElement()); return fields; } else { return NO_FIELDS; } } else { return NO_FIELDS; } }
/** * INTERNAL: * Compare the attributes belonging to this mapping for the objects. */ @Override public boolean compareObjects(Object object1, Object object2, AbstractSession session) { if (isForeignKeyRelationship()) { return (new EISOneToManyMappingHelper(this)).compareObjects(object1, object2, session); } return super.compareObjects(object1, object2, session); }
/** * INTERNAL: * If the mapping has a foreign key, it is order, so must use a different merge. */ @Override public void mergeIntoObject(Object target, boolean isTargetUnInitialized, Object source, MergeManager mergeManager, AbstractSession targetSession) { if (isForeignKeyRelationship()) { (new EISOneToManyMappingHelper(this)).mergeIntoObject(target, isTargetUnInitialized, source, mergeManager, targetSession); return; } super.mergeIntoObject(target, isTargetUnInitialized, source, mergeManager, targetSession); }
/** * INTERNAL: * Compare the attributes belonging to this mapping for the objects. */ public boolean compareObjects(Object object1, Object object2, AbstractSession session) { if (isForeignKeyRelationship()) { return (new EISOneToManyMappingHelper(this)).compareObjects(object1, object2, session); } return super.compareObjects(object1, object2, session); }
/** * INTERNAL: * Compare the attributes belonging to this mapping for the objects. */ @Override public boolean compareObjects(Object object1, Object object2, AbstractSession session) { if (isForeignKeyRelationship()) { return (new EISOneToManyMappingHelper(this)).compareObjects(object1, object2, session); } return super.compareObjects(object1, object2, session); }
/** * INTERNAL: * If the mapping has a foreign key, it is order, so must use a different merge. */ @Override public void mergeChangesIntoObject(Object target, ChangeRecord chgRecord, Object source, MergeManager mergeManager, AbstractSession targetSession) { if (isForeignKeyRelationship()) { (new EISOneToManyMappingHelper(this)).mergeChangesIntoObject(target, chgRecord, source, mergeManager, targetSession); return; } super.mergeChangesIntoObject(target, chgRecord, source, mergeManager, targetSession); }
/** * INTERNAL: * If the mapping has a foreign key, it is order, so must use a different merge. */ @Override public void mergeChangesIntoObject(Object target, ChangeRecord chgRecord, Object source, MergeManager mergeManager, AbstractSession targetSession) { if (isForeignKeyRelationship()) { (new EISOneToManyMappingHelper(this)).mergeChangesIntoObject(target, chgRecord, source, mergeManager, targetSession); return; } super.mergeChangesIntoObject(target, chgRecord, source, mergeManager, targetSession); }
/** * INTERNAL: * If the mapping has a foreign key, it is order, so must use a different merge. */ @Override public void mergeIntoObject(Object target, boolean isTargetUnInitialized, Object source, MergeManager mergeManager, AbstractSession targetSession) { if (isForeignKeyRelationship()) { (new EISOneToManyMappingHelper(this)).mergeIntoObject(target, isTargetUnInitialized, source, mergeManager, targetSession); return; } super.mergeIntoObject(target, isTargetUnInitialized, source, mergeManager, targetSession); }
/** * INTERNAL: * Get the appropriate attribute value from the object * and put it in the appropriate field of the database row. * Loop through the reference objects and extract the * primary keys and put them in the vector of "nested" rows. */ public void writeFromObjectIntoRowWithChangeRecord(ChangeRecord changeRecord, AbstractRecord row, AbstractSession session) { if (isForeignKeyRelationship()) { Object object = ((ObjectChangeSet)changeRecord.getOwner()).getUnitOfWorkClone(); this.writeFromObjectIntoRow(object, row, session); } else { super.writeFromObjectIntoRowWithChangeRecord(changeRecord, row, session); } }
/** * INTERNAL: * Get the appropriate attribute value from the object * and put it in the appropriate field of the database row. * Loop through the reference objects and extract the * primary keys and put them in the vector of "nested" rows. */ @Override public void writeFromObjectIntoRowWithChangeRecord(ChangeRecord changeRecord, AbstractRecord row, AbstractSession session, WriteType writeType) { if (isForeignKeyRelationship()) { Object object = ((ObjectChangeSet)changeRecord.getOwner()).getUnitOfWorkClone(); this.writeFromObjectIntoRow(object, row, session, writeType); } else { super.writeFromObjectIntoRowWithChangeRecord(changeRecord, row, session, writeType); } }
/** * INTERNAL: * Get the appropriate attribute value from the object * and put it in the appropriate field of the database row. * Loop through the reference objects and extract the * primary keys and put them in the vector of "nested" rows. */ @Override public void writeFromObjectIntoRowWithChangeRecord(ChangeRecord changeRecord, AbstractRecord row, AbstractSession session, WriteType writeType) { if (isForeignKeyRelationship()) { Object object = ((ObjectChangeSet)changeRecord.getOwner()).getUnitOfWorkClone(); this.writeFromObjectIntoRow(object, row, session, writeType); } else { super.writeFromObjectIntoRowWithChangeRecord(changeRecord, row, session, writeType); } }
/** * INTERNAL: * Write fields needed for insert into the template for with null values. */ public void writeInsertFieldsIntoRow(AbstractRecord row, AbstractSession session) { if (isForeignKeyRelationship() && !isReadOnly()) { if (getForeignKeyGroupingElement() != null) { row.put(getForeignKeyGroupingElement(), null); } else if (this.getSourceForeignKeyFields().size() > 0) { row.put(getSourceForeignKeyFields().get(0), null); } } else { super.writeInsertFieldsIntoRow(row, session); } }
/** * INTERNAL: * Write fields needed for insert into the template for with null values. */ @Override public void writeInsertFieldsIntoRow(AbstractRecord row, AbstractSession session) { if (isForeignKeyRelationship() && !isReadOnly()) { if (getForeignKeyGroupingElement() != null) { row.put(getForeignKeyGroupingElement(), null); } else if (this.getSourceForeignKeyFields().size() > 0) { row.put(getSourceForeignKeyFields().get(0), null); } } else { super.writeInsertFieldsIntoRow(row, 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. */ public void writeFromObjectIntoRowForShallowInsert(Object object, AbstractRecord row, AbstractSession session) { if (isForeignKeyRelationship() && !isReadOnly()) { if (getForeignKeyGroupingElement() != null) { row.put(getForeignKeyGroupingElement(), null); } else if (this.getSourceForeignKeyFields().size() > 0) { row.put(getSourceForeignKeyFields().get(0), null); } } else { super.writeFromObjectIntoRowForShallowInsert(object, row, 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. */ @Override public void writeFromObjectIntoRowForShallowInsert(Object object, AbstractRecord row, AbstractSession session) { if (isForeignKeyRelationship() && !isReadOnly()) { if (getForeignKeyGroupingElement() != null) { row.put(getForeignKeyGroupingElement(), null); } else if (this.getSourceForeignKeyFields().size() > 0) { row.put(getSourceForeignKeyFields().get(0), null); } } else { super.writeFromObjectIntoRowForShallowInsert(object, row, session); } }
/** * INTERNAL: * Write fields needed for insert into the template for with null values. */ @Override public void writeInsertFieldsIntoRow(AbstractRecord row, AbstractSession session) { if (isForeignKeyRelationship() && !isReadOnly()) { if (getForeignKeyGroupingElement() != null) { row.put(getForeignKeyGroupingElement(), null); } else if (this.getSourceForeignKeyFields().size() > 0) { row.put(getSourceForeignKeyFields().get(0), null); } } else { super.writeInsertFieldsIntoRow(row, 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. */ public void writeFromObjectIntoRowForShallowInsertWithChangeRecord(ChangeRecord changeRecord, AbstractRecord row, AbstractSession session) { if (isForeignKeyRelationship() && !isReadOnly()) { if (getForeignKeyGroupingElement() != null) { row.put(getForeignKeyGroupingElement(), null); } else if (this.getSourceForeignKeyFields().size() > 0) { row.put(getSourceForeignKeyFields().get(0), null); } } else { super.writeFromObjectIntoRowForShallowInsertWithChangeRecord(changeRecord, row, session); } }
/** * INTERNAL: * Compare the changes between two collections. Element comparisons are * made using identity and, when appropriate, the value of the element's key * for the Map container. */ @Override public ChangeRecord compareForChange(Object clone, Object backup, ObjectChangeSet owner, AbstractSession session) { if (isForeignKeyRelationship()) { if ((this.getAttributeValueFromObject(clone) != null) && (!this.isAttributeValueInstantiatedOrChanged(clone))) { return null;// never instantiated - no changes to report } return (new EISOneToManyMappingHelper(this)).compareForChange(clone, backup, owner, session); } else { return super.compareForChange(clone, backup, owner, session); } }
/** * INTERNAL: * Compare the changes between two collections. Element comparisons are * made using identity and, when appropriate, the value of the element's key * for the Map container. */ public ChangeRecord compareForChange(Object clone, Object backup, ObjectChangeSet owner, AbstractSession session) { if (isForeignKeyRelationship()) { if ((this.getAttributeValueFromObject(clone) != null) && (!this.isAttributeValueInstantiatedOrChanged(clone))) { return null;// never instantiated - no changes to report } return (new EISOneToManyMappingHelper(this)).compareForChange(clone, backup, owner, session); } else { return super.compareForChange(clone, backup, owner, session); } }