Class XMLBinaryDataCollectionMapping
- All Implemented Interfaces:
Serializable,Cloneable,org.eclipse.persistence.internal.oxm.mappings.BinaryDataCollectionMapping<org.eclipse.persistence.internal.sessions.AbstractSession,,AttributeAccessor, org.eclipse.persistence.internal.queries.ContainerPolicy, Converter, ClassDescriptor, org.eclipse.persistence.internal.helper.DatabaseField, XMLMarshaller, MimeTypePolicy, Session, XMLUnmarshaller, XMLRecord> org.eclipse.persistence.internal.oxm.mappings.DirectCollectionMapping<org.eclipse.persistence.internal.sessions.AbstractSession,,AttributeAccessor, org.eclipse.persistence.internal.queries.ContainerPolicy, Converter, ClassDescriptor, org.eclipse.persistence.internal.helper.DatabaseField, XMLMarshaller, Session, XMLUnmarshaller, XMLRecord> org.eclipse.persistence.internal.oxm.mappings.Mapping<org.eclipse.persistence.internal.sessions.AbstractSession,,AttributeAccessor, org.eclipse.persistence.internal.queries.ContainerPolicy, ClassDescriptor, org.eclipse.persistence.internal.helper.DatabaseField, XMLRecord> org.eclipse.persistence.internal.oxm.mappings.XMLContainerMapping,org.eclipse.persistence.internal.oxm.mappings.XMLConverterMapping<XMLMarshaller,,Session, XMLUnmarshaller> ContainerMapping,ArrayCollectionMapping,XMLMapping,XMLNillableMapping
Purpose:Provide a mapping for a collection of binary data values that can be treated as either inline binary values or as an attachment.
Responsibilities:
- Handle converting binary types (byte[], Image etc) to base64
- Make callbacks to AttachmentMarshaller/AttachmentUnmarshaller
- Write out approriate attachment information (xop:include)
XMLBinaryDataCollectionMapping represents a mapping of a collection of binary data in the object model to XML. This can either be written directly as inline binary data (base64) or passed through as an MTOM or SWAREF attachment.
The following types are allowable to be mapped using an XMLBinaryDataMapping:
- java.awt.Image
- byte[]
- jakarta.activation.DataHandler
- javax.xml.transform.Source
- jakarta.mail.internet.MimeMultipart
Setting the XPath: TopLink XML mappings make use of XPath statements to find the relevant
data in an XML document. The XPath statement is relative to the context node specified in the descriptor.
The XPath may contain path and positional information; the last node in the XPath forms the local
node for the binary mapping. The XPath is specified on the mapping using the setXPath
method.
Inline Binary Data: Set this flag if you want to always inline binary data for this mapping. This will disable consideration for attachment handling for this mapping.
SwaRef: Set this flag in order to specify that the target node of this mapping is of type xs:swaref
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.persistence.mappings.DatabaseMapping
DatabaseMapping.WriteType -
Field Summary
Fields inherited from class org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping
nullValue, reuseContainerFields inherited from class org.eclipse.persistence.mappings.foundation.AbstractCompositeDirectCollectionMapping
elementDataTypeName, field, valueConverterFields inherited from class org.eclipse.persistence.mappings.DatabaseMapping
attributeAccessor, attributeName, derivedIdMapping, derivesId, descriptor, fields, isCacheable, isInSopObject, isJPAId, isLazy, isMapKeyMapping, isOptional, isPrimaryKeyMapping, isReadOnly, isRemotelyInitialized, mapsIdValue, NO_FIELDS, NO_WEIGHT, properties, unconvertedProperties, weight, WEIGHT_AGGREGATE, WEIGHT_DIRECT, WEIGHT_TO_ONE, WEIGHT_TRANSFORMFields inherited from interface org.eclipse.persistence.internal.oxm.mappings.XMLContainerMapping
EMPTY_CONTAINER_DEFAULT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionPUBLIC: Return the class each element in the object's collection should be converted to, before the collection is inserted into the object.INTERNALgetMimeType(Object anObject) INTERNALgetValueToWrite(Object value, Object parent, XMLRecord record, XMLField field, XMLField includeField, org.eclipse.persistence.internal.sessions.AbstractSession session) booleanINTERNAL:booleanisSwaRef()voidsetAttributeElementClass(Class attributeElementClass) PUBLIC: Set the class each element in the object's collection should be converted to, before the collection is inserted into the object.voidsetCollectionContentType(Class javaClass) voidsetMimeType(String mimeTypeString) Force mapping to set default FixedMimeTypePolicy using the MimeType string as argumentvoidsetMimeTypePolicy(MimeTypePolicy mimeTypePolicy) Allow implementer to set the MimeTypePolicy class FixedMimeTypePolicy or AttributeMimeTypePolicy (dynamic)voidsetShouldInlineBinaryData(boolean b) voidsetSwaRef(boolean swaRef) voidSet the Mapping field name attribute to the given XPath StringbooleanvalueFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager, ObjectBuildingQuery query, org.eclipse.persistence.internal.identitymaps.CacheKey cacheKey, org.eclipse.persistence.internal.sessions.AbstractSession executionSession, boolean isTargetProtected, Boolean[] wasCacheUsed) INTERNAL: Build the nested collection from the database row.voidwriteFromObjectIntoRow(Object object, org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.sessions.AbstractSession session, DatabaseMapping.WriteType writeType) INTERNAL:voidwriteSingleValue(Object value, Object parent, XMLRecord record, org.eclipse.persistence.internal.sessions.AbstractSession session) INTERNAL: A method that marshals a single value to the provided Record based on this mapping's XPath.Methods inherited from class org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping
convertDataValueToObjectValue, convertObjectValueToDataValue, getNullPolicy, getNullValue, getReuseContainer, getWrapperNullPolicy, getXPath, initialize, isCDATA, isCollapsingStringValues, isDefaultEmptyContainer, isNormalizingStringValues, isWriteOnly, isXMLMapping, preInitialize, setAttributeValueInObject, setCollapsingStringValues, setDefaultEmptyContainer, setIsCDATA, setIsWriteOnly, setNormalizingStringValues, setNullPolicy, setNullValue, setReuseContainer, setWrapperNullPolicy, useCollectionClassNameMethods inherited from class org.eclipse.persistence.mappings.foundation.AbstractCompositeDirectCollectionMapping
buildAddedElementFromChangeSet, buildBackupClone, buildChangeSet, buildClone, buildCloneFromRow, buildClonePart, buildCopy, buildElementFromChangeSet, buildElementFromElement, buildRemovedElementFromChangeSet, cascadePerformRemoveIfRequired, cascadeRegisterNewIfRequired, collectFields, compareElements, compareElementsForChange, compareForChange, compareObjects, convertClassNamesToClasses, convertToChangeRecord, createMapComponentFromRow, fixObjectReferences, getContainerPolicy, getField, getFieldClassification, getFieldElementClass, getFieldName, getRealCollectionAttributeValueFromObject, getValueConverter, hasValueConverter, isCollectionMapping, iterate, mapKeyHasChanged, mergeChangesIntoObject, mergeIntoObject, setAttributeElementClassName, setContainerPolicy, setField, setFieldElementClass, setUsesSingleNode, setValueConverter, simpleAddToCollectionChangeRecord, simpleRemoveFromCollectionChangeRecord, useCollectionClass, useListClassName, useMapClass, useMapClassName, usesSingleNode, writeFromObjectIntoRowForUpdate, writeFromObjectIntoRowWithChangeRecord, writeInsertFieldsIntoRowMethods inherited from class org.eclipse.persistence.mappings.DatabaseMapping
addUnconvertedProperty, buildBackupCloneForPartObject, buildChangeRecord, buildCloneForPartObject, buildContainerClone, buildExpression, buildObjectJoinExpression, buildObjectJoinExpression, buildShallowOriginalFromRow, calculateDeferredChanges, cascadeDiscoverAndPersistUnregisteredNewObjects, cascadePerformRemovePrivateOwnedObjectFromChangeSetIfRequired, clone, cloneFields, collectQueryParameters, convertConverterClassNamesToClasses, createCloneValueHolder, derivesId, earlyPreDelete, extractNestedExpressions, extractNestedNonAggregateExpressions, fixRealObjectReferences, getAttributeAccessor, getAttributeClassification, getAttributeName, getAttributeValueFromObject, getDerivedIdMapping, getDescriptor, getFields, getGetMethodName, getMapsIdValue, getObjectCorrespondingTo, getOrderByNormalizedExpressions, getProperties, getProperty, getRealAttributeValueFromAttribute, getRealAttributeValueFromObject, getReferenceDescriptor, getRelationshipPartner, getSelectFields, getSelectTables, getSetMethodName, getUnconvertedProperties, getValueFromRemoteValueHolder, getWeight, hasConstraintDependency, hasDependency, hasInverseConstraintDependency, hasMapsIdValue, hasNestedIdentityReference, hasRootExpressionThatShouldUseOuterJoin, hasUnconvertedProperties, instantiateAttribute, isAbstractColumnMapping, isAbstractCompositeCollectionMapping, isAbstractCompositeObjectMapping, isAbstractDirectMapping, isAggregateCollectionMapping, isAggregateMapping, isAggregateObjectMapping, isAttributeValueFromObjectInstantiated, isCacheable, isCandidateForPrivateOwnedRemoval, isCascadedLockingSupported, isChangeTrackingSupported, isCloningRequired, isDatabaseMapping, isDirectCollectionMapping, isDirectMapMapping, isDirectToFieldMapping, isDirectToXMLTypeMapping, isEISMapping, isElementCollectionMapping, isForeignReferenceMapping, isInAndOutSopObject, isInOnlySopObject, isInSopObject, isJoiningSupported, isJPAId, isLazy, isLockableMapping, isManyToManyMapping, isManyToOneMapping, isMapKeyMapping, isMultitenantPrimaryKeyMapping, isNestedTableMapping, isObjectReferenceMapping, isOneToManyMapping, isOneToOneMapping, isOptional, isOutOnlySopObject, isOutSopObject, isOwned, isPrimaryKeyMapping, isPrivateOwned, isReadOnly, isReferenceMapping, isRelationalMapping, isRemotelyInitialized, isStructureMapping, isTransformationMapping, isUnidirectionalOneToManyMapping, isUsingMethodAccess, isVariableOneToOneMapping, iterateOnRealAttributeValue, load, loadAll, performDataModificationEvent, postCalculateChanges, postCalculateChangesOnDeleted, postDelete, postInitialize, postInitializeSourceAndTargetExpressions, postInsert, postUpdate, preDelete, preInsert, prepareCascadeLockingPolicy, preUpdate, readFromResultSetIntoObject, readFromRowIntoObject, readOnly, readWrite, recordPrivateOwnedRemovals, rehashFieldDependancies, remoteInitialization, remotelyInitialized, replaceValueHoldersIn, setAttributeAccessor, setAttributeName, setChangeListener, setDerivedIdMapping, setDerivesId, setDescriptor, setFields, setGetMethodName, setIsCacheable, setIsInAndOutSopObject, setIsInSopObject, setIsJPAId, setIsLazy, setIsMapKeyMapping, setIsOptional, setIsOutSopObject, setIsPrimaryKeyMapping, setIsReadOnly, setMapsIdValue, setProperties, setProperty, setRealAttributeValueInObject, setSetMethodName, setWeight, toString, updateChangeRecord, updateCollectionChangeRecord, validateAfterInitialization, validateBeforeInitialization, valueFromObject, valueFromResultSet, valueFromRow, verifyDelete, writeFromAttributeIntoRow, writeFromObjectIntoRowForShallowInsert, writeFromObjectIntoRowForShallowInsertWithChangeRecord, writeFromObjectIntoRowForUpdateAfterShallowInsert, writeFromObjectIntoRowForUpdateBeforeShallowDelete, writeFromObjectIntoRowForWhereClause, writeUpdateFieldsIntoRowMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.persistence.mappings.structures.ArrayCollectionMapping
getAttributeName, setRealAttributeValueInObjectMethods inherited from interface org.eclipse.persistence.internal.oxm.mappings.BinaryDataCollectionMapping
getNullPolicy, isWriteOnly, setField, setIsWriteOnly, setNullPolicy, setValueConverter, useCollectionClassNameMethods inherited from interface org.eclipse.persistence.internal.oxm.mappings.DirectCollectionMapping
getValueConverter, setField, setFieldElementClass, setUsesSingleNode, setValueConverter, usesSingleNodeMethods inherited from interface org.eclipse.persistence.internal.oxm.mappings.Mapping
getAttributeAccessor, getAttributeClassification, getAttributeName, getAttributeValueFromObject, getContainerPolicy, getDescriptor, getField, getReferenceDescriptor, isAbstractCompositeCollectionMapping, isAbstractCompositeObjectMapping, isAbstractDirectMapping, isCollectionMapping, isReadOnly, isReferenceMapping, isTransformationMapping, setAttributeAccessor, setAttributeName, setAttributeValueInObject, setGetMethodName, setIsReadOnly, setProperties, setSetMethodNameMethods inherited from interface org.eclipse.persistence.internal.oxm.mappings.XMLContainerMapping
getReuseContainer, getWrapperNullPolicy, isDefaultEmptyContainer, setDefaultEmptyContainer, setReuseContainer, setWrapperNullPolicyMethods inherited from interface org.eclipse.persistence.internal.oxm.mappings.XMLConverterMapping
convertDataValueToObjectValue, convertObjectValueToDataValueMethods inherited from interface org.eclipse.persistence.oxm.mappings.XMLMapping
convertClassNamesToClasses
-
Constructor Details
-
XMLBinaryDataCollectionMapping
public XMLBinaryDataCollectionMapping()
-
-
Method Details
-
shouldInlineBinaryData
public boolean shouldInlineBinaryData()- Specified by:
shouldInlineBinaryDatain interfaceorg.eclipse.persistence.internal.oxm.mappings.BinaryDataCollectionMapping<org.eclipse.persistence.internal.sessions.AbstractSession,AttributeAccessor, org.eclipse.persistence.internal.queries.ContainerPolicy, Converter, ClassDescriptor, org.eclipse.persistence.internal.helper.DatabaseField, XMLMarshaller, MimeTypePolicy, Session, XMLUnmarshaller, XMLRecord>
-
setShouldInlineBinaryData
public void setShouldInlineBinaryData(boolean b) - Specified by:
setShouldInlineBinaryDatain interfaceorg.eclipse.persistence.internal.oxm.mappings.BinaryDataCollectionMapping<org.eclipse.persistence.internal.sessions.AbstractSession,AttributeAccessor, org.eclipse.persistence.internal.queries.ContainerPolicy, Converter, ClassDescriptor, org.eclipse.persistence.internal.helper.DatabaseField, XMLMarshaller, MimeTypePolicy, Session, XMLUnmarshaller, XMLRecord>
-
getMimeType
INTERNAL- Specified by:
getMimeTypein interfaceorg.eclipse.persistence.internal.oxm.mappings.BinaryDataCollectionMapping<org.eclipse.persistence.internal.sessions.AbstractSession,AttributeAccessor, org.eclipse.persistence.internal.queries.ContainerPolicy, Converter, ClassDescriptor, org.eclipse.persistence.internal.helper.DatabaseField, XMLMarshaller, MimeTypePolicy, Session, XMLUnmarshaller, XMLRecord>
-
getMimeType
INTERNAL- Specified by:
getMimeTypein interfaceorg.eclipse.persistence.internal.oxm.mappings.BinaryDataCollectionMapping<org.eclipse.persistence.internal.sessions.AbstractSession,AttributeAccessor, org.eclipse.persistence.internal.queries.ContainerPolicy, Converter, ClassDescriptor, org.eclipse.persistence.internal.helper.DatabaseField, XMLMarshaller, MimeTypePolicy, Session, XMLUnmarshaller, XMLRecord>
-
getMimeTypePolicy
- Specified by:
getMimeTypePolicyin interfaceorg.eclipse.persistence.internal.oxm.mappings.BinaryDataCollectionMapping<org.eclipse.persistence.internal.sessions.AbstractSession,AttributeAccessor, org.eclipse.persistence.internal.queries.ContainerPolicy, Converter, ClassDescriptor, org.eclipse.persistence.internal.helper.DatabaseField, XMLMarshaller, MimeTypePolicy, Session, XMLUnmarshaller, XMLRecord>
-
setMimeTypePolicy
Allow implementer to set the MimeTypePolicy class FixedMimeTypePolicy or AttributeMimeTypePolicy (dynamic)- Specified by:
setMimeTypePolicyin interfaceorg.eclipse.persistence.internal.oxm.mappings.BinaryDataCollectionMapping<org.eclipse.persistence.internal.sessions.AbstractSession,AttributeAccessor, org.eclipse.persistence.internal.queries.ContainerPolicy, Converter, ClassDescriptor, org.eclipse.persistence.internal.helper.DatabaseField, XMLMarshaller, MimeTypePolicy, Session, XMLUnmarshaller, XMLRecord> - Parameters:
mimeTypePolicy- MimeTypePolicy
-
setMimeType
Force mapping to set default FixedMimeTypePolicy using the MimeType string as argument- Parameters:
mimeTypeString-
-
isSwaRef
public boolean isSwaRef()- Specified by:
isSwaRefin interfaceorg.eclipse.persistence.internal.oxm.mappings.BinaryDataCollectionMapping<org.eclipse.persistence.internal.sessions.AbstractSession,AttributeAccessor, org.eclipse.persistence.internal.queries.ContainerPolicy, Converter, ClassDescriptor, org.eclipse.persistence.internal.helper.DatabaseField, XMLMarshaller, MimeTypePolicy, Session, XMLUnmarshaller, XMLRecord>
-
setSwaRef
public void setSwaRef(boolean swaRef) - Specified by:
setSwaRefin interfaceorg.eclipse.persistence.internal.oxm.mappings.BinaryDataCollectionMapping<org.eclipse.persistence.internal.sessions.AbstractSession,AttributeAccessor, org.eclipse.persistence.internal.queries.ContainerPolicy, Converter, ClassDescriptor, org.eclipse.persistence.internal.helper.DatabaseField, XMLMarshaller, MimeTypePolicy, Session, XMLUnmarshaller, XMLRecord>
-
isAbstractCompositeDirectCollectionMapping
public boolean isAbstractCompositeDirectCollectionMapping()Description copied from class:AbstractCompositeDirectCollectionMappingINTERNAL:- Specified by:
isAbstractCompositeDirectCollectionMappingin interfaceorg.eclipse.persistence.internal.oxm.mappings.Mapping<org.eclipse.persistence.internal.sessions.AbstractSession,AttributeAccessor, org.eclipse.persistence.internal.queries.ContainerPolicy, ClassDescriptor, org.eclipse.persistence.internal.helper.DatabaseField, XMLRecord> - Overrides:
isAbstractCompositeDirectCollectionMappingin classAbstractCompositeDirectCollectionMapping
-
setXPath
Set the Mapping field name attribute to the given XPath String- Specified by:
setXPathin interfaceorg.eclipse.persistence.internal.oxm.mappings.DirectCollectionMapping<org.eclipse.persistence.internal.sessions.AbstractSession,AttributeAccessor, org.eclipse.persistence.internal.queries.ContainerPolicy, Converter, ClassDescriptor, org.eclipse.persistence.internal.helper.DatabaseField, XMLMarshaller, Session, XMLUnmarshaller, XMLRecord> - Overrides:
setXPathin classXMLCompositeDirectCollectionMapping- Parameters:
xpathString- String
-
writeFromObjectIntoRow
public void writeFromObjectIntoRow(Object object, org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.sessions.AbstractSession session, DatabaseMapping.WriteType writeType) Description copied from class:XMLCompositeDirectCollectionMappingINTERNAL:- Overrides:
writeFromObjectIntoRowin classXMLCompositeDirectCollectionMapping
-
getValueToWrite
-
writeSingleValue
public void writeSingleValue(Object value, Object parent, XMLRecord record, org.eclipse.persistence.internal.sessions.AbstractSession session) Description copied from interface:XMLMappingINTERNAL: A method that marshals a single value to the provided Record based on this mapping's XPath. Used for Sequenced marshalling.- Specified by:
writeSingleValuein interfaceorg.eclipse.persistence.internal.oxm.mappings.Mapping<org.eclipse.persistence.internal.sessions.AbstractSession,AttributeAccessor, org.eclipse.persistence.internal.queries.ContainerPolicy, ClassDescriptor, org.eclipse.persistence.internal.helper.DatabaseField, XMLRecord> - Specified by:
writeSingleValuein interfaceXMLMapping- Overrides:
writeSingleValuein classXMLCompositeDirectCollectionMapping- Parameters:
value- - The value to be marshalledrecord- - The Record the value is being marshalled too.
-
valueFromRow
public Object valueFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager, ObjectBuildingQuery query, org.eclipse.persistence.internal.identitymaps.CacheKey cacheKey, org.eclipse.persistence.internal.sessions.AbstractSession executionSession, boolean isTargetProtected, Boolean[] wasCacheUsed) Description copied from class:XMLCompositeDirectCollectionMappingINTERNAL: Build the nested collection from the database row.- Overrides:
valueFromRowin classXMLCompositeDirectCollectionMapping
-
setCollectionContentType
-
getCollectionContentType
-
setAttributeElementClass
PUBLIC: Set the class each element in the object's collection should be converted to, before the collection is inserted into the object. This is optional - if left null, the elements will be added to the object's collection unconverted.- Specified by:
setAttributeElementClassin interfaceorg.eclipse.persistence.internal.oxm.mappings.BinaryDataCollectionMapping<org.eclipse.persistence.internal.sessions.AbstractSession,AttributeAccessor, org.eclipse.persistence.internal.queries.ContainerPolicy, Converter, ClassDescriptor, org.eclipse.persistence.internal.helper.DatabaseField, XMLMarshaller, MimeTypePolicy, Session, XMLUnmarshaller, XMLRecord> - Specified by:
setAttributeElementClassin interfaceorg.eclipse.persistence.internal.oxm.mappings.DirectCollectionMapping<org.eclipse.persistence.internal.sessions.AbstractSession,AttributeAccessor, org.eclipse.persistence.internal.queries.ContainerPolicy, Converter, ClassDescriptor, org.eclipse.persistence.internal.helper.DatabaseField, XMLMarshaller, Session, XMLUnmarshaller, XMLRecord> - Overrides:
setAttributeElementClassin classAbstractCompositeDirectCollectionMapping
-
getAttributeElementClass
Description copied from class:AbstractCompositeDirectCollectionMappingPUBLIC: Return the class each element in the object's collection should be converted to, before the collection is inserted into the object. This is optional - if left null, the elements will be added to the object's collection unconverted.- Specified by:
getAttributeElementClassin interfaceorg.eclipse.persistence.internal.oxm.mappings.BinaryDataCollectionMapping<org.eclipse.persistence.internal.sessions.AbstractSession,AttributeAccessor, org.eclipse.persistence.internal.queries.ContainerPolicy, Converter, ClassDescriptor, org.eclipse.persistence.internal.helper.DatabaseField, XMLMarshaller, MimeTypePolicy, Session, XMLUnmarshaller, XMLRecord> - Specified by:
getAttributeElementClassin interfaceorg.eclipse.persistence.internal.oxm.mappings.DirectCollectionMapping<org.eclipse.persistence.internal.sessions.AbstractSession,AttributeAccessor, org.eclipse.persistence.internal.queries.ContainerPolicy, Converter, ClassDescriptor, org.eclipse.persistence.internal.helper.DatabaseField, XMLMarshaller, Session, XMLUnmarshaller, XMLRecord> - Overrides:
getAttributeElementClassin classAbstractCompositeDirectCollectionMapping
-