Class 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 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
      • 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()
      • 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 from nextPendingDeferredObject()
        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 set
        value - the value to associate with the key
      • 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 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
      • 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
      • isPreserveIds

        public boolean isPreserveIds()
        Deprecated.
      • getExportDescriptor

        public ExportDescriptor getExportDescriptor()
        Deprecated.