Skip to content

Commit

Permalink
chore(update): 1264 - added predicate for filtering.
Browse files Browse the repository at this point in the history
  • Loading branch information
ds-mwesener committed Jul 24, 2024
1 parent f35c716 commit 681e135
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,16 @@ public PageResult<Contract> getContractsByPageable(Pageable pageable, SearchCrit
&& (contract.getType().equals(ContractType.ASSET_AS_BUILT)
|| contract.getType().equals(ContractType.ASSET_AS_PLANNED));

Predicate<Contract> notificationWithoutGlobalAssetId = contract -> contract.getGlobalAssetId() == null
&& (contract.getType().equals(ContractType.NOTIFICATION));


Predicate<Contract> partsWithGlobalAssetIdOrNotificationWithoutGlobalAssetId = partsWithGlobalAssetId.or(notificationWithoutGlobalAssetId);

List<Contract> contracts = fetchEdcContractAgreements(baseEntities)
.stream()
.filter(contract -> contract.getContractId() != null)
.filter(partsWithGlobalAssetId)
.filter(partsWithGlobalAssetIdOrNotificationWithoutGlobalAssetId)
.toList();

return new PageResult<>(contracts,
Expand Down

0 comments on commit 681e135

Please sign in to comment.