@Test public void testGetMappingDetailsOnStudyWithAssociationsThatHaveErrors() throws Exception { STU_WITH_ASSOCIATIONS.setAssociations(Collections.singletonList(ASS3)); Set<String> warnings = new HashSet<>(); warnings.add("No Gene For Symbol"); when(associationValidationReportService.getWarningSet(ASS3.getId())).thenReturn(warnings); CurationSystemEmailToCurator email = emailMappingErrorsService.getMappingDetails(STU_WITH_ASSOCIATIONS, EMAIL1); assertThat(email).isInstanceOf(CurationSystemEmailToCurator.class); assertThat(email).hasFieldOrProperty("body"); assertThat(email.getBody()).contains("Validation Results: No Gene For Symbol"); }
public CurationSystemEmailToCurator getMappingDetails(Study study, CurationSystemEmailToCurator email) { String associationSummary = ""; Collection<Association> associations = study.getAssociations(); if (associations == null || associations.isEmpty()) { associationSummary = "No associations for this study"; } else { for (Association association : associations) { SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss"); String mappingDate = ""; String performer = ""; if (association.getLastMappingDate() != null) { mappingDate = dateFormat.format(association.getLastMappingDate()); } if (association.getLastMappingPerformedBy() != null) { performer = association.getLastMappingPerformedBy(); } String associationLink = email.getLink() + "associations/" + association.getId(); Set<String> validationWarnings = associationValidationReportService.getWarningSet(association.getId()); String validationWarningsForEmailBody = formatWarnings(validationWarnings); if (!validationWarningsForEmailBody.contains("No validation warnings found")) { associationSummary = associationSummary + "Association: " + associationLink + "\n" + "Validation Results: " + validationWarningsForEmailBody + "Last Mapping Date: " + mappingDate + "\n" + "Last Mapping Performed By: " + performer + "\n\n"; } } } if (associationSummary.isEmpty()) { associationSummary = "Note: No validation warnings detected for any association in this study."; } email.addToBody(associationSummary); return email; }
EmailMappingErrorsService { public CurationSystemEmailToCurator getMappingDetails(Study study, CurationSystemEmailToCurator email) { String associationSummary = ""; Collection<Association> associations = study.getAssociations(); if (associations == null || associations.isEmpty()) { associationSummary = "No associations for this study"; } else { for (Association association : associations) { SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss"); String mappingDate = ""; String performer = ""; if (association.getLastMappingDate() != null) { mappingDate = dateFormat.format(association.getLastMappingDate()); } if (association.getLastMappingPerformedBy() != null) { performer = association.getLastMappingPerformedBy(); } String associationLink = email.getLink() + "associations/" + association.getId(); Set<String> validationWarnings = associationValidationReportService.getWarningSet(association.getId()); String validationWarningsForEmailBody = formatWarnings(validationWarnings); if (!validationWarningsForEmailBody.contains("No validation warnings found")) { associationSummary = associationSummary + "Association: " + associationLink + "\n" + "Validation Results: " + validationWarningsForEmailBody + "Last Mapping Date: " + mappingDate + "\n" + "Last Mapping Performed By: " + performer + "\n\n"; } } } if (associationSummary.isEmpty()) { associationSummary = "Note: No validation warnings detected for any association in this study."; } email.addToBody(associationSummary); return email; } }
EmailMappingErrorsService { public CurationSystemEmailToCurator getMappingDetails(Study study, CurationSystemEmailToCurator email) { String associationSummary = ""; Collection<Association> associations = study.getAssociations(); if (associations == null || associations.isEmpty()) { associationSummary = "No associations for this study"; } else { for (Association association : associations) { SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss"); String mappingDate = ""; String performer = ""; if (association.getLastMappingDate() != null) { mappingDate = dateFormat.format(association.getLastMappingDate()); } if (association.getLastMappingPerformedBy() != null) { performer = association.getLastMappingPerformedBy(); } String associationLink = email.getLink() + "associations/" + association.getId(); Set<String> validationWarnings = associationValidationReportService.getWarningSet(association.getId()); String validationWarningsForEmailBody = formatWarnings(validationWarnings); if (!validationWarningsForEmailBody.contains("No validation warnings found")) { associationSummary = associationSummary + "Association: " + associationLink + "\n" + "Validation Results: " + validationWarningsForEmailBody + "Last Mapping Date: " + mappingDate + "\n" + "Last Mapping Performed By: " + performer + "\n\n"; } } } if (associationSummary.isEmpty()) { associationSummary = "Note: No validation warnings detected for any association in this study."; } email.addToBody(associationSummary); return email; } @Autowired  EmailMappingErrorsService(AssociationValidationReportService associationValidationReportService); }
EmailMappingErrorsService { public CurationSystemEmailToCurator getMappingDetails(Study study, CurationSystemEmailToCurator email) { String associationSummary = ""; Collection<Association> associations = study.getAssociations(); if (associations == null || associations.isEmpty()) { associationSummary = "No associations for this study"; } else { for (Association association : associations) { SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss"); String mappingDate = ""; String performer = ""; if (association.getLastMappingDate() != null) { mappingDate = dateFormat.format(association.getLastMappingDate()); } if (association.getLastMappingPerformedBy() != null) { performer = association.getLastMappingPerformedBy(); } String associationLink = email.getLink() + "associations/" + association.getId(); Set<String> validationWarnings = associationValidationReportService.getWarningSet(association.getId()); String validationWarningsForEmailBody = formatWarnings(validationWarnings); if (!validationWarningsForEmailBody.contains("No validation warnings found")) { associationSummary = associationSummary + "Association: " + associationLink + "\n" + "Validation Results: " + validationWarningsForEmailBody + "Last Mapping Date: " + mappingDate + "\n" + "Last Mapping Performed By: " + performer + "\n\n"; } } } if (associationSummary.isEmpty()) { associationSummary = "Note: No validation warnings detected for any association in this study."; } email.addToBody(associationSummary); return email; } @Autowired  EmailMappingErrorsService(AssociationValidationReportService associationValidationReportService); CurationSystemEmailToCurator getMappingDetails(Study study, CurationSystemEmailToCurator email); }
EmailMappingErrorsService { public CurationSystemEmailToCurator getMappingDetails(Study study, CurationSystemEmailToCurator email) { String associationSummary = ""; Collection<Association> associations = study.getAssociations(); if (associations == null || associations.isEmpty()) { associationSummary = "No associations for this study"; } else { for (Association association : associations) { SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss"); String mappingDate = ""; String performer = ""; if (association.getLastMappingDate() != null) { mappingDate = dateFormat.format(association.getLastMappingDate()); } if (association.getLastMappingPerformedBy() != null) { performer = association.getLastMappingPerformedBy(); } String associationLink = email.getLink() + "associations/" + association.getId(); Set<String> validationWarnings = associationValidationReportService.getWarningSet(association.getId()); String validationWarningsForEmailBody = formatWarnings(validationWarnings); if (!validationWarningsForEmailBody.contains("No validation warnings found")) { associationSummary = associationSummary + "Association: " + associationLink + "\n" + "Validation Results: " + validationWarningsForEmailBody + "Last Mapping Date: " + mappingDate + "\n" + "Last Mapping Performed By: " + performer + "\n\n"; } } } if (associationSummary.isEmpty()) { associationSummary = "Note: No validation warnings detected for any association in this study."; } email.addToBody(associationSummary); return email; } @Autowired  EmailMappingErrorsService(AssociationValidationReportService associationValidationReportService); CurationSystemEmailToCurator getMappingDetails(Study study, CurationSystemEmailToCurator email);  }