Subversion Repositories SmartDukaan

Rev

Rev 23269 | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | RSS feed

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

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

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

import org.hibernate.annotations.UpdateTimestamp;

import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
import com.spice.profitmandi.dao.enumuration.catalog.TagType;

/**
 * This class basically contains tag details
 * 
 * @author ashikali
 *
 */
@Entity
@Table(name="catalog.tag", uniqueConstraints = {@UniqueConstraint(columnNames = {"label","type"})})
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")
        @Enumerated(EnumType.STRING)
        private TagType type;
        
        @Column(name = "description", length = 100)
        private String description;
        
        @Column(name = "created_by")
        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")
        @Convert(converter = LocalDateTimeAttributeConverter.class)
        private LocalDateTime createTimestamp = LocalDateTime.now();
        
        @Column(name = "update_timestamp")
        @Convert(converter = LocalDateTimeAttributeConverter.class)
        @UpdateTimestamp
        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 int getCreatedBy() {
                return createdBy;
        }
    public void setCreatedBy(int createdBy) {
                this.createdBy = createdBy;
        }
    
    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 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;
                Tag other = (Tag) obj;
                if (id != other.id)
                        return false;
                return true;
        }
        @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 + "]";
        }
    
    
    
}