Class XMLBinaryDataMapping
- All Implemented Interfaces:
Serializable,Cloneable,org.eclipse.persistence.internal.oxm.mappings.BinaryDataMapping<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.DirectMapping<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.XMLConverterMapping<XMLMarshaller,,Session, XMLUnmarshaller> MapComponentMapping,MapKeyMapping,XMLMapping,XMLNillableMapping
Purpose:Provide a mapping for binary data that can be treated as either inline 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)
XMLBinaryDataMapping represents a mapping 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 typed are allowable to be mapped using an XMLBinaryDataMapping:
- java.awt.Image
- byte[]
- jakarta.activation.DataHandler
- javax.xml.transform.Source
- javax.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.XMLDirectMapping
isCDATAFields inherited from class org.eclipse.persistence.mappings.foundation.AbstractDirectMapping
attributeClassification, attributeClassificationName, attributeObjectClassification, bypassDefaultNullValueCheck, fieldClassificationClassName, isMutable, keyTableForMapKey, nullValueFields inherited from class org.eclipse.persistence.mappings.foundation.AbstractColumnMapping
converter, converterClassName, field, isInsertable, isUpdatableFields 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_TRANSFORM -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionINTERNALgetMimeType(Object anObject) INTERNALbooleanINTERNAL:booleanINTERNAL:booleanisSwaRef()voidsetMimeType(String mimeTypeString) Force mapping to set default FixedMimeTypePolicy using the MimeType string as argumentvoidsetMimeTypePolicy(MimeTypePolicy aPolicy) 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: Return the mapping's attribute value from the row.voidwriteFromObjectIntoRow(Object object, org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.sessions.AbstractSession session, DatabaseMapping.WriteType writeType) INTERNAL: Get a value from the object and set that in the respective field of the row.voidwriteSingleValue(Object attributeValue, 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.XMLDirectMapping
convertDataValueToObjectValue, convertObjectValueToDataValue, getAttributeValue, getFieldValue, getNullPolicy, getXPath, initialize, isCDATA, isCloningRequired, isCollapsingStringValues, isNormalizingStringValues, isNullValueMarshalled, isWriteOnly, isXMLMapping, preInitialize, setAttributeValueInObject, setCollapsingStringValues, setIsCDATA, setIsWriteOnly, setNormalizingStringValues, setNullPolicy, setNullValueMarshalled, writeValueIntoRowMethods inherited from class org.eclipse.persistence.mappings.foundation.AbstractDirectMapping
addAdditionalFieldsToQuery, addFieldsForMapKey, addKeyToDeletedObjectsList, buildBackupClone, buildChangeRecord, buildClone, buildCloneFromRow, buildCloneValue, buildCloneValue, buildCopy, buildElementClone, buildExpression, buildSelectionQueryForDirectCollectionKeyMapping, buildShallowOriginalFromRow, cascadeDiscoverAndPersistUnregisteredNewObjects, cascadePerformRemoveIfRequired, cascadePerformRemoveIfRequired, cascadeRegisterNewIfRequired, cascadeRegisterNewIfRequired, compareForChange, compareObjects, compareObjectValues, convertClassNamesToClasses, createMapComponentFromJoinedRow, createMapComponentFromRow, createMapComponentsFromSerializableKeyInfo, createQueryKeyForMapKey, createSerializableMapKeyInfo, createStubbedMapComponentFromSerializableKeyInfo, deleteMapKey, extractIdentityFieldsForQuery, getAdditionalSelectionCriteriaForMapKey, getAdditionalTablesForJoinQuery, getAllFieldsForMapKey, getAttributeClassification, getAttributeClassificationName, getFieldClassification, getFieldClassification, getFieldClassificationClassName, getFieldName, getFieldValue, getForeignKeyFieldsForMapKey, getIdentityFieldsForMapKey, getMapKeyTargetType, getNestedJoinQuery, getNullValue, getObjectValue, getObjectValueWithoutClassCheck, getReferenceDescriptor, getTargetVersionOfSourceObject, getWeight, internalBuildChangeRecord, isChangeTrackingSupported, isDirectToFieldMapping, isMutable, iterateOnMapKey, mergeChangesIntoObject, mergeIntoObject, postInitializeMapKey, preinitializeMapKey, remoteInitialization, requiresDataModificationEventsForMapKey, setAttributeClassification, setAttributeClassificationName, setFieldClassification, setFieldClassificationClassName, setFieldType, setIsMutable, setNullValue, toString, unwrapKey, updateChangeRecord, validateBeforeInitialization, valueFromObject, valueFromResultSet, wrapKey, writeFromObjectIntoRowForUpdate, writeFromObjectIntoRowWithChangeRecord, writeInsertFieldsIntoRow, writeUpdateFieldsIntoRowMethods inherited from class org.eclipse.persistence.mappings.foundation.AbstractColumnMapping
clone, collectFields, fixObjectReferences, getConverter, getField, hasConverter, isInsertable, isUpdatable, iterate, setConverter, setConverterClassName, setFieldMethods inherited from class org.eclipse.persistence.mappings.DatabaseMapping
addUnconvertedProperty, buildBackupCloneForPartObject, buildCloneForPartObject, buildContainerClone, buildObjectJoinExpression, buildObjectJoinExpression, calculateDeferredChanges, cascadeDiscoverAndPersistUnregisteredNewObjects, cascadePerformRemovePrivateOwnedObjectFromChangeSetIfRequired, cloneFields, collectQueryParameters, convertConverterClassNamesToClasses, createCloneValueHolder, derivesId, earlyPreDelete, extractNestedExpressions, extractNestedNonAggregateExpressions, fixRealObjectReferences, getAttributeAccessor, getAttributeName, getAttributeValueFromObject, getContainerPolicy, getDerivedIdMapping, getDescriptor, getFields, getGetMethodName, getMapsIdValue, getObjectCorrespondingTo, getOrderByNormalizedExpressions, getProperties, getProperty, getRealAttributeValueFromAttribute, getRealAttributeValueFromObject, getRealCollectionAttributeValueFromObject, getRelationshipPartner, getSelectFields, getSelectTables, getSetMethodName, getUnconvertedProperties, getValueFromRemoteValueHolder, hasConstraintDependency, hasDependency, hasInverseConstraintDependency, hasMapsIdValue, hasNestedIdentityReference, hasRootExpressionThatShouldUseOuterJoin, hasUnconvertedProperties, instantiateAttribute, isAbstractCompositeCollectionMapping, isAbstractCompositeDirectCollectionMapping, isAbstractCompositeObjectMapping, isAggregateCollectionMapping, isAggregateMapping, isAggregateObjectMapping, isAttributeValueFromObjectInstantiated, isCacheable, isCandidateForPrivateOwnedRemoval, isCascadedLockingSupported, isCollectionMapping, isDatabaseMapping, isDirectCollectionMapping, isDirectMapMapping, 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, 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, simpleAddToCollectionChangeRecord, simpleRemoveFromCollectionChangeRecord, updateCollectionChangeRecord, validateAfterInitialization, valueFromRow, verifyDelete, writeFromAttributeIntoRow, writeFromObjectIntoRowForShallowInsert, writeFromObjectIntoRowForShallowInsertWithChangeRecord, writeFromObjectIntoRowForUpdateAfterShallowInsert, writeFromObjectIntoRowForUpdateBeforeShallowDelete, writeFromObjectIntoRowForWhereClauseMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.persistence.internal.oxm.mappings.BinaryDataMapping
getNullPolicy, getObjectValue, getXPath, setAttributeClassification, setAttributeClassificationName, setConverter, setField, setIsWriteOnly, setNullPolicyMethods inherited from interface org.eclipse.persistence.internal.oxm.mappings.DirectMapping
getConverter, getNullValue, getObjectValue, hasConverter, setAttributeClassification, setAttributeClassificationName, setConverter, setField, setNullValue, valueFromObjectMethods inherited from interface org.eclipse.persistence.mappings.foundation.MapComponentMapping
cloneMethods inherited from interface org.eclipse.persistence.internal.oxm.mappings.Mapping
getAttributeAccessor, getAttributeClassification, getAttributeName, getAttributeValueFromObject, getContainerPolicy, getDescriptor, getField, getReferenceDescriptor, isAbstractCompositeCollectionMapping, isAbstractCompositeDirectCollectionMapping, isAbstractCompositeObjectMapping, isCollectionMapping, isReadOnly, isReferenceMapping, isTransformationMapping, setAttributeAccessor, setAttributeName, setAttributeValueInObject, setGetMethodName, setIsReadOnly, setProperties, setSetMethodNameMethods inherited from interface org.eclipse.persistence.internal.oxm.mappings.XMLConverterMapping
convertDataValueToObjectValue, convertObjectValueToDataValueMethods inherited from interface org.eclipse.persistence.oxm.mappings.XMLMapping
convertClassNamesToClasses
-
Constructor Details
-
XMLBinaryDataMapping
public XMLBinaryDataMapping()
-
-
Method Details
-
shouldInlineBinaryData
public boolean shouldInlineBinaryData()- Specified by:
shouldInlineBinaryDatain interfaceorg.eclipse.persistence.internal.oxm.mappings.BinaryDataMapping<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.BinaryDataMapping<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.BinaryDataMapping<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.BinaryDataMapping<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
-
setMimeTypePolicy
Allow implementer to set the MimeTypePolicy class FixedMimeTypePolicy or AttributeMimeTypePolicy (dynamic)- Specified by:
setMimeTypePolicyin interfaceorg.eclipse.persistence.internal.oxm.mappings.BinaryDataMapping<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:
aPolicy- MimeTypePolicy
-
setMimeType
Force mapping to set default FixedMimeTypePolicy using the MimeType string as argument- Specified by:
setMimeTypein interfaceorg.eclipse.persistence.internal.oxm.mappings.BinaryDataMapping<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:
mimeTypeString-
-
isSwaRef
public boolean isSwaRef()- Specified by:
isSwaRefin interfaceorg.eclipse.persistence.internal.oxm.mappings.BinaryDataMapping<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.BinaryDataMapping<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>
-
setXPath
Set the Mapping field name attribute to the given XPath String- Specified by:
setXPathin interfaceorg.eclipse.persistence.internal.oxm.mappings.BinaryDataMapping<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:
setXPathin interfaceorg.eclipse.persistence.internal.oxm.mappings.DirectMapping<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 classXMLDirectMapping- 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:XMLDirectMappingINTERNAL: Get a value from the object and set that in the respective field of the row.- Overrides:
writeFromObjectIntoRowin classXMLDirectMapping
-
writeSingleValue
public void writeSingleValue(Object attributeValue, 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 classXMLDirectMapping- Parameters:
attributeValue- - 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:XMLDirectMappingINTERNAL: Return the mapping's attribute value from the row. The execution session is passed for the case of building a UnitOfWork clone directly from a row, the session set in the query will not know which platform to use for converting the value. Allows the correct session to be passed in.- Overrides:
valueFromRowin classXMLDirectMapping
-
isAbstractDirectMapping
public boolean isAbstractDirectMapping()Description copied from class:AbstractDirectMappingINTERNAL:- Specified by:
isAbstractDirectMappingin 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:
isAbstractDirectMappingin classAbstractDirectMapping
-
isAbstractColumnMapping
public boolean isAbstractColumnMapping()Description copied from class:AbstractColumnMappingINTERNAL:- Overrides:
isAbstractColumnMappingin classAbstractColumnMapping
-