Skip to content

Refactor: decouple ExportDms from ExportMets #6955

Draft
BartChris wants to merge 1 commit into
kitodo:mainfrom
BartChris:export_mets_refactor
Draft

Refactor: decouple ExportDms from ExportMets #6955
BartChris wants to merge 1 commit into
kitodo:mainfrom
BartChris:export_mets_refactor

Conversation

@BartChris
Copy link
Copy Markdown
Collaborator

@BartChris BartChris commented Apr 2, 2026

ExportDms currently extends ExportMets, introducing unnecessary coupling that makes further refactoring of the DMS export logic difficult.

This PR removes the inheritance relationship and refactors the code so that ExportDms uses ExportMets via composition instead. In addition, the startExport methods in ExportMets are removed, as they contributed to confusion about the relationship between both classes.

A dedicated MetsExportService is introduced to handle orchestration concerns (e.g. resolving user home, preparing directories, loading metadata), while ExportMets is reduced to a focused helper for writing METS files.

@codacy-production
Copy link
Copy Markdown

codacy-production Bot commented Apr 2, 2026

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics -10 complexity · 0 duplication

Metric Results
Complexity -10
Duplication 0

View in Codacy

TIP This summary will be updated as you push new changes. Give us feedback

// validate metadata
if (ConfigCore.getBooleanParameterOrDefaultValue(ParameterCore.USE_META_DATA_VALIDATION)
&& !ServiceManager.getMetadataValidationService().validate(gdzfile, this.myPrefs)) {
&& !ServiceManager.getMetadataValidationService().validate(gdzfile, prefs)) {

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note

Invoking
MetadataValidationService.validate
should be avoided because it has been deprecated.
LegacyMetsModsDigitalDocumentHelper gdzfile;
try {
gdzfile = new LegacyMetsModsDigitalDocumentHelper(this.myPrefs.getRuleset());
gdzfile = new LegacyMetsModsDigitalDocumentHelper(prefs.getRuleset());

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note

Invoking
LegacyMetsModsDigitalDocumentHelper.LegacyMetsModsDigitalDocumentHelper
should be avoided because it has been deprecated.
LegacyMetsModsDigitalDocumentHelper gdzfile;
try {
gdzfile = new LegacyMetsModsDigitalDocumentHelper(this.myPrefs.getRuleset());
gdzfile = new LegacyMetsModsDigitalDocumentHelper(prefs.getRuleset());

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note

Invoking
LegacyPrefsHelper.getRuleset
should be avoided because it has been deprecated.
@BartChris BartChris force-pushed the export_mets_refactor branch from dcb1dce to 3f54dc8 Compare April 7, 2026 15:03
@solth solth added the export Export mappings and configurations label Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

export Export mappings and configurations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants