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

feat(Event Frame Work): add intermediate superclass for PolicyDefinition Events hierarchy #1915

Conversation

janpmeyer
Copy link
Contributor

What this PR changes/adds

Add a 'intermediate' superclass for the Event Payload Classes of the PolicyDefinition classes.

Why it does that

Improve the work with the Event Framework and give the possibility to filter Events on a bigger group of events.

Linked Issue(s)

Closes #1914

Checklist

  • added appropriate tests?
  • performed checkstyle check locally?
  • added/updated copyright headers?
  • documented public classes/methods?
  • added/updated relevant documentation?
  • assigned appropriate label? (exclude from changelog with label no-changelog)
  • formatted title correctly? (take a look at the CONTRIBUTING and styleguide for details)

@janpmeyer janpmeyer added enhancement New feature or request core feature labels Sep 2, 2022
@janpmeyer janpmeyer temporarily deployed to Azure-dev September 2, 2022 07:31 Inactive
@codecov-commenter
Copy link

Codecov Report

Merging #1915 (782d100) into main (8737a4f) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #1915   +/-   ##
=======================================
  Coverage   62.78%   62.78%           
=======================================
  Files         781      782    +1     
  Lines       16614    16614           
  Branches     1079     1079           
=======================================
  Hits        10431    10431           
  Misses       5732     5732           
  Partials      451      451           
Impacted Files Coverage Δ
...vent/policydefinition/PolicyDefinitionCreated.java 100.00% <100.00%> (ø)
...vent/policydefinition/PolicyDefinitionDeleted.java 100.00% <100.00%> (ø)
...policydefinition/PolicyDefinitionEventPayload.java 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@mspiekermann mspiekermann requested a review from ndr-brt September 5, 2022 14:02

import org.eclipse.dataspaceconnector.spi.event.EventPayload;

public class PolicyDefinitionEventPayload extends EventPayload {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please include documentation

Copy link
Contributor

Choose a reason for hiding this comment

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

How about: "Contains data related to policy definition events"?

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 add this additionally to the current information, ok?

public String getPolicyDefinitionId() {
return policyDefinitionId;
}
public static class Payload extends PolicyDefinitionEventPayload {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please include documentation

Copy link
Contributor

@jimmarino jimmarino 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 documentation

@janpmeyer janpmeyer temporarily deployed to Azure-dev September 7, 2022 13:10 Inactive
@janpmeyer
Copy link
Contributor Author

@jimmarino Added the asked documentation. Just give me a feedback if its the way you want it.
If it is ok, i will add it the same way to the other PRs.

@jimmarino
Copy link
Contributor

I don't think this is necessarily related to this PR, but the PR highlights an issue: the event class hierarchy seems more complicated than it needs to be. Specifically, there are payload classes, some of which are package level, and others which are inner classes. This contributed to some confusing class hierarchies and a lot of extra classes.

@ndr-brt Why can't we flatten the event class structure by keeping payloads in the event? Common fields can be placed on abstract classes and with concrete classes containing the payload data directly. We don't need the ability to partially unwrap events, so wouldn't this make things easier and more concise?

We can also move this to a discussion instead of polluting the PR.

@ndr-brt
Copy link
Member

ndr-brt commented Sep 12, 2022

I don't think this is necessarily related to this PR, but the PR highlights an issue: the event class hierarchy seems more complicated than it needs to be. Specifically, there are payload classes, some of which are package level, and others which are inner classes. This contributed to some confusing class hierarchies and a lot of extra classes.

@ndr-brt Why can't we flatten the event class structure by keeping payloads in the event? Common fields can be placed on abstract classes and with concrete classes containing the payload data directly. We don't need the ability to partially unwrap events, so wouldn't this make things easier and more concise?

We can also move this to a discussion instead of polluting the PR.

@jimmarino the decision to have the payload separated from the Event class was taken down the road, I remember some discussion with @paullatzelsperger about this and keeping them separated seemed like the best option, the main goal that it achieves is to keep the event data (that's related to the context, it can be called "metadata" or "headers") separated from the payload data (that's strictly related to the event) also on a serialization level.
One positive aspect of this separation appears on the cloud-events extensions, where the event data is used to actually fill the cloud event metadata, and the payload alone is the "cloud event data":
https://github.com/eclipse-dataspaceconnector/DataSpaceConnector/blob/76a38259cd25bff93984c17d2afa28fa3fa94d52/extensions/common/events/cloudevents-http/src/main/java/org/eclipse/dataspaceconnector/events/cloudevents/http/CloudEventsPublisher.java#L65-L75

@janpmeyer
Copy link
Contributor Author

So im going to adjust the documentation as you described @jimmarino and push it to the PRs.

For the structure you are gonna open a discussion. Are you fine with this @jimmarino and @ndr-brt ?

@ndr-brt
Copy link
Member

ndr-brt commented Sep 12, 2022

So im going to adjust the documentation as you described @jimmarino and push it to the PRs.

For the structure you are gonna open a discussion. Are you fine with this @jimmarino and @ndr-brt ?

Yes I'm fine with it, I would go and merge these "superclass" PRs, then discuss modeling in parallel.

@jimmarino jimmarino self-requested a review September 12, 2022 21:38
@ndr-brt ndr-brt merged commit 0ba966f into eclipse-edc:main Sep 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core feature enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve Event Framework: Adding "intermediate" superclass for PolicyDefinition Events
4 participants