Subversion Repositories SmartDukaan

Rev

Go to most recent revision | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | RSS feed

package com.spice.profitmandi.dao.entity.dtr;

import java.io.Serializable;
import java.time.LocalDateTime;

import javax.persistence.Column;
import javax.persistence.Convert;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;

/**
 * This class basically contains role details
 * 
 * @author ashikali
 *
 */

@Entity
@Table(name="dtr.role", schema = "dtr")
public class Role implements Serializable{
        
        private static final long serialVersionUID = 1L;
        
        public Role() {
        }
        
        @Id
        @Column(name="id", unique=true, updatable=false)
        @GeneratedValue(strategy = GenerationType.IDENTITY)
        private int id;
        
        @Column(name="name", unique = true)
        private String name;
        
        @Convert(converter = LocalDateTimeAttributeConverter.class)
        @Column(name="create_timestamp", updatable = false)
        private LocalDateTime createTimestamp = LocalDateTime.now();
        
        public int getId() {
                return id;
        }
        public void setId(int id) {
                this.id = id;
        }
        public void setName(String name) {
        this.name = name;
    }
    public String getName() {
        return name;
    }
    
    public void setCreateTimestamp(LocalDateTime createTimestamp) {
                this.createTimestamp = createTimestamp;
        }
    public LocalDateTime getCreateTimestamp() {
                return createTimestamp;
        }
    
        
        @Override
        public int hashCode() {
                final int prime = 31;
                int result = 1;
                result = prime * result + id;
                return result;
        }
        
        @Override
        public boolean equals(Object obj) {
                if (this == obj)
                        return true;
                if (obj == null)
                        return false;
                if (getClass() != obj.getClass())
                        return false;
                Role other = (Role) obj;
                if (id != other.id)
                        return false;
                return true;
        }
        
        @Override
        public String toString() {
                return "Role [id=" + id + ", name=" + name + ", createTimestamp=" + createTimestamp + "]";
        }    
        
}