|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atlassian.confluence.importexport.xmlimport.ImportProcessorContext
public class ImportProcessorContext
Context that records the current state of an import, and provides helper methods that are dependent on that state. The context is responsible for keeping track of which objects have been imported, any ID re-mappings that have occurred during the import, any operations that have been deferred because some dependent object is not present.
Constructor Summary | |
---|---|
ImportProcessorContext(net.sf.hibernate.engine.SessionImplementor session,
net.sf.hibernate.engine.SessionFactoryImplementor sessionFactory,
com.atlassian.core.util.ProgressMeter meter,
boolean preserveIds)
|
Method Summary | ||
---|---|---|
void |
addExplicitIdMapping(TransientHibernateHandle transientHibernateHandle,
java.io.Serializable mappedId)
|
|
void |
addUnsatisfiedObjectDependencies(java.util.Set<TransientHibernateHandle> unsatisfiedObjectDependencies,
ImportedObject importedObject)
Defer the saving of an object because it has referential dependencies on some objects that have not yet been imported, but that can not be temporarily left null. |
|
void |
deferOperations(java.util.Map<TransientHibernateHandle,java.util.Set<Operation>> operations)
Defer a set of operations until the objects they require have been imported. |
|
|
generateNewIdFor(java.lang.Class<T> clazz,
T object)
|
|
net.sf.hibernate.metadata.ClassMetadata |
getClassMetadata(java.lang.Class classToPersist)
Gets the hibernate class metadata for a particular class |
|
java.lang.Object |
getContextVariable(java.lang.String key)
Free-form storage so persisters can maintain state during an import (for example, the BucketPropertySet persister needs to maintain a counter to help it fix broken property IDs). |
|
java.lang.Object |
getIdMappingFor(TransientHibernateHandle handle)
|
|
java.util.Collection<TransientHibernateHandle> |
getImportedObjectHandlesOfType(java.lang.Class clazz)
Get handles for all objects of a particular class that were imported. |
|
|
getImportedObjectsOfType(java.lang.Class<T> clazz)
Retrieve all the objects of a particular class that were imported. |
|
java.util.Set<TransientHibernateHandle> |
getPersistedMappedHandles()
|
|
net.sf.hibernate.persister.ClassPersister |
getPersister(java.lang.Class classToPersist)
Get the Hibernate class persister for a particular class. |
|
net.sf.hibernate.engine.SessionImplementor |
getSession()
Gets the current Hibernate session. |
|
java.lang.Object |
getUnfixedIdFor(java.lang.Class clazz,
java.lang.Object originalId)
|
|
boolean |
hasPendingDeferredObject()
When an object that has previously been deferred due to missing dependencies is able to be persisted, it is pushed onto a stack. |
|
boolean |
isObjectAlreadyImported(TransientHibernateHandle key)
Has an object with this type and ID already been imported? Checks against all the handles that have been recorded by objectImported(bucket.core.persistence.hibernate.schema.TransientHibernateHandle) . |
|
java.lang.Object |
lookupObjectByUnfixedHandle(TransientHibernateHandle key)
Find a previously imported object by the ID as it appeared in the backup file, even if it has since been assigned a new ID. |
|
ImportedObject |
nextPendingDeferredObject()
Pops any pending deferred object off the stack (see hasPendingDeferredObject() |
|
void |
objectImported(TransientHibernateHandle handle)
Record that a particular object has been successfully persisted. |
|
void |
reportIncompleteDefferredOperations()
Log any deferred operations that are still pending. |
|
void |
saveObject(java.lang.Object object)
Save a particular object to the Hibernate session. |
|
void |
saveObject(java.io.Serializable id,
java.lang.Class classToPersist,
java.lang.Object objectToPersist)
|
|
void |
setContextVariable(java.lang.String key,
java.lang.Object value)
Free-form storage so persisters can maintain state during an import (for example, the BucketPropertySet persister needs to maintain a counter to help it fix broken property IDs). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ImportProcessorContext(net.sf.hibernate.engine.SessionImplementor session, net.sf.hibernate.engine.SessionFactoryImplementor sessionFactory, com.atlassian.core.util.ProgressMeter meter, boolean preserveIds) throws net.sf.hibernate.HibernateException
net.sf.hibernate.HibernateException
Method Detail |
---|
public void objectImported(TransientHibernateHandle handle) throws java.lang.Exception
handle
- the handle of the persisted object, before any ID mapping occurred
java.lang.Exception
- if some error occurred running the deferred operationspublic net.sf.hibernate.persister.ClassPersister getPersister(java.lang.Class classToPersist) throws net.sf.hibernate.MappingException
net.sf.hibernate.MappingException
public boolean isObjectAlreadyImported(TransientHibernateHandle key)
objectImported(bucket.core.persistence.hibernate.schema.TransientHibernateHandle)
.
public void saveObject(java.lang.Object object) throws net.sf.hibernate.HibernateException
net.sf.hibernate.HibernateException
public net.sf.hibernate.metadata.ClassMetadata getClassMetadata(java.lang.Class classToPersist) throws net.sf.hibernate.HibernateException
net.sf.hibernate.HibernateException
public java.lang.Object lookupObjectByUnfixedHandle(TransientHibernateHandle key) throws net.sf.hibernate.HibernateException
net.sf.hibernate.HibernateException
public net.sf.hibernate.engine.SessionImplementor getSession()
public void deferOperations(java.util.Map<TransientHibernateHandle,java.util.Set<Operation>> operations)
operations
- a map between the handle of the object that is being waited on, and the set of operations
that should be executed once that object is imported.public boolean hasPendingDeferredObject()
nextPendingDeferredObject()
public ImportedObject nextPendingDeferredObject()
hasPendingDeferredObject()
java.util.EmptyStackException
- if there is no pending objecthasPendingDeferredObject()
,
addUnsatisfiedObjectDependencies(java.util.Set, com.atlassian.confluence.importexport.xmlimport.model.ImportedObject)
public void addUnsatisfiedObjectDependencies(java.util.Set<TransientHibernateHandle> unsatisfiedObjectDependencies, ImportedObject importedObject)
nextPendingDeferredObject()
unsatisfiedObjectDependencies
- importedObject
- nextPendingDeferredObject()
,
hasPendingDeferredObject()
public java.lang.Object getContextVariable(java.lang.String key)
key
- the key of the context variable to retrieve
public void setContextVariable(java.lang.String key, java.lang.Object value)
key
- the key of the context variable to setvalue
- the value to associate with the keypublic java.lang.Object getIdMappingFor(TransientHibernateHandle handle)
public void saveObject(java.io.Serializable id, java.lang.Class classToPersist, java.lang.Object objectToPersist) throws net.sf.hibernate.HibernateException, java.sql.SQLException
net.sf.hibernate.HibernateException
java.sql.SQLException
public void addExplicitIdMapping(TransientHibernateHandle transientHibernateHandle, java.io.Serializable mappedId)
public java.util.Set<TransientHibernateHandle> getPersistedMappedHandles()
getPersistedMappedHandles
in interface ImportProcessorSummary
public java.lang.Object getUnfixedIdFor(java.lang.Class clazz, java.lang.Object originalId)
getUnfixedIdFor
in interface ImportProcessorSummary
public java.util.Collection<TransientHibernateHandle> getImportedObjectHandlesOfType(java.lang.Class clazz)
getImportedObjectHandlesOfType
in interface ImportProcessorSummary
clazz
- the class of objects being looked for
public <T> java.util.Collection<T> getImportedObjectsOfType(java.lang.Class<T> clazz) throws net.sf.hibernate.HibernateException
getImportedObjectsOfType
in interface ImportProcessorSummary
clazz
- the class being looked up
net.sf.hibernate.HibernateException
- if the objects could not successfully be looked uppublic void reportIncompleteDefferredOperations() throws java.lang.Exception
java.lang.Exception
- there was some problem reporting the deferred operations (should not happen)public <T> java.lang.Object generateNewIdFor(java.lang.Class<T> clazz, T object) throws net.sf.hibernate.HibernateException, java.sql.SQLException
net.sf.hibernate.HibernateException
java.sql.SQLException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |