Class AbstractDatabaseDataConverter
- java.lang.Object
-
- com.atlassian.confluence.impl.backuprestore.backup.exporters.converters.AbstractDatabaseDataConverter
-
- All Implemented Interfaces:
Converter
- Direct Known Subclasses:
AliasedKeyDatabaseDataConverter
,CommonDatabaseDataConverter
,Content2ContentRelationEntityDataConverter
,ContentEntityDatabaseDataConverter
,ContentPropertyDataConverter
public abstract class AbstractDatabaseDataConverter extends Object implements Converter
- Since:
- 7.20.0
-
-
Field Summary
Fields Modifier and Type Field Description protected HibernateMetadataHelper
hibernateMetadataHelper
-
Constructor Summary
Constructors Constructor Description AbstractDatabaseDataConverter(ExportableEntityInfo entityInfo, HibernateMetadataHelper hibernateMetadataHelper)
AbstractDatabaseDataConverter(Collection<ExportableEntityInfo> entityInfos, HibernateMetadataHelper hibernateMetadataHelper)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
addExternalReferenceToObject(Map<String,Object> dbObjectProperties, EntityObjectReadyForExport object, org.hibernate.type.ManyToOneType type, String columnName, String propertyName)
Converts reference property into exportable format and adds it to the exportable objectprotected Class<?>
calculateReferencedClass(Object referencedId, Class<?> referencedClass)
static @Nullable Boolean
convertToBoolean(Object value)
Some databases return boolean values as "T" and "F" If value is a string, best efforts to convert it to "true" or "false" will be made.static Integer
convertToInteger(Object value)
Oracle server returns BigDecimal objects (not Integer), so it has to be fixed first.static Long
convertToLong(Object value)
SQL server and Oracle returns BigDecimal objects (not Long), so it has to be fixed first.protected abstract EntityObjectReadyForExport
convertToObjectReadyForSerialisation(DbRawObjectData dbObject)
Converts db object into object ready for serialisationprotected EntityObjectReadyForExport
convertToObjectReadyForSerialisationImpl(DbRawObjectData dbObject)
List<EntityObjectReadyForExport>
convertToObjectsReadyForSerialisation(List<DbRawObjectData> dbObjectsProperties)
Class<?>
getContentClassByContentType(String contentType)
ExportableEntityInfo
getEntityInfo()
ExportableEntityInfo
getEntityInfo(Class<?> entityClass)
protected abstract Class<?>
getHibernateEntityClass(Map<String,Object> objectProperties)
-
-
-
Field Detail
-
hibernateMetadataHelper
protected final HibernateMetadataHelper hibernateMetadataHelper
-
-
Constructor Detail
-
AbstractDatabaseDataConverter
public AbstractDatabaseDataConverter(ExportableEntityInfo entityInfo, HibernateMetadataHelper hibernateMetadataHelper)
-
AbstractDatabaseDataConverter
public AbstractDatabaseDataConverter(Collection<ExportableEntityInfo> entityInfos, HibernateMetadataHelper hibernateMetadataHelper)
-
-
Method Detail
-
getHibernateEntityClass
protected abstract Class<?> getHibernateEntityClass(Map<String,Object> objectProperties) throws DataConversionException
- Returns:
- the java class associated with the entity
- Throws:
DataConversionException
- Overriding classes may throw this exception when they convert data into exportable format
-
convertToObjectReadyForSerialisation
protected abstract EntityObjectReadyForExport convertToObjectReadyForSerialisation(DbRawObjectData dbObject) throws DataConversionException
Converts db object into object ready for serialisation- Parameters:
dbObject
- Raw db object data that should be converted- Returns:
- Object that is ready for export
- Throws:
DataConversionException
- Overriding classes may throw this exception when they convert data into exportable format
-
convertToObjectReadyForSerialisationImpl
protected EntityObjectReadyForExport convertToObjectReadyForSerialisationImpl(DbRawObjectData dbObject) throws DataConversionException
- Throws:
DataConversionException
-
getEntityInfo
public ExportableEntityInfo getEntityInfo()
- Specified by:
getEntityInfo
in interfaceConverter
- Returns:
- default entity info.
-
getEntityInfo
public ExportableEntityInfo getEntityInfo(Class<?> entityClass)
- Specified by:
getEntityInfo
in interfaceConverter
- Returns:
- entity info for the particular class
-
addExternalReferenceToObject
protected void addExternalReferenceToObject(Map<String,Object> dbObjectProperties, EntityObjectReadyForExport object, org.hibernate.type.ManyToOneType type, String columnName, String propertyName) throws DataConversionException
Converts reference property into exportable format and adds it to the exportable object- Parameters:
dbObjectProperties
- Map of object propertiesobject
- Object in exportable format to which reference will be addedtype
- Type of the columncolumnName
- Column name in DBpropertyName
- Property name- Throws:
DataConversionException
- Overriding classes may throw this exception when they convert data into exportable format
-
convertToObjectsReadyForSerialisation
public List<EntityObjectReadyForExport> convertToObjectsReadyForSerialisation(List<DbRawObjectData> dbObjectsProperties)
- Specified by:
convertToObjectsReadyForSerialisation
in interfaceConverter
-
convertToLong
public static Long convertToLong(Object value)
SQL server and Oracle returns BigDecimal objects (not Long), so it has to be fixed first.
-
convertToInteger
public static Integer convertToInteger(Object value)
Oracle server returns BigDecimal objects (not Integer), so it has to be fixed first.
-
convertToBoolean
public static @Nullable Boolean convertToBoolean(Object value)
Some databases return boolean values as "T" and "F" If value is a string, best efforts to convert it to "true" or "false" will be made. ("T", "F", "yes", "no", etc.) If no match is made, null is returned. See BooleanUtils.html#toBoolean-java.lang.String
-
-