private List<ProposalLog> cleanSearchResultsForNegotiationLookup( List<ProposalLog> searchResults) { List<ProposalLog> newResults = CollectionUtils.createCorrectImplementationForCollection(searchResults); newResults.addAll( searchResults .stream() .filter(pl -> StringUtils.isBlank(pl.getInstProposalNumber())) .collect(Collectors.toList())); return newResults; }
protected List<ProposalLog> filterForPermissions(List<ProposalLog> results) { List<ProposalLog> proposalLogs = CollectionUtils.createCorrectImplementationForCollection(results); ProposalLogDocumentAuthorizer authorizer = new ProposalLogDocumentAuthorizer(); Person user = GlobalVariables.getUserSession().getPerson(); proposalLogs.addAll( results .stream() .filter(proposalLog -> proposalLog.getProposalNumber() != null) .filter(proposalLog -> authorizer.canOpen(proposalLog, user)) .collect(Collectors.toList())); return proposalLogs; }
protected List<ProtocolOnlineReviewBase> filterResults(List<ProtocolOnlineReviewBase> results) { List<ProtocolOnlineReviewBase> onlineReviews = CollectionUtils.createCorrectImplementationForCollection(results); // ensure that only pending submission statuses are shown for online reviews, i.e. do not show // reviews assigned but not completed for approved protocols. onlineReviews.addAll( results .stream() .filter(review -> review.getProtocolOnlineReviewDocument() != null) .filter( review -> !(review .getProtocolSubmission() .getSubmissionStatusCode() .equalsIgnoreCase(getProtocolSubmissionApprovedStatusCodeHook()) || review .getProtocolSubmission() .getSubmissionStatusCode() .equalsIgnoreCase(getProtocolSubmissionAdminApprovedStatusCodeHook()))) .collect(Collectors.toList())); return onlineReviews; }