Subversion Repositories SmartDukaan

Rev

Rev 21602 | 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 javax.persistence.UniqueConstraint;

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

/**
 * This class basically contains tag details
 * 
 * @author ashikali
 *
 */
@Entity
@Table(name="fofo.tag", schema = "fofo", uniqueConstraints = {@UniqueConstraint(columnNames = {"label","type"})})
@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 = "pin_all")
        private boolean pinAll;
        
        @Column(name = "user_all")
        private boolean userAll;
        
        @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 boolean isPinAll() {
                return pinAll;
        }
    public void setPinAll(boolean pinAll) {
                this.pinAll = pinAll;
        }
    public boolean isUserAll() {
                return userAll;
        }
    public void setUserAll(boolean userAll) {
                this.userAll = userAll;
        }
    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;
        }
        @Override
        public String toString() {
                return "Tag [id=" + id + ", label=" + label + ", type=" + type + ", description=" + description + ", createdBy="
                                + createdBy + ", pinAll=" + pinAll + ", userAll=" + userAll + ", active=" + active
                                + ", createTimestamp=" + createTimestamp + ", updateTimestamp=" + updateTimestamp + "]";
        }
    
    
    
}