package com.publiccms.entities.cms;
// Generated 2016-11-20 14:46:17 by Hibernate Tools 4.3.1

import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.Length;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.publiccms.common.generator.annotation.GeneratorColumn;

/**
 * CmsLanguageId generated by hbm2java
 */
@Embeddable
public class CmsLanguageId implements java.io.Serializable {

    /**
     * 
     */
    private static final long serialVersionUID = 1L;
    /**
     * code
     * <p>
     * 编码
     */
    @GeneratorColumn(title = "编码")
    @NotNull
    @Length(max = 50)
    private String code;
    @GeneratorColumn(title = "站点", condition = true)
    @JsonIgnore
    private short siteId;

    public CmsLanguageId() {
    }

    public CmsLanguageId(String code, short siteId) {
        this.code = code;
        this.siteId = siteId;
    }

    @Column(name = "code", nullable = false, length = 20)
    public String getCode() {
        return this.code;
    }

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

    @Column(name = "site_id", nullable = false)
    public short getSiteId() {
        return this.siteId;
    }

    public void setSiteId(short siteId) {
        this.siteId = siteId;
    }

    public boolean equals(Object other) {
        if ((this == other))
            return true;
        if ((other == null))
            return false;
        if (!(other instanceof CmsLanguageId))
            return false;
        CmsLanguageId castOther = (CmsLanguageId) other;

        return ((this.getCode() == castOther.getCode())
                || (this.getCode() != null && castOther.getCode() != null && this.getCode().equals(castOther.getCode())))
                && (this.getSiteId() == castOther.getSiteId());
    }

    public int hashCode() {
        int result = 17;
        result = 37 * result + (getCode() == null ? 0 : this.getCode().hashCode());
        result = 37 * result + this.getSiteId();
        return result;
    }

}
