/** * For the first time a curation page is opened, create a MergeCas that contains only agreeing * annotations Using the CAS of the curator user. * * @param aProject the project * @param randomAnnotationDocument an annotation document. * @param jCases the JCases * @param aAnnotationLayers the layers. * @return the JCas. * @throws IOException if an I/O error occurs. */ public JCas createCurationCas( Project aProject, AnnotationDocument randomAnnotationDocument, Map<String, JCas> jCases, List<AnnotationLayer> aAnnotationLayers) throws IOException { User userLoggedIn = userRepository.get(SecurityContextHolder.getContext().getAuthentication().getName()); JCas mergeJCas = repository.readAnnotationCas(randomAnnotationDocument); jCases.put(CurationPanel.CURATION_USER, mergeJCas); List<Type> entryTypes = getEntryTypes(mergeJCas, aAnnotationLayers, annotationService); DiffResult diff = CasDiff2.doDiffSingle( annotationService, aProject, entryTypes, jCases, 0, mergeJCas.getDocumentText().length()); for (Entry<Position, ConfigurationSet> diffEntry : diff.getDifferingConfigurationSets().entrySet()) { // Remove FSes with differences from the merge CAS List<Configuration> cfgsForCurationUser = diffEntry.getValue().getConfigurations(CurationPanel.CURATION_USER); for (Configuration cfg : cfgsForCurationUser) { FeatureStructure fs = cfg.getFs(CurationPanel.CURATION_USER, jCases); mergeJCas.removeFsFromIndexes(fs); } } repository.writeCurationCas(mergeJCas, randomAnnotationDocument.getDocument(), userLoggedIn); return mergeJCas; }