-
Notifications
You must be signed in to change notification settings - Fork 246
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: add getStatusPurpose method #4172
feat: add getStatusPurpose method #4172
Conversation
63003bc
to
36d3f5c
Compare
3db7149
to
cd42a65
Compare
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #4172 +/- ##
==========================================
+ Coverage 71.74% 75.02% +3.28%
==========================================
Files 919 1007 +88
Lines 18457 20471 +2014
Branches 1037 1153 +116
==========================================
+ Hits 13242 15359 +2117
+ Misses 4756 4610 -146
- Partials 459 502 +43 ☔ View full report in Codecov by Sentry. |
cd42a65
to
9d645f0
Compare
spi/common/boot-spi/src/main/java/org/eclipse/edc/spi/result/Result.java
Outdated
Show resolved
Hide resolved
if (credential.getCredentialStatus().isEmpty()) { | ||
return successNullable(null); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this guard is not necessary, when the status is empty the method will return a success(null) anyway
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's either the guard here, or I refactor / add a similar check in Line 76 to avoid a NPE:
var list = res.get(true).stream()
.filter(r -> r.getContent() != null)
.map(AbstractResult::getContent).toList();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nope, because the stream will be empty so the filter function will never be evaluated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, but the .get(true)
will, which is what'll cause the NPE. res
is a Map<Boolean, List<Result<...>>
due to the grouping
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ouch!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in any case, you don't need to get the true
, but you can stream directly on the whole credential.getCredentialStatus
, because at that point there won't be any failed results.
I'm ok also with the guard anyway
What this PR changes/adds
This PR adds a method
getStatusPurpose
to theRevocationListService
that returns either the active status ("suspension"
,"revocation"
) ornull
if no status is active.Why it does that
In IdentityHub we need to update the internal status of a
VerifiableCredentialResource
depending on this status.Further notes
Linked Issue(s)
addedResult#successNullable(@Nullable T content)
, because results can be successful and still carry no data.@NotNull
annotation fromResult#success(T content)
.Relates eclipse-edc/IdentityHub#340
Please be sure to take a look at the contributing guidelines and our etiquette for pull requests.