Module org.eclipse.persistence.core
Class XMLObjectBuilder
- java.lang.Object
-
- org.eclipse.persistence.internal.core.descriptors.CoreObjectBuilder<AbstractRecord,AbstractSession,DatabaseField,DatabaseMapping>
-
- org.eclipse.persistence.internal.descriptors.ObjectBuilder
-
- org.eclipse.persistence.internal.oxm.XMLObjectBuilder
-
- All Implemented Interfaces:
Serializable,Cloneable
- Direct Known Subclasses:
TreeObjectBuilder,XMLSequencedObjectBuilder
public class XMLObjectBuilder extends ObjectBuilder
INTERNAL:Purpose: Object-to-XML specific ObjectBuilder.
- Since:
- TopLink 10i, 03/31/2003 16:29:40
- Author:
- Rick Barkhouse - rick.barkhouse@oracle.com
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.eclipse.persistence.internal.descriptors.ObjectBuilder
batchFetchedAttributes, cloningMappings, descriptor, eagerMappings, fieldsMap, hasCacheIndexesInSopObject, hasInBatchFetchedAttribute, hasWrapperPolicy, isSimple, joinedAttributes, lockAttribute, mappingsByAttribute, mappingsByField, mayHaveNullInPrimaryKey, nonPrimaryKeyMappings, primaryKeyClassifications, primaryKeyExpression, primaryKeyMappings, readOnlyMappingsByField, relationshipMappings, sequenceMapping, shouldKeepRow
-
-
Constructor Summary
Constructors Constructor Description XMLObjectBuilder(ClassDescriptor descriptor)Create an XML object builder for the descriptor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected List<Namespace>addExtraNamespacesToNamespaceResolver(Descriptor desc, AbstractMarshalRecord marshalRecord, CoreAbstractSession session, boolean allowOverride, boolean ignoreEqualResolvers)voidaddNamespaceDeclarations(Document document)voidbuildAttributesIntoObject(Object domainObject, CacheKey cacheKey, AbstractRecord databaseRow, ObjectBuildingQuery query, JoinedAttributeManager joinManager, FetchGroup executionFetchGroup, boolean forRefresh, AbstractSession targetSession)Override method in superclass in order to set the session on the record.AbstractRecordbuildIntoNestedRow(AbstractRecord row, Object originalObject, Object object, AbstractSession session, Descriptor refDesc, Field xmlField, boolean wasXMLRoot)AbstractRecordbuildIntoNestedRow(AbstractRecord row, Object object, AbstractSession session)AbstractRecordbuildIntoNestedRow(AbstractRecord row, Object object, AbstractSession session, Descriptor refDesc, Field xmlField)ObjectbuildObject(ObjectBuildingQuery query, AbstractRecord databaseRow, JoinedAttributeManager joinManager)INTERNAL: Override the parent's buildObject to allow for the caching of aggregate objects in OX.AbstractRecordbuildRow(Object object, AbstractSession session, DatabaseField xmlField, XMLRecord parentRecord)Build the nested row into the parent dom.AbstractRecordbuildRow(AbstractRecord databaseRow, Object object, AbstractSession session)AbstractRecordbuildRow(AbstractRecord databaseRow, Object object, AbstractSession session, boolean wasXMLRoot)AbstractRecordcreateRecord(int size, AbstractSession session)Create a new row/record for the object builder.AbstractRecordcreateRecord(String rootName, String rootUri, AbstractSession session)Create a new row/record for the object builder with the given name and namespace resolver instead of the namespace resolver from the descriptor.AbstractMarshalRecordcreateRecord(String rootName, AbstractSession session)Create a new row/record for the object builder with the given name.AbstractMarshalRecordcreateRecord(String rootName, Node parent, AbstractSession session)Create a new row/record for the object builder with the given name.AbstractRecordcreateRecord(AbstractSession session)Create a new row/record for the object builder.AbstractRecordcreateRecordFor(Object attributeValue, Field xmlField, XMLRecord parentRecord, Mapping mapping)AbstractRecordcreateRecordFor(Object object, DocumentPreservationPolicy docPresPolicy)AbstractRecordcreateRecordFor(Object object, DocumentPreservationPolicy docPresPolicy, String rootName, String rootUri)protected AbstractRecordcreateRecordForPKExtraction(int size, AbstractSession session)Create a new row/record for the object builder.ObjectextractPrimaryKeyFromExpression(boolean requiresExactMatch, Expression expression, AbstractRecord translationRow, AbstractSession session)Override method in superclass in order to set the session on the record.ObjectextractPrimaryKeyFromObject(Object domainObject, AbstractSession session)Extract primary key attribute values from the domainObject.AbstractRecordextractPrimaryKeyRowFromExpression(Expression expression, AbstractRecord translationRow, AbstractSession session)Override method in superclass in order to set the session on the record.NamespaceResolvergetNamespaceResolver()voidinitialize(AbstractSession session)Cache all the mappings by their attribute and fields.protected booleanisXmlDescriptor()Indicates if the object builder's descriptor is an XMLDescriptor.booleanisXMLObjectBuilder()booleanisXsiTypeIndicatorField()voidsetDescriptor(ClassDescriptor aDescriptor)Set the descriptor.voidwriteExtraNamespaces(List extraNamespaces, XMLRecord xmlRecord)voidwriteOutMappings(XMLRecord row, Object object, AbstractSession session)-
Methods inherited from class org.eclipse.persistence.internal.descriptors.ObjectBuilder
addPrimaryKeyForNonDefaultTable, addPrimaryKeyForNonDefaultTable, assignReturnRow, assignReturnValueForField, assignReturnValueToMapping, assignSequenceNumber, assignSequenceNumber, assignSequenceNumber, assignSequenceNumber, buildAttributesIntoObjectSOP, buildAttributesIntoShallowObject, buildAttributesIntoWorkingCopyClone, buildAttributesIntoWorkingCopyCloneSOP, buildBackupClone, buildDeleteExpression, buildExpressionFromExample, buildNewInstance, buildObject, buildObject, buildObject, buildObjectFromResultSet, buildObjectInUnitOfWork, buildObjectsFromCursorInto, buildObjectsFromResultSetInto, buildObjectsInto, buildPrimaryKeyAttributesIntoObject, buildPrimaryKeyExpression, buildPrimaryKeyExpressionFromKeys, buildPrimaryKeyExpressionFromObject, buildProtectedObject, buildRow, buildRow, buildRowForShallowInsert, buildRowForShallowInsert, buildRowForTranslation, buildRowForUpdate, buildRowForUpdate, buildRowForUpdateAfterShallowInsert, buildRowForUpdateAfterShallowInsert, buildRowForUpdateBeforeShallowDelete, buildRowForUpdateBeforeShallowDelete, buildRowForUpdateWithChangeSet, buildRowForWhereClause, buildRowFromPrimaryKeyValues, buildRowWithChangeSet, buildTemplateInsertRow, buildTemplateInsertRow, buildTemplateUpdateRow, buildUpdateExpression, buildWorkingCopyCloneFromRow, buildWorkingCopyCloneNormally, cacheForeignKeyValues, cacheForeignKeyValues, cascadeDiscoverAndPersistUnregisteredNewObjects, cascadePerformRemove, cascadePerformRemovePrivateOwnedObjectFromChangeSet, cascadeRegisterNewForCreate, clearPrimaryKey, clone, compareForChange, compareObjects, copyInto, copyInto, copyObject, copyQueryInfoToCacheKey, createObjectChangeSet, createObjectChangeSet, createObjectChangeSet, createPrimaryKeyExpression, createRecordFromXMLContext, extractPrimaryKeyFromObject, extractPrimaryKeyFromRow, extractPrimaryKeyRowFromObject, extractRowFromExpression, extractValueFromObjectForField, fixObjectReferences, getBaseChangeRecordForField, getBaseMappingForField, getBaseValueForField, getBatchFetchedAttributes, getCloningMappings, getDescriptor, getEagerMappings, getFieldClassification, getFieldForQueryKeyName, getFieldsMap, getJoinedAttributes, getLockAttribute, getMappingForAttributeName, getMappingForField, getMappingsByAttribute, getMappingsByField, getNonPrimaryKeyMappings, getParentObjectForField, getPrimaryKeyClassifications, getPrimaryKeyExpression, getPrimaryKeyMappings, getReadOnlyMappingsByField, getReadOnlyMappingsForField, getRelationshipMappings, getSequenceMapping, getTargetFieldForQueryKeyName, hasBatchFetchedAttributes, hasCacheIndexesInSopObject, hasInBatchFetchedAttribute, hasJoinedAttributes, hasWrapperPolicy, initialize, initializeBatchFetchedAttributes, initializeJoinedAttributes, initializePrimaryKey, instantiateClone, instantiateEagerMappings, instantiateWorkingCopyClone, instantiateWorkingCopyCloneFromRow, isPrimaryKeyComponentInvalid, isPrimaryKeyExpression, isPrimaryKeyMapping, isSimple, iterate, load, loadAll, loadAll, loadBatchReadAttributes, loadJoinedAttributes, mergeChangesIntoObject, mergeChangesIntoObject, mergeIntoObject, mergeIntoObject, populateAttributesForClone, postBuildAttributesIntoObjectEvent, postBuildAttributesIntoWorkingCopyCloneEvent, postInitialize, recordPrivateOwnedRemovals, refreshObjectIfRequired, rehashFieldDependancies, setFieldsMap, setHasInBatchFetchedAttribute, setHasWrapperPolicy, setMappingsByAttribute, setMappingsByField, setNonPrimaryKeyMappings, setPrimaryKeyClassifications, setPrimaryKeyExpression, setPrimaryKeyMappings, setReadOnlyMappingsByField, setSequenceMapping, shouldKeepRow, toString, trimFieldsForInsert, unwrapObject, updateCachedAttributes, validate, verifyDelete, wrapObject, writeIntoRowFromPrimaryKeyValues
-
-
-
-
Constructor Detail
-
XMLObjectBuilder
public XMLObjectBuilder(ClassDescriptor descriptor)
Create an XML object builder for the descriptor.
-
-
Method Detail
-
buildRow
public AbstractRecord buildRow(Object object, AbstractSession session, DatabaseField xmlField, XMLRecord parentRecord)
Build the nested row into the parent dom.
-
createRecord
public AbstractRecord createRecord(AbstractSession session)
Create a new row/record for the object builder. This allows subclasses to define different record types.- Overrides:
createRecordin classObjectBuilder
-
createRecord
public AbstractRecord createRecord(int size, AbstractSession session)
Create a new row/record for the object builder. This allows subclasses to define different record types.- Overrides:
createRecordin classObjectBuilder
-
createRecord
public AbstractMarshalRecord createRecord(String rootName, AbstractSession session)
Create a new row/record for the object builder with the given name. This allows subclasses to define different record types.
-
createRecord
public AbstractRecord createRecord(String rootName, String rootUri, AbstractSession session)
Create a new row/record for the object builder with the given name and namespace resolver instead of the namespace resolver from the descriptor. This allows subclasses to define different record types.
-
createRecord
public AbstractMarshalRecord createRecord(String rootName, Node parent, AbstractSession session)
Create a new row/record for the object builder with the given name. This allows subclasses to define different record types.
-
createRecordFor
public AbstractRecord createRecordFor(Object attributeValue, Field xmlField, XMLRecord parentRecord, Mapping mapping)
-
createRecordFor
public AbstractRecord createRecordFor(Object object, DocumentPreservationPolicy docPresPolicy)
-
createRecordFor
public AbstractRecord createRecordFor(Object object, DocumentPreservationPolicy docPresPolicy, String rootName, String rootUri)
-
createRecordForPKExtraction
protected AbstractRecord createRecordForPKExtraction(int size, AbstractSession session)
Create a new row/record for the object builder. This allows subclasses to define different record types. This will typically be called when a record will be used for temporarily holding on to primary key fields.- Overrides:
createRecordForPKExtractionin classObjectBuilder
-
buildObject
public Object buildObject(ObjectBuildingQuery query, AbstractRecord databaseRow, JoinedAttributeManager joinManager) throws DatabaseException, QueryException
INTERNAL: Override the parent's buildObject to allow for the caching of aggregate objects in OX. By caching aggregates along with XML Nodes that they were created from, we are able to preserve the structure and unmapped content of the document that was used to create these objects.- Overrides:
buildObjectin classObjectBuilder- Throws:
DatabaseExceptionQueryException
-
buildRow
public AbstractRecord buildRow(AbstractRecord databaseRow, Object object, AbstractSession session)
-
buildRow
public AbstractRecord buildRow(AbstractRecord databaseRow, Object object, AbstractSession session, boolean wasXMLRoot)
-
writeOutMappings
public void writeOutMappings(XMLRecord row, Object object, AbstractSession session)
-
addNamespaceDeclarations
public void addNamespaceDeclarations(Document document)
-
buildAttributesIntoObject
public void buildAttributesIntoObject(Object domainObject, CacheKey cacheKey, AbstractRecord databaseRow, ObjectBuildingQuery query, JoinedAttributeManager joinManager, FetchGroup executionFetchGroup, boolean forRefresh, AbstractSession targetSession) throws DatabaseException
Override method in superclass in order to set the session on the record. Each mapping is recursed to assign values from the Record to the attributes in the domain object.- Overrides:
buildAttributesIntoObjectin classObjectBuilder- Throws:
DatabaseException
-
extractPrimaryKeyRowFromExpression
public AbstractRecord extractPrimaryKeyRowFromExpression(Expression expression, AbstractRecord translationRow, AbstractSession session)
Override method in superclass in order to set the session on the record. Return the row with primary keys and their values from the given expression.- Overrides:
extractPrimaryKeyRowFromExpressionin classObjectBuilder
-
extractPrimaryKeyFromExpression
public Object extractPrimaryKeyFromExpression(boolean requiresExactMatch, Expression expression, AbstractRecord translationRow, AbstractSession session)
Override method in superclass in order to set the session on the record. Return the row with primary keys and their values from the given expression.- Overrides:
extractPrimaryKeyFromExpressionin classObjectBuilder
-
extractPrimaryKeyFromObject
public Object extractPrimaryKeyFromObject(Object domainObject, AbstractSession session)
Description copied from class:ObjectBuilderExtract primary key attribute values from the domainObject.- Overrides:
extractPrimaryKeyFromObjectin classObjectBuilder
-
buildIntoNestedRow
public AbstractRecord buildIntoNestedRow(AbstractRecord row, Object object, AbstractSession session)
-
buildIntoNestedRow
public AbstractRecord buildIntoNestedRow(AbstractRecord row, Object object, AbstractSession session, Descriptor refDesc, Field xmlField)
-
buildIntoNestedRow
public AbstractRecord buildIntoNestedRow(AbstractRecord row, Object originalObject, Object object, AbstractSession session, Descriptor refDesc, Field xmlField, boolean wasXMLRoot)
-
getNamespaceResolver
public NamespaceResolver getNamespaceResolver()
-
isXmlDescriptor
protected boolean isXmlDescriptor()
Indicates if the object builder's descriptor is an XMLDescriptor. The value is lazily initialized.
-
setDescriptor
public void setDescriptor(ClassDescriptor aDescriptor)
Set the descriptor. This method is overridden so the isXMLDescriptor Boolean can be reset.- Overrides:
setDescriptorin classObjectBuilder
-
addExtraNamespacesToNamespaceResolver
protected List<Namespace> addExtraNamespacesToNamespaceResolver(Descriptor desc, AbstractMarshalRecord marshalRecord, CoreAbstractSession session, boolean allowOverride, boolean ignoreEqualResolvers)
-
initialize
public void initialize(AbstractSession session) throws DescriptorException
Description copied from class:ObjectBuilderCache all the mappings by their attribute and fields.- Overrides:
initializein classObjectBuilder- Throws:
DescriptorException
-
isXMLObjectBuilder
public boolean isXMLObjectBuilder()
- Overrides:
isXMLObjectBuilderin classObjectBuilder
-
isXsiTypeIndicatorField
public boolean isXsiTypeIndicatorField()
-
-