Class ReflectiveObjectPersister

  extended by com.atlassian.confluence.importexport.xmlimport.persister.ReflectiveObjectPersister
All Implemented Interfaces:

public class ReflectiveObjectPersister
extends Object
implements ObjectPersister

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
static org.slf4j.Logger log
Constructor Summary
ReflectiveObjectPersister(LabelManager labelManager)
Method Summary
 Object getPrimitivePropertyValue(net.sf.hibernate.persister.ClassPersister entityPersister, PrimitiveProperty property)
 List<TransientHibernateHandle> persist(ImportProcessorContext context, ImportedObject importedObject)
          Persist a given imported object.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail


public static final org.slf4j.Logger log
Constructor Detail


public ReflectiveObjectPersister(LabelManager labelManager)
Method Detail


public List<TransientHibernateHandle> persist(ImportProcessorContext context,
                                              ImportedObject importedObject)
                                       throws Exception
Description copied from interface: ObjectPersister
Persist a given imported object.

Specified by:
persist in interface ObjectPersister
context - the context of the current import operation
importedObject - the object to save.
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
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.


public Object getPrimitivePropertyValue(net.sf.hibernate.persister.ClassPersister entityPersister,
                                        PrimitiveProperty property)
                                 throws net.sf.hibernate.HibernateException

Copyright © 2003-2013 Atlassian. All Rights Reserved.