Search in sources :

Example 1 with ExportedAnnotationDocument

use of de.tudarmstadt.ukp.clarin.webanno.export.model.ExportedAnnotationDocument in project webanno by webanno.

the class AnnotationDocumentExporter method importAnnotationDocuments.

/**
 * Create {@link de.tudarmstadt.ukp.clarin.webanno.model.AnnotationDocument} from exported
 * {@link ExportedAnnotationDocument}
 *
 * @param aExProject
 *            the imported project.
 * @param aProject
 *            the project.
 * @throws IOException
 *             if an I/O error occurs.
 */
private void importAnnotationDocuments(ExportedProject aExProject, Project aProject, Map<String, SourceDocument> aNameToDoc) throws IOException {
    for (ExportedAnnotationDocument exAnnotationDocument : aExProject.getAnnotationDocuments()) {
        AnnotationDocument annotationDocument = new AnnotationDocument();
        annotationDocument.setName(exAnnotationDocument.getName());
        annotationDocument.setState(exAnnotationDocument.getState());
        annotationDocument.setProject(aProject);
        annotationDocument.setUser(exAnnotationDocument.getUser());
        annotationDocument.setTimestamp(exAnnotationDocument.getTimestamp());
        annotationDocument.setDocument(aNameToDoc.get(exAnnotationDocument.getName()));
        annotationDocument.setSentenceAccessed(exAnnotationDocument.getSentenceAccessed());
        annotationDocument.setCreated(exAnnotationDocument.getCreated());
        annotationDocument.setUpdated(exAnnotationDocument.getUpdated());
        documentService.createAnnotationDocument(annotationDocument);
    }
}
Also used : ExportedAnnotationDocument(de.tudarmstadt.ukp.clarin.webanno.export.model.ExportedAnnotationDocument) AnnotationDocument(de.tudarmstadt.ukp.clarin.webanno.model.AnnotationDocument) ExportedAnnotationDocument(de.tudarmstadt.ukp.clarin.webanno.export.model.ExportedAnnotationDocument)

Example 2 with ExportedAnnotationDocument

use of de.tudarmstadt.ukp.clarin.webanno.export.model.ExportedAnnotationDocument in project webanno by webanno.

the class AnnotationDocumentExporter method exportAnnotationDocuments.

private void exportAnnotationDocuments(ProjectExportTaskMonitor aMonitor, Project aProject, ExportedProject aExProject) {
    List<ExportedAnnotationDocument> annotationDocuments = new ArrayList<>();
    for (AnnotationDocument annotationDocument : documentService.listAnnotationDocuments(aProject)) {
        ExportedAnnotationDocument exAnnotationDocument = new ExportedAnnotationDocument();
        exAnnotationDocument.setName(annotationDocument.getName());
        exAnnotationDocument.setState(annotationDocument.getState());
        exAnnotationDocument.setUser(annotationDocument.getUser());
        exAnnotationDocument.setTimestamp(annotationDocument.getTimestamp());
        exAnnotationDocument.setSentenceAccessed(annotationDocument.getSentenceAccessed());
        exAnnotationDocument.setCreated(annotationDocument.getCreated());
        exAnnotationDocument.setUpdated(annotationDocument.getUpdated());
        annotationDocuments.add(exAnnotationDocument);
    }
    aExProject.setAnnotationDocuments(annotationDocuments);
}
Also used : ExportedAnnotationDocument(de.tudarmstadt.ukp.clarin.webanno.export.model.ExportedAnnotationDocument) ArrayList(java.util.ArrayList) AnnotationDocument(de.tudarmstadt.ukp.clarin.webanno.model.AnnotationDocument) ExportedAnnotationDocument(de.tudarmstadt.ukp.clarin.webanno.export.model.ExportedAnnotationDocument)

Aggregations

ExportedAnnotationDocument (de.tudarmstadt.ukp.clarin.webanno.export.model.ExportedAnnotationDocument)2 AnnotationDocument (de.tudarmstadt.ukp.clarin.webanno.model.AnnotationDocument)2 ArrayList (java.util.ArrayList)1