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

Refactor preservation logic and include hidden metadata #6244

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

BartChris
Copy link
Collaborator

@BartChris BartChris commented Oct 1, 2024

fixes #5220
alternative to #6238

This pull request addresses an issue where the special metadata fields "LABEL", "ORDERLABEL", and "CONTENTIDS" are lost when they are set as excluded metadata. When opening a process in the metadata editor and saving it, this loss can occur. A special problem is, that an excluded "ORDERLABEL" will result in broken pagination (#5220).

Pull request #6238 specifically resolves the issue of preserving pagination even when the ORDERLABEL is excluded by not resetting the ORDERLABEL in case of a page. However, in order to fully address the broader problem of losing the special metada fields when they are excluded, we must also ensure that the division data is updated based on hidden/excluded metadata.

This pull request not only resolves the issue of losing excluded metadata but also refactors the existing logic. The goal of the refactoring is to make the logic more explicit, improving both readability and maintainability. The current BiConsumer logic is difficult to follow, so I’ve aimed to preserve the functionality while making the code more understandable.

If this approach is rejected or introduces new problems, we should seek an alternative solution to properly handle hidden metadata.

@BartChris BartChris marked this pull request as ready for review October 1, 2024 16:29
return ((ProcessTextMetadata) value).getValue();
} else if (value instanceof ProcessSelectMetadata) {
return String.join(" ", ((ProcessSelectMetadata) value).getSelectedItems());
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Missing to handle ProcessBooleanMetadata

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 added boolean metadata.

private String extractSimpleValue(ProcessDetail value) {
if (value instanceof ProcessTextMetadata) {
return ((ProcessTextMetadata) value).getValue();
} else if (value instanceof ProcessSelectMetadata) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

In general, this refactoring is less object-oriented. It is not good practise to have lists of if (x instanceof A) { … } else if (x instanceof B) { … } else if (x instanceof C) { … } ...

Copy link
Collaborator Author

@BartChris BartChris Oct 25, 2024

Choose a reason for hiding this comment

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

I tried to adress that remark by putting the necessary logic in the specific class and call it using polymorphism.

Copy link
Collaborator

@matthias-ronge matthias-ronge 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 missing case for ProcessBooleanMetadata.

In general, I am only half-convineced about this refactoring, because is less object-oriented then. It is not good practise to have lists of if (x instanceof A) { … } else if (x instanceof B) { … } else if (x instanceof C) { … }, if that can be avoided. But I understand as well that the other variant is clumsy to read and understand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Setting the ORDERLABEL to excluded breaks the pagination
2 participants