public class ImportProcessorContext extends Object implements ImportProcessorSummary
Constructor and Description |
---|
ImportProcessorContext(net.sf.hibernate.engine.SessionImplementor session,
net.sf.hibernate.engine.SessionFactoryImplementor sessionFactory,
com.atlassian.core.util.ProgressMeter meter,
boolean preserveIds,
ImportedObjectPreProcessor preProcessor) |
Modifier and Type | Method and Description |
---|---|
void |
addExplicitIdMapping(TransientHibernateHandle transientHibernateHandle,
Serializable mappedId) |
void |
addUnsatisfiedObjectDependencies(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(Map<TransientHibernateHandle,Set<Operation>> operations)
Deprecated.
since 5.2 Use
deferOperations(PrimitiveId, Map) |
void |
deferOperations(PrimitiveId idProperty,
Map<TransientHibernateHandle,Set<Operation>> operations)
Defer a set of operations until the objects they require have been imported.
|
<T> Object |
generateNewIdFor(Class<T> clazz,
T object) |
net.sf.hibernate.metadata.ClassMetadata |
getClassMetadata(Class classToPersist)
Gets the hibernate class metadata for a particular class
|
Object |
getContextVariable(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).
|
Serializable |
getIdMappingFor(TransientHibernateHandle handle) |
Collection<TransientHibernateHandle> |
getImportedObjectHandlesOfType(Class clazz)
Get handles for all objects of a particular class that were imported.
|
<T> Collection<T> |
getImportedObjectsOfType(Class<T> clazz)
Retrieve all the objects of a particular class that were imported.
|
Set<TransientHibernateHandle> |
getPersistedMappedHandles() |
Set<TransientHibernateHandle> |
getPersistedUnmappedHandles() |
net.sf.hibernate.persister.ClassPersister |
getPersister(Class classToPersist)
Get the Hibernate class persister for a particular class.
|
ImportedObjectPreProcessor |
getPreProcessor() |
net.sf.hibernate.engine.SessionImplementor |
getSession()
Gets the current Hibernate session.
|
Object |
getUnfixedIdFor(Class clazz,
Object newId) |
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(com.atlassian.confluence.core.persistence.hibernate.TransientHibernateHandle) . |
boolean |
isPreserveIds() |
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.
|
<T> T |
polyMorphicLookupByUnfixedId(long id,
Class<? extends T>... classes) |
void |
reportIncompleteDefferredOperations()
Log any deferred operations that are still pending.
|
void |
saveObject(Object object)
Save a particular object to the Hibernate session.
|
void |
saveObject(Serializable id,
Class classToPersist,
Object objectToPersist) |
void |
setContextVariable(String key,
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).
|
void |
setPreProcessor(ImportedObjectPreProcessor preProcessor) |
public ImportProcessorContext(net.sf.hibernate.engine.SessionImplementor session, net.sf.hibernate.engine.SessionFactoryImplementor sessionFactory, com.atlassian.core.util.ProgressMeter meter, boolean preserveIds, ImportedObjectPreProcessor preProcessor) throws net.sf.hibernate.HibernateException
net.sf.hibernate.HibernateException
public void objectImported(TransientHibernateHandle handle) throws Exception
handle
- the handle of the persisted object, before any ID mapping occurredException
- if some error occurred running the deferred operationspublic net.sf.hibernate.persister.ClassPersister getPersister(Class classToPersist) throws net.sf.hibernate.MappingException
net.sf.hibernate.MappingException
public boolean isObjectAlreadyImported(TransientHibernateHandle key)
objectImported(com.atlassian.confluence.core.persistence.hibernate.TransientHibernateHandle)
.public void saveObject(Object object) throws net.sf.hibernate.HibernateException
net.sf.hibernate.HibernateException
public net.sf.hibernate.metadata.ClassMetadata getClassMetadata(Class classToPersist) throws net.sf.hibernate.HibernateException
net.sf.hibernate.HibernateException
public Object lookupObjectByUnfixedHandle(TransientHibernateHandle key) throws net.sf.hibernate.HibernateException
net.sf.hibernate.HibernateException
public <T> T polyMorphicLookupByUnfixedId(long id, Class<? extends T>... classes) throws net.sf.hibernate.HibernateException
net.sf.hibernate.HibernateException
public net.sf.hibernate.engine.SessionImplementor getSession()
public void deferOperations(PrimitiveId idProperty, Map<TransientHibernateHandle,Set<Operation>> operations)
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.@Deprecated public void deferOperations(Map<TransientHibernateHandle,Set<Operation>> operations)
deferOperations(PrimitiveId, Map)
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()
EmptyStackException
- if there is no pending objecthasPendingDeferredObject()
,
addUnsatisfiedObjectDependencies(java.util.Set, com.atlassian.confluence.importexport.xmlimport.model.ImportedObject)
public void addUnsatisfiedObjectDependencies(Set<TransientHibernateHandle> unsatisfiedObjectDependencies, ImportedObject importedObject)
nextPendingDeferredObject()
unsatisfiedObjectDependencies
- importedObject
- nextPendingDeferredObject()
,
hasPendingDeferredObject()
public Object getContextVariable(String key)
key
- the key of the context variable to retrievepublic void setContextVariable(String key, Object value)
key
- the key of the context variable to setvalue
- the value to associate with the keypublic Serializable getIdMappingFor(TransientHibernateHandle handle)
getIdMappingFor
in interface ImportProcessorSummary
public void saveObject(Serializable id, Class classToPersist, Object objectToPersist) throws net.sf.hibernate.HibernateException, SQLException
net.sf.hibernate.HibernateException
SQLException
public void addExplicitIdMapping(TransientHibernateHandle transientHibernateHandle, Serializable mappedId)
public Set<TransientHibernateHandle> getPersistedUnmappedHandles()
getPersistedUnmappedHandles
in interface ImportProcessorSummary
public Set<TransientHibernateHandle> getPersistedMappedHandles()
getPersistedMappedHandles
in interface ImportProcessorSummary
public Object getUnfixedIdFor(Class clazz, Object newId)
getUnfixedIdFor
in interface ImportProcessorSummary
public Collection<TransientHibernateHandle> getImportedObjectHandlesOfType(Class clazz)
getImportedObjectHandlesOfType
in interface ImportProcessorSummary
clazz
- the class of objects being looked forpublic <T> Collection<T> getImportedObjectsOfType(Class<T> clazz) throws net.sf.hibernate.HibernateException
getImportedObjectsOfType
in interface ImportProcessorSummary
clazz
- the class being looked upnet.sf.hibernate.HibernateException
- if the objects could not successfully be looked uppublic void reportIncompleteDefferredOperations() throws Exception
Exception
- there was some problem reporting the deferred operations (should not happen)public <T> Object generateNewIdFor(Class<T> clazz, T object) throws net.sf.hibernate.HibernateException, SQLException
net.sf.hibernate.HibernateException
SQLException
public void setPreProcessor(ImportedObjectPreProcessor preProcessor)
public ImportedObjectPreProcessor getPreProcessor()
public boolean isPreserveIds()
Copyright © 2003–2016 Atlassian. All rights reserved.