Skip to content

Commit

Permalink
Merge pull request #3693 from inception-project/feature/3511-Add-empt…
Browse files Browse the repository at this point in the history
…y-project-template

#3511 - Add empty project template
  • Loading branch information
reckart authored Jan 6, 2023
2 parents c6eb6bb + 775f876 commit 0ef6ae8
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import de.tudarmstadt.ukp.clarin.webanno.project.initializers.StandardProjectInitializer;
import de.tudarmstadt.ukp.clarin.webanno.project.initializers.SurfaceFormLayerInitializer;
import de.tudarmstadt.ukp.clarin.webanno.project.initializers.TokenLayerInitializer;
import de.tudarmstadt.ukp.clarin.webanno.project.initializers.empty.EmptyProjectInitializer;
import de.tudarmstadt.ukp.inception.schema.AnnotationSchemaService;

@Configuration
Expand Down Expand Up @@ -182,4 +183,10 @@ public SentenceLayerInitializer sentenceLayerInitializer(AnnotationSchemaService
{
return new SentenceLayerInitializer(aSchemaService);
}

@Bean
public EmptyProjectInitializer emptyProjectInitializer()
{
return new EmptyProjectInitializer();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*
* Licensed to the Technische Universität Darmstadt under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The Technische Universität Darmstadt
* licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package de.tudarmstadt.ukp.clarin.webanno.project.initializers.empty;

import static java.util.Arrays.asList;

import java.io.IOException;
import java.util.List;

import de.tudarmstadt.ukp.clarin.webanno.api.project.ProjectInitializer;
import de.tudarmstadt.ukp.clarin.webanno.model.Project;
import de.tudarmstadt.ukp.clarin.webanno.project.initializers.QuickProjectInitializer;
import de.tudarmstadt.ukp.clarin.webanno.project.initializers.SentenceLayerInitializer;
import de.tudarmstadt.ukp.clarin.webanno.project.initializers.TokenLayerInitializer;
import de.tudarmstadt.ukp.clarin.webanno.project.initializers.config.ProjectInitializersAutoConfiguration;

/**
* <p>
* This class is exposed as a Spring Component via
* {@link ProjectInitializersAutoConfiguration#emptyProjectInitializer}.
* </p>
*/
public class EmptyProjectInitializer
implements QuickProjectInitializer
{
@Override
public String getName()
{
return "Empty project (no layers)";
}

@Override
public boolean alreadyApplied(Project aProject)
{
return false;
}

@Override
public boolean applyByDefault()
{
return false;
}

@Override
public List<Class<? extends ProjectInitializer>> getDependencies()
{
return asList( //
TokenLayerInitializer.class, //
SentenceLayerInitializer.class);
}

@Override
public void configure(Project aProject) throws IOException
{
aProject.setDescription("This project has no pre-defined layers. You will only be able to "
+ "annotate after you have defined annotation layers in the project settings.");
}
}

0 comments on commit 0ef6ae8

Please sign in to comment.