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

provide a default repository implementation #114

Merged

Conversation

nderwin
Copy link
Contributor

@nderwin nderwin commented Oct 12, 2024

  • centralized some constants into a runtime class that can be used in multiple places
  • added a default read-only repository that can load a report file and any of it's subreports
  • added a build step to produce the default repository bean
  • updated the tests (except the JSON data source tests) to use the repository instead of doing the loading themselves
  • added a blurb in the docs about using the repository

Signed-off-by:Nathan Erwin [email protected]

@nderwin nderwin requested a review from a team as a code owner October 12, 2024 01:25
import net.sf.jasperreports.repo.SimpleRepositoryContext;
import net.sf.jasperreports.repo.StreamRepositoryService;

@Dependent
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be ApplicationScoped?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was thinking that we might leak things from one report invocation to the next, so explicitly making it @Dependent would help isolate it. I could be totally misunderstanding things too, and if we find that nothing is shared between invocations then @ApplicationScoped seems correct in that case.

@@ -0,0 +1,17 @@
package io.quarkiverse.jasperreports;

public interface Constants {
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm don't love generic Constants class let me see what other extensions do

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, me either. I would love to have a better pattern here.


// TODO - why is it not picking up the default value from ReportConfig???
@ConfigProperty(name = "quarkus.jasperreports.build.destination", defaultValue = Constants.DEFAULT_DEST_PATH)
Optional<Path> reportPathConfig;
Copy link
Contributor

@melloware melloware Oct 12, 2024

Choose a reason for hiding this comment

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

You had this as Optional String not path above. It might be that it's a Path?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I went several rounds with this, using String, using Path, changing the config to use a converter, changing the config to use an Optional with a converter, using a default method that set the value... No matter what, I still ended up with null for the value at this point, so I logged #115 and kind of punted by adding the defaultValue here. 😞

* centralized some constants into a runtime class that can be used in multiple places
* added a default read-only repository that can load a report file and any of it's subreports
* added a build step to produce the default repository bean
* updated the tests (except the JSON data source tests) to use the repository instead of doing the loading themselves
* added a blurb in the docs about using the repository

Signed-off-by:Nathan Erwin <[email protected]>
@nderwin nderwin force-pushed the feature/default-repository branch from c78c086 to 9c9128c Compare October 12, 2024 16:13
@melloware melloware merged commit fe6a575 into quarkiverse:main Oct 13, 2024
1 check passed
@nderwin nderwin deleted the feature/default-repository branch October 13, 2024 22:44
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.

2 participants