<commit_before>package org.devnull.zuul.data.model

import groovy.transform.EqualsAndHashCode
import groovy.transform.ToString
import org.devnull.zuul.data.config.ZuulDataConstants
import org.hibernate.annotations.Cache
import org.hibernate.annotations.CacheConcurrencyStrategy

import javax.persistence.CascadeType
import javax.persistence.Entity
import javax.persistence.Id
import javax.persistence.OneToMany

@Entity
@EqualsAndHashCode(includes = "name")
@ToString(includeNames = true, excludes = "groups")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
class Environment implements Serializable {

    static final long serialVersionUID = ZuulDataConstants.API_VERSION

    @Id
    String name


    @OneToMany(cascade = [CascadeType.ALL], mappedBy = "environment")
    List<SettingsGroup> groups = []


}
<commit_msg>restricted environment names to numbers and letters<commit_after>package org.devnull.zuul.data.model

import groovy.transform.EqualsAndHashCode
import groovy.transform.ToString
import org.devnull.zuul.data.config.ZuulDataConstants
import org.hibernate.annotations.Cache
import org.hibernate.annotations.CacheConcurrencyStrategy

import javax.persistence.CascadeType
import javax.persistence.Entity
import javax.persistence.Id
import javax.persistence.OneToMany
import javax.validation.constraints.Pattern
import javax.persistence.Column
import javax.validation.constraints.Size

@Entity
@EqualsAndHashCode(includes = "name")
@ToString(includeNames = true, excludes = "groups")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
class Environment implements Serializable {

    static final long serialVersionUID = ZuulDataConstants.API_VERSION

    @Id
    @Pattern(regexp="^[a-zA-Z0-9]+\$/", message="Name can only contain letters and numbers")
    @Size(min=1, max=12, message="Name must be 1-12 characters long")
    @Column(length=12)
    String name


    @OneToMany(cascade = [CascadeType.ALL], mappedBy = "environment")
    List<SettingsGroup> groups = []


}

{'fraction_non_alphanumeric': 0.09273182957393483, 'fraction_numerical': 0.005012531328320802, 'mean_word_length': 5.882758620689655, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '1220904', 'n_tokens_mistral': 585, 'n_tokens_neox': 562, 'n_words': 123}