@Override @PreAuthorize("hasAnyRole('ROLE_ADMIN','ROLE_USER')") public void writeCorrectionCas(JCas aJcas, SourceDocument aDocument) throws IOException { casStorageService.writeCas(aDocument, aJcas, CORRECTION_USER); }
@Override @PreAuthorize("hasAnyRole('ROLE_ADMIN','ROLE_USER')") public void writeCorrectionCas(JCas aJcas, SourceDocument aDocument) throws IOException { casStorageService.writeCas(aDocument, aJcas, CORRECTION_USER); }
@Override @PreAuthorize("hasAnyRole('ROLE_ADMIN','ROLE_USER')") @Transactional public void writeCurationCas(JCas aJcas, SourceDocument aDocument, boolean aUpdateTimestamp) throws IOException { casStorageService.writeCas(aDocument, aJcas, CURATION_USER); if (aUpdateTimestamp) { aDocument.setTimestamp(new Timestamp(new Date().getTime())); entityManager.merge(aDocument); } }
@Override @Transactional public void writeAnnotationCas(JCas aJCas, AnnotationDocument aAnnotationDocument, boolean aUpdateTimestamp) throws IOException { casStorageService.writeCas(aAnnotationDocument.getDocument(), aJCas, aAnnotationDocument.getUser()); if (aUpdateTimestamp) { // FIXME REC Does it really make sense to set the accessed sentence from the source // document?! aAnnotationDocument.setSentenceAccessed( aAnnotationDocument.getDocument().getSentenceAccessed()); aAnnotationDocument.setTimestamp(new Timestamp(new Date().getTime())); setAnnotationDocumentState(aAnnotationDocument, AnnotationDocumentState.IN_PROGRESS); } applicationEventPublisher .publishEvent(new AfterAnnotationUpdateEvent(this, aAnnotationDocument, aJCas)); }
@Override @Transactional public void writeAnnotationCas(JCas aJCas, AnnotationDocument aAnnotationDocument, boolean aUpdateTimestamp) throws IOException { casStorageService.writeCas(aAnnotationDocument.getDocument(), aJCas, aAnnotationDocument.getUser()); if (aUpdateTimestamp) { // FIXME REC Does it really make sense to set the accessed sentence from the source // document?! aAnnotationDocument.setSentenceAccessed( aAnnotationDocument.getDocument().getSentenceAccessed()); aAnnotationDocument.setTimestamp(new Timestamp(new Date().getTime())); setAnnotationDocumentState(aAnnotationDocument, AnnotationDocumentState.IN_PROGRESS); } applicationEventPublisher .publishEvent(new AfterAnnotationUpdateEvent(this, aAnnotationDocument, aJCas)); }
@Test public void testCasMetadataGetsCreated() throws Exception { List<TypeSystemDescription> typeSystems = new ArrayList<>(); typeSystems.add(createTypeSystemDescription()); typeSystems.add(CasMetadataUtils.getInternalTypeSystem()); JCas cas = JCasFactory.createJCas(mergeTypeSystems(typeSystems)); SourceDocument doc = makeSourceDocument(1l, 1l); String user = "test"; sut.writeCas(doc, cas, user); JCas cas2 = sut.readCas(doc, user); List<CASMetadata> cmds = new ArrayList<>(select(cas2, CASMetadata.class)); assertThat(cmds).hasSize(1); assertThat(cmds.get(0).getProjectId()).isEqualTo(doc.getProject().getId()); assertThat(cmds.get(0).getSourceDocumentId()).isEqualTo(doc.getId()); assertThat(cmds.get(0).getLastChangedOnDisk()) .isEqualTo(sut.getCasTimestamp(doc, user).get()); }
@Test public void testWriteReadExistsDeleteCas() throws Exception { SourceDocument doc = makeSourceDocument(1l, 1l); JCas cas = JCasFactory.createText("This is a test"); String user = "test"; sut.writeCas(doc, cas, user); assertThat(sut.getCasFile(doc, user)).exists(); assertThat(sut.existsCas(doc, user)).isTrue(); JCas cas2 = sut.readCas(doc, user); assertThat(cas2.getDocumentText()).isEqualTo(cas.getDocumentText()); sut.deleteCas(doc, user); assertThat(sut.getCasFile(doc, user)).doesNotExist(); assertThat(sut.existsCas(doc, user)).isFalse(); }
JCas initialCas = createOrReadInitialCasWithoutSaving(sd, messageSet); casDoctor.repair(project, initialCas.getCas(), messageSet.messages); casStorageService.writeCas(sd, initialCas, INITIAL_CAS_PSEUDO_USER);
JCas initialCas = createOrReadInitialCasWithoutSaving(sd, messageSet); casDoctor.repair(project, initialCas.getCas(), messageSet.messages); casStorageService.writeCas(sd, initialCas, INITIAL_CAS_PSEUDO_USER);
JCas cas = casStorageService.readCas(doc, ann.getUser()); annotationService.upgradeCas(cas.getCas(), doc, ann.getUser()); casStorageService.writeCas(doc, cas, ann.getUser()); JCas cas = casStorageService.readCas(doc, CURATION_USER); annotationService.upgradeCas(cas.getCas(), doc, CURATION_USER); casStorageService.writeCas(doc, cas, CURATION_USER);
JCas cas = casStorageService.readCas(doc, ann.getUser()); annotationService.upgradeCas(cas.getCas(), doc, ann.getUser()); casStorageService.writeCas(doc, cas, ann.getUser()); JCas cas = casStorageService.readCas(doc, CURATION_USER); annotationService.upgradeCas(cas.getCas(), doc, CURATION_USER); casStorageService.writeCas(doc, cas, CURATION_USER);