Class ImportProcessorContext
java.lang.Object
com.atlassian.confluence.importexport.xmlimport.ImportProcessorContext
- All Implemented Interfaces:
- 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 SummaryConstructorsConstructorDescriptionImportProcessorContext(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 SummaryModifier and TypeMethodDescriptionvoidaddExplicitIdMapping(TransientHibernateHandle TransientHibernateHandle5, Serializable mappedId) Deprecated.voidaddUnsatisfiedObjectDependencies(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.voiddeferOperations(PrimitiveId idProperty, Map<TransientHibernateHandle, Set<Operation>> operations) Deprecated.Defer a set of operations until the objects they require have been imported.<T> ObjectgenerateNewIdFor(Class<T> clazz, T object) Deprecated.org.hibernate.metadata.ClassMetadatagetClassMetadata(Class classToPersist) Deprecated.Gets the hibernate class metadata for a particular classgetContextVariable(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.EntityPersistergetEntityPersister(Class classToPersist) Deprecated.Get the Hibernate class persister for a particular class.Deprecated.Deprecated.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.Deprecated.Deprecated.org.hibernate.persister.entity.EntityPersistergetPersister(Class classToPersist) Deprecated.Get the Hibernate class persister for a particular class.Deprecated.org.hibernate.engine.spi.SessionImplementorDeprecated.Gets the current Hibernate session.getUnfixedIdFor(Class clazz, Object newId) Deprecated.booleanDeprecated.When an object that has previously been deferred due to missing dependencies is able to be persisted, it is pushed onto a stack.booleanDeprecated.Has an object with this type and ID already been imported? Checks against all the handles that have been recorded byobjectImported(TransientHibernateHandle).booleanDeprecated.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.Deprecated.Pops any pending deferred object off the stack (seehasPendingDeferredObject()voidDeprecated.Record that a particular object has been successfully persisted.<T> TpolyMorphicLookupByUnfixedId(long id, Class<? extends T>... classes) Deprecated.voidDeprecated.Log any deferred operations that are still pending.voidsaveObject(Serializable id, Class classToPersist, Object objectToPersist) Deprecated.voidsaveObject(Object object) Deprecated.Save a particular object to the Hibernate session.voidsetContextVariable(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).voidsetPreProcessor(ImportedObjectPreProcessor preProcessor) Deprecated.
- 
Constructor Details- 
ImportProcessorContextpublic 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
 
- 
ImportProcessorContextpublic 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 Details- 
objectImportedDeprecated.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
 
- 
getPersisterpublic 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
 
- 
getEntityPersisterpublic 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
 
- 
isObjectAlreadyImportedDeprecated.Has an object with this type and ID already been imported? Checks against all the handles that have been recorded byobjectImported(TransientHibernateHandle).
- 
saveObjectDeprecated.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
 
- 
getClassMetadatapublic 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
 
- 
lookupObjectByUnfixedHandlepublic 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
 
- 
polyMorphicLookupByUnfixedIdpublic <T> T polyMorphicLookupByUnfixedId(long id, Class<? extends T>... classes) throws org.hibernate.HibernateException Deprecated.- Throws:
- org.hibernate.HibernateException
 
- 
getSessionpublic 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.
- 
deferOperationspublic 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.
 
- 
hasPendingDeferredObjectpublic 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:
 
- 
nextPendingDeferredObjectDeprecated.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:
 
- 
addUnsatisfiedObjectDependenciespublic 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:
 
- 
getContextVariableDeprecated.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
 
- 
setContextVariableDeprecated.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 set
- value- the value to associate with the key
 
- 
getIdMappingForDeprecated.- Specified by:
- getIdMappingForin interface- ImportProcessorSummary
 
- 
saveObjectpublic void saveObject(Serializable id, Class classToPersist, Object objectToPersist) throws org.hibernate.HibernateException, SQLException Deprecated.- Throws:
- org.hibernate.HibernateException
- SQLException
 
- 
addExplicitIdMappingpublic void addExplicitIdMapping(TransientHibernateHandle TransientHibernateHandle5, Serializable mappedId) Deprecated.
- 
getPersistedUnmappedHandlesDeprecated.- Specified by:
- getPersistedUnmappedHandlesin interface- ImportProcessorSummary
 
- 
getPersistedMappedHandlesDeprecated.- Specified by:
- getPersistedMappedHandlesin interface- ImportProcessorSummary
 
- 
getUnfixedIdForDeprecated.- Specified by:
- getUnfixedIdForin interface- ImportProcessorSummary
 
- 
getImportedObjectHandlesOfTypeDeprecated.Get handles for all objects of a particular class that were imported. Useful for post-processing.- Specified by:
- getImportedObjectHandlesOfTypein interface- ImportProcessorSummary
- Parameters:
- clazz- the class of objects being looked for
- Returns:
- a collection of handles to all imported objects of that type
 
- 
getImportedObjectsOfTypepublic <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:
- getImportedObjectsOfTypein interface- ImportProcessorSummary
- 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
 
- 
reportIncompleteDefferredOperationsDeprecated.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)
 
- 
generateNewIdForpublic <T> Object generateNewIdFor(Class<T> clazz, T object) throws org.hibernate.HibernateException, SQLException Deprecated.- Throws:
- org.hibernate.HibernateException
- SQLException
 
- 
setPreProcessorDeprecated.
- 
getPreProcessorDeprecated.
- 
isPreserveIdspublic boolean isPreserveIds()Deprecated.
- 
getExportDescriptorDeprecated.
 
-