Subversion Repositories SmartDukaan

Rev

Rev 22608 | 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.catalog;

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

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

/**
 * This class basically contains scheme details
 * 
 * @author ashikali
 *
 */
@Entity
@Table(name="catalog.scheme", schema = "catalog", uniqueConstraints = {@UniqueConstraint(columnNames = {"item_id", "scheme_tag_id", "start_date"})})

public class Scheme implements Serializable{
        
        private static final long serialVersionUID = 1L;
        
        public Scheme() {
        }
        
        @Id
        @Column(name="id")
        @GeneratedValue(strategy = GenerationType.IDENTITY)
        private int id;
        
        @Column(name="item_id")
        private int itemId;
        
        @Column(name = "scheme_tag_id")
        private int schemeTagId;
        
        @Column(name = "amount_type")
        private SchemeAmountType amountType;
        
        @Column(name = "amount")
        private float amount;
        
        @Convert(converter = LocalDateTimeAttributeConverter.class)
        @Column(name = "start_date")
        private LocalDateTime startDate = LocalDateTime.now();
        
        @Convert(converter = LocalDateTimeAttributeConverter.class)
        @Column(name = "create_timestamp")
        private LocalDateTime createdTimestamp = LocalDateTime.now();
        
        @Column(name = "created_by")
        private int createdBy;
        
        @Column(name = "active", columnDefinition="tinyint(1) default 0")
        private boolean active;
        
        public int getId() {
                return id;
        }
        public void setId(int id) {
                this.id = id;
        }
        
        public int getItemId() {
                return itemId;
        }
        public void setItemId(int itemId) {
                this.itemId = itemId;
        }
        
        public int getSchemeTagId() {
                return schemeTagId;
        }
        public void setSchemeTagId(int schemeTagId) {
                this.schemeTagId = schemeTagId;
        }
        
        public SchemeAmountType getAmountType() {
                return amountType;
        }
        
        public void setAmountType(SchemeAmountType amountType) {
                this.amountType = amountType;
        }
        
        public float getAmount() {
                return amount;
        }
        public void setAmount(float amount) {
                this.amount = amount;
        }
        
        public LocalDateTime getStartDate() {
                return startDate;
        }
        public void setStartDate(LocalDateTime startDate) {
                this.startDate = startDate;
        }
        public LocalDateTime getCreatedTimestamp() {
                return createdTimestamp;
        }
        public void setCreatedTimestamp(LocalDateTime createdTimestamp) {
                this.createdTimestamp = createdTimestamp;
        }
        public int getCreatedBy() {
                return createdBy;
        }
        public void setCreatedBy(int createdBy) {
                this.createdBy = createdBy;
        }
    public boolean isActive() {
                return active;
        }
    public void setActive(boolean active) {
                this.active = active;
        }
    
        @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;
                Scheme other = (Scheme) obj;
                if (id != other.id)
                        return false;
                return true;
        }
        @Override
        public String toString() {
                return "Scheme [id=" + id + ", itemId=" + itemId + ", schemeTagId=" + schemeTagId + ", amountType=" + amountType
                                + ", amount=" + amount + ", startDate=" + startDate + ", createdTimestamp=" + createdTimestamp
                                + ", createdBy=" + createdBy + ", active=" + active + "]";
        }
    
}