コード例 #1
0
 Map<String, Object> getAuditLogItem(Object current) {
   DynaBean currentDynaBean = new WrapDynaBean(current);
   return propertiesToTrack
       .stream()
       .map(
           name -> {
             return CollectionUtils.entry(name, currentDynaBean.get(name));
           })
       .collect(CollectionUtils.nullSafeEntriesToMap());
 }
コード例 #2
0
 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;
 }
コード例 #3
0
  protected <T extends CoiDisclosureAttachment> boolean deleteExistingAttachment(
      final int index, final List<T> attachments) {

    if (!CollectionUtils.validIndexForList(index, attachments)) {
      return false;
    }

    CoiDisclosureAttachment attachment = attachments.get(index);
    attachments.remove(attachment);

    return true;
  }
コード例 #4
0
 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;
 }
コード例 #6
0
 Map<String, Object> getUpdatedAuditLogItem(Object current, Object updated) {
   DynaBean currentDynaBean = new WrapDynaBean(current);
   DynaBean updatedDynaBean = new WrapDynaBean(updated);
   return propertiesToTrack
       .stream()
       .map(
           name -> {
             Object currentValue = currentDynaBean.get(name);
             Object newValue = updatedDynaBean.get(name);
             if (areValuesEqual(currentValue, newValue)) {
               return CollectionUtils.entry(name, currentValue);
             } else {
               Map<String, Object> diffs =
                   Stream.of(
                           CollectionUtils.entry("old", currentValue),
                           CollectionUtils.entry("new", newValue))
                       .collect(CollectionUtils.nullSafeEntriesToMap());
               return CollectionUtils.entry(name, (Object) diffs);
             }
           })
       .collect(CollectionUtils.nullSafeEntriesToMap());
 }
コード例 #7
0
 private static <T extends CoiDisclosureAttachment> T retrieveExistingAttachment(
     final int index, final List<T> attachments) {
   return CollectionUtils.getFromList(index, attachments);
 }