Class SingleDependencyGenericExporter
java.lang.Object
com.atlassian.confluence.impl.backuprestore.backup.exporters.SingleDependencyGenericExporter
- All Implemented Interfaces:
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
FieldsModifier and TypeFieldDescriptionprotected final CommonDatabaseDataExporterprotected final Stringprotected final Class<?> -
Constructor Summary
ConstructorsConstructorDescriptionSingleDependencyGenericExporter(CommonDatabaseDataExporter commonExporter, ExportableEntityInfo entityInfo, Set<Class<?>> simpleEntities) -
Method Summary
Modifier and TypeMethodDescriptionprotected StringbuildQuery(ExportableEntityInfo entityInfo, Set<Class<?>> simpleEntities) protected voidexport(Collection<Object> objectIdList) protected static List<HibernateField> getAllExternalReferencesExceptSimpleOnes(ExportableEntityInfo entityInfo, Set<Class<?>> simpleEntities) Returns default entity info for persister.getEntityInfo(Class<?> exportedClass) Returns default entity info for the particular class.protected Class<?> getMonitoredClass(ExportableEntityInfo entityInfo, Set<Class<?>> simpleEntities) Collection<Class<?>> Return a collection of entity classes that subscriber will monitor the object export events.static booleanisSuitableForExporter(ExportableEntityInfo entityInfo, Set<Class<?>> simpleEntities) Returns true when the entity type has only one external reference (except references to the simple entities).voidonMonitoredObjectsExport(Class<?> exportedClass, Collection<Object> idList) It is called when the collection of objects was exported.
-
Field Details
-
commonExporter
-
monitoredClass
-
ENTITY_BY_ID_QUERY
-
-
Constructor Details
-
SingleDependencyGenericExporter
public SingleDependencyGenericExporter(CommonDatabaseDataExporter commonExporter, ExportableEntityInfo entityInfo, Set<Class<?>> simpleEntities)
-
-
Method Details
-
buildQuery
-
getMonitoredClass
-
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
Description copied from interface:SubscriberReturn 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:
getWatchingEntityClassesin interfaceSubscriber
-
getEntityInfo
Description copied from interface:ExporterReturns default entity info for persister. Will fail if the persister has to work with multiple hibernate entitites.- Specified by:
getEntityInfoin interfaceExporter
-
getEntityInfo
Description copied from interface:ExporterReturns default entity info for the particular class.- Specified by:
getEntityInfoin 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:SubscriberIt is called when the collection of objects was exported. This is called only for objects that this class is watching. SeegetWatchingEntityClasses()- Specified by:
onMonitoredObjectsExportin interfaceSubscriber- Parameters:
exportedClass- the exported classidList- the list of ids of exported objects- Throws:
InterruptedExceptionBackupRestoreException
-
export
-