<commit_before>/*
 * Copyright 2012
 * Ubiquitous Knowledge Processing (UKP) Lab and FG Language Technology
 * Technische Universität Darmstadt
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *  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.model;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

import org.hibernate.annotations.ForeignKey;


/**
 * A persistence object for an annotation layer. Currently, the builtin layers are:
 * {@literal
 *  'pos' as  'span',
 *  'dependency' as 'relation',
 *   'named entity' as 'span',
 *   'coreference type' as 'chain', and
 *   'coreference' as 'chain'
 *  }
 */
@Entity
@Table(name = "annotation_type", uniqueConstraints = {
        @UniqueConstraint(columnNames = { "name", "project" }) })
public class AnnotationLayer
    implements Serializable
{
    private static final long serialVersionUID = 8496087166198616020L;

    @Id
    @GeneratedValue
    @Column(name = "id")
    private long id;

    @Column(nullable = false)
    private String uiName;

    @Column(nullable = false)
    private String type;

    @Lob
    @Column(length = 64000)
    private String description;

    private boolean enabled = true;

    private boolean builtIn = false;
    
    private boolean readonly = false;
    
    @Column(nullable = true)
    private String onClickJavascriptAction;

    @Column(name = "name", nullable = false)
    private String name;

    @ManyToOne
   // @ForeignKey(ConstraintMode.NO_CONSTRAINT)
    @ForeignKey(name = "none")
    @JoinColumn(name = "annotation_type")
    private AnnotationLayer attachType;

    @ManyToOne
    @ForeignKey(name = "none")
    @JoinColumn(name = "annotation_feature")
    private AnnotationFeature attachFeature;

    @ManyToOne
    @JoinColumn(name = "project")
    private Project project;

    private boolean lockToTokenOffset = true;

    // There wase a type in the code which unfortunately made it into databases...
    @Column(name = "allowSTacking")
    private boolean allowStacking;

    private boolean crossSentence;

    private boolean multipleTokens;
    <commit_msg>#520 - Perform javascript action on click<commit_after>/*
 * Copyright 2012
 * Ubiquitous Knowledge Processing (UKP) Lab and FG Language Technology
 * Technische Universität Darmstadt
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *  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.model;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

import org.hibernate.annotations.ForeignKey;


/**
 * A persistence object for an annotation layer. Currently, the builtin layers are:
 * {@literal
 *  'pos' as  'span',
 *  'dependency' as 'relation',
 *   'named entity' as 'span',
 *   'coreference type' as 'chain', and
 *   'coreference' as 'chain'
 *  }
 */
@Entity
@Table(name = "annotation_type", uniqueConstraints = {
        @UniqueConstraint(columnNames = { "name", "project" }) })
public class AnnotationLayer
    implements Serializable
{
    private static final long serialVersionUID = 8496087166198616020L;

    @Id
    @GeneratedValue
    @Column(name = "id")
    private long id;

    @Column(nullable = false)
    private String uiName;

    @Column(nullable = false)
    private String type;

    @Lob
    @Column(length = 64000)
    private String description;

    private boolean enabled = true;

    private boolean builtIn = false;
    
    private boolean readonly = false;
    
    @Column(nullable = true, length = 128000)
    private String onClickJavascriptAction;

    @Column(name = "name", nullable = false)
    private String name;

    @ManyToOne
   // @ForeignKey(ConstraintMode.NO_CONSTRAINT)
    @ForeignKey(name = "none")
    @JoinColumn(name = "annotation_type")
    private AnnotationLayer attachType;

    @ManyToOne
    @ForeignKey(name = "none")
    @JoinColumn(name = "annotation_feature")
    private AnnotationFeature attachFeature;

    @ManyToOne
    @JoinColumn(name = "project")
    private Project project;

    private boolean lockToTokenOffset = true;

    // There wase a type in the code which unfortunately made it into databases...
    @Column(name = "allowSTacking")
    private boolean allowStacking;

    private boolean crossSentence;

    private boolean multipleTokens;
    
{'fraction_non_alphanumeric': 0.08992248062015504, 'fraction_numerical': 0.012575366063738156, 'mean_word_length': 3.7943848059454997, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5111313', 'n_tokens_mistral': 1671, 'n_tokens_neox': 1597, 'n_words': 535}