ReportConfigAttributes.java

package com.tradecloud.domain.configuration;

import com.tradecloud.common.base.PersistenceBase;
import org.hibernate.annotations.ForeignKey;

import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;

@Entity
@Table(name = "reportconfigattributes")
@XmlRootElement(name = "reportconfigattributes")
public class ReportConfigAttributes extends PersistenceBase {

    private static final long serialVersionUID = 1L;

    @ManyToOne(cascade = {CascadeType.PERSIST, CascadeType.MERGE}, fetch = FetchType.LAZY)
    @ForeignKey(name = "report_foreign_key")
    private ReportConfig reportConfig;

    private String displayName;

    private boolean active;

    private int sortOrder;

    public String getDisplayName() {
        return displayName;
    }

    public void setDisplayName(String displayName) {
        this.displayName = displayName;
    }

    public ReportConfig getReportConfig() {
        return reportConfig;
    }

    public void setReportConfig(ReportConfig reportConfig) {
        this.reportConfig = reportConfig;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = super.hashCode();
        result = prime * result + ((displayName == null) ? 0 : displayName.hashCode());
        result = prime * result + ((reportConfig == null) ? 0 : reportConfig.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (!super.equals(obj))
            return false;
        if (getClass() != obj.getClass())
            return false;
        ReportConfigAttributes other = (ReportConfigAttributes) obj;
        if (displayName == null) {
            if (other.displayName != null)
                return false;
        } else if (!displayName.equals(other.displayName))
            return false;
        if (reportConfig == null) {
            if (other.reportConfig != null)
                return false;
        } else if (!reportConfig.equals(other.reportConfig))
            return false;
        return true;
    }

    public boolean isActive() {
        return active;
    }

    public void setActive(boolean active) {
        this.active = active;
    }

    @Override
    public String toString() {
        return "ReportConfigAttributes [reportConfig=" + reportConfig + ", displayName=" + displayName + ", active=" + active + "]";
    }

    public int getSortOrder() {
        return sortOrder;
    }

    public void setSortOrder(int sortOrder) {
        this.sortOrder = sortOrder;
    }
}