Class ImportProcessorContext
- java.lang.Object
-
- com.atlassian.confluence.importexport.xmlimport.ImportProcessorContext
-
- All Implemented Interfaces:
ImportProcessorSummary
@Deprecated public class ImportProcessorContext extends Object implements ImportProcessorSummary
Deprecated.since 7.17.0.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
Constructors Constructor Description ImportProcessorContext(org.hibernate.engine.spi.SessionImplementor session, org.hibernate.engine.spi.SessionFactoryImplementor sessionFactory, boolean preserveIds, ImportContext importContext)
Deprecated.ImportProcessorContext(org.hibernate.engine.spi.SessionImplementor session, org.hibernate.engine.spi.SessionFactoryImplementor sessionFactory, com.atlassian.core.util.ProgressMeter meter, boolean preserveIds, ImportedObjectPreProcessor preProcessor)
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addExplicitIdMapping(TransientHibernateHandle TransientHibernateHandle5, Serializable mappedId)
Deprecated.void
addUnsatisfiedObjectDependencies(Set<TransientHibernateHandle> unsatisfiedObjectDependencies, ImportedObject importedObject)
Deprecated.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(PrimitiveId idProperty, Map<TransientHibernateHandle,Set<Operation>> operations)
Deprecated.Defer a set of operations until the objects they require have been imported.<T> Object
generateNewIdFor(Class<T> clazz, T object)
Deprecated.org.hibernate.metadata.ClassMetadata
getClassMetadata(Class classToPersist)
Deprecated.Gets the hibernate class metadata for a particular classObject
getContextVariable(String key)
Deprecated.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).org.hibernate.persister.entity.EntityPersister
getEntityPersister(Class classToPersist)
Deprecated.Get the Hibernate class persister for a particular class.ExportDescriptor
getExportDescriptor()
Deprecated.Serializable
getIdMappingFor(TransientHibernateHandle handle)
Deprecated.Collection<TransientHibernateHandle>
getImportedObjectHandlesOfType(Class clazz)
Deprecated.Get handles for all objects of a particular class that were imported.<T> Collection<T>
getImportedObjectsOfType(Class<T> clazz)
Deprecated.Retrieve all the objects of a particular class that were imported.Set<TransientHibernateHandle>
getPersistedMappedHandles()
Deprecated.Set<TransientHibernateHandle>
getPersistedUnmappedHandles()
Deprecated.org.hibernate.persister.entity.EntityPersister
getPersister(Class classToPersist)
Deprecated.Get the Hibernate class persister for a particular class.ImportedObjectPreProcessor
getPreProcessor()
Deprecated.org.hibernate.engine.spi.SessionImplementor
getSession()
Deprecated.Gets the current Hibernate session.Object
getUnfixedIdFor(Class clazz, Object newId)
Deprecated.boolean
hasPendingDeferredObject()
Deprecated.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)
Deprecated.Has an object with this type and ID already been imported? Checks against all the handles that have been recorded byobjectImported(TransientHibernateHandle)
.boolean
isPreserveIds()
Deprecated.Object
lookupObjectByUnfixedHandle(TransientHibernateHandle key)
Deprecated.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()
Deprecated.Pops any pending deferred object off the stack (seehasPendingDeferredObject()
void
objectImported(TransientHibernateHandle handle)
Deprecated.Record that a particular object has been successfully persisted.<T> T
polyMorphicLookupByUnfixedId(long id, Class<? extends T>... classes)
Deprecated.void
reportIncompleteDefferredOperations()
Deprecated.Log any deferred operations that are still pending.void
saveObject(Serializable id, Class classToPersist, Object objectToPersist)
Deprecated.void
saveObject(Object object)
Deprecated.Save a particular object to the Hibernate session.void
setContextVariable(String key, Object value)
Deprecated.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).void
setPreProcessor(ImportedObjectPreProcessor preProcessor)
Deprecated.
-
-
-
Constructor Detail
-
ImportProcessorContext
public ImportProcessorContext(org.hibernate.engine.spi.SessionImplementor session, org.hibernate.engine.spi.SessionFactoryImplementor sessionFactory, com.atlassian.core.util.ProgressMeter meter, boolean preserveIds, ImportedObjectPreProcessor preProcessor) throws org.hibernate.HibernateException
Deprecated.- Throws:
org.hibernate.HibernateException
-
ImportProcessorContext
public ImportProcessorContext(org.hibernate.engine.spi.SessionImplementor session, org.hibernate.engine.spi.SessionFactoryImplementor sessionFactory, boolean preserveIds, ImportContext importContext) throws org.hibernate.HibernateException
Deprecated.- Throws:
org.hibernate.HibernateException
-
-
Method Detail
-
objectImported
public void objectImported(TransientHibernateHandle handle) throws Exception
Deprecated.Record that a particular object has been successfully persisted. This will trigger any deferred operations that were waiting on that object to exist.- Parameters:
handle
- the handle of the persisted object, before any ID mapping occurred- Throws:
Exception
- if some error occurred running the deferred operations
-
getPersister
public org.hibernate.persister.entity.EntityPersister getPersister(Class classToPersist) throws org.hibernate.MappingException
Deprecated.Get the Hibernate class persister for a particular class.- Throws:
org.hibernate.MappingException
-
getEntityPersister
public org.hibernate.persister.entity.EntityPersister getEntityPersister(Class classToPersist) throws org.hibernate.MappingException
Deprecated.Get the Hibernate class persister for a particular class.- Throws:
org.hibernate.MappingException
-
isObjectAlreadyImported
public boolean isObjectAlreadyImported(TransientHibernateHandle key)
Deprecated.Has an object with this type and ID already been imported? Checks against all the handles that have been recorded byobjectImported(TransientHibernateHandle)
.
-
saveObject
public void saveObject(Object object) throws org.hibernate.HibernateException
Deprecated.Save a particular object to the Hibernate session. IDs will be assigned to the object using Hibernate's standard ID generation. Should only be used if you are creating new objects during an import (i.e. migrating from an old data representation to some new one where IDs can not be preserved).- Throws:
org.hibernate.HibernateException
-
getClassMetadata
public org.hibernate.metadata.ClassMetadata getClassMetadata(Class classToPersist) throws org.hibernate.HibernateException
Deprecated.Gets the hibernate class metadata for a particular class- Throws:
org.hibernate.HibernateException
-
lookupObjectByUnfixedHandle
public Object lookupObjectByUnfixedHandle(TransientHibernateHandle key) throws org.hibernate.HibernateException
Deprecated.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.- Throws:
org.hibernate.HibernateException
-
polyMorphicLookupByUnfixedId
public <T> T polyMorphicLookupByUnfixedId(long id, Class<? extends T>... classes) throws org.hibernate.HibernateException
Deprecated.- Throws:
org.hibernate.HibernateException
-
getSession
public org.hibernate.engine.spi.SessionImplementor getSession()
Deprecated.Gets the current Hibernate session. Returns a SessionImplementor because our import code needs access to the Hibernate internals in order to work. This is a bug, not a feature.
-
deferOperations
public void deferOperations(PrimitiveId idProperty, Map<TransientHibernateHandle,Set<Operation>> operations)
Deprecated.Defer a set of operations until the objects they require have been imported.- Parameters:
idProperty
- ID of the object on which the operations will be performed.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.
-
hasPendingDeferredObject
public boolean hasPendingDeferredObject()
Deprecated.When an object that has previously been deferred due to missing dependencies is able to be persisted, it is pushed onto a stack. The backup processor should periodically pop objects off the stack and attempt to persist them again.- Returns:
- whether there are any deferred objects that are ready to be saved
- See Also:
nextPendingDeferredObject()
-
nextPendingDeferredObject
public ImportedObject nextPendingDeferredObject()
Deprecated.Pops any pending deferred object off the stack (seehasPendingDeferredObject()
- Returns:
- the next pending deferred object
- Throws:
EmptyStackException
- if there is no pending object- See Also:
hasPendingDeferredObject()
,addUnsatisfiedObjectDependencies(java.util.Set, com.atlassian.confluence.importexport.xmlimport.model.ImportedObject)
-
addUnsatisfiedObjectDependencies
public void addUnsatisfiedObjectDependencies(Set<TransientHibernateHandle> unsatisfiedObjectDependencies, ImportedObject importedObject)
Deprecated.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. Once the objects being depended on have been imported, the deferred object will be available fromnextPendingDeferredObject()
- Parameters:
unsatisfiedObjectDependencies
-importedObject
-- See Also:
nextPendingDeferredObject()
,hasPendingDeferredObject()
-
getContextVariable
public Object getContextVariable(String key)
Deprecated.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). Persisters are responsible for ensuring their context keys don't clash with any other persister.- Parameters:
key
- the key of the context variable to retrieve- Returns:
- the associated value, or null if there is no value associated with the key
-
setContextVariable
public void setContextVariable(String key, Object value)
Deprecated.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). Persisters are responsible for ensuring their context keys don't clash with any other persister.- Parameters:
key
- the key of the context variable to setvalue
- the value to associate with the key
-
getIdMappingFor
public Serializable getIdMappingFor(TransientHibernateHandle handle)
Deprecated.- Specified by:
getIdMappingFor
in interfaceImportProcessorSummary
-
saveObject
public void saveObject(Serializable id, Class classToPersist, Object objectToPersist) throws org.hibernate.HibernateException, SQLException
Deprecated.- Throws:
org.hibernate.HibernateException
SQLException
-
addExplicitIdMapping
public void addExplicitIdMapping(TransientHibernateHandle TransientHibernateHandle5, Serializable mappedId)
Deprecated.
-
getPersistedUnmappedHandles
public Set<TransientHibernateHandle> getPersistedUnmappedHandles()
Deprecated.- Specified by:
getPersistedUnmappedHandles
in interfaceImportProcessorSummary
-
getPersistedMappedHandles
public Set<TransientHibernateHandle> getPersistedMappedHandles()
Deprecated.- Specified by:
getPersistedMappedHandles
in interfaceImportProcessorSummary
-
getUnfixedIdFor
public Object getUnfixedIdFor(Class clazz, Object newId)
Deprecated.- Specified by:
getUnfixedIdFor
in interfaceImportProcessorSummary
-
getImportedObjectHandlesOfType
public Collection<TransientHibernateHandle> getImportedObjectHandlesOfType(Class clazz)
Deprecated.Get handles for all objects of a particular class that were imported. Useful for post-processing.- Specified by:
getImportedObjectHandlesOfType
in interfaceImportProcessorSummary
- Parameters:
clazz
- the class of objects being looked for- Returns:
- a collection of handles to all imported objects of that type
-
getImportedObjectsOfType
public <T> Collection<T> getImportedObjectsOfType(Class<T> clazz) throws org.hibernate.HibernateException
Deprecated.Retrieve all the objects of a particular class that were imported. This is a very inefficient method as it does a database lookup for each object. Only call it for things you know there will be a manageable number of (usually: spaces)- Specified by:
getImportedObjectsOfType
in interfaceImportProcessorSummary
- Parameters:
clazz
- the class being looked up- Returns:
- a collection of all objects of the given type that were imported
- Throws:
org.hibernate.HibernateException
- if the objects could not successfully be looked up
-
reportIncompleteDefferredOperations
public void reportIncompleteDefferredOperations() throws Exception
Deprecated.Log any deferred operations that are still pending. Usually done at the end of an import in case something went wrong with the dependency mechanism (or the backup was corrupt)- Throws:
Exception
- there was some problem reporting the deferred operations (should not happen)
-
generateNewIdFor
public <T> Object generateNewIdFor(Class<T> clazz, T object) throws org.hibernate.HibernateException, SQLException
Deprecated.- Throws:
org.hibernate.HibernateException
SQLException
-
setPreProcessor
public void setPreProcessor(ImportedObjectPreProcessor preProcessor)
Deprecated.
-
getPreProcessor
public ImportedObjectPreProcessor getPreProcessor()
Deprecated.
-
isPreserveIds
public boolean isPreserveIds()
Deprecated.
-
getExportDescriptor
public ExportDescriptor getExportDescriptor()
Deprecated.
-
-