<commit_before>package gov.nih.nci.cabig.caaers.domain;

import gov.nih.nci.cabig.ctms.domain.AbstractMutableDomainObject;

import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.apache.commons.lang.StringEscapeUtils;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;
import org.hibernate.validator.Length;

/**
 * This class represents the TreatmentAssignment domain object associated with the Adverse event
 * report. Domain object representing Study Therapy
 * 
 * @author <NAME>
 */
@Entity
@Table(name = "treatment_assignment")
@GenericGenerator(name = "id-generator", strategy = "native", parameters = { @Parameter(name = "sequence", value = "seq_treatment_assignment_id") })
public class TreatmentAssignment extends AbstractMutableDomainObject implements StudyChild {

    private Study study;

    private String code;

    private Integer doseLevelOrder;

    private String description;

    private String comments;

    @ManyToOne
    @JoinColumn(name = "study_id", nullable = false)
    public Study getStudy() {
        return study;
    }

    public void setStudy(final Study study) {
        this.study = study;
    }

    public TreatmentAssignment() {
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    @Length(max = 99)
    public Integer getDoseLevelOrder() {
        return doseLevelOrder;
    }

    public void setDoseLevelOrder(Integer doseLevelOrder) {
        this.doseLevelOrder = doseLevelOrder;
    }

    public String getDescription() {
        return description;
    }

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

    @Transient
    /**
     * The below function is only used for UI purpose
     */
    public String getEscapedDescription() {
        return StringEscapeUtils.escapeJavaScript(description);
    }

    public String getComments() {
        return comments;
    }

    public void setComments(String comments) {
        this.comments = comments;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + (code == null ? 0 : code.hashCode());
        result = prime * result + (comments == null ? 0 : comments.hashCode());
        result = prime * result + (description == null ? 0 : description.hashCode());
        result = prime * result + (doseLevelOrder == null ? 0 : doseLevelOrder);
        result = prime * result + (study.getId() == null ? 0 : study.getId().hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final TreatmentAssignment other = (TreatmentAssignment) obj;
        if (code == null) {
            if (other.code != null) {
                return false;
            }
        } else if (!code.equals(other.code)) {
            return false;
        }
        if (comments == null) {
            if (other.comments != null) {
                return false;
            }
        } else if (!comments.equals(other.comments)) {
            return false;
        }
        if (description == null) {
            if (other.description != null) {
                return false;
            }
        } else if (!description.equals(other.description)) {
            return false;
        }

        if (study.getId() == null) {
            if (other.study.getId() != null) {
                return false;
            }<commit_msg>Added doseLevelOrder and id to the equals method. Also added id to the hashCode Logic<commit_after>package gov.nih.nci.cabig.caaers.domain;

import gov.nih.nci.cabig.ctms.domain.AbstractMutableDomainObject;

import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.apache.commons.lang.StringEscapeUtils;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;
import org.hibernate.validator.Length;

/**
 * This class represents the TreatmentAssignment domain object associated with the Adverse event
 * report. Domain object representing Study Therapy
 * 
 * @author <NAME>
 */
@Entity
@Table(name = "treatment_assignment")
@GenericGenerator(name = "id-generator", strategy = "native", parameters = { @Parameter(name = "sequence", value = "seq_treatment_assignment_id") })
public class TreatmentAssignment extends AbstractMutableDomainObject implements StudyChild {

    private Study study;

    private String code;

    private Integer doseLevelOrder;

    private String description;

    private String comments;

    @ManyToOne
    @JoinColumn(name = "study_id", nullable = false)
    public Study getStudy() {
        return study;
    }

    public void setStudy(final Study study) {
        this.study = study;
    }

    public TreatmentAssignment() {
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    @Length(max = 99)
    public Integer getDoseLevelOrder() {
        return doseLevelOrder;
    }

    public void setDoseLevelOrder(Integer doseLevelOrder) {
        this.doseLevelOrder = doseLevelOrder;
    }

    public String getDescription() {
        return description;
    }

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

    @Transient
    /**
     * The below function is only used for UI purpose
     */
    public String getEscapedDescription() {
        return StringEscapeUtils.escapeJavaScript(description);
    }

    public String getComments() {
        return comments;
    }

    public void setComments(String comments) {
        this.comments = comments;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + (getId() == null ? 0 : getId().hashCode());
        result = prime * result + (code == null ? 0 : code.hashCode());
        result = prime * result + (comments == null ? 0 : comments.hashCode());
        result = prime * result + (description == null ? 0 : description.hashCode());
        result = prime * result + (doseLevelOrder == null ? 0 : doseLevelOrder);
        result = prime * result + (study.getId() == null ? 0 : study.getId().hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final TreatmentAssignment other = (TreatmentAssignment) obj;
        if (getId() == null) {
            if (other.getId() != null) {
                return false;
            }
        } else if (!getId().equals(other.getId())) {
            return false;
        }
        if (code == null) {
            if (other.code != null) {
                return false;
            }
        } else if (!code.equals(other.code)) {
            return false;
        }
        if (comments == null) {
            if (other.comments != null) {
                return false;
            }
        } else if (!comments.equals(other.comments)) {
            return false;
        }
        if (description == null) {
            if (other.description != null) {
                return false;
            }
        } else if (!description.equals(other.description)) {
            return false;
        }
        if (doseLevelOrder == null) {
            if (other.doseLevelOrder != null) {
                return false;
            }
        } else if (!doseLevelOrder.equals(other.doseLevelOrder)) {
            return false;
        }
        if (study.getId() == null) {
            if (other.study.getId() != null) {
                return false;
            }
{'fraction_non_alphanumeric': 0.10401834198141667, 'fraction_numerical': 0.0025340895378303365, 'mean_word_length': 2.1913746630727764, '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': '4559290', 'n_tokens_mistral': 2278, 'n_tokens_neox': 2172, 'n_words': 599}