Package com.atlassian.crowd.migration
Class GenericMapper
java.lang.Object
com.atlassian.crowd.migration.GenericMapper
- Direct Known Subclasses:
ApplicationSamlConfigurationEntityMapper,DatabaseMapper,GenericLegacyImporter,SAMLTrustEntityMapper,XmlMapper
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static interfaceprotected static interface -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Stringprotected static final CrowdBackupDateConverterstatic final Stringprotected final org.slf4j.Loggerprotected static final String -
Constructor Summary
ConstructorsConstructorDescriptionGenericMapper(org.hibernate.SessionFactory sessionFactory, BatchProcessor batchProcessor) -
Method Summary
Modifier and TypeMethodDescriptionprotected <T> voidaddEntities(List<T> entitiesToPersist, HibernateOperation<org.hibernate.Session> hibernateOperation) Replicates a collection of Hibernate persistable entities using the batch processor.protected <T> voidaddEntitiesViaMerge(List<T> entitiesToPersist) Replicates a collection of Hibernate persistable entities using the batch processor.protected <T> voidaddEntitiesViaReplicate(List<T> entitiesToPersist) Replicates a collection of Hibernate persistable entities using the batch processor.protected <T extends Serializable,E extends Serializable>
voidaddEntity(TransactionGroup<T, E> entitiesToPersist) Replicates a collection of Hibernate persistable entities using the batch processor.protected voidReplicates a Hibernate persistable entity.protected ObjectaddEntityViaMerge(Object entityToPersist) Replicates a Hibernate persistable entity.protected ObjectaddEntityViaSave(Object entityToPersist) Replicates a Hibernate persistable entity.protected voidprotected <T> org.dom4j.ElementexportXml(List<T> elements, String collectionName, String elementName, GenericMapper.Exporter<T> exporter) protected Stringprotected BooleangetBoolean(org.dom4j.Element parent, String name) protected booleangetBoolean(org.dom4j.Element parent, String name, boolean defaultValue) getDateConverterForXml(org.dom4j.Element root) protected DategetDateFromTimestamp(org.dom4j.Element parent, String name) protected DirectoryTypegetDirectoryTypeFromLegacyCode(int code) protected Longprotected StringgetNameFromLegacyCode(String codeName) protected OperationTypeprotected <T> Optional<T>getOptionalValue(org.dom4j.Element parent, String name, Function<String, T> transformer) org.hibernate.SessionFactoryprotected Stringprotected <T> T<T> List<T>importXml(org.dom4j.Element root, String collectionName, GenericMapper.Importer<T> importer) protected voidprotected <T> voidprotected voidsetTimestamp(org.dom4j.Element parent, String name, Date date)
-
Field Details
-
logger
protected final org.slf4j.Logger logger -
LEGACY_XML_DATE_FORMAT
- See Also:
-
DATABASE_DATE_FORMAT
- See Also:
-
PLUGIN_KEY_PREFIX
- See Also:
-
DATE_CONVERTER_FOR_EXPORT
-
-
Constructor Details
-
GenericMapper
-
-
Method Details
-
getDateConverterForXml
- Parameters:
root- the root element of the XML- Returns:
- the appropriate date parser for the dates used across the given XML
-
addEntity
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.HibernateExceptionReplicates a collection of Hibernate persistable entities using the batch processor.- Parameters:
entitiesToPersist- transaction group containing primary and dependent entities.- Throws:
org.hibernate.HibernateException
-
addEntityViaMerge
Replicates a Hibernate persistable entity.- Parameters:
entityToPersist- entity to replicate.- Throws:
ImportException- error persisting.
-
addEntityViaSave
Replicates a Hibernate persistable entity.- Parameters:
entityToPersist- entity to replicate.- Throws:
ImportException- error persisting.
-
getDateFromTimestamp
-
getLong
-
setTimestamp
-
setCDATA
-
setText
-
getValue
-
getOptionalValue
-
getBoolean
-
getBoolean
-
getString
-
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
-
getAttributeValue
-
getDirectoryTypeFromLegacyCode
-
getNameFromLegacyCode
-
clearSession
protected void clearSession()
-