/** * Return the fields mapped by the mapping. */ protected Vector collectFields() { Vector fields = new Vector(1); fields.addElement(this.getField()); return fields; }
/** * Return the fields mapped by the mapping. */ protected Vector collectFields() { Vector fields = new Vector(1); fields.addElement(this.getField()); return fields; }
/** * Return the fields mapped by the mapping. */ protected Vector collectFields() { Vector fields = new Vector(1); fields.addElement(this.getField()); return fields; }
/** * INTERNAL: * Write fields needed for insert into the template for with null values. */ public void writeInsertFieldsIntoRow(AbstractRecord record, AbstractSession session) { if (this.isReadOnly()) { return; } record.put(this.getField(), null); } }
/** * INTERNAL: * Write fields needed for insert into the template for with null values. */ public void writeInsertFieldsIntoRow(AbstractRecord record, AbstractSession session) { if (this.isReadOnly()) { return; } record.put(this.getField(), null); } }
/** * INTERNAL: * Write fields needed for insert into the template for with null values. */ public void writeInsertFieldsIntoRow(AbstractRecord record, AbstractSession session) { if (this.isReadOnly()) { return; } record.put(this.getField(), null); }
/** * INTERNAL: * Build the value for the database field and put it in the * specified database row. */ public void writeFromObjectIntoRow(Object object, AbstractRecord record, AbstractSession session) throws DescriptorException { if (this.isReadOnly()) { return; } Object attributeValue = this.getAttributeValueFromObject(object); if(getConverter() != null) { getConverter().convertObjectValueToDataValue(attributeValue, session); } if (attributeValue == null) { record.put(this.getField(), null); } else { Object fieldValue = buildCompositeRow(attributeValue, session, record); record.put(this.getField(), fieldValue); } }
/** * INTERNAL: * Build the value for the database field and put it in the * specified database row. */ @Override public void writeFromObjectIntoRow(Object object, AbstractRecord record, AbstractSession session, WriteType writeType) throws DescriptorException { if (this.isReadOnly()) { return; } Object attributeValue = this.getAttributeValueFromObject(object); if(getConverter() != null) { getConverter().convertObjectValueToDataValue(attributeValue, session); } if (attributeValue == null) { record.put(this.getField(), null); } else { Object fieldValue = buildCompositeRow(attributeValue, session, record, writeType); record.put(this.getField(), fieldValue); } }
/** * INTERNAL: * Build the value for the database field and put it in the * specified database row. */ @Override public void writeFromObjectIntoRow(Object object, AbstractRecord record, AbstractSession session, WriteType writeType) throws DescriptorException { if (this.isReadOnly()) { return; } Object attributeValue = this.getAttributeValueFromObject(object); if(getConverter() != null) { getConverter().convertObjectValueToDataValue(attributeValue, session); } if (attributeValue == null) { record.put(this.getField(), null); } else { Object fieldValue = buildCompositeRow(attributeValue, session, record, writeType); record.put(this.getField(), fieldValue); } }
/** * INTERNAL: * Initialize the mapping. */ public void initialize(AbstractSession session) throws DescriptorException { super.initialize(session); if (getField() == null) { throw DescriptorException.fieldNameNotSetInMapping(this); } setField(getDescriptor().buildField(getField())); setFields(collectFields()); // initialize the converter - if necessary if (hasConverter()) { getConverter().initialize(this, session); } }
/** * INTERNAL: * Initialize the mapping. */ public void initialize(AbstractSession session) throws DescriptorException { super.initialize(session); if (getField() == null) { throw DescriptorException.fieldNameNotSetInMapping(this); } setField(getDescriptor().buildField(getField())); setFields(collectFields()); // initialize the converter - if necessary if (hasConverter()) { getConverter().initialize(this, session); } }
/** * INTERNAL: * Initialize the mapping. */ public void initialize(AbstractSession session) throws DescriptorException { super.initialize(session); if (getField() == null) { throw DescriptorException.fieldNameNotSetInMapping(this); } setField(getDescriptor().buildField(getField())); setFields(collectFields()); // initialize the converter - if necessary if (hasConverter()) { getConverter().initialize(this, session); } }
/** * INTERNAL: * Builds a shallow original object. Only direct attributes and primary * keys are populated. In this way the minimum original required for * instantiating a working copy clone can be built without placing it in * the shared cache (no concern over cycles). */ public void buildShallowOriginalFromRow(AbstractRecord row, Object original, JoinedAttributeManager joinManager, ObjectBuildingQuery sourceQuery, AbstractSession executionSession) { Object fieldValue = row.get(this.getField()); // BUG#2667762 there could be whitespace in the row instead of null if ((fieldValue == null) || (fieldValue instanceof String)) { return; } // pretty sure we can ignore inheritance here: AbstractRecord nestedRow = this.getReferenceDescriptor().buildNestedRowFromFieldValue(fieldValue); ClassDescriptor descriptor = this.getReferenceDescriptor(); if (descriptor.hasInheritance()) { Class nestedElementClass = descriptor.getInheritancePolicy().classFromRow(nestedRow, executionSession); descriptor = this.getReferenceDescriptor(nestedElementClass, executionSession); } ObjectBuilder objectBuilder = descriptor.getObjectBuilder(); // instead of calling buildCompositeObject, which calls either objectBuilder. // buildObject or buildNewInstance and buildAttributesIntoObject, do the // following always. Since shallow original no concern over cycles or caching. Object element = objectBuilder.buildNewInstance(); objectBuilder.buildAttributesIntoShallowObject(element, nestedRow, sourceQuery); setAttributeValueInObject(original, element); }
/** * INTERNAL: * Builds a shallow original object. Only direct attributes and primary * keys are populated. In this way the minimum original required for * instantiating a working copy clone can be built without placing it in * the shared cache (no concern over cycles). */ public void buildShallowOriginalFromRow(AbstractRecord row, Object original, JoinedAttributeManager joinManager, ObjectBuildingQuery sourceQuery, AbstractSession executionSession) { Object fieldValue = row.get(this.getField()); // BUG#2667762 there could be whitespace in the row instead of null if ((fieldValue == null) || (fieldValue instanceof String)) { return; } // pretty sure we can ignore inheritance here: AbstractRecord nestedRow = this.getReferenceDescriptor().buildNestedRowFromFieldValue(fieldValue); ClassDescriptor descriptor = this.getReferenceDescriptor(); if (descriptor.hasInheritance()) { Class nestedElementClass = descriptor.getInheritancePolicy().classFromRow(nestedRow, executionSession); descriptor = this.getReferenceDescriptor(nestedElementClass, executionSession); } ObjectBuilder objectBuilder = descriptor.getObjectBuilder(); // instead of calling buildCompositeObject, which calls either objectBuilder. // buildObject or buildNewInstance and buildAttributesIntoObject, do the // following always. Since shallow original no concern over cycles or caching. Object element = objectBuilder.buildNewInstance(); objectBuilder.buildAttributesIntoShallowObject(element, nestedRow, sourceQuery); setAttributeValueInObject(original, element); }
/** * INTERNAL: * Builds a shallow original object. Only direct attributes and primary * keys are populated. In this way the minimum original required for * instantiating a working copy clone can be built without placing it in * the shared cache (no concern over cycles). */ public void buildShallowOriginalFromRow(AbstractRecord row, Object original, JoinedAttributeManager joinManager, ObjectBuildingQuery sourceQuery, AbstractSession executionSession) { Object fieldValue = row.get(this.getField()); // BUG#2667762 there could be whitespace in the row instead of null if ((fieldValue == null) || (fieldValue instanceof String)) { return; } // pretty sure we can ignore inheritance here: AbstractRecord nestedRow = this.getReferenceDescriptor().buildNestedRowFromFieldValue(fieldValue); ClassDescriptor descriptor = this.getReferenceDescriptor(); if (descriptor.hasInheritance()) { Class nestedElementClass = descriptor.getInheritancePolicy().classFromRow(nestedRow, executionSession); descriptor = this.getReferenceDescriptor(nestedElementClass, executionSession); } ObjectBuilder objectBuilder = descriptor.getObjectBuilder(); // instead of calling buildCompositeObject, which calls either objectBuilder. // buildObject or buildNewInstance and buildAttributesIntoObject, do the // following always. Since shallow original no concern over cycles or caching. Object element = objectBuilder.buildNewInstance(); objectBuilder.buildAttributesIntoShallowObject(element, nestedRow, sourceQuery); setAttributeValueInObject(original, element); }
/** * INTERNAL: * Extract and return the aggregate object from * the specified row. */ public Object valueFromRow(AbstractRecord row, JoinedAttributeManager joinManager, ObjectBuildingQuery sourceQuery, AbstractSession executionSession) throws DatabaseException { Object fieldValue = row.get(this.getField()); // BUG#2667762 there could be whitespace in the row instead of null if ((fieldValue == null) || (fieldValue instanceof String)) { return null; } // pretty sure we can ignore inheritance here: AbstractRecord nestedRow = this.getReferenceDescriptor().buildNestedRowFromFieldValue(fieldValue); ClassDescriptor descriptor = this.getReferenceDescriptor(); if (descriptor.hasInheritance()) { Class nestedElementClass = descriptor.getInheritancePolicy().classFromRow(nestedRow, executionSession); descriptor = this.getReferenceDescriptor(nestedElementClass, executionSession); } ObjectBuilder objectBuilder = descriptor.getObjectBuilder(); Object toReturn = buildCompositeObject(objectBuilder, nestedRow, sourceQuery, joinManager); if(getConverter() != null) { toReturn = getConverter().convertDataValueToObjectValue(toReturn, executionSession); } return buildCompositeObject(objectBuilder, nestedRow, sourceQuery, joinManager); }
queryKeyExpression = (QueryKeyExpression)queryKeyExpression.getBaseExpression(); if (queryKeyExpression.getMapping().isAbstractCompositeObjectMapping()) { name = ((AbstractCompositeObjectMapping)queryKeyExpression.getMapping()).getField().getName() + "." + name; } else if (queryKeyExpression.getMapping().isAbstractCompositeCollectionMapping()) { name = ((AbstractCompositeCollectionMapping)queryKeyExpression.getMapping()).getField().getName() + "." + name;