public abstract class GenericMapper extends Object
Modifier and Type | Class and Description |
---|---|
protected static interface |
GenericMapper.Exporter<T> |
protected static interface |
GenericMapper.Importer<T> |
Modifier and Type | Field and Description |
---|---|
protected static String |
DATABASE_DATE_FORMAT |
protected static CrowdBackupDateConverter |
DATE_CONVERTER_FOR_EXPORT |
static String |
LEGACY_XML_DATE_FORMAT |
protected org.slf4j.Logger |
logger |
protected static String |
PLUGIN_KEY_PREFIX |
Constructor and Description |
---|
GenericMapper(org.hibernate.SessionFactory sessionFactory,
BatchProcessor batchProcessor) |
Modifier and Type | Method and Description |
---|---|
protected <T> void |
addEntities(List<T> entitiesToPersist,
HibernateOperation<org.hibernate.Session> hibernateOperation)
Replicates a collection of Hibernate persistable entities using the batch processor.
|
protected <T> void |
addEntitiesViaMerge(List<T> entitiesToPersist)
Replicates a collection of Hibernate persistable entities using the batch processor.
|
protected <T> void |
addEntitiesViaReplicate(List<T> entitiesToPersist)
Replicates a collection of Hibernate persistable entities using the batch processor.
|
protected void |
addEntity(Object entityToPersist)
Replicates a Hibernate persistable entity.
|
protected <T extends Serializable,E extends Serializable> |
addEntity(TransactionGroup<T,E> entitiesToPersist)
Replicates a collection of Hibernate persistable entities using the batch processor.
|
protected Object |
addEntityViaMerge(Object entityToPersist)
Replicates a Hibernate persistable entity.
|
protected Object |
addEntityViaSave(Object entityToPersist)
Replicates a Hibernate persistable entity.
|
protected void |
clearSession() |
protected <T> org.dom4j.Element |
exportXml(List<T> elements,
String collectionName,
String elementName,
GenericMapper.Exporter<T> exporter) |
protected String |
getAttributeValue(String name,
Map<String,Set<String>> attributes,
String defaultValue) |
protected Boolean |
getBoolean(org.dom4j.Element parent,
String name) |
protected boolean |
getBoolean(org.dom4j.Element parent,
String name,
boolean defaultValue) |
CrowdBackupDateConverter |
getDateConverterForXml(org.dom4j.Element root) |
protected Date |
getDateFromTimestamp(org.dom4j.Element parent,
String name) |
protected DirectoryType |
getDirectoryTypeFromLegacyCode(int code) |
protected Long |
getLong(org.dom4j.Element parent,
String name) |
protected String |
getNameFromLegacyCode(String codeName) |
protected OperationType |
getOperationTypeFromLegacyPermissionName(String name) |
protected <T> Optional<T> |
getOptionalValue(org.dom4j.Element parent,
String name,
Function<String,T> transformer) |
org.hibernate.SessionFactory |
getSessionFactory() |
protected String |
getString(org.dom4j.Element parent,
String name) |
protected <T> T |
getValue(org.dom4j.Element parent,
String name,
Function<String,T> transformer) |
<T> List<T> |
importXml(org.dom4j.Element root,
String collectionName,
GenericMapper.Importer<T> importer) |
protected void |
setCDATA(org.dom4j.Element certNode,
String name,
String data) |
protected <T> void |
setText(org.dom4j.Element parent,
String name,
T value) |
protected void |
setTimestamp(org.dom4j.Element parent,
String name,
Date date) |
protected final org.slf4j.Logger logger
public static final String LEGACY_XML_DATE_FORMAT
protected static final String DATABASE_DATE_FORMAT
protected static final String PLUGIN_KEY_PREFIX
protected static final CrowdBackupDateConverter DATE_CONVERTER_FOR_EXPORT
public GenericMapper(org.hibernate.SessionFactory sessionFactory, BatchProcessor batchProcessor)
public CrowdBackupDateConverter getDateConverterForXml(org.dom4j.Element root)
root
- the root element of the XMLprotected void addEntity(Object entityToPersist) throws ImportException
entityToPersist
- entity to replicate.ImportException
protected <T> void addEntities(List<T> entitiesToPersist, HibernateOperation<org.hibernate.Session> hibernateOperation) throws org.hibernate.HibernateException
entitiesToPersist
- entity to replicate.hibernateOperation
- the operation to perform on the entitiesorg.hibernate.HibernateException
protected <T> void addEntitiesViaReplicate(List<T> entitiesToPersist) throws org.hibernate.HibernateException
entitiesToPersist
- entity to replicate.org.hibernate.HibernateException
protected <T> void addEntitiesViaMerge(List<T> entitiesToPersist) throws org.hibernate.HibernateException
entitiesToPersist
- entity to replicate.org.hibernate.HibernateException
protected <T extends Serializable,E extends Serializable> void addEntity(TransactionGroup<T,E> entitiesToPersist) throws org.hibernate.HibernateException
entitiesToPersist
- transaction group containing primary and dependent entities.org.hibernate.HibernateException
protected Object addEntityViaMerge(Object entityToPersist) throws ImportException
entityToPersist
- entity to replicate.ImportException
- error persisting.protected Object addEntityViaSave(Object entityToPersist) throws ImportException
entityToPersist
- entity to replicate.ImportException
- error persisting.protected <T> void setText(org.dom4j.Element parent, String name, T value)
protected <T> T getValue(org.dom4j.Element parent, String name, Function<String,T> transformer)
protected <T> Optional<T> getOptionalValue(org.dom4j.Element parent, String name, Function<String,T> transformer)
protected boolean getBoolean(org.dom4j.Element parent, String name, boolean defaultValue)
protected <T> org.dom4j.Element exportXml(List<T> elements, String collectionName, String elementName, GenericMapper.Exporter<T> exporter) throws ExportException
ExportException
public <T> List<T> importXml(org.dom4j.Element root, String collectionName, GenericMapper.Importer<T> importer) throws ImportException
ImportException
public org.hibernate.SessionFactory getSessionFactory()
protected OperationType getOperationTypeFromLegacyPermissionName(String name)
protected String getAttributeValue(String name, Map<String,Set<String>> attributes, String defaultValue)
protected DirectoryType getDirectoryTypeFromLegacyCode(int code)
protected void clearSession()
Copyright © 2021 Atlassian. All rights reserved.