Class SingleDependencyGenericExporter
- java.lang.Object
-
- com.atlassian.confluence.impl.backuprestore.backup.exporters.SingleDependencyGenericExporter
-
- All Implemented Interfaces:
Exporter
,Subscriber
public class SingleDependencyGenericExporter extends Object implements Exporter, Subscriber
Generic data exporter depends on another single entity type. That means that it can handle notifications from that entity and export its own records. For example, SpacePermissions entity type depends on Space entity type only. When the space is exported, this generic data exporter for SpacePermissions can export all permissions related to the export. This algorithm does not work for notification because notifications have references to a few other entity types, so notifications have to have their own custom data exporter. Note that simple entities (like users, labels etc) are ignored because they are dependant on other entities and they should not trigger export of other entities. Like, the user object will be exported if it is referenced, but no other entities monitor exporting users.- Since:
- 7.20.0
-
-
Field Summary
Fields Modifier and Type Field Description protected CommonDatabaseDataExporter
commonExporter
protected String
ENTITY_BY_ID_QUERY
protected Class<?>
monitoredClass
-
Constructor Summary
Constructors Constructor Description SingleDependencyGenericExporter(CommonDatabaseDataExporter commonExporter, ExportableEntityInfo entityInfo, Set<Class<?>> simpleEntities)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
buildQuery(ExportableEntityInfo entityInfo, Set<Class<?>> simpleEntities)
protected void
export(Collection<Object> objectIdList)
protected static List<HibernateField>
getAllExternalReferencesExceptSimpleOnes(ExportableEntityInfo entityInfo, Set<Class<?>> simpleEntities)
ExportableEntityInfo
getEntityInfo()
Returns default entity info for persister.ExportableEntityInfo
getEntityInfo(Class<?> exportedClass)
Returns default entity info for the particular class.protected Class<?>
getMonitoredClass(ExportableEntityInfo entityInfo, Set<Class<?>> simpleEntities)
Collection<Class<?>>
getWatchingEntityClasses()
Return a collection of entity classes that subscriber will monitor the object export events.static boolean
isSuitableForExporter(ExportableEntityInfo entityInfo, Set<Class<?>> simpleEntities)
Returns true when the entity type has only one external reference (except references to the simple entities).void
onMonitoredObjectsExport(Class<?> exportedClass, Collection<Object> idList)
It is called when the collection of objects was exported.
-
-
-
Field Detail
-
commonExporter
protected final CommonDatabaseDataExporter commonExporter
-
monitoredClass
protected final Class<?> monitoredClass
-
ENTITY_BY_ID_QUERY
protected final String ENTITY_BY_ID_QUERY
-
-
Constructor Detail
-
SingleDependencyGenericExporter
public SingleDependencyGenericExporter(CommonDatabaseDataExporter commonExporter, ExportableEntityInfo entityInfo, Set<Class<?>> simpleEntities)
-
-
Method Detail
-
buildQuery
protected String buildQuery(ExportableEntityInfo entityInfo, Set<Class<?>> simpleEntities)
-
getMonitoredClass
protected Class<?> getMonitoredClass(ExportableEntityInfo entityInfo, Set<Class<?>> simpleEntities)
-
isSuitableForExporter
public static boolean isSuitableForExporter(ExportableEntityInfo entityInfo, Set<Class<?>> simpleEntities)
Returns true when the entity type has only one external reference (except references to the simple entities).
-
getWatchingEntityClasses
public Collection<Class<?>> getWatchingEntityClasses()
Description copied from interface:Subscriber
Return a collection of entity classes that subscriber will monitor the object export events. This is called when DatabaseExporterHelper register subscribers for all exporters. See UseDatabaseExporterHelper.registerSubscriber(Subscriber)
- Specified by:
getWatchingEntityClasses
in interfaceSubscriber
-
getEntityInfo
public ExportableEntityInfo getEntityInfo()
Description copied from interface:Exporter
Returns default entity info for persister. Will fail if the persister has to work with multiple hibernate entitites.- Specified by:
getEntityInfo
in interfaceExporter
-
getEntityInfo
public ExportableEntityInfo getEntityInfo(Class<?> exportedClass)
Description copied from interface:Exporter
Returns default entity info for the particular class.- Specified by:
getEntityInfo
in interfaceExporter
-
getAllExternalReferencesExceptSimpleOnes
protected static List<HibernateField> getAllExternalReferencesExceptSimpleOnes(ExportableEntityInfo entityInfo, Set<Class<?>> simpleEntities)
-
onMonitoredObjectsExport
public void onMonitoredObjectsExport(Class<?> exportedClass, Collection<Object> idList) throws InterruptedException, BackupRestoreException
Description copied from interface:Subscriber
It is called when the collection of objects was exported. This is called only for objects that this class is watching. SeegetWatchingEntityClasses()
- Specified by:
onMonitoredObjectsExport
in interfaceSubscriber
- Parameters:
exportedClass
- the exported classidList
- the list of ids of exported objects- Throws:
InterruptedException
BackupRestoreException
-
export
protected void export(Collection<Object> objectIdList)
-
-