Skip to content

Commit

Permalink
Merge pull request #906 from Cofinity-X/chore/upstream-contribution
Browse files Browse the repository at this point in the history
Chore/upstream contribution
  • Loading branch information
ds-lcapellino authored Jan 14, 2025
2 parents 8533972 + c33c8c7 commit 5a613d4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
9 changes: 5 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,17 @@ _**For better traceability add the corresponding GitHub issue number in each cha

## [Unreleased]

### Added
- Added api key authentication for edc notification requests

### Changed
### Changed

- Resolve Null pointer exception while registering the company #888
- Added the discovery type configurable, with a default value of bpnl in (ConnectorEndpointsService) (#12)

### Removed
- Removed subjectId from AssetAdministrationShellDescriptor object

### Added
- Added api key authentication for edc notification requests

## [5.4.1] - 2024-08-19

### Fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@
********************************************************************************/
package org.eclipse.tractusx.irs.edc.client.policy;

import java.util.Collections;
import java.util.List;
import java.util.Optional;

import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.ListUtils;
import org.eclipse.edc.policy.model.AndConstraint;
import org.eclipse.edc.policy.model.AtomicConstraint;
import org.eclipse.edc.policy.model.Constraint;
Expand Down Expand Up @@ -60,8 +59,8 @@ private boolean isValidOnList(final Constraint constraint, final List<Constraint
private boolean isSameAs(final Constraint constraint, final Constraints acceptedConstraints) {

if (constraint instanceof AtomicConstraint atomicConstraint) {
return acceptedConstraints.getOr().stream().anyMatch(p -> isSameAs(atomicConstraint, p))
|| acceptedConstraints.getAnd().stream().anyMatch(p -> isSameAs(atomicConstraint, p));
return ListUtils.emptyIfNull(acceptedConstraints.getOr()).stream().anyMatch(p -> isSameAs(atomicConstraint, p))
|| ListUtils.emptyIfNull(acceptedConstraints.getAnd()).stream().anyMatch(p -> isSameAs(atomicConstraint, p));
}

if (constraint instanceof AndConstraint andConstraint) {
Expand All @@ -74,15 +73,15 @@ private boolean isSameAs(final Constraint constraint, final Constraints accepted

return andConstraint.getConstraints()
.stream()
.allMatch(constr -> isInList(constr, Optional.ofNullable(acceptedConstraints.getAnd())
.orElse(Collections.emptyList())));
.allMatch(constr -> isInList(constr,
ListUtils.emptyIfNull(acceptedConstraints.getAnd())));
}

if (constraint instanceof OrConstraint orConstraint) {
return orConstraint.getConstraints()
.stream()
.anyMatch(constr -> isInList(constr, Optional.ofNullable(acceptedConstraints.getOr())
.orElse(Collections.emptyList())));
.anyMatch(constr -> isInList(constr,
ListUtils.emptyIfNull(acceptedConstraints.getOr())));
}

return false;
Expand All @@ -108,5 +107,4 @@ private boolean isSameAs(final AtomicConstraint atomicConstraint,
.build()
.isValid();
}

}

0 comments on commit 5a613d4

Please sign in to comment.