Tabnine Logo
de.tudarmstadt.ukp.clarin.webanno.export.model
Code IndexAdd Tabnine to your IDE (free)

How to use de.tudarmstadt.ukp.clarin.webanno.export.model

Best Java code snippets using de.tudarmstadt.ukp.clarin.webanno.export.model (Showing top 20 results out of 315)

origin: de.tudarmstadt.ukp.clarin.webanno/webanno-api-dao

private void exportSourceDocuments(Project aProject, ExportedProject exProject)
{
  List<ExportedSourceDocument> sourceDocuments = new ArrayList<>();
  // add source documents to a project
  List<SourceDocument> documents = documentService.listSourceDocuments(aProject);
  for (SourceDocument sourceDocument : documents) {
    ExportedSourceDocument exDocument = new ExportedSourceDocument();
    exDocument.setFormat(sourceDocument.getFormat());
    exDocument.setName(sourceDocument.getName());
    exDocument.setState(sourceDocument.getState());
    exDocument.setTimestamp(sourceDocument.getTimestamp());
    exDocument.setSentenceAccessed(sourceDocument.getSentenceAccessed());
    exDocument.setCreated(sourceDocument.getCreated());
    exDocument.setUpdated(sourceDocument.getUpdated());
    sourceDocuments.add(exDocument);
  }
  exProject.setSourceDocuments(sourceDocuments);
}
origin: de.tudarmstadt.ukp.clarin.webanno/webanno-api-dao

@Override
public void exportData(ProjectExportRequest aRequest, ExportedProject aExProject, File aStage)
  throws Exception
{
  List<ExportedTagSet> extTagSets = new ArrayList<>();
  for (TagSet tagSet : annotationService.listTagSets(aRequest.getProject())) {
    ExportedTagSet exTagSet = new ExportedTagSet();
    exTagSet.setCreateTag(tagSet.isCreateTag());
    exTagSet.setDescription(tagSet.getDescription());
    exTagSet.setLanguage(tagSet.getLanguage());
    exTagSet.setName(tagSet.getName());
    
    List<ExportedTag> exTags = new ArrayList<>();
    for (Tag tag : annotationService.listTags(tagSet)) {
      ExportedTag exTag = new ExportedTag();
      exTag.setDescription(tag.getDescription());
      exTag.setName(tag.getName());
      exTags.add(exTag);
    }
    exTagSet.setTags(exTags);
    extTagSets.add(exTagSet);
  }
  aExProject.setTagSets(extTagSets);
}

origin: de.tudarmstadt.ukp.clarin.webanno/webanno-api-dao

private void exportAnnotationDocuments(Project aProject, ExportedProject aExProject)
{
  List<ExportedAnnotationDocument> annotationDocuments = new ArrayList<>();
  // add source documents to a project
  List<SourceDocument> documents = documentService.listSourceDocuments(aProject);
  for (SourceDocument sourceDocument : documents) {
    // add annotation document to Project
    for (AnnotationDocument annotationDocument : documentService
        .listAnnotationDocuments(sourceDocument)) {
      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);
}
origin: de.tudarmstadt.ukp.clarin.webanno/webanno-api-dao

  private void importTagSet(TagSet aTagSet, ExportedTagSet aExTagSet, Project aProject)
    throws IOException
  {
    // aTagSet is a parameter because we want to use this also in the project settings
    // panel and have the ability there to merge imported tags into an existing tagset
    aTagSet.setCreateTag(aExTagSet.isCreateTag());
    aTagSet.setDescription(aExTagSet.getDescription());
    aTagSet.setLanguage(aExTagSet.getLanguage());
    aTagSet.setName(aExTagSet.getName());
    aTagSet.setProject(aProject);
    annotationService.createTagSet(aTagSet);

    for (ExportedTag exTag : aExTagSet.getTags()) {
      // do not duplicate tag
      if (annotationService.existsTag(exTag.getName(), aTagSet)) {
        continue;
      }
      Tag tag = new Tag();
      tag.setDescription(exTag.getDescription());
      tag.setTagSet(aTagSet);
      tag.setName(exTag.getName());
      annotationService.createTag(tag);
    }
  }
}
origin: de.tudarmstadt.ukp.clarin.webanno/webanno-api-dao

