use of de.tudarmstadt.ukp.clarin.webanno.automation.service.export.model.ExportedMiraTemplate in project webanno by webanno.
the class AutomationMiraTemplateExporter method importData.
@Override
public void importData(ProjectImportRequest aRequest, Project aProject, ExportedProject aExProject, ZipFile aZip) throws Exception {
ExportedMiraTemplate[] templates = aExProject.getArrayProperty(MIRA_TEMPLATES, ExportedMiraTemplate.class);
for (ExportedMiraTemplate exTemplate : templates) {
MiraTemplate template = new MiraTemplate();
template.setAnnotateAndRepeat(exTemplate.isAnnotateAndPredict());
template.setAutomationStarted(false);
template.setCurrentLayer(exTemplate.isCurrentLayer());
template.setResult("---");
AnnotationLayer trainingLayer = annotationService.findLayer(aProject, exTemplate.getTrainFeature().getLayer());
AnnotationFeature trainingFeature = annotationService.getFeature(exTemplate.getTrainFeature().getName(), trainingLayer);
template.setTrainFeature(trainingFeature);
Set<AnnotationFeature> otherFeatures = new HashSet<>();
if (exTemplate.getOtherFeatures() != null) {
for (ExportedAnnotationFeatureReference other : exTemplate.getOtherFeatures()) {
AnnotationLayer layer = annotationService.findLayer(aProject, other.getLayer());
AnnotationFeature feature = annotationService.getFeature(other.getName(), layer);
otherFeatures.add(feature);
}
template.setOtherFeatures(otherFeatures);
}
automationService.createTemplate(template);
}
}
use of de.tudarmstadt.ukp.clarin.webanno.automation.service.export.model.ExportedMiraTemplate in project webanno by webanno.
the class AutomationMiraTemplateExporter method exportData.
@Override
public void exportData(ProjectExportRequest aRequest, ProjectExportTaskMonitor aMonitor, ExportedProject aExProject, File aStage) throws Exception {
List<ExportedMiraTemplate> exTemplates = new ArrayList<>();
for (MiraTemplate template : automationService.listMiraTemplates(aRequest.getProject())) {
ExportedMiraTemplate exTemplate = new ExportedMiraTemplate();
exTemplate.setAnnotateAndPredict(template.isAnnotateAndRepeat());
exTemplate.setAutomationStarted(template.isAutomationStarted());
exTemplate.setCurrentLayer(template.isCurrentLayer());
exTemplate.setResult(template.getResult());
exTemplate.setTrainFeature(new ExportedAnnotationFeatureReference(template.getTrainFeature()));
if (template.getOtherFeatures().size() > 0) {
Set<ExportedAnnotationFeatureReference> exOtherFeatures = new HashSet<>();
for (AnnotationFeature feature : template.getOtherFeatures()) {
exOtherFeatures.add(new ExportedAnnotationFeatureReference(feature));
}
exTemplate.setOtherFeatures(exOtherFeatures);
}
exTemplates.add(exTemplate);
}
aExProject.setProperty(MIRA_TEMPLATES, exTemplates);
}
Aggregations