public void validateDocumentToUpdate(Document document) { List<Document> memberList = (List) document.get("members"); if (memberList != null) { // We make sure we don't store duplicates Map<Long, Individual> individualMap = new HashMap<>(); for (Document individual : memberList) { long id = individual.getInteger("uid").longValue(); int version = individual.getInteger("version"); if (id > 0) { Individual tmpIndividual = new Individual() .setVersion(version); tmpIndividual.setUid(id); individualMap.put(id, tmpIndividual); } } document.put("members", individualMap.entrySet().stream() .map(entry -> new Document() .append("uid", entry.getValue().getUid()) .append("version", entry.getValue().getVersion())) .collect(Collectors.toList())); } List<Document> disorderList = (List) document.get("disorders"); if (disorderList != null) { for (Document disorder : disorderList) { fixPhenotypeFields((List) disorder.get("evidences")); } } fixPhenotypeFields((List) document.get("phenotypes")); }
@Test public void testCreateIndividualFatherNotFound() throws Exception { long studyId = user3.getProjects().get(0).getStudies().get(0).getUid(); thrown.expect(CatalogDBException.class); catalogIndividualDBAdaptor.insert(studyId, new Individual("in1", "in1", new Individual().setId("father").setUid(10), null, null, null, null, null, "", null, null, null, "", Collections.emptyList(), false, 1, Collections.emptyList(), Collections.emptyList(), null), null); }
proband.setUid(resource.getResource().getUid());
individual.setUid(individualId); individual.setStudyUid(studyId); individual.setVersion(1);
new Individual.Population("valencian", "", ""), 2, AnnotationHelper.createAnnotation(), null); individual.setUid(300).setMultiples(new Multiples("twin", Arrays.asList("Pedro"))) .setKaryotypicSex(IndividualProperty.KaryotypicSex.XX).setVersion(4).setStatus(new Status("READY")). setLifeStatus(IndividualProperty.LifeStatus.ABORTED).setAffectationStatus(IndividualProperty.AffectationStatus.AFFECTED).