@Override public void configure(Project aProject) throws IOException { AnnotationLayer tokenLayer = new AnnotationLayer(Token.class.getName(), "Token", SPAN_TYPE, aProject, true, AnchoringMode.SINGLE_TOKEN); // Since the user cannot turn off validation for the token layer if there is any kind of // problem with the validation functionality we are conservative here and disable validation // from the start. tokenLayer.setValidationMode(NEVER); annotationSchemaService.createLayer(tokenLayer); } }
private List<AnnotationLayer> layers() { AnnotationLayer layer1 = new AnnotationLayer("webanno.custom.Span", "Span", WebAnnoConst.SPAN_TYPE, project, false, AnchoringMode.SINGLE_TOKEN); layer1.setValidationMode(ValidationMode.ALWAYS); AnnotationLayer layer2 = new AnnotationLayer("webanno.custom.Span2", "Span2", WebAnnoConst.SPAN_TYPE, project, false, AnchoringMode.SENTENCES); layer2.setValidationMode(ValidationMode.NEVER); AnnotationLayer layer3 = new AnnotationLayer("webanno.custom.Relation", "Relation", WebAnnoConst.RELATION_TYPE, project, true, AnchoringMode.TOKENS); return asList(layer1, layer2, layer3); }
@Deprecated public static void setLayer(AnnotationSchemaService aAnnotationService, AnnotationLayer aLayer, ExportedAnnotationLayer aExLayer, Project aProject, User aUser) throws IOException { aLayer.setAllowStacking(aExLayer.isAllowStacking()); aLayer.setBuiltIn(aExLayer.isBuiltIn()); aLayer.setReadonly(aExLayer.isReadonly()); aLayer.setCrossSentence(aExLayer.isCrossSentence()); aLayer.setDescription(aExLayer.getDescription()); aLayer.setEnabled(aExLayer.isEnabled()); if (aExLayer.getAnchoringMode() == null) { // This allows importing old projects which did not have the anchoring mode yet aLayer.setAnchoringMode(aExLayer.isLockToTokenOffset(), aExLayer.isMultipleTokens()); } else { aLayer.setAnchoringMode(aExLayer.getAnchoringMode()); } aLayer.setValidationMode(aExLayer.getValidationMode() != null ? aExLayer.getValidationMode() : ValidationMode.NEVER); aLayer.setLinkedListBehavior(aExLayer.isLinkedListBehavior()); aLayer.setUiName(aExLayer.getUiName()); aLayer.setName(aExLayer.getName()); aLayer.setProject(aProject); aLayer.setType(aExLayer.getType()); aAnnotationService.createLayer(aLayer); }
public void importLayer(AnnotationLayer aLayer, ExportedAnnotationLayer aExLayer, Project aProject) throws IOException { aLayer.setAllowStacking(aExLayer.isAllowStacking()); aLayer.setBuiltIn(aExLayer.isBuiltIn()); aLayer.setReadonly(aExLayer.isReadonly()); aLayer.setCrossSentence(aExLayer.isCrossSentence()); aLayer.setDescription(aExLayer.getDescription()); aLayer.setEnabled(aExLayer.isEnabled()); if (aExLayer.getAnchoringMode() == null) { // This allows importing old projects which did not have the anchoring mode yet aLayer.setAnchoringMode(aExLayer.isLockToTokenOffset(), aExLayer.isMultipleTokens()); } else { aLayer.setAnchoringMode(aExLayer.getAnchoringMode()); } aLayer.setValidationMode(aExLayer.getValidationMode() != null ? aExLayer.getValidationMode() : ValidationMode.NEVER); aLayer.setLinkedListBehavior(aExLayer.isLinkedListBehavior()); aLayer.setUiName(aExLayer.getUiName()); aLayer.setName(aExLayer.getName()); aLayer.setProject(aProject); aLayer.setType(aExLayer.getType()); annotationService.createLayer(aLayer); }