Class GenericMapper

java.lang.Object
com.atlassian.crowd.migration.GenericMapper
Direct Known Subclasses:
ApplicationSamlConfigurationEntityMapper, DatabaseMapper, GenericLegacyImporter, SAMLTrustEntityMapper, XmlMapper

public abstract class GenericMapper extends Object
  • Field Details

  • Constructor Details

    • GenericMapper

      public GenericMapper(org.hibernate.SessionFactory sessionFactory, BatchProcessor batchProcessor)
  • Method Details

    • getDateConverterForXml

      public CrowdBackupDateConverter getDateConverterForXml(org.dom4j.Element root)
      Parameters:
      root - the root element of the XML
      Returns:
      the appropriate date parser for the dates used across the given XML
    • addEntity

      protected void addEntity(Object entityToPersist) throws ImportException
      Replicates a Hibernate persistable entity.
      Parameters:
      entityToPersist - entity to replicate.
      Throws:
      ImportException
    • addEntities

      protected <T> void addEntities(List<T> entitiesToPersist, HibernateOperation<org.hibernate.Session> hibernateOperation) throws org.hibernate.HibernateException
      Replicates a collection of Hibernate persistable entities using the batch processor.
      Parameters:
      entitiesToPersist - entity to replicate.
      hibernateOperation - the operation to perform on the entities
      Throws:
      org.hibernate.HibernateException
    • addEntitiesViaReplicate

      protected <T> void addEntitiesViaReplicate(List<T> entitiesToPersist) throws org.hibernate.HibernateException
      Replicates a collection of Hibernate persistable entities using the batch processor.
      Parameters:
      entitiesToPersist - entity to replicate.
      Throws:
      org.hibernate.HibernateException
    • addEntitiesViaMerge

      protected <T> void addEntitiesViaMerge(List<T> entitiesToPersist) throws org.hibernate.HibernateException
      Replicates a collection of Hibernate persistable entities using the batch processor.
      Parameters:
      entitiesToPersist - entity to replicate.
      Throws:
      org.hibernate.HibernateException
    • addEntity

      protected <T extends Serializable, E extends Serializable> void addEntity(TransactionGroup<T,E> entitiesToPersist) throws org.hibernate.HibernateException
      Replicates a collection of Hibernate persistable entities using the batch processor.
      Parameters:
      entitiesToPersist - transaction group containing primary and dependent entities.
      Throws:
      org.hibernate.HibernateException
    • addEntityViaMerge

      protected Object addEntityViaMerge(Object entityToPersist) throws ImportException
      Replicates a Hibernate persistable entity.
      Parameters:
      entityToPersist - entity to replicate.
      Throws:
      ImportException - error persisting.
    • addEntityViaSave

      protected Object addEntityViaSave(Object entityToPersist) throws ImportException
      Replicates a Hibernate persistable entity.
      Parameters:
      entityToPersist - entity to replicate.
      Throws:
      ImportException - error persisting.
    • getDateFromTimestamp

      protected Date getDateFromTimestamp(org.dom4j.Element parent, String name)
    • getLong

      protected Long getLong(org.dom4j.Element parent, String name)
    • setTimestamp

      protected void setTimestamp(org.dom4j.Element parent, String name, Date date)
    • setCDATA

      protected void setCDATA(org.dom4j.Element certNode, String name, String data)
    • setText

      protected <T> void setText(org.dom4j.Element parent, String name, T value)
    • getValue

      protected <T> T getValue(org.dom4j.Element parent, String name, Function<String,T> transformer)
    • getOptionalValue

      protected <T> Optional<T> getOptionalValue(org.dom4j.Element parent, String name, Function<String,T> transformer)
    • getBoolean

      protected Boolean getBoolean(org.dom4j.Element parent, String name)
    • getBoolean

      protected boolean getBoolean(org.dom4j.Element parent, String name, boolean defaultValue)
    • getString

      protected String getString(org.dom4j.Element parent, String name)
    • exportXml

      protected <T> org.dom4j.Element exportXml(List<T> elements, String collectionName, String elementName, GenericMapper.Exporter<T> exporter) throws ExportException
      Throws:
      ExportException
    • importXml

      public <T> List<T> importXml(org.dom4j.Element root, String collectionName, GenericMapper.Importer<T> importer) throws ImportException
      Throws:
      ImportException
    • getSessionFactory

      public org.hibernate.SessionFactory getSessionFactory()
    • getOperationTypeFromLegacyPermissionName

      protected OperationType getOperationTypeFromLegacyPermissionName(String name)
    • getAttributeValue

      protected String getAttributeValue(String name, Map<String,Set<String>> attributes, String defaultValue)
    • getDirectoryTypeFromLegacyCode

      protected DirectoryType getDirectoryTypeFromLegacyCode(int code)
    • getNameFromLegacyCode

      protected String getNameFromLegacyCode(String codeName)
    • clearSession

      protected void clearSession()