net.kamhon.ieagle.function.master.vo.Dept.java Source code

Java tutorial

Introduction

Here is the source code for net.kamhon.ieagle.function.master.vo.Dept.java

Source

/*
 * Copyright 2012 Eng Kam Hon (kamhon@gmail.com)
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package net.kamhon.ieagle.function.master.vo;

import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

import net.kamhon.ieagle.vo.Manipulateable;
import net.kamhon.ieagle.vo.annotation.ToTrim;
import net.kamhon.ieagle.vo.annotation.ToUpperCase;

import org.apache.commons.lang.builder.HashCodeBuilder;
import org.hibernate.annotations.GenericGenerator;

@Entity
@Table(name = "app_dept")
@Access(AccessType.FIELD)
public class Dept extends net.kamhon.ieagle.vo.VoBase implements Manipulateable {
    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(generator = "system-uuid")
    @GenericGenerator(name = "system-uuid", strategy = "uuid")
    @Column(name = "dept_id", nullable = false, length = 32)
    private String deptId;

    @Column(name = "comp_id", nullable = false, length = 32)
    private String compId;

    @ToTrim
    @ToUpperCase
    @Column(name = "dept_name", length = 50)
    private String deptName;

    @ToTrim
    @ToUpperCase
    @Column(name = "dept_desc", length = 200)
    private String deptDesc;

    @ToTrim
    @ToUpperCase
    @Column(name = "status", length = 1)
    private String status;

    public Dept() {
    }

    public Dept(String deptId) {
        this.deptId = deptId;
    }

    public Dept(boolean defaultValue) {
        if (defaultValue) {
        }
    }

    public String getDeptId() {
        return deptId;
    }

    public String getCompId() {
        return compId;
    }

    public String getDeptName() {
        return deptName;
    }

    public String getDeptDesc() {
        return deptDesc;
    }

    public String getStatus() {
        return status;
    }

    public void setDeptId(String deptId) {
        this.deptId = deptId;
    }

    public void setCompId(String compId) {
        this.compId = compId;
    }

    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }

    public void setDeptDesc(String deptDesc) {
        this.deptDesc = deptDesc;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        final Dept other = (Dept) obj;
        if (this.deptId == null) {
            if (other.deptId != null)
                return false;
        } else if (!this.deptId.equals(other.deptId))
            return false;
        return true;
    }

    public int hashCode() {
        HashCodeBuilder hashCode = new HashCodeBuilder();
        if (deptId != null)
            hashCode.append(deptId);
        return hashCode.toHashCode();
    }

    public boolean isApproveable() {
        return false;
    }

    public boolean isDeleteable() {
        return false;
    }

    public boolean isEditable() {
        return true;
    }

}