AnnotationLayer layer; if (annotationService.existsLayer(aExLayer.getName(), aExLayer.getType(), project)) { layer = annotationService.getLayer(aExLayer.getName(), project); ImportUtil.setLayer(annotationService, layer, aExLayer, project, aUser); ImportUtil.setLayer(annotationService, layer, aExLayer, project, aUser); for (ExportedAnnotationFeature exfeature : aExLayer.getFeatures()) { ExportedTagSet exTagset = exfeature.getTagSet(); TagSet tagSet = null; if (exTagset != null && annotationService.existsTagSet(exTagset.getName(), project)) { tagSet = annotationService.getTagSet(exTagset.getName(), project); ImportUtil.createTagSet(tagSet, exTagset, project, aUser, annotationService); ImportUtil.createTagSet(tagSet, exTagset, project, aUser, annotationService); if (annotationService.existsFeature(exfeature.getName(), layer)) { AnnotationFeature feature = annotationService.getFeature(exfeature.getName(), layer); feature.setTagset(tagSet); ImportUtil.setFeature(annotationService, feature, exfeature, project, aUser); continue; feature.setLayer(layer); feature.setTagset(tagSet); ImportUtil.setFeature(annotationService, feature, exfeature, project, aUser);
private IResourceStream exportLayerJson() { try { AnnotationLayer layer = getModelObject(); List<ExportedAnnotationLayer> exLayers = new ArrayList<>(); ExportedAnnotationLayer exMainLayer = ImportUtil.exportLayerDetails(null, null, layer, annotationService); exLayers.add(exMainLayer); // If the layer is attached to another layer, then we also have to export // that, otherwise we would be missing it during re-import. if (layer.getAttachType() != null) { AnnotationLayer attachLayer = layer.getAttachType(); ExportedAnnotationLayer exAttachLayer = ImportUtil.exportLayerDetails(null, null, attachLayer, annotationService); exMainLayer.setAttachType( new ExportedAnnotationLayerReference(exAttachLayer.getName())); exLayers.add(exAttachLayer); } return new InputStreamResourceStream(new ByteArrayInputStream( JSONUtil.toPrettyJsonString(exLayers).getBytes("UTF-8"))); } catch (Exception e) { error("Unable to generate the JSON file: " + ExceptionUtils.getRootCauseMessage(e)); ProjectLayersPanel.LOG.error("Unable to generate the JSON file", e); RequestCycle.get().find(IPartialPageRequestHandler.class) .ifPresent(handler -> handler.addChildren(getPage(), IFeedback.class)); return null; } }
error("No curation document created yet for this document"); } else { ExportUtil.exportCuratedDocuments(documentService, importExportService, ProjectExportForm.this.getModelObject(), exportTempDir, false); ZipUtils.zipFolder(exportTempDir, new File(
if (!ImportUtil.isZipValidWebanno(tempFile)) { throw new IOException("ZIP file is not a valid project archive");
String text = IOUtils.toString(tagInputStream, "UTF-8"); Map<String, String> tabbedTagsetFromFile = ImportUtil .getTagSetFromFile(text);
AnnotationLayer layer; if (annotationService.existsLayer(aExLayer.getName(), aExLayer.getType(), project)) { layer = annotationService.getLayer(aExLayer.getName(), project); ImportUtil.setLayer(annotationService, layer, aExLayer, project, aUser); ImportUtil.setLayer(annotationService, layer, aExLayer, project, aUser); for (ExportedAnnotationFeature exfeature : aExLayer.getFeatures()) { ExportedTagSet exTagset = exfeature.getTagSet(); TagSet tagSet = null; if (exTagset != null && annotationService.existsTagSet(exTagset.getName(), project)) { tagSet = annotationService.getTagSet(exTagset.getName(), project); ImportUtil.createTagSet(tagSet, exTagset, project, aUser, annotationService); ImportUtil.createTagSet(tagSet, exTagset, project, aUser, annotationService); if (annotationService.existsFeature(exfeature.getName(), layer)) { AnnotationFeature feature = annotationService.getFeature(exfeature.getName(), layer); feature.setTagset(tagSet); ImportUtil.setFeature(annotationService, feature, exfeature, project, aUser); continue; feature.setLayer(layer); feature.setTagset(tagSet); ImportUtil.setFeature(annotationService, feature, exfeature, project, aUser);
private IResourceStream exportLayerJson() { try { AnnotationLayer layer = getModelObject(); List<ExportedAnnotationLayer> exLayers = new ArrayList<>(); ExportedAnnotationLayer exMainLayer = ImportUtil.exportLayerDetails(null, null, layer, annotationService); exLayers.add(exMainLayer); // If the layer is attached to another layer, then we also have to export // that, otherwise we would be missing it during re-import. if (layer.getAttachType() != null) { AnnotationLayer attachLayer = layer.getAttachType(); ExportedAnnotationLayer exAttachLayer = ImportUtil.exportLayerDetails(null, null, attachLayer, annotationService); exMainLayer.setAttachType( new ExportedAnnotationLayerReference(exAttachLayer.getName())); exLayers.add(exAttachLayer); } return new InputStreamResourceStream(new ByteArrayInputStream( JSONUtil.toPrettyJsonString(exLayers).getBytes("UTF-8"))); } catch (Exception e) { error("Unable to generate the JSON file: " + ExceptionUtils.getRootCauseMessage(e)); ProjectLayersPanel.LOG.error("Unable to generate the JSON file", e); RequestCycle.get().find(IPartialPageRequestHandler.class) .ifPresent(handler -> handler.addChildren(getPage(), IFeedback.class)); return null; } }
if (!ImportUtil.isZipValidWebanno(tempFile)) { throw new UnsupportedFormatException("Incompatible to webanno ZIP file");
error("No curation document created yet for this document"); } else { ExportUtil.exportCuratedDocuments(documentService, importExportService, ProjectExportForm.this.getModelObject(), exportTempDir, false); ZipUtils.zipFolder(exportTempDir, new File(
String text = IOUtils.toString(tagInputStream, "UTF-8"); Map<String, String> tabbedTagsetFromFile = ImportUtil .getTagSetFromFile(text);
if (!ImportUtil.isZipValidWebanno(tempFile)) { throw new IOException("ZIP file is not a valid project archive");
if (!ImportUtil.isZipValidWebanno(tempFile)) { throw new UnsupportedFormatException("Incompatible to webanno ZIP file");
if (!ImportUtil.isZipValidWebanno(tempFile)) { throw new IOException("ZIP file is not a WebAnno project archive");
if (!ImportUtil.isZipValidWebanno(tempFile)) { throw new IOException("ZIP file is not a WebAnno project archive");