for (ExportedAnnotationLayer exLayer : aExProject.getLayers()) {
  if (annotationService.existsLayer(exLayer.getName(), exLayer.getType(), aProject)) {
    AnnotationLayer layer = annotationService.getLayer(exLayer.getName(), aProject);
    importLayer(layer, exLayer, aProject);
    for (ExportedAnnotationFeature exfeature : exLayer.getFeatures()) {
      if (annotationService.existsFeature(exfeature.getName(), layer)) {
        AnnotationFeature feature = annotationService.getFeature(
            exfeature.getName(), layer);
        importFeature(feature, exfeature, aProject);
        continue;
    AnnotationLayer layer = new AnnotationLayer();
    importLayer(layer, exLayer, aProject);
    for (ExportedAnnotationFeature exfeature : exLayer.getFeatures()) {
      AnnotationFeature feature = new AnnotationFeature();
      feature.setLayer(layer);
for (ExportedAnnotationLayer exLayer : aExProject.getLayers()) {
  if (exLayer.getAttachType() != null) {
    AnnotationLayer layer = annotationService.getLayer(exLayer.getName(), aProject);
    AnnotationLayer attachLayer = annotationService.getLayer(exLayer.getAttachType()
        .getName(), aProject);
    layer.setAttachType(attachLayer);
    if (exLayer.getAttachFeature() != null) {
      AnnotationFeature attachFeature = annotationService
          .getFeature(exLayer.getAttachFeature().getName(), attachLayer);
      layer.setAttachFeature(attachFeature);
origin: de.tudarmstadt.ukp.clarin.webanno/webanno-api-dao

/**
 * Create s {@link SourceDocument} from the exported {@link SourceDocument}
 * 
 * @param aImportedProjectSetting
 *            the exported project.
 * @param aImportedProject
 *            the project.
 * @throws IOException
 *             if an I/O error occurs.
 */
private void importSourceDocuments(ExportedProject aImportedProjectSetting,
    Project aImportedProject)
  throws IOException
{
  for (ExportedSourceDocument importedSourceDocument : aImportedProjectSetting
      .getSourceDocuments()) {
    SourceDocument sourceDocument = new SourceDocument();
    sourceDocument.setFormat(importedSourceDocument.getFormat());
    sourceDocument.setName(importedSourceDocument.getName());
    sourceDocument.setState(importedSourceDocument.getState());
    sourceDocument.setProject(aImportedProject);
    sourceDocument.setTimestamp(importedSourceDocument.getTimestamp());
    sourceDocument.setSentenceAccessed(importedSourceDocument.getSentenceAccessed());
    sourceDocument.setCreated(importedSourceDocument.getCreated());
    sourceDocument.setUpdated(importedSourceDocument.getUpdated());
    documentService.createSourceDocument(sourceDocument);
  }
}

origin: de.tudarmstadt.ukp.clarin.webanno/webanno-api-dao

  .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(documentService.getSourceDocument(aProject,
    exAnnotationDocument.getName()));
annotationDocument.setSentenceAccessed(exAnnotationDocument.getSentenceAccessed());
annotationDocument.setCreated(exAnnotationDocument.getCreated());
annotationDocument.setUpdated(exAnnotationDocument.getUpdated());
documentService.createAnnotationDocument(annotationDocument);
origin: de.tudarmstadt.ukp.clarin.webanno/webanno-api-dao

    layerToExLayers.get(layer).setAttachType(
        new ExportedAnnotationLayerReference(layer.getAttachType().getName()));
    layerToExLayers.get(layer).setAttachFeature(
        new ExportedAnnotationFeatureReference(layer.getAttachFeature()));
aExProject.setLayers(exLayers);
origin: de.tudarmstadt.ukp.clarin.webanno/webanno-project

/**
 * Create {@link ProjectPermission} from the exported
 * {@link de.tudarmstadt.ukp.clarin.webanno.export.model.ExportedProjectPermission}
 * 
 * @param aImportedProjectSetting
 *            the imported project.
 * @param aImportedProject
 *            the project.
 * @throws IOException
 *             if an I/O error occurs.
 */
@Deprecated
private void createProjectPermission(
    de.tudarmstadt.ukp.clarin.webanno.export.model.ExportedProject aImportedProjectSetting,
    Project aImportedProject)
  throws IOException
{
  for (ExportedProjectPermission importedPermission : aImportedProjectSetting
      .getProjectPermissions()) {
    ProjectPermission permission = new ProjectPermission();
    permission.setLevel(importedPermission.getLevel());
    permission.setProject(aImportedProject);
    permission.setUser(importedPermission.getUser());
    createProjectPermission(permission);
  }
}

origin: webanno/webanno

@Override
public void importData(ProjectImportRequest aRequest, Project aProject,
    ExportedProject aExProject, ZipFile aZip)
  throws Exception
{
  // this is projects prior to version 2.0
  if (aExProject.getVersion() == 0) {
    importTagSetsV0(aProject, aExProject);
  }
  else {
    for (ExportedTagSet exTagSet : aExProject.getTagSets()) {
      importTagSet(new TagSet(), exTagSet, aProject);
    }
  }
}

origin: webanno/webanno

@Override
public void exportData(ProjectExportRequest aRequest, ExportedProject aExProject, File aStage)
  throws Exception
{
  List<ExportedTagSet> extTagSets = new ArrayList<>();
  for (TagSet tagSet : annotationService.listTagSets(aRequest.getProject())) {
    ExportedTagSet exTagSet = new ExportedTagSet();
    exTagSet.setCreateTag(tagSet.isCreateTag());
    exTagSet.setDescription(tagSet.getDescription());
    exTagSet.setLanguage(tagSet.getLanguage());
    exTagSet.setName(tagSet.getName());
    
    List<ExportedTag> exTags = new ArrayList<>();
    for (Tag tag : annotationService.listTags(tagSet)) {
      ExportedTag exTag = new ExportedTag();
      exTag.setDescription(tag.getDescription());
      exTag.setName(tag.getName());
      exTags.add(exTag);
    }
    exTagSet.setTags(exTags);
    extTagSets.add(exTagSet);
  }
  aExProject.setTagSets(extTagSets);
}

origin: webanno/webanno

  private void importTagSet(TagSet aTagSet, ExportedTagSet aExTagSet, Project aProject)
    throws IOException
  {
    // aTagSet is a parameter because we want to use this also in the project settings
    // panel and have the ability there to merge imported tags into an existing tagset
    aTagSet.setCreateTag(aExTagSet.isCreateTag());
    aTagSet.setDescription(aExTagSet.getDescription());
    aTagSet.setLanguage(aExTagSet.getLanguage());
    aTagSet.setName(aExTagSet.getName());
    aTagSet.setProject(aProject);
    annotationService.createTagSet(aTagSet);

    for (ExportedTag exTag : aExTagSet.getTags()) {
      // do not duplicate tag
      if (annotationService.existsTag(exTag.getName(), aTagSet)) {
        continue;
      }
      Tag tag = new Tag();
      tag.setDescription(exTag.getDescription());
      tag.setTagSet(aTagSet);
      tag.setName(exTag.getName());
      annotationService.createTag(tag);
    }
  }
}
origin: webanno/webanno

private void exportSourceDocuments(Project aProject, ExportedProject exProject)
{
  List<ExportedSourceDocument> sourceDocuments = new ArrayList<>();
  // add source documents to a project
  List<SourceDocument> documents = documentService.listSourceDocuments(aProject);
  for (SourceDocument sourceDocument : documents) {
    ExportedSourceDocument exDocument = new ExportedSourceDocument();
    exDocument.setFormat(sourceDocument.getFormat());
    exDocument.setName(sourceDocument.getName());
    exDocument.setState(sourceDocument.getState());
    exDocument.setTimestamp(sourceDocument.getTimestamp());
    exDocument.setSentenceAccessed(sourceDocument.getSentenceAccessed());
    exDocument.setCreated(sourceDocument.getCreated());
    exDocument.setUpdated(sourceDocument.getUpdated());
    sourceDocuments.add(exDocument);
  }
  exProject.setSourceDocuments(sourceDocuments);
}
origin: webanno/webanno

/**
 * Create s {@link SourceDocument} from the exported {@link SourceDocument}
 * 
 * @param aImportedProjectSetting
 *            the exported project.
 * @param aImportedProject
 *            the project.
 * @throws IOException
 *             if an I/O error occurs.
 */
private void importSourceDocuments(ExportedProject aImportedProjectSetting,
    Project aImportedProject)
  throws IOException
{
  for (ExportedSourceDocument importedSourceDocument : aImportedProjectSetting
      .getSourceDocuments()) {
    SourceDocument sourceDocument = new SourceDocument();
    sourceDocument.setFormat(importedSourceDocument.getFormat());
    sourceDocument.setName(importedSourceDocument.getName());
    sourceDocument.setState(importedSourceDocument.getState());
    sourceDocument.setProject(aImportedProject);
    sourceDocument.setTimestamp(importedSourceDocument.getTimestamp());
    sourceDocument.setSentenceAccessed(importedSourceDocument.getSentenceAccessed());
    sourceDocument.setCreated(importedSourceDocument.getCreated());
    sourceDocument.setUpdated(importedSourceDocument.getUpdated());
    documentService.createSourceDocument(sourceDocument);
  }
}

origin: webanno/webanno

  .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(documentService.getSourceDocument(aProject,
    exAnnotationDocument.getName()));
annotationDocument.setSentenceAccessed(exAnnotationDocument.getSentenceAccessed());
annotationDocument.setCreated(exAnnotationDocument.getCreated());
annotationDocument.setUpdated(exAnnotationDocument.getUpdated());
documentService.createAnnotationDocument(annotationDocument);
origin: webanno/webanno

/**
 * Create {@link ProjectPermission} from the exported
 * {@link de.tudarmstadt.ukp.clarin.webanno.export.model.ExportedProjectPermission}
 * 
 * @param aImportedProjectSetting
 *            the imported project.
 * @param aImportedProject
 *            the project.
 * @throws IOException
 *             if an I/O error occurs.
 */
@Deprecated
private void createProjectPermission(
    de.tudarmstadt.ukp.clarin.webanno.export.model.ExportedProject aImportedProjectSetting,
    Project aImportedProject)
  throws IOException
{
  for (ExportedProjectPermission importedPermission : aImportedProjectSetting
      .getProjectPermissions()) {
    ProjectPermission permission = new ProjectPermission();
    permission.setLevel(importedPermission.getLevel());
    permission.setProject(aImportedProject);
    permission.setUser(importedPermission.getUser());
    createProjectPermission(permission);
  }
}

origin: de.tudarmstadt.ukp.clarin.webanno/webanno-api-dao

@Override
public void importData(ProjectImportRequest aRequest, Project aProject,
    ExportedProject aExProject, ZipFile aZip)
  throws Exception
{
  // this is projects prior to version 2.0
  if (aExProject.getVersion() == 0) {
    importTagSetsV0(aProject, aExProject);
  }
  else {
    for (ExportedTagSet exTagSet : aExProject.getTagSets()) {
      importTagSet(new TagSet(), exTagSet, aProject);
    }
  }
}

origin: webanno/webanno

@Deprecated
public static void createTagSet(TagSet aTagSet,
    ExportedTagSet aExTagSet, Project aProject,
    User aUser, AnnotationSchemaService aAnnotationService)
  throws IOException
{
  aTagSet.setCreateTag(aExTagSet.isCreateTag());
  aTagSet.setDescription(aExTagSet.getDescription());
  aTagSet.setLanguage(aExTagSet.getLanguage());
  aTagSet.setName(aExTagSet.getName());
  aTagSet.setProject(aProject);
  aAnnotationService.createTagSet(aTagSet);
  for (ExportedTag exTag : aExTagSet.getTags()) {
    // do not duplicate tag
    if (aAnnotationService.existsTag(exTag.getName(), aTagSet)) {
      continue;
    }
    Tag tag = new Tag();
    tag.setDescription(exTag.getDescription());
    tag.setTagSet(aTagSet);
    tag.setName(exTag.getName());
    aAnnotationService.createTag(tag);
  }
}
origin: de.tudarmstadt.ukp.clarin.webanno/webanno-api-dao

private static TagSet replaceTagSet(Project project,
    ExportedTagSet importedTagSet,
    AnnotationSchemaService aAnnotationService)
  throws IOException
{
  String importedTagSetName = importedTagSet.getName();
  de.tudarmstadt.ukp.clarin.webanno.model.TagSet tagsetInUse = aAnnotationService
      .getTagSet(importedTagSetName, project);
  // Remove all tags associated with Tagset
  aAnnotationService.removeAllTags(tagsetInUse);
  // Copy and update TagSet Information from imported tagset
  tagsetInUse.setDescription(importedTagSet.getDescription());
  tagsetInUse.setName(importedTagSetName);
  tagsetInUse.setLanguage(importedTagSet.getLanguage());
  tagsetInUse.setProject(project);
  aAnnotationService.createTagSet(tagsetInUse);
  // Add all tags from imported tagset
  for (ExportedTag tag : importedTagSet.getTags()) {
    Tag newTag = new Tag();
    newTag.setDescription(tag.getDescription());
    newTag.setName(tag.getName());
    newTag.setTagSet(tagsetInUse);
    aAnnotationService.createTag(newTag);
  }
  
  return tagsetInUse;
}

origin: webanno/webanno

private static TagSet replaceTagSet(Project project,
    ExportedTagSet importedTagSet,
    AnnotationSchemaService aAnnotationService)
  throws IOException
{
  String importedTagSetName = importedTagSet.getName();
  de.tudarmstadt.ukp.clarin.webanno.model.TagSet tagsetInUse = aAnnotationService
      .getTagSet(importedTagSetName, project);
  // Remove all tags associated with Tagset
  aAnnotationService.removeAllTags(tagsetInUse);
  // Copy and update TagSet Information from imported tagset
  tagsetInUse.setDescription(importedTagSet.getDescription());
  tagsetInUse.setName(importedTagSetName);
  tagsetInUse.setLanguage(importedTagSet.getLanguage());
  tagsetInUse.setProject(project);
  aAnnotationService.createTagSet(tagsetInUse);
  // Add all tags from imported tagset
  for (ExportedTag tag : importedTagSet.getTags()) {
    Tag newTag = new Tag();
    newTag.setDescription(tag.getDescription());
    newTag.setName(tag.getName());
    newTag.setTagSet(tagsetInUse);
    aAnnotationService.createTag(newTag);
  }
  
  return tagsetInUse;
}

de.tudarmstadt.ukp.clarin.webanno.export.model

Most used classes

  • ExportedProject
  • ExportedAnnotationFeature
  • ExportedAnnotationFeatureReference
  • ExportedAnnotationLayer
  • ExportedTag
  • ExportedAnnotationLayerReference,
  • ExportedProjectPermission,
  • ExportedAnnotationDocument,
  • ExportedSourceDocument
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now