@Override public void validate(IValidatable<String> aValidatable) { String newName = aValidatable.getValue(); String oldName = aValidatable.getModel().getObject(); if (!StringUtils.equals(newName, oldName) && isNotBlank(newName) && annotationSchemaService.existsTag(newName, selectedTagSet.getObject())) { aValidatable.error(new ValidationError( "Another tag with the same name exists. Please try a different name")); } } }
@Override public void validate(IValidatable<String> aValidatable) { String newName = aValidatable.getValue(); String oldName = aValidatable.getModel().getObject(); if (!StringUtils.equals(newName, oldName) && isNotBlank(newName) && annotationSchemaService.existsTag(newName, selectedTagSet.getObject())) { aValidatable.error(new ValidationError( "Another tag with the same name exists. Please try a different name")); } } }
private void writeFeatureEditorModelsToCas(TypeAdapter aAdapter, JCas aJCas) throws IOException { List<FeatureState> featureStates = featureList.getModelObject(); LOG.trace("writeFeatureEditorModelsToCas()"); List<AnnotationFeature> features = new ArrayList<>(); for (FeatureState featureState : featureStates) { features.add(featureState.feature); // For string features with extensible tagsets, extend the tagset if (CAS.TYPE_NAME_STRING.equals(featureState.feature.getType())) { String value = (String) featureState.value; if (value != null && featureState.feature.getTagset() != null && featureState.feature.getTagset().isCreateTag() && !annotationService.existsTag(value, featureState.feature.getTagset())) { Tag selectedTag = new Tag(); selectedTag.setName(value); selectedTag.setTagSet(featureState.feature.getTagset()); annotationService.createTag(selectedTag); } } LOG.trace("writeFeatureEditorModelsToCas() " + featureState.feature.getUiName() + " = " + featureState.value); aAdapter.setFeatureValue(sourceDocument.getObject(), username.getObject(), aJCas, getModelObject().getId(), featureState.feature, featureState.value); } }
private void writeFeatureEditorModelsToCas(TypeAdapter aAdapter, JCas aJCas) throws IOException { List<FeatureState> featureStates = featureList.getModelObject(); LOG.trace("writeFeatureEditorModelsToCas()"); List<AnnotationFeature> features = new ArrayList<>(); for (FeatureState featureState : featureStates) { features.add(featureState.feature); // For string features with extensible tagsets, extend the tagset if (CAS.TYPE_NAME_STRING.equals(featureState.feature.getType())) { String value = (String) featureState.value; if (value != null && featureState.feature.getTagset() != null && featureState.feature.getTagset().isCreateTag() && !annotationService.existsTag(value, featureState.feature.getTagset())) { Tag selectedTag = new Tag(); selectedTag.setName(value); selectedTag.setTagSet(featureState.feature.getTagset()); annotationService.createTag(selectedTag); } } LOG.trace("writeFeatureEditorModelsToCas() " + featureState.feature.getUiName() + " = " + featureState.value); aAdapter.setFeatureValue(sourceDocument.getObject(), username.getObject(), aJCas, getModelObject().getId(), featureState.feature, featureState.value); } }
&& !annotationService.existsTag(value, featureState.feature.getTagset())) { Tag selectedTag = new Tag(); selectedTag.setName(value);
@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); } }
@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); } }
feature.getTagset() != null && !feature.getTagset().isCreateTag() && !annotationService.existsTag(value, feature.getTagset()) ) { error("[" + value
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); } } }
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); } } }