<commit_before>package ca.corefacility.bioinformatics.irida.model;

import ca.corefacility.bioinformatics.irida.model.roles.impl.Audit;
import ca.corefacility.bioinformatics.irida.model.roles.impl.Identifier;
import ca.corefacility.bioinformatics.irida.model.roles.Auditable;
import ca.corefacility.bioinformatics.irida.model.roles.Identifiable;
import java.util.Objects;
import javax.validation.constraints.NotNull;
import org.springframework.security.core.GrantedAuthority;

/**
 * Roles for authorization in the application.
 *
 * @author <NAME> <<EMAIL>>
 */
public class Role implements Comparable<Role>, GrantedAuthority, Auditable<Audit>, Identifiable<Identifier> {

    private Identifier id;
    @NotNull
    private String name;
    @NotNull
    private String description;
    @NotNull
    private Audit audit;

    public Role() {
        audit = new Audit();
    }

    public Role(Identifier id) {
        this();
        this.id = id;
    }

    @Override
    public int compareTo(Role r) {
        return audit.compareTo(r.audit);
    }

    @Override
    public boolean equals(Object other) {
        if (other instanceof Role) {
            Role r = (Role) other;
            return Objects.equals(id, r.id)
                    && Objects.equals(name, r.name)
                    && Objects.equals(description, r.description);
        }

        return false;
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, name, description);
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @Override
    public String getAuthority() {
        return name;
    }

    @Override
    public Audit getAuditInformation() {
        return audit;
    }

    @Override
    public Identifier getIdentifier() {
        return id;
    }

    @Override
    public void setIdentifier(Identifier identifier) {
        this.id = identifier;
    }

    @Override
    public void setAuditInformation(Audit audit) {
        this.audit = audit;
    }
}<commit_msg>Add constructor for Role to allow specifying the name of the role.<commit_after>package ca.corefacility.bioinformatics.irida.model;

import ca.corefacility.bioinformatics.irida.model.roles.Auditable;
import ca.corefacility.bioinformatics.irida.model.roles.Identifiable;
import ca.corefacility.bioinformatics.irida.model.roles.impl.Audit;
import ca.corefacility.bioinformatics.irida.model.roles.impl.Identifier;
import org.springframework.security.core.GrantedAuthority;

import javax.validation.constraints.NotNull;
import java.util.Objects;

/**
 * Roles for authorization in the application.
 *
 * @author <NAME> <<EMAIL>>
 */
public class Role implements Comparable<Role>, GrantedAuthority, Auditable<Audit>, Identifiable<Identifier> {

    private Identifier id;
    @NotNull
    private String name;
    @NotNull
    private String description;
    @NotNull
    private Audit audit;

    public Role() {
        audit = new Audit();
    }

    public Role(Identifier id) {
        this();
        this.id = id;
    }

    public Role(String name) {
        this();
        this.name = name;
    }

    @Override
    public int compareTo(Role r) {
        return audit.compareTo(r.audit);
    }

    @Override
    public boolean equals(Object other) {
        if (other instanceof Role) {
            Role r = (Role) other;
            return Objects.equals(id, r.id)
                    && Objects.equals(name, r.name)
                    && Objects.equals(description, r.description);
        }

        return false;
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, name, description);
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @Override
    public String getAuthority() {
        return name;
    }

    @Override
    public Audit getAuditInformation() {
        return audit;
    }

    @Override
    public void setAuditInformation(Audit audit) {
        this.audit = audit;
    }

    @Override
    public Identifier getIdentifier() {
        return id;
    }

    @Override
    public void setIdentifier(Identifier identifier) {
        this.id = identifier;
    }
}
{'fraction_non_alphanumeric': 0.0952895419187554, 'fraction_numerical': 0.0, 'mean_word_length': 2.457057505601195, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '6647664', 'n_tokens_mistral': 1355, 'n_tokens_neox': 1285, 'n_words': 317}