Skip to content
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

Support output of metadata in docket creation #4968

Merged
merged 12 commits into from
Feb 6, 2023

Conversation

matthias-ronge
Copy link
Collaborator

@matthias-ronge matthias-ronge commented Feb 9, 2022

Fixes #4964, fixes #4963, fixes #4984

@matthias-ronge matthias-ronge changed the title Get '<anchor>' metadata elements from parent process Support output of metadata in docket creation Feb 14, 2022
@Kathrin-Huber
Copy link
Contributor

please fix checkstyle

Copy link
Contributor

@Kathrin-Huber Kathrin-Huber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add tests (with and without parent metadata)

@matthias-ronge

This comment was marked as resolved.

@solth
Copy link
Member

solth commented Sep 14, 2022

Please resolve conflicts

Copy link
Collaborator

@henning-gerhardt henning-gerhardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only a code review, no function review and beside my code remarks I have one more:

Changing nearly all methods to static of the moved class and some of the existing methods in other classes only to get ride out of the new operator for the class instance is wrong as the static methods are violating against the poly morph principle of object operating programming and is a sign of lazy programming in my opinion.

Comment on lines +75 to +76
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • used version of commons-collections is very, very old and should be replaced by commons-collections4
  • in the new created unit test there is no usage of this library or I did not see the usage

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apache Commons XMLConfiguration needs it. When I don’t add it, the test throw NoClassDefFoundError: org/apache/commons/collections/CollectionUtils

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is then the used scope test right? Should then the scope not changed to the default value so this dependency is visible and not hidden solved?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is only needed for the test to work. Don’t ask me why

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason is, that this dependency exists somewhere else too and is resolved there and as the application provide all needed dependencies the dependency here is solved in a "hidden" (or magic) way.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed test scope

@solth
Copy link
Member

solth commented Nov 29, 2022

Please rebase against master to fix broken Github CI builds!

Copy link
Collaborator

@henning-gerhardt henning-gerhardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again only a code review as we did not use this feature:

Looks okay but I don't see any requirements to made a lot of methods static. This may be possible but I don't likes static methods except for only a few tiny reasons.

@matthias-ronge
Copy link
Collaborator Author

A function is static if it does not use member variables, and does not use other functions that use member variables. In my opinion, any function to which this applies should then also be labeled as such. Then, as a programmer reading the source code, you know that these characteristics are met for this function. This is just like how we mark constants as final. You don't have to do this, it would work without it, but it says something to the programmer reading the code. I like to do that, also for myself, when I read my own code again years later. I find it clearer. Why does it bother you?

@henning-gerhardt
Copy link
Collaborator

henning-gerhardt commented Jan 10, 2023

Independent of the "static method" changes I'm unsure if all this changes should belong to the "Kitodo-Docket" module as this module in my understanding is only for creating the dockets and not for general generating pdf files depending on xslt, xml and meta data of the process. Maybe this should be discussed first before the changes are made.

@matthias-ronge
Copy link
Collaborator Author

matthias-ronge commented Jan 10, 2023

The sole purpose of generating the XML log is to create the docket from it. Previously, there were two places where the XML log was generated (duplicate code), one copy in the core for saving it to the user folder, and another copy in the docket module for creating the docket. These two have now been deduplicated and the code now only exists once.

In addition, due to incomplete copy-paste, the saved XML log was not exactly identical to what was generated in the Docket module, so if you developed an XSLT for a docket for a customer and it ran with the saved XML log, it still didn't work reliably with the docket module. This was very nerve-wracking when the customer wants many adjustments to the docket.xslt.

I think this change makes sense for both reasons, code deduplication and better configurability.

@henning-gerhardt
Copy link
Collaborator

This may be true (I did not validate your statement in any little detail) but and in mind of the current module concept the base (generating the XML log) should then be in a separate module and the current docket module should depend on this new module or if there are only some common logic: the common logic should be in one module and the outputs in two depending modules of this common module.

But I don't know if the current module concept is still valid or not. Maybe this should be discussed but there is no discussion ongoing as no one is participating as everyone has only his/her stuff to do. So @solth should be decide if this changes should all go into the current docket module or not.

@matthias-ronge
Copy link
Collaborator Author

Hi @henning-gerhardt: I removed the static modifiers from the static functions. From the point of view of the code review, is the source code consistent with the coding guidelines? If so, I would ask you to mark the pull request as approved.

I think the questions of dividing the functions into modules, and how to proceed at all with the modularization of the source code (there are quite a few more open questions, I think), are important, and you are welcome to open a GitHub discussion for this.

@henning-gerhardt
Copy link
Collaborator

I can review this maybe next week and I'm discussing some in deep details only in my native language.

@solth solth modified the milestone: Kitodo.Production 3.6.0 Feb 6, 2023
@solth solth merged commit 653afad into kitodo:master Feb 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants