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

WIP: Custom placeholders #12

Merged
merged 16 commits into from
Oct 12, 2020
Merged

WIP: Custom placeholders #12

merged 16 commits into from
Oct 12, 2020

Conversation

AntonOellerer
Copy link
Contributor

@AntonOellerer AntonOellerer commented Sep 17, 2020

Add custom placeholder infrastructure

To be able to add custom placeholders from outside of the
generator, infrastructure allowing this should be created
(#10 ).

In this MR, the current implementation approach is discussed.
The way this works is by having a registry where custom
placeholder resolvers (of type PlaceholderType.Custom) can
be registered.
When the resolver is passed a placeholder to resolve, the
resolver now consults the registry on whether it has a
resolver for the placeholder registered, and if it does it
accesses it a second time to retrieve an Optional of the
corresponding class.
The registry is passed to the resolver on first creation, and
subsequently gets passed to the recursive instantiations.

To be able to add custom placeholders from outside of the
generator infrastructure allowing this should be created
(gh issue #26)
This commit introduces a first draft for it.
The way this works is by having a registry where custom
placeholder resolvers (of type `PlaceholderType.Custom`) can
be registered.
When the resolver is passed a placeholder to resolve, it
now consults this registry whether it has a resolver
for it registered, and if it does it returns an `Optional`
of the corresponding class.
The registry is passed to the resolver on first creation, and
subsequently gets passed to the recursive instantiations.

Signed-off-by: Anton Oellerer <a.oellerer@docu-tools.com>
Until now, test relied on manually review the documents,
which led to a number of errors staying undiscovered in the
library.
This commit automates a big number of the tests with the
help of `poipath`

Signed-off-by: Anton Oellerer <a.oellerer@docu-tools.com>
Signed-off-by: Anton Oellerer <a.oellerer@docu-tools.com>
Signed-off-by: Anton Oellerer <a.oellerer@docu-tools.com>
# Conflicts:
#	src/main/java/com/docutools/jocument/impl/ReflectionResolver.java
@AntonOellerer AntonOellerer marked this pull request as draft September 17, 2020 09:32
@AntonOellerer AntonOellerer self-assigned this Sep 17, 2020
@AntonOellerer AntonOellerer added the enhancement New feature or request label Sep 17, 2020
@AntonOellerer AntonOellerer linked an issue Sep 17, 2020 that may be closed by this pull request
@alexpartsch alexpartsch moved this from To do to In progress in Release First Major Version of jocument Sep 23, 2020
@alexpartsch alexpartsch added this to the Get Jocument Cleaned up milestone Sep 23, 2020
# Conflicts:
#	build.gradle
#	src/test/java/com/docutools/jocument/TestUtils.java
This commit adds the path to the poipath github maven repo

Signed-off-by: Anton Oellerer <a.oellerer@docu-tools.com>
This commit refactors to fix problems found during the
first review of this branch.
Those are:
* Naming
* Running automated tests via tag
* Workbook closing
* Test minimization
* Additional tests for nested loops and pictures

Additionally , the path and version of poipath were updated

Signed-off-by: Anton Oellerer <a.oellerer@docu-tools.com>
This commit adds automated testing to the github action which
is triggered on every push

Signed-off-by: Anton Oellerer <a.oellerer@docu-tools.com>
Signed-off-by: Anton Oellerer <a.oellerer@docu-tools.com>
Since the formatting of the birthdate of a person was not
fixed, it was difficult to reproduce the birthdate string
correctly in testing.
This commit fixes the formatting to "dd.MM.yyyy", so this
is easier

Signed-off-by: Anton Oellerer <a.oellerer@docu-tools.com>
# Conflicts:
#	src/main/java/com/docutools/jocument/impl/ReflectionResolver.java
Signed-off-by: Anton Oellerer <a.oellerer@docu-tools.com>
This commit implements a test to test and demonstrate the
custom placeholder implementation.
Additionally the old table of contents test was removed

Signed-off-by: Anton Oellerer <a.oellerer@docu-tools.com>
@AntonOellerer AntonOellerer marked this pull request as ready for review October 9, 2020 18:37
@AntonOellerer AntonOellerer moved this from In progress to To review in Release First Major Version of jocument Oct 9, 2020
@AntonOellerer AntonOellerer changed the base branch from main to master October 9, 2020 18:44
@AntonOellerer AntonOellerer changed the base branch from master to main October 9, 2020 18:45
@AntonOellerer AntonOellerer changed the base branch from main to master October 9, 2020 18:46
@alexpartsch alexpartsch merged commit 1d359f2 into master Oct 12, 2020
@alexpartsch alexpartsch deleted the feature/custom_placeholders branch March 24, 2021 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

Custom placeholders implementation
2 participants