-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make behaviour of repeated import configurable #5613
Merged
Merged
Changes from 16 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
81af102
Implement interface and tests
matthias-ronge 76725ee
Get reimport settings from ruleset
matthias-ronge 3dd9ac4
Implement metadata update
matthias-ronge a04c25d
Implement use
matthias-ronge d4b2085
Clean-up
matthias-ronge 88c50d1
Organize imports
matthias-ronge 96eb697
Add javadoc
matthias-ronge 7214ff3
Fix checkstyle (kitodo-data-editor)
matthias-ronge e31c7c2
Fix checkstyle
matthias-ronge 418dc62
Explain use on ruleset subhh.xml
matthias-ronge 0d7371b
Fix Codacy complains
matthias-ronge 92e3938
Use wrong use of Objects.nonNull() to check for null values
matthias-ronge e66b31e
Use an other error message
matthias-ronge b83c520
Replace 'var' typing with explicit type naming
matthias-ronge eb12937
Add an explaination that 'replace' does not delete not-imported metadata
matthias-ronge 6af03c4
Split long method
matthias-ronge 1979dfe
Implements the reimport behaviour respecting the maxOccurs setting
matthias-ronge 6183027
Fix import
matthias-ronge 9b5fb2e
Fix test dummy class
matthias-ronge b379c3a
Better explain the use of English
matthias-ronge 370c019
Update Kitodo-DataEditor/src/main/java/org/kitodo/dataeditor/ruleset/…
matthias-ronge 2177480
Update Kitodo-DataEditor/src/main/java/org/kitodo/dataeditor/ruleset/…
matthias-ronge 599eaeb
Update Kitodo-DataEditor/src/main/java/org/kitodo/dataeditor/ruleset/…
matthias-ronge 32b1469
Update Kitodo/src/main/java/org/kitodo/production/forms/createprocess…
matthias-ronge File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
Kitodo-DataEditor/src/main/java/org/kitodo/dataeditor/ruleset/xml/Reimport.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* (c) Kitodo. Key to digital objects e. V. <contact@kitodo.org> | ||
* | ||
* This file is part of the Kitodo project. | ||
* | ||
* It is licensed under GNU General Public License version 3 or later. | ||
* | ||
* For the full copyright and license information, please read the | ||
* GPL3-License.txt file that was distributed with this source code. | ||
*/ | ||
|
||
package org.kitodo.dataeditor.ruleset.xml; | ||
|
||
import javax.xml.bind.annotation.XmlEnum; | ||
import javax.xml.bind.annotation.XmlEnumValue; | ||
|
||
/** | ||
* This class is a backing bean for the XML attribute reimport in the | ||
* ruleset. With it, JAXB can map the attribute to an enum. | ||
*/ | ||
@XmlEnum(String.class) | ||
matthias-ronge marked this conversation as resolved.
Show resolved
Hide resolved
|
||
public enum Reimport { | ||
/** | ||
* The metadata should be added. | ||
*/ | ||
@XmlEnumValue("add") | ||
ADD, | ||
|
||
/** | ||
* The existing metadata should be kept. | ||
*/ | ||
@XmlEnumValue("keep") | ||
KEEP, | ||
|
||
/** | ||
* The existing metadata should be replaced. | ||
*/ | ||
@XmlEnumValue("replace") | ||
REPLACE | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a conditional replacement. If
updateEntry
value is empty it will not replaced. I think this should be at least in the description of the ruleset.xsd.Maybe it makes sense to make two replace variants out of this. e.g. like it is the case with
git-reset
https://git-scm.com/docs/git-reset. SoREPLACE_HARD
will be to replace independent ofupdateEntries
value andREPLACE_SOFT
checks theupdateEntries
value before.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
currentEntries
is the metadata (for that one key) that is in the user interface. It may be manually entered, or it may have come from the previous import, if that import returned different fields, like first importing a manuscript record from the library catalog, and then importing the record for that manuscript from a secondary database, that holds different information. Without the check, any other metadata, that doesn’t come with the second import, would be deleted during the repeated import, which should not be what the user expects.