Subversion Repositories SmartDukaan

Rev

Blame | Last modification | View Log | RSS feed

package com.spice.profitmandi.dao.entity;

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

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

import com.spice.profitmandi.dao.enumuration.TagType;

/**
 * This class basically contains tag details
 * 
 * @author ashikali
 *
 */
@Entity
@Table(name="tag", schema = "dtr")
@NamedQueries({
        @NamedQuery(name="Tag.selectCount", query = "select count(t) from Tag t"),
        @NamedQuery(name="Tag.selectAll", query = "select t from Tag t"),
        @NamedQuery(name="Tag.selectById", query = "select t from Tag t where t.id= :id"),
        @NamedQuery(name="Tag.selectByCreatedBy", query = "select t from Tag t where t.createdBy= :createdBy"),
        @NamedQuery(name="Tag.selectByType", query = "select t from Tag t where t.type = :type"),
        @NamedQuery(name="Tag.deleteById", query = "delete from Tag t where t.id= :id"),
        @NamedQuery(name="Tag.updateActiveById", query = "update Tag t set t.active = :active where t.id= :id")
})
public class Tag implements Serializable{
        
        private static final long serialVersionUID = 1L;
        
        public Tag() {
        }
        
        @Id
        @Column(name="id", columnDefinition = "int(10) unsigned")
        @GeneratedValue(strategy = GenerationType.IDENTITY)
        private int id;
        
        @Column(name="label", unique = true)
        private String label;
        
        @Column(name = "type")
        private TagType type;
        
        @Column(name = "description", length = 100)
        private String description;
        
        @Column(name = "createdBy")
        private int createdBy;
        
        @Column(name = "active", columnDefinition="tinyint(1) default 0")
        private boolean active;
        
        @Column(name = "create_timestamp")
        private LocalDateTime createTimestamp = LocalDateTime.now();
        
        @Column(name = "update_timestamp")
        private LocalDateTime updateTimestamp = LocalDateTime.now();
        
        public int getId() {
                return id;
        }
        public void setId(int id) {
                this.id = id;
        }
        public String getLabel() {
                return label;
        }
        public void setLabel(String label) {
                this.label = label;
        }
        
    public TagType getType() {
                return type;
        }
    public void setType(TagType type) {
                this.type = type;
        }
    public String getDescription() {
                return description;
        }
    public void setDescription(String description) {
                this.description = description;
        }
    public boolean isActive() {
                return active;
        }
    public void setActive(boolean active) {
                this.active = active;
        }
    public LocalDateTime getCreateTimestamp() {
                return createTimestamp;
        }
    public void setCreateTimestamp(LocalDateTime createTimestamp) {
                this.createTimestamp = createTimestamp;
        }
    
    public LocalDateTime getUpdateTimestamp() {
                return updateTimestamp;
        }
    public void setUpdateTimestamp(LocalDateTime updateTimestamp) {
                this.updateTimestamp = updateTimestamp;
        }
}