private void mergeTranslatedData(Experiment originalExperiment, Experiment translatedExperiment) { originalExperiment.getArrayDesigns().addAll(translatedExperiment.getArrayDesigns()); originalExperiment.setDate(translatedExperiment.getDate()); originalExperiment.setDescription(translatedExperiment.getDescription()); mergeFactors(originalExperiment, translatedExperiment); originalExperiment .getExperimentDesignTypes() .addAll(translatedExperiment.getExperimentDesignTypes()); originalExperiment.getNormalizationTypes().addAll(translatedExperiment.getNormalizationTypes()); originalExperiment.getPublications().addAll(translatedExperiment.getPublications()); originalExperiment .getQualityControlTypes() .addAll(translatedExperiment.getQualityControlTypes()); originalExperiment.getReplicateTypes().addAll(translatedExperiment.getReplicateTypes()); mergeExperimentContacts(originalExperiment, translatedExperiment); originalExperiment.getHybridizations().addAll(translatedExperiment.getHybridizations()); this.projectDao.save(originalExperiment.getHybridizations()); for (final LabeledExtract le : translatedExperiment.getLabeledExtracts()) { le.setExperiment(originalExperiment); originalExperiment.getLabeledExtracts().add(le); } this.projectDao.save(originalExperiment.getLabeledExtracts()); for (final Extract e : translatedExperiment.getExtracts()) { e.setExperiment(originalExperiment); originalExperiment.getExtracts().add(e); } this.projectDao.save(originalExperiment.getExtracts()); for (final Sample s : translatedExperiment.getSamples()) { s.setExperiment(originalExperiment); originalExperiment.getSamples().add(s); } this.projectDao.save(originalExperiment.getSamples()); for (final Source s : translatedExperiment.getSources()) { s.setExperiment(originalExperiment); originalExperiment.getSources().add(s); } this.projectDao.save(originalExperiment.getSources()); }
/* * Tests to make sure that Characteristic categories with various forms of * "external id", regardless of spaces and case, get translated into the * "externalId" attribute of the biomaterial. */ @Test public void testExternalIds() { MageTabDocumentSet ds = getDocumentSet(TestMageTabSets.EXTERNAL_ID_1_INPUT_SET); CaArrayFileSet fileSet = TestMageTabSets.getFileSet(ds); CaArrayTranslationResult result = this.translator.translate(ds, fileSet); Experiment experiment = result.getInvestigations().iterator().next(); Source src = experiment.getSources().iterator().next(); String sourceExternalId = src.getExternalId(); assertTrue(SOURCE_1_EXTERNAL_ID.equals(sourceExternalId)); Sample sampl = experiment.getSamples().iterator().next(); String sampleExternalId = sampl.getExternalId(); assertTrue(SAMPLE_1_EXTERNAL_ID.equals(sampleExternalId)); }