-
Notifications
You must be signed in to change notification settings - Fork 63
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
add script for addData #4104
add script for addData #4104
Conversation
6d90e9c
to
c158356
Compare
c158356
to
1e40812
Compare
Before I start my review, first of all: I am pleased that you are making the copyData work again. But, I remember, we wanted to fundamentally reimplement it. Internally, the accesses are still passed on via the redirection interfaces for former UGH classes. In addition, new functionalities should be implemented, for example one should be able to access the parent documents. There was also an intranet page with a draft, but I'd have to look for it first. Now to the specific pull request: Which of the following functionalities should be included in this PR?
|
It's the smalles amount of funktionality. Can you point out, where old ugh classes are used? |
|
None of those classes are used anymore in the KitodoScripts. |
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.
What you are doing here is incompatible to the copyData syntax we used so far. Is this intentional? Your test may work, but only because it uses a "wrong" String script
(assuming that the old syntax should be retained).
String metadataKey = "LegalNoteAndTermsOfUse";
String script = "action:addData " + metadataKey + "=PDM1.0";
So your copyData command is:
LegalNoteAndTermsOfUse=PDM1.0
But it should look like this:
/@LegalNoteAndTermsOfUse = "PDM1.0"
/
is the logical root element of the structure tree, @
means: descend into attached metadata structure (not in logical structure), here points to a metadata key LegalNoteAndTermsOfUse
. White space. It is a question if white space is required for parsing the copyData commands. The old parser needed it. It should at least be optional. =
overwrite or create operator. White space. String in quotes, to indicate it is a string.
(Left side argument must always start with a /
character, right side arguments must always start with one of the following characters: /
(metadata), "
(constant string), $
(toString() of internal variable), or #
(select division relative to left side).)
I see two different approaches here.
- If you want to quickly find a solution to add metadata to the root element of the logical structure tree, implement exactly that in the
KitodoScriptService
. In that case you don't need any special syntax, just:
action:addMetadata key:LegalNoteAndTermsOfUse value:PDM1.0
action:copyMetadata key:LegalNoteAndTermsOfUse value:TSL_ATS
- If the aim is to bring the copydata functionality back, we should then write tests first (or even: we should first work out the syntax that will be needed in the future. There were approaches to this in the intranet. And then write tests). And then implement the functionality so that the tests no longer fail. There is a large amount of functionality in this. Getting this right is not trivial.
This review is not an approval or a rejection. If you intend to change the existing copyData syntax, your PR should do what it does. In that case, it would be good to document the new syntax.
ServiceManager.getMetsService().save(workpiece, out); | ||
ServiceManager.getProcessService().saveToIndex(data.getProcess(), false); | ||
} catch (IOException | CustomResponseException | DataException e) { | ||
System.out.println("log me"); |
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.
please use: Helper.setErrorMessage(e.getMessage(), logger, e)
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.
I'm going to remove this class, and as PRs are stacking up please be generous to spare me conflicts. :-)
This is a reimplementation of the copyData script. The resulting syntax may be slightly different, but the implementation is not done yet. |
is replaced by #4112 |
first part of #3368
only adding a new metadata is supported. Either by a given value or by a given metadata .
Not supported yet: