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

add barebones internal models for reports #146

Merged
merged 7 commits into from
Jan 17, 2019

Conversation

cwbriones
Copy link
Contributor

Defines the minimal amount necessary to build a report repository. These models are mostly POJOs but additional methods defining behavior are expected (particularly in the case of ReportSource and a Sink wrapper around RecipientGroup).


@Override
public Optional<Instant> getLastRun() {
return Optional.empty();
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 think, IIUC, this will take in some sort of callback that hides the ReportJobRepository when fetching the execution state but that would be added with the repo (or perhaps even after).

Copy link
Member

Choose a reason for hiding this comment

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

Not sure I agree. The two choices are:

  1. The internal model object is created with the current last run from the database when it is fetch from the repository using getJobI(UUID).

  2. The internal model object does not have this field and it must be fetched separately from the repository.

There are pros/cons to each approach. Regardless, the caller needs to understand the staleness/freshness of the internal model data and act accordingly. @speezepearson is probably in the best position to say which works better since he is writing the primary consumer code for this data.

@BrandonArp thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

After talking to @speezepearson I realized this functionality is already on JobRepository which coincides with option (2). Unless you have any objections I'll remove this and we can commit to the latter.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, that's fine. I spoke with Spencer about this yesterday afternoon; just make sure you're on the same page.

private String _name;
@NotNull
@MinSize(value = 1)
private Set<String> _emails;
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 added the @Email validator, but from some quick testing it seems like it doesn't think that '+' emails are valid (e.g. [email protected]

Copy link
Member

Choose a reason for hiding this comment

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

Here's the implementation:

https://github.com/sebthom/oval/blob/master/src/main/java/net/sf/oval/constraint/EmailCheck.java

Seem to work:

https://www.regexpal.com/?fam=107035

Of course there may be a bug in the checker; can you provide a test case?

Granted, it does not appear to be RFC compliant:

https://gist.github.com/gregseth/5582254

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So it works, it looks like the problem is that the builder validator does not honor the ConstraintTarget annotation. I could take a stab at adding that support myself but I'm not too familiar with all this reflection and code generation happening in there.

Copy link
Member

Choose a reason for hiding this comment

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

Is this the relevant issue on commons?

ArpNetworking/commons#23

I agree, this is not the time to fork more work. I assume you can work around it for now?

Please add a TODO to to the Metrics Portal code here with a link to issue 23 above.

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 created a new issue here: ArpNetworking/commons#79, I'll link to it in the TODO. This is fine, I can just use a method validator for the time being.

app/models/internal/impl/ChromeScreenshotReportSource.java Outdated Show resolved Hide resolved
app/models/internal/impl/ChromeScreenshotReportSource.java Outdated Show resolved Hide resolved
app/models/internal/impl/ChromeScreenshotReportSource.java Outdated Show resolved Hide resolved
app/models/internal/impl/ChromeScreenshotReportSource.java Outdated Show resolved Hide resolved
app/models/internal/reports/RecipientGroup.java Outdated Show resolved Hide resolved
app/models/internal/reports/RecipientGroup.java Outdated Show resolved Hide resolved
app/models/internal/reports/Report.java Outdated Show resolved Hide resolved
app/models/internal/reports/Report.java Show resolved Hide resolved
app/models/internal/reports/ReportFormat.java Show resolved Hide resolved
Defines the minimal amount necessary to build a report
repository. These models are mostly POJOs but additional
methods defining behaviour are expected (particularly
in the case of ReportSource).
PDF/HTML => pdf/html
Use Immutable* collections in all builders/interfaces
JavaDoc style
ConstraintTarget.VALUES isn't supported by OvalBuilder, we'll probably
have to roll a custom method validator until that is fixed.
Oval 1.90 introduced a fix to the @Email validator.
@cwbriones cwbriones force-pushed the barebones_internal_model branch from 5478d57 to f24a3be Compare January 16, 2019 22:50
@vjkoskela vjkoskela merged commit df6d842 into ArpNetworking:master Jan 17, 2019
@cwbriones cwbriones deleted the barebones_internal_model branch February 3, 2020 19:36
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