net.kamhon.ieagle.function.user.vo.UserLocType.java Source code

Java tutorial

Introduction

Here is the source code for net.kamhon.ieagle.function.user.vo.UserLocType.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.user.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.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_user_loc_type")
@Access(AccessType.FIELD)
public class UserLocType extends net.kamhon.ieagle.vo.VoBase {
    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(generator = "system-uuid")
    @GenericGenerator(name = "system-uuid", strategy = "uuid")
    @Column(name = "loc_type_id", unique = true, nullable = false, length = 32)
    private String locTypeId;

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

    @ToTrim
    @ToUpperCase
    @Column(name = "loc_type_code", length = 5)
    private String locTypeCode;

    @ToTrim
    @ToUpperCase
    @Column(name = "loc_type_name", length = 50)
    private String locTypeName;

    @ToTrim
    @ToUpperCase
    @Column(name = "loc_type_desc", length = 200)
    private String locTypeDesc;

    @Column(name = "loc_level")
    private Integer locLevel;

    @Column(name = "include_sub_loc")
    private Boolean includeSubLoc;

    @Column(name = "parent_loc_type_id")
    private Long parentLocTypeId;

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

    public UserLocType() {
    }

    public UserLocType(String locTypeId) {
        this.locTypeId = locTypeId;
    }

    public UserLocType(boolean defaultValue) {
        if (defaultValue) {
            includeSubLoc = false;
        }
    }

    public String getLocTypeId() {
        return locTypeId;
    }

    public String getCompId() {
        return compId;
    }

    public String getLocTypeCode() {
        return locTypeCode;
    }

    public String getLocTypeName() {
        return locTypeName;
    }

    public String getLocTypeDesc() {
        return locTypeDesc;
    }

    public Integer getLocLevel() {
        return locLevel;
    }

    public Boolean getIncludeSubLoc() {
        return includeSubLoc;
    }

    public Long getParentLocTypeId() {
        return parentLocTypeId;
    }

    public String getStatus() {
        return status;
    }

    public void setLocTypeId(String locTypeId) {
        this.locTypeId = locTypeId;
    }

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

    public void setLocTypeCode(String locTypeCode) {
        this.locTypeCode = locTypeCode;
    }

    public void setLocTypeName(String locTypeName) {
        this.locTypeName = locTypeName;
    }

    public void setLocTypeDesc(String locTypeDesc) {
        this.locTypeDesc = locTypeDesc;
    }

    public void setLocLevel(Integer locLevel) {
        this.locLevel = locLevel;
    }

    public void setIncludeSubLoc(Boolean includeSubLoc) {
        this.includeSubLoc = includeSubLoc;
    }

    public void setParentLocTypeId(Long parentLocTypeId) {
        this.parentLocTypeId = parentLocTypeId;
    }

    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 UserLocType other = (UserLocType) obj;
        if (this.locTypeId == null) {
            if (other.locTypeId != null)
                return false;
        } else if (!this.locTypeId.equals(other.locTypeId))
            return false;
        return true;
    }

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