Class ReflectiveObjectPersister
java.lang.Object
com.atlassian.confluence.importexport.xmlimport.persister.AbstractObjectPersister
com.atlassian.confluence.importexport.xmlimport.persister.ReflectiveObjectPersister
- All Implemented Interfaces:
ObjectPersister
@Deprecated
public class ReflectiveObjectPersister
extends AbstractObjectPersister
implements ObjectPersister
Deprecated.
since 7.17.0
Uses Hibernate metadata to persist imported objects. This code is a direct port of the old import code that was
scattered between ReverseDatabinder and poorly factored helper classes. Hopefully, though, it is a lot easier
to understand encapsulated here.
Limitations: the ReflectiveObjectPersister is NOT generic enough to persist anything you throw at it. It
makes assumptions about the objects that are true of most Confluence hibernate objects: including the presence
of an ID of type Long. Types that the reflective persister can not handle will need their own specific persister,
for example PropertySetItemPersister
.
-
Field Summary
FieldsFields inherited from class com.atlassian.confluence.importexport.xmlimport.persister.AbstractObjectPersister
NAME_BUCKET_CLOB_STRING_TYPE, NAME_CRYPTOGRAPHIC_KEY_TYPE, NAME_CUSTOM_CLOB_TYPE, NAME_INSTANT_TYPE, NAME_NAMESPACE_USER_TYPE, NAME_SPOOLING_BLOB_INPUT_STREAM_TYPE, NAME_USER_KEY_TYPE, persisterOperations, unsatisfiedObjectDependencies
-
Constructor Summary
ConstructorsConstructorDescriptionReflectiveObjectPersister
(LabelManager labelManager, ConfluenceUserDao confluenceUserDao, StorageFormatUserRewriter storageFormatUserRewriter) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionpersist
(ImportProcessorContext context, ImportedObject importedObject) Deprecated.Persist a given imported object.static Object
unproxyIfRequired
(Object object) Deprecated.When an object is retrieved from a Hibernate session, due to its lazy loading strategy, the object is possibly a proxy object.Methods inherited from class com.atlassian.confluence.importexport.xmlimport.persister.AbstractObjectPersister
getPrimitivePropertyValue, getReferencePropertyValue
-
Field Details
-
log
public static final org.slf4j.Logger logDeprecated.
-
-
Constructor Details
-
ReflectiveObjectPersister
public ReflectiveObjectPersister(LabelManager labelManager, ConfluenceUserDao confluenceUserDao, StorageFormatUserRewriter storageFormatUserRewriter) Deprecated.
-
-
Method Details
-
persist
public List<TransientHibernateHandle> persist(ImportProcessorContext context, ImportedObject importedObject) throws Exception Deprecated.Description copied from interface:ObjectPersister
Persist a given imported object.- Specified by:
persist
in interfaceObjectPersister
- Parameters:
context
- the context of the current import operationimportedObject
- the object to save.- Returns:
- a list of handles of the objects that were saved. If IDs are being rewritten on import, this list should still contain the pre-rewriting ID as it appears in the backup file
- Throws:
Exception
- if something goes wrong. To avoid duplication of "wrap everything in one exception type" code in every persister, it is assumed wrapping happens at a higher level.
-
unproxyIfRequired
Deprecated.When an object is retrieved from a Hibernate session, due to its lazy loading strategy, the object is possibly a proxy object. Whennet.sf.hibernate.metadata.ClassMetadata#setPropertyValue(Object target, String property, Object value)
is called but thetarget
object is a proxy object. Then, the newvalue
cannot be persisted to database. This method aims to turn a proxy object to a real object so any update (if happens) can be persisted to database.- Parameters:
object
- an object got from a Hibernate session, this object is either a real object or a proxy object.- Returns:
- a real object of the input
object
- Throws:
org.hibernate.HibernateException
-